Search code examples
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.

  • Ubuntu 22.04.1 LTS
  • Cuda compilation tools, release 11.5, V11.5.119
  • gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  • g++ (Ubuntu 9.5.0-1ubuntu1~22.04) 11.3.0

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.

    • Ubuntu 22.04.1 LTS
    • Cuda compilation tools, release 11.8, V11.8.89
    • gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    • g++ (Ubuntu 9.5.0-1ubuntu1~22.04) 11.3.0