次のCUDAスラストプログラムがクラッシュします。
#include <thrust/device_vector.h>
#include <thrust/extrema.h>
int main(void)
{
thrust::device_vector<int> vec;
for (int i(0); i < 1000; ++i) {
vec.push_back(i);
}
thrust::min_element(vec.begin(), vec.end());
}
私が得る例外は次のとおりです。
Unhandled exception at 0x7650b9bc in test_thrust.exe: Microsoft C++
exception:thrust::system::system_error at memory location 0x0017f178..
In `checked_cudaMemcpy()` in `trivial_copy.inl`.
を追加#include <thrust/sort.h>して置き換えるmin_elementとsort、クラッシュしません。
Windows 7 64ビット、compute_20、sm_20(Fermi)、デバッグビルドでCUDA4.1を使用しています。リリースビルドでは、クラッシュが発生せず、min_elementが正しい要素を見つけます。
私は何か間違ったことをしていますか、それともスラストにバグがありますか?