What are template methods in C ++ / CUDA with three angle brackets (<<<)?

Sorry what could be a simple question, my C ++ is rusty. I am working on machine learning in C that uses CUDA for some computation and I found the following line of code.

Just curious how to make it out. It looks like a boilerplate method, but I don't understand the triple angle brackets' <<<What's going on here?

backward_scale_kernel<<<n, BLOCK>>>(x_norm, delta, batch, n, size, scale_updates);

      

In context, "n" is passed as a parameter to the function and I cannot find where BLOCK is defined or assigned.

+3


source share


1 answer


I'm sure there is already a good duplicate for this, but the decorator <<< >>>

you see is the CUDA runtime API syntax extension that allows you to specify the execution parameters of a CUDA core call.

Complete syntax



kernel_function<<<grid dimensions, block dimensions, dynamic shared memory, stream ID>>>( ....arguments....)

      

The CUDA runtime API extends this syntax with a pair of inline function calls to the compiler released by the template to ensure that the GPU core runs at runtime.

+7


source







All Articles