90 lines
2.0 KiB
Plaintext
90 lines
2.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "000d047d-3dfd-48cb-a3c3-bd1ad7c78b71",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"TensorFlow version: 2.16.1\n",
|
|
"GPUs detected: 1\n",
|
|
" - PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import os\n",
|
|
"import tensorflow as tf\n",
|
|
"\n",
|
|
"os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n",
|
|
"\n",
|
|
"def get_available_gpus():\n",
|
|
" gpus = tf.config.list_physical_devices('GPU')\n",
|
|
" if gpus:\n",
|
|
" print(f\"GPUs detected: {len(gpus)}\")\n",
|
|
" for gpu in gpus:\n",
|
|
" print(f\" - {gpu}\")\n",
|
|
" else:\n",
|
|
" print(\"No GPUs detected.\")\n",
|
|
"\n",
|
|
"if __name__ == \"__main__\":\n",
|
|
" print(\"TensorFlow version:\", tf.__version__)\n",
|
|
" get_available_gpus()\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "324dc7a1-61b8-4384-bfed-4385e7dbe49d",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"gpus = tf.config.list_physical_devices('GPU')\n",
|
|
"for gpu in gpus:\n",
|
|
" print(gpu)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "080fdf50-a5d5-4650-8f29-34c773443d59",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.11.0rc1"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|