Nested kernels in CUDA

CUDA does not currently allow nested kernels.

To be specific, I have the following problem: I have N number of M-dimensional data. To process each of the N data points, you must run three cores in a sequence. Since kernel nesting is not allowed, I cannot create a kernel with calls to three kernels. Therefore, I have to process each data point in turn.

One solution is to write a large kernel containing the functionality of all the other three cores, but I think that it will be not optimal.

Can anyone suggest how threads can be used for parallel operation of N data points, while maintaining three smaller cores.

Thank.

+3
source share
3

, ... N :

cudaStream_t streams;
streams = malloc(N * sizeof(cudaStream_t));
for(i=0; i<N; i++)
{
    cudaStreamCreate(&streams[i]);
}

i- cudaMemcpyAsync :

cudaMemcpyAsync(dst, src, kind, count, streams[i]);

(sharedMemory 0, ):

kernel_1 <<< nBlocks, nThreads, sharedMemory, streams[i] >>> ( args );
kernel_2 <<< nBlocks, nThreads, sharedMemory, streams[i] >>> ( args );

, , :

for(i=0; i<N; i++)
{
    cudaStreamDestroy(streams[i]);
}
free(streams)
+3

, NVidia Compute Capability 3.5 Parallelism, .

+2

With Fermi compatibility, you can now run a parallel kernel

0
source

Source: https://habr.com/ru/post/1779807/


All Articles