2016-10-05 4 views
1

racecheck 도구가 내 응용 프로그램과 메모리 경쟁을보고했습니다. 나는 이것을 CUFFT exec 함수에 격리시켰다.왜 cuda-memcheck racecheck가 cufft에서 오류를보고합니까?

내가 잘못 했나요? 그렇지 않다면 어떻게하면 경주가 이것을 무시할 수 있습니까? 여기

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; 
} 
+0

FWIW, cuFFT에 대한 nVidia 버그 # 1823484를 제출했습니다. 어쩌면 그것은 cuda-memcheck에게 재 할당 될 것입니다. –

답변

1

같은 '위험'의 무리를 생산하는 최소한의 예입니다. 나는 nvprof 비슷한 비활성화 할 수 있다고 생각하지 않습니다 - cudaProfilerStart/cudaProfilerStop을

__syncthreads의 설명과 BAR.SYNC 명령 사이에 약간의 차이가 준수하십시오 :

__syncthreads - http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#synchronization-functions

대기 모든 때까지를 http://docs.nvidia.com/cuda/parallel-thread-execution/index.html#texture-instructions

- 스레드 블록에서 스레드가이 점을

BAR.SYNC에 도달했습니다 워프의 모든 스레드가 활성화되어있는 경우 0

장벽은 당 워프으로 실행됩니다. "

이 정확히 동일한 동작하지 않습니다. cuda-memcheck racecheck이 __syncthreads 정의와 cuFFT 커널 BAR.SYNC를 따를 수도 있습니다.

이것은 다음 릴리스에서 수정 될 가능성이 큽니다.

+0

'__syncthreads()'는'bar.sync'에 컴파일되므로 그 효과는 동일합니다. 차이점은 문서에서만,'__syncthreads()'에 대한 설명이 단순화되어 조건부 코드 내에서 동작을 생략 할 수 있습니다. – tera

+0

"이것은 다음 릴리스에서 수정 될 가능성이 큽니다." - 내부 정보가 있습니까? 이 정도의 문서 세부 수준의 불일치는 7 개 정도의 주요 CUDA 릴리즈 (기본적으로 PTX가 공식적으로 문서화 된 이래로)에 있었기 때문에 Nvidia가 과거의 동작을 관찰하는 것은 Nvidia가 곧 변경하려고하는 것처럼 보이지 않습니다. – tera

+0

앞으로 변경 될 가능성이있는 공개 정보를 알려 드리겠습니다. 프레젠테이션의 마지막 부분을 "협동 그룹"에 바칩니다. http://on-demand.gputechconf.com/gtc/2016/presentation/s6224-mark-harris.pdf – llukas