zombie process resulting from using many GPUs
I run the example cifar10_multi_gpu_train.py on a PC equipped with 4 GPUs. Somehow the program occupies 4 GPUs, but only the first GPU is doing computation.
When I hit ctrl + c, the python scripts did not terminate, and I found zombie process using htop (the zombie process is associated with command python). After that I have to reboot using "reboot -nf" to gain access to GPUs. Tensorflow was installed from source (https://github.com/tensorflow/tensorflow.git).
File "cifar10_multi_gpu_train.py", line 270, in <module>
tf.app.run()
File "/home/pc/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "cifar10_multi_gpu_train.py", line 266, in main
train()
File "cifar10_multi_gpu_train.py", line 236, in train
_, loss_value = sess.run([train_op, loss])
File "/home/pc/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 373, in run
results = self._do_run(target_list, unique_fetch_targets, feed_dict_string)
File "/home/pc/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 433, in _do_run
target_list)
KeyboardInterrupt
However, if I do export CUDA_VISIBLE_DEVICES=0 before running the example to limit it to one GPU, I am able to terminate the python scripts normally using ctrl + c.
nvidia-smi

htop

I noticed a similar bug as well, it also is a function of when you do ctrl-c, quite often I've had TensorFlow crash the driver. I presume there must be a NVIDIA driver bug as well, since a user process should never be able to crash a kernel driver...
@wchan I was able to do multi-GPU training with tensorflow 0.5, but not with tensorflow 0.6. Did you find this problem? When you use multiple GPUs, do all GPUs work normally? When you do ctrl+c, does it crash the driver every time?
I was using the official example cifar10_multi_gpu_train.py to test multi-GPU training
I was running in to the same issue. Specifically, I could replicate it by
-
starting a python prompt and running
import tensorflow as tf sess = tf.InteractiveSession() -
killing the python process
The python process would not die and any other code that used the GPU driver (including simply running nvidia-smi) would hang on a read to /dev/nvidiactl. Setting CUDA_VISIBLE_DEVICES prevented the problem.
After turning on persistence mode (as below) I no longer observed this problem.
$ nvidia-smi -pm 1
@mcogswell what does persistence mode do? Does this solve multi-GPU training case?
Persistence mode keeps the driver loaded even when not used. I'm not sure about the cifar10 example script, but I see no reason why it should be different.
Same problem here, we are using Titan Z which has dual GPU. The python process would not die and any other code that used the GPU driver (including simply running nvidia-smi) would hang. export CUDA_VISIBLE_DEVICES=0 solved the probelm
This could be related to this problem:
https://groups.google.com/forum/#!msg/torch7/kLusyLEj4oc/uwbK1GiQDwAJ
This is an issue associated with kernel version and cuda drivers when multiple GPUs are being used.
Using Nicholas Leonard's instructions at the end solved this issue for me, without having to use CUDA_VISIBLE_DEVICES.
Closing because yamins81 provided a solution. Feel free to reopen if this is still a problem!
I wish this issue is reopened since @yamins81's solution still doesn't solve the problem of not being able to use multiple GPUs.