alpaka-group / alpaka

Abstraction Library for Parallel Kernel Acceleration :llama:
https://alpaka.readthedocs.io
Mozilla Public License 2.0
353 stars 72 forks source link

To run the kernel: some examples use exec method, others use createTaskKernel<Acc> +enqueue. #2221

Open mehmetyusufoglu opened 8 months ago

mehmetyusufoglu commented 8 months ago

There are 2 ways of running a kernel. Some of the examples use alpaka::exec<Acc>(queue, workdiv...) some others use createTaskKernel<Acc> and enqueue functions.

Should all the examples use the same approach?

psychocoderHPC commented 8 months ago

copied from: https://github.com/alpaka-group/alpaka/pull/2219#issuecomment-1892393476

I am wondering if it makes more sense to remove alpaka::exec<Acc>() and provide alpaka::enqueue<Acc>(queue, workdiv, kernel) or alpaka::enqueue(alpaka::TagGpuCudaRt, queue, workdiv, kernel)? I do not see a real reason why we have two different names to enqueue a kernel. That we have different function signatures makes IMO sense.

fwyzard commented 8 months ago

@psychocoderHPC the CMS code is using alpaka::exec() because it's shorter, and people normally don't have any reason to use the other alpaka::enqueue() variants.

psychocoderHPC commented 8 months ago

offline discussed in the dev meeting: We will keep both methods. alpaka:exec() is heavily used by CERN and will for compatibility reasons stay. @fwyzard also mentioned that we need to take care that enqueue can enqueue generic tasks, this could be device kernels but also nonparallel host tasks.

I also said that I will provide an enqueue() interface similar to alpaka::exec() but after looking into a fix for https://github.com/alpaka-group/alpaka/issues/2222 I am not sure about the possible additional interface for enqueue. I try to fix first https://github.com/alpaka-group/alpaka/issues/2222 and then will revisit this issue.