CUDA kernel launch fails when using various offsets into input data

后端 未结 2 1174
暖寄归人
暖寄归人 2020-12-10 09:36

My code is giving an error message and I am trying to track down the cause of it. To make it easier to find the problem, I have stripped away code that apparently is not rel

相关标签:
2条回答
  • 2020-12-10 10:03

    the error indicates out of bound memory access, please check the offset value.

    0 讨论(0)
  • 2020-12-10 10:11

    It was very hard to parse your original code with all of those magic constants, but your updated repro case makes the problem immediately obvious. The GPU architecture requires all pointers to be aligned to word boundaries. Your kernel contains a pointer access which is not correctly word aligned. Doubles are an 64 bit type, and your addressing is not aligned to an even 64 bit boundary. This:

    *(double*)((int*)data+100) = 0.0; // 50th double
    

    or this:

    *(double*)((int*)data+102) = 0.0; // 51st double
    

    are both legal. This:

    *(double*)((int*)data+101) = 0.0; // not aligned to a 64 bit boundary
    

    is not.

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