cudaDeviceSynchronize() error code 77: cudaErrorIllegalAddress

后端 未结 1 738
-上瘾入骨i
-上瘾入骨i 2020-12-18 04:22

Thank you very much for reading my threads.

I am doing CUDA work, but keep getting cudaDeviceSynchronize() error code 77: cudaErrorIllegalAddress, without any idea

相关标签:
1条回答
  • 2020-12-18 04:43

    While this may not be the only source of error in the code, you are not allocating any dynamic shared memory for the reduction kernel, leading to the illegal addressing error you see. The correct kernel launch should be something like

    size_t shm_size = block_size * sizeof(unsigned long long);
    reduceSum<<<num_blocks,block_size,shm_size>>>(dev_img, dev_sum, size);
    

    This allocates the equivalent of one unsigned long long for each thread running in the reduction kernel, which (by my very cursory reading of your code) should make the shared memory array sdata the correct size for the kernel to run without out-of-bounds access to that array.

    0 讨论(0)
提交回复
热议问题