我正在尝试用Thrust CUDA库实现一些算法。它在前几次运行中运行良好,但现在显示thrust::system::detail bad_alloc error
。那是什么意思?我的GPU有4GB的全局内存,所以我确定我的内存不足(我的app几乎不需要200MB)。我在必要的地方使用free
和cudaFree
。这是sys conf。
操作系统:Linux
卡片:特斯拉C2070
CUDA版本:5
司机:301.42
我跑过cuda-memcheck它显示了这样的错误
========= Invalid \__global__ write of size 4 ========= at 0x000006b8 in void thrust::detail::backend::cuda::detail::fast_scan::downsweep_intervals, thrust::device_ptr, int, thrust::plus, thrust::detail::backend::uniform_decomposition>(int, thrust::device_ptr, thrust::device_ptr*, int, int) ========= by thread (158,0,0) in block (0,0,0) ========= Address 0xbfae3ecc is out of bounds ========= Saved host backtrace up to driver entry point at kernel launch time ========= Host Frame:/usr/lib/libcuda.so (cuLaunchKernel + 0x31a) [0x558ba] ========= Host Frame:/usr/local/cuda/lib/libcudart.so.5.0 [0x8e6a]似乎Thrust失败了。