2013-06-22 10 views
1

PC에 CUDA 툴킷을 설치했는데 문제가있는 것 같습니다. nvcc 컴파일 할 수없는 아니하며이 같은 간단한 인사 세계 :nvcc가 컴파일 할 수 없습니다.

#include <stdio.h> 

int main(int argc, char** argv) { 
    printf("Hello, world!\n"); 
    return 0; 
} 

출력은 다음과 같습니다

$ nvcc hello.cu 
/usr/include/c++/4.8.0/cstdlib(178): error: identifier "__int128" is undefined 
/usr/include/c++/4.8.0/cstdlib(179): error: identifier "__int128" is undefined 

2 errors detected in the compilation of "/tmp/tmpxft_000011a2_00000000-6_hello.cpp1.ii". 

자세한 정보 출력은 다음과 같습니다

$ nvcc --verbose hello.cu 
#$ _SPACE_= 
#$ _CUDART_=cudart 
#$ _HERE_=/opt/cuda/bin 
#$ _THERE_=/opt/cuda/bin 
#$ _TARGET_SIZE_=64 
#$ TOP=/opt/cuda/bin/.. 
#$ LD_LIBRARY_PATH=/opt/cuda/bin/../lib: 
#$ PATH=/opt/cuda/bin/../open64/bin:/opt/cuda/bin/../nvvm:/opt/cuda/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-studio/bin:/opt/cuda/bin:/extra/usr/bin:/opt/java/bin:/opt/java/db/bin:/opt/java/jre/bin:/usr/bin/core_perl:/usr/lib/smlnj/bin:.:. 
#$ INCLUDES="-I/opt/cuda/bin/../include" 
#$ LIBRARIES= "-L/opt/cuda/bin/../lib64" -lcudart 
#$ CUDAFE_FLAGS= 
#$ OPENCC_FLAGS= 
#$ PTXAS_FLAGS= 
#$ gcc -D__CUDA_ARCH__=100 -E -x c++ -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS -DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -D__CUDACC__ -D__NVCC__ "-I/opt/cuda/bin/../include" -include "cuda_runtime.h" -m64 -o "/tmp/tmpxft_000011e1_00000000-6_hello.cpp1.ii" "hello.cu" 
#$ cudafe --m64 --gnu_version=40800 -tused --no_remove_unneeded_entities --gen_c_file_name "/tmp/tmpxft_000011e1_00000000-3_hello.cudafe1.c" --stub_file_name "/tmp/tmpxft_000011e1_00000000-3_hello.cudafe1.stub.c" --gen_device_file_name "/tmp/tmpxft_000011e1_00000000-3_hello.cudafe1.gpu" --nv_arch "compute_10" --gen_module_id_file --module_id_file_name "/tmp/tmpxft_000011e1_00000000-2_hello.module_id" --include_file_name "tmpxft_000011e1_00000000-1_hello.fatbin.c" "/tmp/tmpxft_000011e1_00000000-6_hello.cpp1.ii" 
/usr/include/c++/4.8.0/cstdlib(178): error: identifier "__int128" is undefined 

/usr/include/c++/4.8.0/cstdlib(179): error: identifier "__int128" is undefined 

2 errors detected in the compilation of "/tmp/tmpxft_000011e1_00000000-6_hello.cpp1.ii". 
# --error 0x2 -- 

에 대한 몇 가지 정보를 제 시스템 :

OS는 Chakra Linux (아치 기반 배포판) 64 비트입니다.

http://pastebin.com/WtUckrYv가 당신을 감사합니다

$ nvcc --version 
nvcc: NVIDIA (R) Cuda compiler driver 
Copyright (c) 2005-2012 NVIDIA Corporation 
Built on Fri_Sep_21_17:28:58_PDT_2012 
Cuda compilation tools, release 5.0, V0.2.1221 

마지막으로,이 문제가 헤더 파일 : CUDA 툴킷에 대한

$ gcc -v 
Using built-in specs. 
COLLECT_GCC=gcc 
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper 
Target: x86_64-unknown-linux-gnu 
Configured with: /chakra/lib32-testing/gcc-multilib/src/gcc-4.8-20130411/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://chakra-project.org/bugs --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-install-libiberty --enable-multilib --disable-libssp --disable-werror --enable-checking=release 
Thread model: posix 
gcc version 4.8.0 20130411 (prerelease) (GCC) 

정보 : 현재 나는 GCC-multilib 버전을 사용하고 있습니다 전진.

답변

8

CUDA 5.0은 gcc 4.8.0과 호환되지 않습니다.

호환되는 배포판 및 gcc 버전을 더 잘 이해하려면 release notes을 참조하십시오.

당신은 운좋게도 5.5 RC의 cuda를 가지고 있을지 모르지만, 여러분이 언급 한 gcc 버전뿐만 아니라 해당 배포판은 여전히 ​​리눅스 지원하에 release notes에 나와 있지 않습니다.

가장 좋은 경험은 지원되는 배포판으로 전환하면 찾을 수 있습니다.

일반적으로 CUDA 5 nvcc가 자동으로 올바른/허용 컴파일러 버전을 확인하기 위해 다양한 매크로를 가지고 파일 /usr/local/cuda/include/host_config.h, 그 매크로 중 하나를 포함하여 경우에 오류가 발생 할 뻔했지만하지 않았다 것 같다 :

#if defined(__GNUC__) 

#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6) 

#error -- unsupported GNU version! gcc 4.7 and up are not supported! 

#endif /* __GNUC__> 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6) */ 

#endif /* __GNUC__ */ 
+0

아, 아주 성가 시지만 고맙습니다. 내 시스템에서 나는 그 파일을 가지고 있지 않으며 아마도 이것은 나쁜 설치의 징조 일 것입니다 ... – eang

+0

Btw, 나는 Windows에 CUDA를 설치하려고합니다. CUDA 5.5는 Visual Studio 2012를 지원해야합니다. 맞습니까? – eang

+2

예, CUDA 5.5는 VS2012를 지원해야합니다. 가장 쉬운 설정을 위해 CUDA 5.5 설치 프로그램을 실행하기 전에 VS2012가 컴퓨터에 설치되어 있는지 확인하십시오. 그리고 물론 CUDA 5.5는 RC (릴리스 후보) 단계에 있으므로 아직 "베타"와 유사합니다. –

0

이것은 적어도 저에게 효과적이었습니다. 나는 cuda 5.0과 gcc 4.8을 설치했다.

당신은 단지 추가해야합니다 :

#undef _GLIBCXX_USE_INT128 

just before line #129: 

#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) 

파일 /usr/include/c++/4.8.1/cstdlib

에 이렇게, 나는 다시는 내 코드를 컴파일 할 수있다.

+8

CUDA가 지원되지 않는 컴파일러 버전으로 작동하게하려면 시스템 헤더를 수정하지 않는 것이 좋습니다. CUDA가 아닌 코드를 컴파일 할 때 발생할 수있는 문제는 엄청납니다. – talonmies

1

cuda-5.5에서도 gcc-4.7 +에 문제가있는 경우 이전 버전의 nvidia-cuda-toolkit도 설치되어 있는지 확인하고 모든 nvdia-cuda- * 항목을 제거하고 cuda-5.5 (gcc-4.8.1)

1

필자는 llvm을 백엔드로 컴파일하려고 시도했을 때만 오류가 발생했다. 즉:

nvcc -ccbin=/usr/bin/clang -arch=sm_20 -m64 main.cu 

그래서 위에서 언급 한 헤더에보고 후, 내가 추가 :

-D__STRICT_ANSI__ 

그래서 최종 컴파일 명령처럼 보였다 :

nvcc -ccbin=/usr/bin/clang -arch=sm_20 -m64 main.cu -D__STRICT_ANSI__ 

나는 그 소리 dev에 포럼에서 보았다는 것 같습니다 그것은 알려진 이슈이지만 깊이 파고 들지 않았습니다.

희망이 도움이됩니다.

관련 문제