Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

function inside the cuda kernel

Tags:

cuda

Is there any ways i can have a function inside cuda kernel. I mean my cuda kernel gets pretty long and hard to debug at one point. Thanks.

like image 731
small_potato Avatar asked Oct 14 '10 23:10

small_potato


People also ask

What is kernel function in CUDA?

Figure 1 shows that the CUDA kernel is a function that gets executed on GPU. The parallel portion of your applications is executed K times in parallel by K different CUDA threads, as opposed to only one time like regular C/C++ functions. Figure 1. The kernel is a function executed on the GPU.

What is function of __ global __ qualifier in CUDA program?

__global__ : 1. A qualifier added to standard C. This alerts the compiler that a function should be compiled to run on a device (GPU) instead of host (CPU).

What are the limitations of CUDA kernel?

kernel cannot allocate, and only isbits types in device arrays: CUDA C has no garbage collection, and Julia has no manual deallocations, let alone on the device to deal with data that live independently of the CuArray. no try-catch-finally in kernel: CUDA C does not support exception handling on device (v11.


1 Answers

yes, just mark function with __device__ and it will be callable only from GPU. Check CUDA Programming guide, section B.1 Here is the direct link

like image 188
Andrey Avatar answered Sep 28 '22 01:09

Andrey