nvcc fatal : Unsupported gpu architecture 'compute_20' while cuda 9.1+caffe+openCV 3.4.0 is installed

Lawrence_Liu picture Lawrence_Liu · Jan 22, 2018 · Viewed 13.9k times · Source

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.

Answer

Shai picture Shai · Jan 22, 2018

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.