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

How to deal with index dimensions in alpaka? #144

Open
makortel opened this issue Dec 3, 2020 · 6 comments
Open

How to deal with index dimensions in alpaka? #144

makortel opened this issue Dec 3, 2020 · 6 comments
Labels

Comments

@makortel
Copy link
Collaborator

makortel commented Dec 3, 2020

In #141 it was noticed that 1D and 2D (and 3D) indices imply duplication of accelerator, device, and platform types. It would be good to think if that could be simplified somehow.

@makortel makortel added the alpaka label Dec 3, 2020
@makortel
Copy link
Collaborator Author

makortel commented Dec 3, 2020

@fwyzard commented in #141 (comment)

This is a long standing issue with Alpaka: the number of dimensions ends up giving different accelerators, which (IIRC) in turn require having different devices, etc.

I tried discussing this with the Alpaka team but without much luck :-(

We could just give up on it for the time being, and just use 3-dimensional indices all the time ?
At least under the hood (like CUDA and oneAPI do in practice) and assume that people will use the right number of indices when writing/calling kernels ?

@makortel
Copy link
Collaborator Author

makortel commented Dec 3, 2020

We could just give up on it for the time being, and just use 3-dimensional indices all the time ?

I think this could be a worthwhile attempt, perhaps even before moving beyond alpakatest.

@ghugo83
Copy link
Contributor

ghugo83 commented Dec 4, 2020

We could just give up on it for the time being, and just use 3-dimensional indices all the time ?
At least under the hood (like CUDA and oneAPI do in practice) and assume that people will use the right number of indices when writing/calling kernels ?

Ok have tried this out.
Can have one type of platform only, with Dim3, indeed.

Here for example, only the type of platform with Dim2 was used anyway:
https://github.com/cms-patatrack/pixeltrack-standalone/blob/master/src/alpakatest/plugin-Test1/alpaka/alpakaAlgo1.cc#L247
And then kernels with 1D or 2D workdivs are called:

An issue is that when the work division is 1D, it can only be associated with Acc1 (not Acc3).
So it seems that the Acc types need to be duplicated anyway?

This works: ghugo83@eff39ec
But it only removes the duplication of device and platform types, not of accelerator types.

@makortel
Copy link
Collaborator Author

Thinking a bit further after staring #160 for a while made me realize that a Queue constructor requiring a DevAcc, a DevAcc depending on Acc, and Acc depending on Dim makes it hard to support passing a single Queue from one module to another in an Event product if we try to support many Dim types (unless it would be ok to construct a Queue with one device, and then queue operations that use otherwise the same device except for the dimensions).

@makortel
Copy link
Collaborator Author

(unless it would be ok to construct a Queue with one device, and then queue operations that use otherwise the same device except for the dimensions)

Actually alpakatest/plugin-Test1/alpaka/alpakaAlgo1.cc does exactly that constructs the queue with device with "2 dimensions" and enqueues kernels with both Acc2 and Acc1. So maybe that works in practice.

@ghugo83
Copy link
Contributor

ghugo83 commented Jan 20, 2021

Actually alpakatest/plugin-Test1/alpaka/alpakaAlgo1.cc does exactly that constructs the queue with device with "2 dimensions" and enqueues kernels with both Acc2 and Acc1. So maybe that works in practice.

Yes exactly, actually we could maybe just have a Dim3 device and then enqueue kernels with the desired dimension. It definitely worked in alpakaAlgo1 for one type of device and queue (only the Workdiv (makes sense) and Acc (~ makes sense) would keep on being 1D versus 2D versus 3D dependent on a call case basis).

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

No branches or pull requests

2 participants