Hi vacaloca,
thank you for your reply. Yesterday I have collected some more information that might or might not help.
- nvcc -Xcompiler â-std=c++0xâ
When calling the nvcc under Debian with gcc (Debian 4.7.2-5) 4.7.2 as the compiler which is used we get this and other errors:
/usr/include/c++/4.7/x86_64-linux-gnu/./bits/c++config.h(177): error: identifier ânullptrâ is undefined
I have found the following forum postings on the internet and extracted the main statements:
http://stackoverflow.com/questions/12073828/c-version-supported-by-cuda-5-0
CUDA 5.0: no support for GCC 4.7, no support for C++11 features
nvcc does not understand C++11 syntax used in the standard includes of GCC 4.6
http://stackoverflow.com/questions/9057123/error-while-using-cuda-and-c11
ânvcc does not support c++11 constructs, even if they are supported by the host compilerâ
âThe reason it isnât as simple as passing -std=c++0x to the host compiler is that nvcc has to parse the entirety of the code in order to split it into its __host__and device halves. This preprocess happens before the host compiler is presented with any code at all, so nvccâs parser needs to be able to grok c++11 for it to work.â
http://public.kitware.com/Bug/view.php?id=13450
- calling nvcc without the -Xcompiler flag (-std=âŠ) or setting
SET( CUDA_PROPAGATE_HOST_FLAGS OFF ) in Cmake (which should have the same effect)
The following warning appears:
/usr/include/c++/4.7/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard.
This is currently experimental and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
(due to inclusion of #include , use of scoped enumeration types, std::shared_ptr and probably others)
1+2)
I read the output of the build process and could cut it down to the following two different error situations:
- when leaving out the -Xcompiler â-std=c++0xâ flag the build process already stops when the dependency file is geenerated
- when passing the -Xcompiler flag the build stops when generating the object file (.cu.obj/ .cu.o)
- Windows vs. Linux
For me itâs still not that clear what the difference is for Windows and Linux as the build commands (cmake + nvcc) are almost the same. I have made copies of the dependency files, not sure if it makes sense to compare them - Windows and Linux.
I also have found the following forum posts according to the Windows vs. Linux problem:
âI checked with the compiler team, and from what I understand, C++11 features that are supported by the host compiler at default settings should work in the host code portion of a .cu file. However, C++11 features that require the use of specific additional compiler flags (e.g. -std=c++11 with g++) to turn them on are not supported.â
âFor now it seems advisable to move host code using C++11 features into separate .cpp files so it can be processed directly by the host compiler.â
http://stackoverflow.com/questions/21457974/can-i-use-c11-in-the-cu-files-cuda5-5-in-windows7x64-msvc-and-linux64-gc
âFor the host code, nvcc supports whatever part of the C++ ISO/IEC 14882:2003 specification the host c++ compiler supports.â
Can you say if this is a nvcc or a gcc problem?
I also compared the nvcc versions:
Windows:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Tue_Jan_28_00:09:34_PST_2014
Cuda compilation tools, release 6.0, V6.0.1
Linux:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Sat_Jan_25_17:33:19_PST_2014
Cuda compilation tools, release 6.0, V6.0.1
According to my /usr/local/cuda/include/host_config.h file GCC >4.8 not supported.
I might try 4.8.1 but Iâd like to make sure that this is a gcc problem as Iâd have to compile it from sources (at least there is no package available for Debian Wheezy?).
Edit: to put the C++11 code in separate .cpp files seems to be the general solution. Though this might not work for us as the kernel gets some arguments that refer to classes which at least include some C++11 code; at least some effort would be neccessary to put it.
Thank you!