Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/154.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 推力::系统::转换中的系统错误\u减少_C++_Cuda_Thrust - Fatal编程技术网

C++ 推力::系统::转换中的系统错误\u减少

C++ 推力::系统::转换中的系统错误\u减少,c++,cuda,thrust,C++,Cuda,Thrust,我正在运行monte carlo模拟,使用具有2.1计算能力的Nvidia卡上的推力。如果我尝试一次变换整个设备向量,我会得到以下错误。这不是耗尽设备内存的问题,因为向量非常大(~1-10mb)。我知道我的代码是正确的,因为如果我使用openmp编译并仅在主机上运行,它就可以工作。是什么导致了这个问题 但是,如果我在块中进行转换,它可以正常工作,直到我在模拟中缩放时间步数,然后它会给出相同的错误 //run the Monte Carlo simulation zpath * norm_ptr

我正在运行monte carlo模拟,使用具有2.1计算能力的Nvidia卡上的推力。如果我尝试一次变换整个设备向量,我会得到以下错误。这不是耗尽设备内存的问题,因为向量非常大(~1-10mb)。我知道我的代码是正确的,因为如果我使用openmp编译并仅在主机上运行,它就可以工作。是什么导致了这个问题

<未处理的异常在MCCVA.EXE中的0x77 6E15DE:微软C++异常:Purix::St::StulyStor在内存位置0x00 14CB28 .< /P> 但是,如果我在块中进行转换,它可以正常工作,直到我在模拟中缩放时间步数,然后它会给出相同的错误

//run the Monte Carlo simulation
zpath * norm_ptr = thrust::raw_pointer_cast(&z[0]);
cout << "initialized raw pointer" << endl;
thrust::device_vector<ctrparty> devctrp = ctrp;
assert(devctrp.size()==ctrp.size());
cout << "Initialized device vector" << endl;
cout << "copied host vec to device vec" << endl;

float cva = 0;
for(unsigned int i=0; i<5; i++)
{
    if(i<4)
        cva += (1-R) * thrust::transform_reduce(devctrp.begin()+i*2000, devctrp.begin() + (i+1)*2000 - 1, calc(norm_ptr, dt, r, sims, N), 0.0f, sum());
    else
        cva += (1-R) * thrust::transform_reduce(devctrp.begin()+i*2000, devctrp.begin() + (i+1)*2000, calc(norm_ptr, dt, r, sims, N), 0.0f, sum());
}  
我使用的是VS2010,当它出现错误时,会指向dbgheap.c文件中的以下内容

__finally {
    /* unlock the heap
     */
    _munlock(_HEAP_LOCK);
}

当我忘记将项目的
属性
调整到我的CUDA卡计算能力时,我的推力出现了这种错误

Configuration Properties>CUDA C\C++>Device>code-Generation
compute_10、sm_10
更改为您的GPU计算能力


对于具有2.1计算能力的Nvidia卡,它将是
compute\u 20、sm\u 21

计算()和
sum()的定义是什么?其中之一可能就是这个问题。您可以尝试使用
calc
执行
asch::transform
,使用
sum()
执行
asch::reduce
,看看是否可以缩小错误的来源。例如,
norm_ptr
指向设备阵列
z
。我不知道
calc
如何准确地使用它,但是如果它以某种方式通过
z
进行索引,那么当您增加转换的长度时,您可能会遇到麻烦。这只是猜测,但如果能更完整地描述您在Transform中所做的工作,会有所帮助您是否正在构建项目的调试或发布版本?我已经通过在函数中使用printf检查了calc和sum函数是否正常工作。当使用printf时,当transform_一次减少整个向量时,我看到的是,它看起来像是将它本身分解成了块,因为我看到“calc”后面跟着“sum”,后面跟着更多的“calc”和“sum”,但它在某个地方出了问题。我使用的是调试版本,我确实关闭了-g和-g标志。可能是您的计算需要太多时间,并且正被“看门狗计时器”终止。@JaredHoberock有什么方法可以检查吗?我发现这是Windows看门狗计时器超时的错误。一、 我已经在用sm_20了。Windows 2.1英伟达定时器超时的原因是什么?我不确定Windows是否会导致NVIDIA驱动程序崩溃,如果它没有及时从设备中得到响应。或者类似的东西
__finally {
    /* unlock the heap
     */
    _munlock(_HEAP_LOCK);
}