【发布时间】:2014-05-29 14:22:54
【问题描述】:
我在 VS 2012 中运行以下程序来尝试查找 Thrust 函数:
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <thrust/find.h>
#include <thrust/device_vector.h>
#include <stdio.h>
int main() {
thrust::device_vector<char> input(4);
input[0] = 'a';
input[1] = 'b';
input[2] = 'c';
input[3] = 'd';
thrust::device_vector<char>::iterator iter;
iter = thrust::find(input.begin(), input.end(), 'a');
std::cout << "Index of a = " << iter - input.begin() << std::endl;
return 0;
}
这是取自http://docs.thrust.googlecode.com/hg/group__searching.html#ga99c7a59cef5b9f4cdbc70f37b2e221be的代码示例的修改版本
当我在调试模式下运行此程序时,我的程序崩溃并收到错误 Debug Error! ... R6010 - abort() has been called。但是,在发布模式下运行它,我只会得到预期的输出 Index of a = 0。
我知道崩溃的发生是因为包含 find 函数的行。
什么可能导致这种情况发生?
【问题讨论】:
标签: c++ visual-studio-2012 cuda thrust