wandreopoulos / deeplasmid

17 stars 2 forks source link

GPU not working. Does the docker image still contain the correct files? #11

Closed SteMIDIfactory closed 9 months ago

SteMIDIfactory commented 9 months ago

Hi Bill, I'm trying to use deeplasmid on a set of K. pneumo genomes. I would like to use the GPU to make my predictions; however the script always uses 16 CPUs. This is happening on two separate workstations, equipped with different CPUs, GPUs and OS version. I checked the GPU driver installation on both machines and tested the GPU capability of your docker image (billandreo/deeplasmid.tf.gpu2) by running a very simple tensorflow command:

docker run --gpus all -it --rm billandreo/deeplasmid.tf.gpu2 python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

The command above uses GPU (I checked using nvidia-smi) and double checked the tensorflow version with:

docker run --gpus all -it --rm billandreo/deeplasmid.tf.gpu2 python -c "import tensorflow as tf; print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))"

I also double-checked the GPU usage by running nvidia-smi in the same container as the deeplasmid analysis, it was still stuck at 0%, while 16 CPUs were in use.

Last check: analyzing 1 genome with the tf.gpu2 image takes the same time as with the cpu-only image.

I am not good at digging in someone else's code. However, I tried to find the line where any of the scripts tries to call gpus and opts for cpus. I was unable to find any line containing the term "gpu" or "nvidia". Also, only one line imports tensorflow, but it's commented out.

docker run -it billandreo/deeplasmid.tf.gpu2 grep "tensorflow" DL_Model.py

this results in: #import tensorflow as tf

What am I doing wrong? Am I using the correct image? Was the gpu2 image modified?

Thanks in advance

Stefano

SteMIDIfactory commented 9 months ago

I am so deeply sorry! I was benchmarking the performances of the images on the early stages of the script (which all run on cpu by default.

Indeed the classification part works perfectly on gpu and takes such a short time that I did not notice it.

I don't know if repository owners can erase issues. If not, I hope someone can use my commands to check their installation, or just learn from my stupidity/experience

Issue closed, of course! Sorry again