jeudi 21 décembre 2017

CUDA nvcc compiler fails when using C++11 (Linux; clang 3.8)

I am trying to compile with the CUDA toolkit on my Debian GNU/Linux system, but even in extremely simple programs, C++11 support is apparently broken.

Firstly, here is a list of relevant software versions:

  • Linux kernel: 4.13.0
  • CUDA toolkit: 8.0.61
  • Clang: 3.8.1
  • libc: 2.25
  • libstdc++: 7.2.0

Using a really basic test file, test.cu, as below:

__global__ void testfunc(float *a, float *b, int N)
{
    for (int i = 0; i < N; ++i) {
        b[i] += a[i];
    }
}

And compiling with the command:

nvcc -ccbin clang-3.8 -std c++11 -o test test.cu

I get a long list of declaration conflicts with target of using declaration already in scope errors. I'll show two below - it cut off automatically at 20.

/usr/include/math_functions.h:8925:41: error: declaration conflicts with target of using declaration already in scope
__attribute((always_inline)) inline int signbit(float x);
                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/cmath:668:16: note: target of using declaration
constexpr bool signbit(float __x)
               ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/math.h:68:12: note: using declaration
using std::signbit;
           ^
/usr/include/math_functions.h:8929:41: error: declaration conflicts with target of using declaration already in scope
__attribute((always_inline)) inline int signbit(double x);
                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/cmath:672:16: note: target of using declaration
constexpr bool signbit(double __x)
               ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/math.h:68:12: note: using declaration
using std::signbit;
           ^

Am I using compiler/library versions incompatible with CUDA? It's seemingly difficult to find this information, especially as Debian is not officially supported by Nvidia. I am only using packages as distributed by Debian repositories (I am on the testing distribution).

Aucun commentaire:

Enregistrer un commentaire