Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Notebook Example to correctly extract visible devices #1831

Merged
merged 2 commits into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion examples/03-Running-on-multiple-GPUs-or-on-CPU.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "77464844",
"metadata": {},
Expand All @@ -53,6 +54,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "1c5598ae",
"metadata": {},
Expand Down Expand Up @@ -92,6 +94,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "63ac0cf2",
"metadata": {},
Expand All @@ -100,6 +103,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "4def0005",
"metadata": {},
Expand All @@ -123,6 +127,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d7c3f9ea",
"metadata": {},
Expand All @@ -148,6 +153,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "728c3009",
"metadata": {},
Expand Down Expand Up @@ -176,11 +182,15 @@
"\n",
"# Deploy a Single-Machine Multi-GPU Cluster\n",
"protocol = \"tcp\" # \"tcp\" or \"ucx\"\n",
"\n",
"if numba.cuda.is_available():\n",
" NUM_GPUS = list(range(len(numba.cuda.gpus)))\n",
"else:\n",
" NUM_GPUS = []\n",
"visible_devices = \",\".join([str(n) for n in NUM_GPUS]) # Delect devices to place workers\n",
"try:\n",
" visible_devices = os.environ[\"CUDA_VISIBLE_DEVICES\"]\n",
"except KeyError:\n",
" visible_devices = \",\".join([str(n) for n in NUM_GPUS]) # Delect devices to place workers\n",
"device_limit_frac = 0.7 # Spill GPU-Worker memory to host at this limit.\n",
"device_pool_frac = 0.8\n",
"part_mem_frac = 0.15\n",
Expand All @@ -206,6 +216,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d14dc098",
"metadata": {},
Expand Down Expand Up @@ -242,6 +253,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "0576affe",
"metadata": {},
Expand Down Expand Up @@ -589,6 +601,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "94ef0024",
"metadata": {},
Expand All @@ -599,6 +612,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "768fc24e",
"metadata": {},
Expand All @@ -622,6 +636,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "61785127",
"metadata": {},
Expand Down Expand Up @@ -678,6 +693,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "01ea40bb",
"metadata": {},
Expand All @@ -686,6 +702,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "987f3274",
"metadata": {},
Expand Down Expand Up @@ -714,6 +731,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b06c962e",
"metadata": {},
Expand Down Expand Up @@ -745,6 +763,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d28ae761",
"metadata": {},
Expand All @@ -755,6 +774,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "4e07864d",
"metadata": {},
Expand All @@ -763,6 +783,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "8f971a22",
"metadata": {},
Expand Down