keyword 'return' in cuda kernel what is its meaning?

What does the keyword ‘return’ do in cuda kernel code? Does it end the thread or the kernel.
I’m trying to end the execution of the current thread. What is the proper way to do this? I.e.
if (condition) return;

What does the keyword ‘return’ do in cuda kernel code? Does it end the thread or the kernel.
I’m trying to end the execution of the current thread. What is the proper way to do this? I.e.
if (condition) return;

Just like normal C, the return statement exits from the current function.

If you call “return” from the main kernel scope, then indeed, the thread is finished and will no longer compute anything. When all threads are finished, the block finishes.
When all blocks are finished, the kernel finishes.

Just like normal C, the return statement exits from the current function.

If you call “return” from the main kernel scope, then indeed, the thread is finished and will no longer compute anything. When all threads are finished, the block finishes.
When all blocks are finished, the kernel finishes.

if (condition) return; should do what you want. It should terminate the execution of the current thread.

if (condition) return; should do what you want. It should terminate the execution of the current thread.