Cuda 9.0을 실행하는 Ubuntu 16.04에서 컴파일 오류

Cuda 9.0을 실행하는 Ubuntu 16.04에서 컴파일 오류

저는 Cuda를 사용하는 애플리케이션을 설정하려고 합니다. 저는 Cuda 9.0 및 384 Nvidia 드라이버 + GCC 5.4와 함께 Ubuntu 16.04를 실행하고 있습니다. 자세한 내용은 아래에 나와 있습니다.

쿠다:

$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

엔비디아:

$ nvidia-smi
Fri Oct 27 00:34:35 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.90                 Driver Version: 384.90                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 960     Off  | 00000000:02:00.0 Off |                  N/A |
|  0%   31C    P0    27W / 120W |      0MiB /  1989MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

툴킷의 Cuda 예제는 잘 빌드되고 실행되므로 문제가 Cuda 또는 Nvidia 부분에 있지 않다고 확신합니다 :)

GCC:

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Cuda는 분명히 어떤 GCC 버전을 사용하는지에 대해 매우 까다롭지만, 이것이 올바른 버전(?)이라는 말을 들었습니다(Google 검색).

빌드와 관련하여 제가 살펴본 다른 참고 자료는 프로젝트 소유자가 제공한 것입니다.

지침에 따라 ./build.sh 스크립트를 실행할 때까지 아무런 문제가 없었습니다.

내가 얻는 오류는 다음과 같습니다.

Makefile:2199: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/tony/Mining/ccminer1'
Makefile:654: recipe for target 'all' failed
make: *** [all] Error 2

전체 출력:

$ ./build.sh
Making distclean in compat
make[1]: Entering directory '/home/tony/Mining/ccminer1/compat'
Making distclean in jansson
make[2]: Entering directory '/home/tony/Mining/ccminer1/compat/jansson'
test -z "libjansson.a" || rm -f libjansson.a
rm -f *.o
rm -f *.tab.c
test -z "" || rm -f 
test . = "." || test -z "" || rm -f 
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -rf ./.deps
rm -f Makefile
make[2]: Leaving directory '/home/tony/Mining/ccminer1/compat/jansson'
make[2]: Entering directory '/home/tony/Mining/ccminer1/compat'
test -z "" || rm -f 
test . = "." || test -z "" || rm -f 
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
make[2]: Leaving directory '/home/tony/Mining/ccminer1/compat'
rm -f Makefile
make[1]: Leaving directory '/home/tony/Mining/ccminer1/compat'
make[1]: Entering directory '/home/tony/Mining/ccminer1'
test -z "ccminer" || rm -f ccminer
rm -f *.o
rm -f Algo256/*.o
rm -f JHA/*.o
rm -f compat/*.o
rm -f crypto/*.o
rm -f crypto/cpu/*.o
rm -f equi/*.o
rm -f equi/blake2/*.o
rm -f heavy/*.o
rm -f lbry/*.o
rm -f lyra2/*.o
rm -f neoscrypt/*.o
rm -f quark/*.o
rm -f qubit/*.o
rm -f scrypt/*.o
rm -f sha256/*.o
rm -f sia/*.o
rm -f skunk/*.o
rm -f sph/*.o
rm -f tribus/*.o
rm -f x11/*.o
rm -f x13/*.o
rm -f x15/*.o
rm -f x17/*.o
rm -f *.tab.c
test -z "" || rm -f 
test . = "." || test -z "" || rm -f 
rm -f Algo256/.deps/.dirstamp
rm -f Algo256/.dirstamp
rm -f JHA/.deps/.dirstamp
rm -f JHA/.dirstamp
rm -f compat/.deps/.dirstamp
rm -f compat/.dirstamp
rm -f crypto/.deps/.dirstamp
rm -f crypto/.dirstamp
rm -f crypto/cpu/.deps/.dirstamp
rm -f crypto/cpu/.dirstamp
rm -f equi/.deps/.dirstamp
rm -f equi/.dirstamp
rm -f equi/blake2/.deps/.dirstamp
rm -f equi/blake2/.dirstamp
rm -f heavy/.deps/.dirstamp
rm -f heavy/.dirstamp
rm -f lbry/.deps/.dirstamp
rm -f lbry/.dirstamp
rm -f lyra2/.deps/.dirstamp
rm -f lyra2/.dirstamp
rm -f neoscrypt/.deps/.dirstamp
rm -f neoscrypt/.dirstamp
rm -f quark/.deps/.dirstamp
rm -f quark/.dirstamp
rm -f qubit/.deps/.dirstamp
rm -f qubit/.dirstamp
rm -f scrypt/.deps/.dirstamp
rm -f scrypt/.dirstamp
rm -f sha256/.deps/.dirstamp
rm -f sha256/.dirstamp
rm -f sia/.deps/.dirstamp
rm -f sia/.dirstamp
rm -f skunk/.deps/.dirstamp
rm -f skunk/.dirstamp
rm -f sph/.deps/.dirstamp
rm -f sph/.dirstamp
rm -f tribus/.deps/.dirstamp
rm -f tribus/.dirstamp
rm -f x11/.deps/.dirstamp
rm -f x11/.dirstamp
rm -f x13/.deps/.dirstamp
rm -f x13/.dirstamp
rm -f x15/.deps/.dirstamp
rm -f x15/.dirstamp
rm -f x17/.deps/.dirstamp
rm -f x17/.dirstamp
rm -f ccminer-config.h stamp-h1
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -f cscope.out cscope.in.out cscope.po.out cscope.files
make[1]: Leaving directory '/home/tony/Mining/ccminer1'
rm -f config.status config.cache config.log configure.lineno config.status.lineno
rm -rf ./.deps compat/.deps crypto/.deps crypto/cpu/.deps equi/.deps equi/blake2/.deps lyra2/.deps neoscrypt/.deps sia/.deps sph/.deps x13/.deps
rm -f Makefile
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking whether gcc needs -traditional... no
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for gcc option to support OpenMP... -fopenmp
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sys/endian.h usability... no
checking sys/endian.h presence... no
checking for sys/endian.h... no
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for sys/sysctl.h... yes
checking whether be32dec is declared... no
checking whether le32dec is declared... no
checking whether be32enc is declared... no
checking whether le32enc is declared... no
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for getopt_long... yes
checking for json_loads in -ljansson... yes
checking for pthread_create in -lpthread... yes
checking for gzopen in -lz... yes
checking for SSL_library_init in -lssl... yes
checking for EVP_DigestFinal_ex in -lcrypto... yes
checking for gawk... (cached) mawk
checking for curl-config... /usr/bin/curl-config
checking for the version of libcurl... 7.47.0
checking for libcurl >= version 7.15.2... yes
checking whether libcurl is usable... yes
checking for curl_free... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating compat/Makefile
config.status: creating compat/jansson/Makefile
config.status: creating ccminer-config.h
config.status: executing depfiles commands
make  all-recursive
make[1]: Entering directory '/home/tony/Mining/ccminer1'
Making all in compat
make[2]: Entering directory '/home/tony/Mining/ccminer1/compat'
make[3]: Entering directory '/home/tony/Mining/ccminer1/compat'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/tony/Mining/ccminer1/compat'
make[2]: Leaving directory '/home/tony/Mining/ccminer1/compat'
make[2]: Entering directory '/home/tony/Mining/ccminer1'
gcc -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -g -O2 -MT ccminer-crc32.o -MD -MP -MF .deps/ccminer-crc32.Tpo -c -o ccminer-crc32.o `test -f 'crc32.c' || echo './'`crc32.c
gcc -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -g -O2 -MT ccminer-hefty1.o -MD -MP -MF .deps/ccminer-hefty1.Tpo -c -o ccminer-hefty1.o `test -f 'hefty1.c' || echo './'`hefty1.c
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-ccminer.o -MD -MP -MF .deps/ccminer-ccminer.Tpo -c -o ccminer-ccminer.o `test -f 'ccminer.cpp' || echo './'`ccminer.cpp
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-pools.o -MD -MP -MF .deps/ccminer-pools.Tpo -c -o ccminer-pools.o `test -f 'pools.cpp' || echo './'`pools.cpp
mv -f .deps/ccminer-crc32.Tpo .deps/ccminer-crc32.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-util.o -MD -MP -MF .deps/ccminer-util.Tpo -c -o ccminer-util.o `test -f 'util.cpp' || echo './'`util.cpp
mv -f .deps/ccminer-pools.Tpo .deps/ccminer-pools.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-bench.o -MD -MP -MF .deps/ccminer-bench.Tpo -c -o ccminer-bench.o `test -f 'bench.cpp' || echo './'`bench.cpp
mv -f .deps/ccminer-hefty1.Tpo .deps/ccminer-hefty1.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-bignum.o -MD -MP -MF .deps/ccminer-bignum.Tpo -c -o ccminer-bignum.o `test -f 'bignum.cpp' || echo './'`bignum.cpp
mv -f .deps/ccminer-bench.Tpo .deps/ccminer-bench.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-api.o -MD -MP -MF .deps/ccminer-api.Tpo -c -o ccminer-api.o `test -f 'api.cpp' || echo './'`api.cpp
mv -f .deps/ccminer-bignum.Tpo .deps/ccminer-bignum.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-hashlog.o -MD -MP -MF .deps/ccminer-hashlog.Tpo -c -o ccminer-hashlog.o `test -f 'hashlog.cpp' || echo './'`hashlog.cpp
mv -f .deps/ccminer-api.Tpo .deps/ccminer-api.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-nvml.o -MD -MP -MF .deps/ccminer-nvml.Tpo -c -o ccminer-nvml.o `test -f 'nvml.cpp' || echo './'`nvml.cpp
mv -f .deps/ccminer-util.Tpo .deps/ccminer-util.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-stats.o -MD -MP -MF .deps/ccminer-stats.Tpo -c -o ccminer-stats.o `test -f 'stats.cpp' || echo './'`stats.cpp
mv -f .deps/ccminer-hashlog.Tpo .deps/ccminer-hashlog.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-sysinfos.o -MD -MP -MF .deps/ccminer-sysinfos.Tpo -c -o ccminer-sysinfos.o `test -f 'sysinfos.cpp' || echo './'`sysinfos.cpp
mv -f .deps/ccminer-sysinfos.Tpo .deps/ccminer-sysinfos.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-cuda.o -MD -MP -MF .deps/ccminer-cuda.Tpo -c -o ccminer-cuda.o `test -f 'cuda.cpp' || echo './'`cuda.cpp
mv -f .deps/ccminer-stats.Tpo .deps/ccminer-stats.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT ccminer-nvsettings.o -MD -MP -MF .deps/ccminer-nvsettings.Tpo -c -o ccminer-nvsettings.o `test -f 'nvsettings.cpp' || echo './'`nvsettings.cpp
mv -f .deps/ccminer-nvml.Tpo .deps/ccminer-nvml.Po
g++ -DHAVE_CONFIG_H -I.  -fopenmp  -pthread -fno-strict-aliasing  -I/usr/local/cuda/include -DUSE_WRAPNVML    -O3 -march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -MT equi/ccminer-equihash.o -MD -MP -MF equi/.deps/ccminer-equihash.Tpo -c -o equi/ccminer-equihash.o `test -f 'equi/equihash.cpp' || echo './'`equi/equihash.cpp
mv -f .deps/ccminer-nvsettings.Tpo .deps/ccminer-nvsettings.Po
/usr/local/cuda/bin/nvcc -gencode=arch=compute_52,code="sm_52,compute_52" -I/usr/local/cuda/include -I. -O3 -lineno -Xcompiler -Wall  -D_FORCE_INLINES  --ptxas-options="-v" --maxrregcount=128 -o equi/cuda_equi.o -c equi/cuda_equi.cu
nvcc fatal   : 'compute_52' is not in 'keyword=value' format
Makefile:2667: recipe for target 'equi/cuda_equi.o' failed
make[2]: *** [equi/cuda_equi.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/ccminer-cuda.Tpo .deps/ccminer-cuda.Po
mv -f .deps/ccminer-ccminer.Tpo .deps/ccminer-ccminer.Po
mv -f equi/.deps/ccminer-equihash.Tpo equi/.deps/ccminer-equihash.Po
make[2]: Leaving directory '/home/tony/Mining/ccminer1'
Makefile:2199: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/tony/Mining/ccminer1'
Makefile:654: recipe for target 'all' failed
make: *** [all] Error 2

미리 감사드립니다!

(전체 빌드 출력을 추가하도록 편집됨)

답변1

문제가 무엇인지 확실히 파악하지 못했지만 저는 단지 ccminer를 구축 중이었고 몇 가지 튜토리얼을 살펴보고 귀하의 게시물도 찾았습니다.

범인이 되는 로그의 내용:

/usr/local/cuda/bin/nvcc -gencode=arch=compute_52,code="sm_52,compute_52" -I/usr/local/cuda/include -I. -O3 -lineno -Xcompiler -Wall  -D_FORCE_INLINES  --ptxas-options="-v" --maxrregcount=128 -o equi/cuda_equi.o -c equi/cuda_equi.cu

내 로그와 비슷한 줄:

/usr/local/cuda/bin/nvcc -gencode=arch=compute_61,code=\"sm_61,compute_61\" -I/usr/local/cuda/include -I. -O3 -lineno -Xcompiler -Wall  -D_FORCE_INLINES  --ptxas-options="-v" --maxrregcount=128 -o scrypt/sha256.o -c scrypt/sha256.cu

이제 여기서 차이점을 볼 수 있습니다. Makefile.am에서 nvcc_ARCH에 대한 백슬래시가 누락되었습니다.

nvcc_ARCH  = -gencode=arch=compute_52,code=\"sm_52,compute_52\"

누군가가 유용하다고 생각하기를 바랍니다.

관련 정보