我正在用DDT调试一个基于MPI的CUDA程序。当我的代码中从cudaMalloc
和cudaThreadSynchronize
(更新:使用cudaDeviceSynchronize
给出相同的错误)调用(未记录)函数cudaGetExportTable
时,CUDA运行时库(libcudart)抛出异常时,我的代码中止。在cudaGetExportTable(CUDA运行时库)中抛出异常'cudaError_enum'?
为什么libcudart在我的代码中检测到它返回值cudaError_t
或CHECKCUDAERROR
之前抛出异常(我正在使用C API,而不是C++ API)?
(我使用CUDA 4.2 SDK的Linux版本。)
输出:
Process 9: terminate called after throwing an instance of 'cudaError_enum'
Process 9: terminate called recursively
Process 20: terminate called after throwing an instance of 'cudaError'
Process 20: terminate called recursively
我的代码:
cudaThreadSynchronize();
CHECKCUDAERROR("cudaThreadSynchronize()");
其他的代码片段:
const size_t t; // from argument to function
void* p=NULL;
const cudaError_t r=cudaMalloc(&p, t);
if (r!=cudaSuccess) {
ERROR("cudaMalloc failed.");
}
部分回溯:
Process 9:
cudaDeviceSynchronize()
-> cudaGetExportTable()
-> __cxa_throw
Process 20:
cudaMalloc()
-> cudaGetExportTable()
-> cudaGetExportTable()
-> __cxa_throw
内存调试错误:
Processes 0,2,4,6-9,15-17,20-21:
Memory error detected in Malloc_cuda_gx (cudamalloc.cu:35):
dmalloc bad admin structure list.
这条线是上面所示的cudaMalloc代码片段。也:
Processes 1,3,5,10-11,13-14,18-19,23:
Memory error detected in vfprintf from /lib64/libc.so.6:
dmalloc bad admin structure list.
另外,在3个核心上运行时/每节点而不是每个节点4个GPU的GPU,dmalloc检测类似的存储器错误,但是,当不处于调试模式时,代码运行与每节点3分的GPU完全正常(据我所知)。
当发生这种情况时,您运行了多少个MPI进程? – talonmies 2012-07-24 17:39:08
我在6个节点上运行24个进程(每个节点有4个内核和gpus)。 – BenWibking 2012-07-24 18:14:46
'cudaThreadSynchronize'在技术上已被弃用。如果您尝试使用'cudaDeviceSychronize',会发生什么? – talonmies 2012-07-24 18:29:34