【发布时间】:2016-10-05 11:46:17
【问题描述】:
racecheck 工具报告了我的应用程序的内存争用情况。我已将其与 CUFFT 执行功能隔离开来。
我做错了吗?如果没有,我怎样才能让racecheck 忽略这个?
这是一个最小的示例,当在 cuda-memcheck --tool racecheck 中运行时会产生一堆“危险”,例如
========= Race reported between Write access at 0x00000a30 in void spVector0128C::kernelTex<unsigned int, float, fftDirection_t=-1, unsigned int=8, unsigned int=8, LUT, ALL, WRITEBACK>(kernel_parameters_t<fft_tex_t, unsigned int, float>)
========= and Read access at 0x00000a70 in void spVector0128C::kernelTex<unsigned int, float, fftDirection_t=-1, unsigned int=8, unsigned int=8, LUT, ALL, WRITEBACK>(kernel_parameters_t<fft_tex_t, unsigned int, float>) [4 hazards]
例子
#include <cufft.h>
#include <iostream>
#define ck(cmd) if ( cmd) { std::cerr << "error at line " << __LINE__ << std::endl;exit(1);}
int main(int argc,char ** argv)
{
int nfft=128;
cufftComplex * ibuf;
cufftComplex * obuf;
ck( cudaMalloc((void**)&ibuf, sizeof(cufftComplex)*nfft) );
ck( cudaMalloc((void**)&obuf, sizeof(cufftComplex)*nfft) );
ck( cudaMemset( ibuf,0,sizeof(cufftComplex)*nfft) );
cufftHandle fft;
ck( cufftPlanMany(&fft,1,&nfft,
NULL,1,nfft,
NULL,1,nfft,
CUFFT_C2C,1) );
ck( cufftExecC2C(fft,ibuf,obuf,CUFFT_FORWARD) );
ck( cudaDeviceSynchronize() );
cufftDestroy( fft );
ck(cudaFree(ibuf));
ck(cudaFree(obuf));
return 0;
}
【问题讨论】:
-
FWIW,我提交了一个针对 cuFFT 的 nVidia 错误 #1823484。也许它会被重新分配给 cuda-memcheck。
标签: cuda race-condition nvcc cufft