Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate moving alpaka device code to .dev.cc files #44625

Open
fwyzard opened this issue Apr 4, 2024 · 6 comments
Open

Investigate moving alpaka device code to .dev.cc files #44625

fwyzard opened this issue Apr 4, 2024 · 6 comments

Comments

@fwyzard
Copy link
Contributor

fwyzard commented Apr 4, 2024

The common approach for alpaka device code is to template all functions on the accelerator type:

template <typename TAcc>
ALPAKA_ACC_FN int sum(TAcc const& acc, int a, int b) { ... }

Another approach could be to move the code inside the ALPAKA_ACCELERATOR_NAMESPACE and use the accelerator type explicitly:

namespace ALPAKA_ACCELERATOR_NAMESPACE {
  ALPAKA_ACC_FN int sum(Acc1D const& acc, int a, int b) { ... }
}

This should let us move alpaka code that is not otherwise templated from header files to .dev.cc files.

Now that we start to have a sizeable alpaka-based code base, we should maybe re-evaluate both options.

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 4, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 4, 2024

A new Issue was created by @fwyzard.

@Dr15Jones, @antoniovilela, @smuzaffar, @rappoccio, @makortel, @sextonkennedy can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@fwyzard
Copy link
Contributor Author

fwyzard commented Apr 4, 2024

assign heterogeneous

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 4, 2024

New categories assigned: heterogeneous

@fwyzard,@makortel you have been requested to review this Pull request/Issue and eventually sign? Thanks

@makortel
Copy link
Contributor

makortel commented Apr 5, 2024

I agree the explicit Acc1D would be worth of exploring.

I'd further argue the Acc1D might be interesting option also when the function is otherwise templated, because the function (usually?) makes some assumption on the dimensionality of the Acc, and I'd assume the explicit Acc1D would ensure consistency between the function and the alpaka::exec() that calls the kernel calling the function.

@makortel
Copy link
Contributor

Just to record, change from TAcc template argument to explicit Acc<N>D types is explored in #46916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants