-
Notifications
You must be signed in to change notification settings - Fork 74
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
simplify alpaka usage #1017
simplify alpaka usage #1017
Conversation
- accelerator - specialize platform traits to query device information (redirect to platform trait) - specialize buffer for accelerators - device - add concept `ConceptDev` - specialize `DevType` for a device - specialize platform traits to query device information (redirect to platform trait) - mem - Buffer and views not using the template parameter `TDev` directly. Instead `TDev` is handled as concept and the device type is first evaluated.
Use the simplified accelerator centric view for all examples.
Hi, nice simplification. One question though, why not moving |
I like that idea. This will than also mirror the fact that |
@@ -99,7 +99,8 @@ namespace alpaka | |||
typename TElem, | |||
typename TDim, | |||
typename TIdx> | |||
using Buf = typename traits::BufType<TDev, TElem, TDim, TIdx>::type; | |||
using Buf = typename traits::BufType< | |||
alpaka::dev::Dev<TDev>, TElem, TDim, TIdx>::type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this version. You are passing in something (TDev
) that can give you the real device type via alpaka::dev::Dev<>
. This extends the valid types easily.
If it is already a device, it uses the reflexive alpaka::dev::Dev<>
specialization of the device type itself.
If it is not a device, it simply has to have a specialization of alpaka::dev::Dev<>
.
include/alpaka/pltf/Traits.hpp
Outdated
typename pltf::traits::PltfType<TDev>::type> | ||
::getDevCount(); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we could get rid of those specializations here.
We should do the same that is done for the Buffer (if possible).
May we change the implementation of the trait accessor methods below?
Instead of calling traits::GetDevCount<TPltf>::getDevCount()
they could call traits::GetDevCount<alpaka::pltf::Pltf<TPltf>>::getDevCount()
.
The platforms would need a reflexive specialization of the alpaka::pltf::Pltf<>
trait and the device already has a alpaka::pltf::Pltf<>
specialization.
@psychocoderHPC I have pushed a simplification of your simplification onto your branch. So nothing to do for you anymore ;-) |
@BenjaminW3 From my side the changes looks good. We should check if it is useful to add self reflection also to other traits e.g. QueueType in a separate PR. |
Motivation
Currently alpaka is hard to use because the user needs to know how all concepts e.g platform, accelerator, device, queue,... and how they are connected to each other and which concept must be used where.
I started a discussion in #944 to simplify the interface for alpaka.
This PR is introducing a full change of the usage, instead it provides the required trait specifications to allow the user a accelerator based programming. This means instead that the user needs to handle device and platform types he can use the accelerator to allocate buffers, query device information.
Before this PR the user got the device type from an accelerator and used the device type to get the platform. This explicit traversing over types with a 1:1 relation is removed by forwarding traits to the next hierarchy level when needed.
General Simple Workflow
Acc
Acc
Acc
to create buffersChanges
platform trait)
ConceptDev
DevType
for a deviceplatform trait)
TDev
directly.Instead
TDev
is handled as concept and the device type is firstevaluated.