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

Introduce accelerator tags #1246

Closed
j-stephan opened this issue Jan 26, 2021 · 6 comments · Fixed by #1804
Closed

Introduce accelerator tags #1246

j-stephan opened this issue Jan 26, 2021 · 6 comments · Fixed by #1804

Comments

@j-stephan
Copy link
Member

In today's meeting @psychocoderHPC brought up the idea of having special Accelerator tags that are always visible - the backends that are actually activated do not matter. This enables the user to easier specialize traits for accelerators without having to guard them with #ifdef.

We would like to implement this for alpaka 0.7.0. Due to time constraints this has been marked as an optional feature.

@j-stephan j-stephan added Type:Enhancement Release:Optional Use this to mark optional features for the next release labels Jan 26, 2021
@j-stephan j-stephan added this to the Version 0.7.0 milestone Jan 26, 2021
@j-stephan j-stephan added this to To do in Release 0.7 via automation Jan 26, 2021
@j-stephan
Copy link
Member Author

I think this may also be related to #966.

@bernhardmgruber
Copy link
Member

I would like to add my proposition during the last alpaka VC, that we should just declare all backend accelerator templates upfront. This way, users can specialize their traits based on the incomplete accelerator types and no extra tag types are needed. This has the drawback, that we cannot refer to members of incomplete accelerators. Still, I would like this solution to be explored.

Another solution would be a global enum of all accelerators. Each accelerator has a getter for his enumerator and traits on the user side are specialized on these enumerators.

@sbastrakov
Copy link
Member

I think tag types are almost always same or better than enum for these purposes. Tags can be added from anywhere, including user code, while enum is one and centralized.

@psychocoderHPC
Copy link
Member

Another solution would be a global enum of all accelerators. Each accelerator has a getter for his enumerator and traits on the user side are specialized on these enumerators.

What @sbastrakov said. Enums can not be extended from the user code.

I try to write a draft with my thoughts, soon.

@frobnitzem
Copy link
Contributor

Is this related to the enumeration of accelerator types in:

As a new alpaka user, I'm held up by the difficulty of storing auto const devAcc = alpaka::getDevByIdx<Acc>(0u); in my own classes. All the alpaka documentation creates this this as "const auto". How do I name it's storage type (const alpaka::DevUniformCudaHipRt) when declaring classes meant to be specialized to one device? Maybe I should just template it.

@sbastrakov
Copy link
Member

sbastrakov commented Mar 14, 2021

Yes, it's sometimes awkward due to alpaka operating with conditionally defined accelerator types, e.g. AccGpuCudaRt<...> being defined when cuda was configured to be used and found. These types (or types depending on them) are propagated basically everywhere as template parameters. Unconditionally defined tags would make it more simple and less ifdef-guardy.

In user code we normally make corresponding template parameters. Those could in principle mirror alpaka examples e.g. take Acc type and derive the rest from there. Of course it's also possible to start from another level, like Dev or Queue type.

If you just want to specialize kernel code, perhaps you mean for accelerator, not device in alpaka speech? There is a recent example added on it #1271. If you meant something else, please clarify

Edit: fixed typos, fat fingers

@j-stephan j-stephan removed this from To do in Release 0.7 May 11, 2021
@j-stephan j-stephan added this to To do in Release 0.8 via automation May 11, 2021
@j-stephan j-stephan removed this from To do in Release 0.8 Nov 10, 2021
@j-stephan j-stephan added this to To do in Release 0.9 via automation Nov 10, 2021
@j-stephan j-stephan removed the Release:Optional Use this to mark optional features for the next release label Nov 16, 2021
@j-stephan j-stephan removed this from the Version 0.9.0 (I/2022) milestone Mar 29, 2022
@j-stephan j-stephan removed this from To do in Release 0.9 Mar 29, 2022
@j-stephan j-stephan added this to To do in Release 1.0 via automation Mar 29, 2022
@j-stephan j-stephan linked a pull request Oct 5, 2022 that will close this issue
3 tasks
Release 1.0 automation moved this from To do to Done Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants