Skip to content

Commit 11d1ceb

Browse files
icywang86ruiEliza Zhang
authored andcommitted
Unset CUDA_VISIBLE_DEVICES for worker processes (aws#122)
* Unset CUDA_VISIBLE_DEVICES for worker processes * Add comments
1 parent 112a496 commit 11d1ceb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sagemaker_tensorflow_container/training.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ def _run_ps(env):
202202

203203

204204
def _run_worker(env):
205+
# when _run_ps is called CUDA_VISIBLE_DEVICES is set with os.environ. We need to unset it so the worker
206+
# process can use the GPUs.
207+
if os.environ.get('CUDA_VISIBLE_DEVICES'):
208+
del os.environ['CUDA_VISIBLE_DEVICES']
205209
env_vars = _env_vars_with_tf_config(env, ps_task=False)
206210
<<<<<<< HEAD
207211
if install_module:

0 commit comments

Comments
 (0)