简单CUDA推力程序错误
我只是写了一个简单的CUDA推力程序,但当我运行它的时候。我得到这个错误:位置0x0037f99c处的推力::系统::系统_错误 有人能帮我弄清楚为什么会这样吗简单CUDA推力程序错误,cuda,thrust,Cuda,Thrust,我只是写了一个简单的CUDA推力程序,但当我运行它的时候。我得到这个错误:位置0x0037f99c处的推力::系统::系统_错误 有人能帮我弄清楚为什么会这样吗 #include<thrust\host_vector.h> #include<thrust\device_vector.h> #include<iostream> using namespace std; using namespace thrust; int main() { thrus
#include<thrust\host_vector.h>
#include<thrust\device_vector.h>
#include<iostream>
using namespace std;
using namespace thrust;
int main()
{
thrust::host_vector<int> h_vec(3);
h_vec[0]=1;h_vec[1]=2;h_vec[2]=3;
thrust::device_vector<int> d_vec(3) ;
d_vec= h_vec;
int h_sum = thrust::reduce(h_vec.begin(), h_vec.end());
int d_sum = thrust::reduce(d_vec.begin(), d_vec.end());
return 0;
}
#包括
#包括
#包括
使用名称空间std;
使用名称空间推力;
int main()
{
推力:主机向量h向量(3);
h_-vec[0]=1;h_-vec[1]=2;h_-vec[2]=3;
推力:装置矢量d矢量(3);
d_vec=h_vec;
int h_sum=推力::减少(h_vec.begin(),h_vec.end());
int d_sum=推力::减少(d_vec.begin(),d_vec.end());
返回0;
}
几点建议:
- 如果使用
编译代码时遇到问题,请尝试不使用-G
编译代码-G
- 你可以,来获取更多信息李>
- 始终建议您根据所使用的GPU的体系结构编译代码。因此,如果您使用的是cc2.0 GPU,请使用
进行编译。如果您使用的是cc3.0 GPU,请使用-arch=sm_20
等进行编译-arch=sm_30
- 最后,建议构建一个64位项目。在windows上,您可以选择release/x64项目
- 如果使用
编译代码时遇到问题,请尝试不使用-G
编译代码-G
- 你可以,来获取更多信息李>
- 始终建议您根据所使用的GPU的体系结构编译代码。因此,如果您使用的是cc2.0 GPU,请使用
进行编译。如果您使用的是cc3.0 GPU,请使用-arch=sm_20
等进行编译-arch=sm_30
- 最后,建议构建一个64位项目。在windows上,您可以选择release/x64项目