CUDA: How to assert in kernel code?

后端 未结 3 856
臣服心动
臣服心动 2021-01-01 16:45

What is the equivalent technique of an assertion in CUDA kernel code?

There does not seem to be an assert for CUDA kernel code. I w

3条回答
  •  时光取名叫无心
    2021-01-01 17:19

    You may find this helpful:

    Using assert within kernel invocation

    Alternatively you can catch cudaError using cudaThreadSynchronize() which gives you one of about 40 different reasons for kernel returning an error. But mostly you can check those conditions using if/else commands in the kernel.

提交回复
热议问题