DDT を使用して MPI ベースの CUDA プログラムをデバッグしています。CUDA ランタイム ライブラリ( libcudart) が (ドキュメント化されていない) function で例外をスローすると、私のコードは中止されcudaGetExportTable
ます。cudaMalloc
cudaThreadSynchronize
cudaDeviceSynchronize
libcudart が例外をスローするのはなぜですか (私は C++ API ではなく C API を使用しています)、コード内でcudaError_t
戻り値または を使用して例外を検出できますCHECKCUDAERROR
か?
(私は CUDA 4.2 SDK for 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.
また、ノードあたり 4 gpus ではなく、ノードあたり 3 コア/gpus で実行している場合、dmalloc は同様のメモリ エラーを検出しますが、デバッグ モードでない場合、コードはノードあたり 3 gpus で完全に正常に実行されます (私が知る限り)。