c++cudathrust

nvcc compilation error using thrust in CUDA 11.5


I initially asked about an error when trying to compile a code including <algorithm>, but this was solved by adding a flag -std=c++14, as in nvcc -std=c++14 test1.cu. However, now I get the same error message when including something from <thrust>

#include <algorithm>
#include <thrust/extrema.h> // code compiles without this
int main(){
    return 0;
}

The error message is

/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
  435 |         function(_Functor&& __f)
      |                                                                                                                                                 ^ 
/usr/include/c++/11/bits/std_function.h:435:145: note:         ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
  530 |         operator=(_Functor&& __f)
      |                                                                                                                                                  ^ 
/usr/include/c++/11/bits/std_function.h:530:146: note:         ‘_ArgTypes’

What is wrong here?

I use these versions.


Solution

  • It was a bug with the specific version of CUDA, as was pointed out in the comment. The combination of these versions solved the issue.