gpt4 book ai didi

cuda - nvcc 无法编译

转载 作者:行者123 更新时间:2023-12-05 08:28:13 24 4
gpt4 key购买 nike

我已经在我的电脑上安装了 CUDA 工具包,但似乎有些东西坏了。 nvcc 无法编译,像这样的简单 hello-world 也无法编译:

#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 --

关于我的系统的一些信息:

操作系统是 Chakra Linux(基于 Arch 的发行版)64 位。目前我使用的是 gcc-multilib 版本:

$ 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)

有关 CUDA 工具包的信息:

$ 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

最后但同样重要的是,这是有问题的头文件:http://pastebin.com/WtUckrYv

提前谢谢你。

最佳答案

CUDA 5.0 与 gcc 4.8.0 不兼容。

为了更好地了解兼容的发行版和 gcc 版本,请参阅 release notes .

使用 cuda 可能会有更好的运气 5.5 RC ,但是您提到的特定发行版以及 gcc 版本仍未在 release notes 中列出在 linux 支持下。

最好的体验很可能是通过切换到受支持的发行版找到的。

通常,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__ */

关于cuda - nvcc 无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17251316/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com