我最初在尝试编译包含
<algorithm>
的代码时询问了一个错误,但通过添加标志 -std=c++14
解决了这个问题,如 nvcc -std=c++14 test1.cu
中所示。但是,现在我在包含 <thrust>
中的内容时收到相同的错误消息
#include <algorithm>
#include <thrust/extrema.h> // code compiles without this
int main(){
return 0;
}
错误信息是
/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’
这里出了什么问题?
我使用这些版本。
正如评论中指出的那样,这是特定版本的 CUDA 的错误。这些版本的组合解决了这个问题。
我对这些版本也有同样的问题
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
更新到nvcc 11.8后,问题解决了。