Cuda 10.1: Nvidia, you're now "fixing" gcc bugs that gcc doesn't even have

This is cuda-10.1 with gcc-7.3.1 on RHEL 7.6. I’m compiling the 0_Simple/vectorAdd example.

$ nvcc --keep -v -ccbin g++ -I../../common/inc -m64 -gencode arch=compute_61,code=sm_61 -o vectorAdd.o -c vectorAdd.cu
.
.
.
#$ cudafe++ --c++14 --gnu_version=70301 --allow_managed  --m64 --parse_templates --gen_c_file_name "vectorAdd.cudafe1.cpp" --stub_file_name "vectorAdd.cudafe1.stub.c" --module_id_file_name "vectorAdd.module_id" "vectorAdd.cpp4.ii"
#$ g++ -std=c++14 -D__CUDA_ARCH__=610 -c -x c++  -DCUDA_DOUBLE_MATH_FUNCTIONS -I"../../common/inc" "-I/home/joe/cuda-10.1/bin/../targets/x86_64-linux/include"   -m64 -o "vectorAdd.o" "vectorAdd.cudafe1.cpp" 
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:6676:95:   required from here
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
       __p->_M_set_sharable();

A quick ckeck gives:

$ grep _M_set_sharable vectorAdd.cudafe1.cpp
void _M_set_sharable() noexcept 
_M_set_sharable(); 
(_M_rep()->_M_set_sharable()); }  
(__s._M_rep()->_M_set_sharable()); }  
_M_set_sharable();

If I repeat the same with ‘-ccbin clang++’ or go back to cuda 10.0, everything compiles fine and the quick check gives in both cases:

$  grep _M_set_sharable vectorAdd.cudafe1.cpp                                                              
void _M_set_sharable() noexcept 
this->_M_set_sharable(); 
(_M_rep()->_M_set_sharable()); }  
((__s._M_rep())->_M_set_sharable()); }  
__p->_M_set_sharable();

In Summary: Cuda 10.1 now produces wrong C++ for gcc (but not clang).

Hi everyone,

Same here (RHEL 7.6 and gcc 7.3.1)…

I hope a fix is coming (since our configuration / use case is pretty standard)

Same error for GCC 8.3.0 on CentOS 7.6.

Works with GCC 6.4.0.

only for reference: Installation Guide Linux :: CUDA Toolkit Documentation

The table says “Native Linux Distribution Support”. The release notes are here: [url]https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-compiler-new-features[/url].

yep. but this depend in what system is installed. if you see in the system requeriments:

Ubuntu 18.10 supports gcc 8.2.0
Fedora 29 supports gcc 8.0.2

thats why nvcc supports gcc 8 series. but you only can use it in that distros, or if update the glib/gcc to the same versions, then you can use it

for this in arch use gcc 7 (7.4.1) for build cuda code instead of default gcc (8.2.1)

see for example this issue in the incubator-mxnet project:

https://github.com/apache/incubator-mxnet/issues/10558

greetings

It was never meant this way. You’re not talking nvidia’s *** out of this **** by refering to specs.

The bug is that cudafe++ from cuda 10.1 is now patching up code when it sees gcc 7+ in a way that makes it no longer compile.

The github issue you mention is about using gcc 7 for cuda when arch’s default compiler was the then unsupported gcc 8. (Arch isn’t even mentioned in the list of distros with native support.)

not only gcc7. some user in the issue reported works with certain versions, others not, for example one user works with 5.4 but not with 5.5 in distro supported by cuda

i have problems with the cuda 10.1 installer. i can’t test it in this moment

can you test it with gcc 4.8.5 (for RHEL 7.6) like say in the system requirements?

greetings

1 Like

I have zero interest in both gcc 4.8.5 and what you are trying to make me prove.

ok. good luck

greetings

changing devtoolset-8/root/usr/include/c++/8/bits/basic_string.tcc:1067 from this:

__p->_M_set_sharable();

to this seems to fix the compiler error:

(*__p)._M_set_sharable();

1 Like

Issue silently fixed in cuda_10.1.168.