探查器中的cudaErrorIllegalAdress

cudaErrorIllegalAdress in Profiler

本文关键字:cudaErrorIllegalAdress 探查      更新时间:2023-10-16

我有一个CUDA程序,它在某些地方使用推力,但也使用普通内核。

问题是:当我独立运行程序时,一切都很好。当我在探查器(Visual探查器或nvprof cmd行)中运行它时,程序在thrust::inclusive_scan操作中崩溃,并出现cudaErrorIllegalAdress错误。崩溃总是发生在探查器中,并且总是发生在同一位置。此外,我有多个迭代,比如:

void foo(){ cudaProfilerStart();
  for(...){//...
    thrust::inclusive_scan(...);//...
  }
  cudaProfilerStop();
}
for(...) foo();

崩溃总是发生在第二次迭代中第一次调用inclusive_scan时。

我喜欢CUDA 6.5在Win7上的Quadro K5000。

有什么想法可以导致这种情况,或者如何缩小范围吗?也许是一种获取失败访问地址的方法?cuda memcheck不能与nvprof AFAIK(?)一起使用

如果我删除对cudaProfilerStart/Stop的调用,它似乎可以正常工作。奇怪的是,今天早上它确实可以使用它们,尽管我没有引入任何更改(进行了一些代码编辑,但通过git恢复了所有内容)。此外,如果我从一开始禁用/启用配置文件(使用cudaProfilerStart/Stop),行为也不会改变

最小工作示例:

#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <thrust/device_vector.h>
#include <cuda_profiler_api.h>
void foo(){
  thrust::device_vector<int> d_in(100), d_out(100);
  thrust::inclusive_scan(d_in.begin(), d_in.end(), d_out.begin());
  cudaError_t res = cudaDeviceSynchronize();
  std::cout << cudaGetErrorString(res) << std::endl;
}
int main(){
  cudaProfilerStart();
  foo();
  cudaProfilerStop();
  foo(); // Crash here
  cudaDeviceReset();
  return 0;
}

更多场景:
Start();foo();停止();foo()崩溃
Start();foo();停止();Start();foo()确定
Start();foo();停止();any_other_kernel();Start();foo()崩溃

这种行为似乎是由于CUDA 7.0和早期探查器系统中的限制。CUDA 7.5版本工具包中将提供修复程序。

[这个答案是从评论中收集的,并作为社区wiki条目添加,以将问题从未回答的队列中删除]

相关文章:
  • 没有找到相关文章