10

I have installed CUDA 9.1+cudnn-9.1+opencv 3.4.0+caffe.

When I tried to run make all -j8 in caffe directory, this error occurred:

nvcc fatal : Unsupported gpu architecture 'compute_20'

I have tried to run:

"cmake -D CMAKE_BUILD_TYPE=RELEASE -D CUDA_GENERATION=Kepler .."

but it didn't work.

dim mik
  • 939
  • 1
  • 10
  • 30
Lawrence_Liu
  • 127
  • 1
  • 1
  • 6
  • 2
    CUDA 9.x + does not support compute_20 (Fermi), probably you will have to disable it, maybe with `ccmake` you can disable it manually? not sure which variable in your project is the one that is setting this, but probably you will see several numbers like 2.0, 3.0, etc. You just need to delete 2.0 – api55 Jan 22 '18 at 14:36
  • 2
    That's correct. CUDA 9.1 does not support `compute_20` anymore. You'll need to find a makefile that doesn't call out that architecture, or else edit the makefile (or CMakeLists.txt) to remove references to `compute_20` or `sm_20`. Or you could switch to CUDA 8. – Robert Crovella Jan 22 '18 at 14:36

4 Answers4

22

Try manually edit Makefile.config to remove compute_2* architectures from these lines (comments explain why):

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
        -gencode arch=compute_20,code=sm_21 \
        -gencode arch=compute_30,code=sm_30 \
        -gencode arch=compute_35,code=sm_35 \
        -gencode arch=compute_50,code=sm_50 \
        -gencode arch=compute_52,code=sm_52 \
        -gencode arch=compute_60,code=sm_60 \
        -gencode arch=compute_61,code=sm_61 \
        -gencode arch=compute_61,code=compute_61

And add the compute_6* architectures (see the comments) so that your new CUDA_ARCH looks like this:

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
        -gencode arch=compute_35,code=sm_35 \
        -gencode arch=compute_50,code=sm_50 \
        -gencode arch=compute_52,code=sm_52 \
        -gencode arch=compute_60,code=sm_60 \
        -gencode arch=compute_61,code=sm_61 \
        -gencode arch=compute_61,code=compute_61

Then you'll need to make clean before make all.

hobs
  • 18,473
  • 10
  • 83
  • 106
Shai
  • 111,146
  • 38
  • 238
  • 371
2

Makefile.config is not used when compilation is done with cmake. Therefore removing compute_2* architectures from it doesn't solve the problem. Instead, you should edit caffe/Cuda.cmake. On line 9 just get rid of 20 21(20) on the list of known GPU architectures.

Sleepnot
  • 21
  • 1
1

You can use cmake like following:

cmake [other_params] -D CUDA_ARCH_NAME="Pascal" ..
s0urcer
  • 312
  • 2
  • 7
1

This fixed it for me

cd caffe && mkdir build && cd build && \
   cmake -DUSE_CUDNN=1 -DUSE_NCCL=1 -DCUDA_ARCH_NAME=Manual -DCUDA_ARCH_BIN="50 52 60 61" .. && \
   sudo make -j"$(nproc)"

Just dropped 20 and 30 arch support

satyajit_ghana
  • 106
  • 1
  • 6