0

I'd like to use caffe2 with GPU support. I succesfully installed caffe2 (Ubuntu 16.04, python2.7) with conda environment (command : conda install pytorch-nightly -c pytorch)

It is successfully installed (I checked it with the command: python2 -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure" and it says "Success")

However, when I check caffe2 GPU build (command : python2 -c 'from caffe2.python import workspace; print(workspace.NumCudaDevices())), it returns 0.

I already have cuda, cuDNN, nccl and I don't understand why caffe2 does not detect available GPU..

talonmies
  • 70,661
  • 34
  • 192
  • 269
jay671
  • 19
  • 1
  • 3

1 Answers1

1

I guess you are going to implement Detectron (otherwise nobody wanna use this dumb Caffe2 these days)

I'm pretty sure that it is caused by the mismatch of the CUDA version and CuDNN. I got stacked by this problem for a while (you don't know which version is correct for the Caffe2), finally, I got two solutions at almost the same time. Both of them work for me.

At first, just update the Nvidia driver to the latest version. My version is updated to 410.78, you can simply update the driver by selecting the certain driver in the System settings-> Software and update-> Additional Drivers.

Don't forget to restart your PC.

Then, there are two ways to implement it.

  1. Build the environment with a Docker.

It is simple and fast. You just install Docker (as well as nvidia-docker for GPU usage) and use this pre-implemented environment with this command:

sudo docker pull ylashin/detectron

sudo nvidia-docker run --rm -it ylashin/detectron

Then you can test your Caffe2 with that NumCudaDeivce command.

It works for me!

See the whole introduction here, thanks to the efforts:

Build a Detectron environment with Docker

If you have some problem with the Docker installation (especially for the nvidia-docker), you can just skip it to the next one.

  1. Use Detectron2

The newest Detectron is published recently (actually three days ago!). We can now work on that one now which is supported by Pytorch.

Here is the Detectron2:

Detectron2 link

Just go to the lastest one, you can even distribute everything in the Google Colab, it's much easier.

Community
  • 1
  • 1
MikeChenDeepL
  • 114
  • 1
  • 7