代码之家  ›  专栏  ›  技术社区  ›  silence_lamb

使用Intel编译器和-std=c++11标志时,NVCC不工作

  •  1
  • silence_lamb  · 技术社区  · 9 年前

    我正在尝试用Intel编译器作为主编译器来编译cuda程序。cuda程序是用C++编写的,并使用C++11特性。如果我使用默认的主机编译器g++,那么它工作得很好。但我想试试英特尔编译器,因为g++中可能存在性能问题。

    我使用的编译器是CUDA 7.5和Intel 16.0.3。它们是最新的编译器,因此都支持c++11功能。

    下面是我用一个小测试文件尝试的内容:

    nvcc -std=c++11 -ccbin=icpc -Xcompiler=-std=c++11 test.cu -o test
    

    输出如下:

    nvcc warning : The -c++11 flag is not supported with the configured host compiler. Flag will be ignored.
    /usr/local/gcc-4.8.2/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++config.h(190): error: identifier "nullptr" is undefined
    
    /usr/local/gcc-4.8.2/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++config.h(190): error: expected a ";"
    
    /usr/local/gcc-4.8.2/include/c++/4.8.2/exception(63): error: expected a ";"
    

    有人有同样的问题吗?如何解决?谢谢

    1 回复  |  直到 9 年前
        1
  •  3
  •   talonmies    9 年前

    CUDA 7.5中不支持您尝试执行的操作。当前,在CUDA 7.5中将icc用作主机编译器不支持C++11语法,并且CUDA 7.5不支持icc 16。

    CUDA 8.0RC支持将ICC用作带有std=c++11标志的主机编译器(也支持ICC 16.0)