-
Notifications
You must be signed in to change notification settings - Fork 75
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
simplification of the user interface #944
Comments
Thanks a lot for the inspiring concept work. A more simple frontend would help not only the newcomers. It just makes coding more productive and readable. Code examples also would fit on a few slides then, hopefully ;-) Alpaka buffer: Perhaps it is sufficient to pass the buffer instead of the iterator, because the buffer already has all information. But I see the idea, that you can manage the accelerator-dependent access methods by that. buffer mybuffer_d(mybuffer_h);
queue myQueue;
command_group(myQueue, [&]()
{
// Data accessors
auto a = mybuffer_d.get_access<access::read>();
// Kernel
parallel_for(count, kernel_functor([ = ](id<> item) {
int i = item.get_global(0);
// ... do something with a[i] For the record, SYCL is fully C++-compliant and by a C++ library you could map SYCL code to an OpenMP backend with an ordinary C++ compiler (IIRC codeplay had an OpenMP version, but at a very very early stage). The question is, if we can simply move the relevant runtime polymorphic to compile-time one and how the API will look then. (Btw, besides of the integration of the buffer concept, we also have to consider multiple platform levels because the backend can be heterogeneous itself. This means, that you not only traverse the devices, but also the platforms like OpenCL and SYCL do. This is a separate issue though.) First, the accelerator and memory objects/types should be tackled I guess. If impliciteness becomes added, then the question is whether the more simple API should be a separate layer on-top of Alpaka instead of refactoring existing code only. We probably have to evolve through multiple designs, but I would love to see this alive, because especially with the C++17 features it should be doable that Alpaka becomes a modern, productive interface like SYCL (or even better and more performant). So how you would like to proceed? I guess, first we need the whole design and its pitfalls, before we can implement the actual thing. |
My 2 cents on this topic. My understanding is that Alpaka deliberately introduces API as free functions, and not in the object-oriented style, so that e.g. putting a task to a queue looks like |
If (big if) we are basing this on the SYCL API, is there any reason to not just turn alpaka into an actual implementation of SYCL? Minus OpenCL interoperability because that would require a working OpenCL implementation on the executing system. |
We discussed this before in an issue and it's definitely possible, just a matter of priorities of the project and available resources. |
On simplifying namespaces in alpaka: #1034 |
On the |
+1 for using object-oriented style. Especially:
This morning I wasted an hour trying to write a class method that creates a kernel and enqueues it. |
I agree with the general sentiment. And judging by this topic I guess most of alpaka contributors do. I think the main difference is not between I feel a larger issue is that there is no I believe there is a way to convert between |
With C++20 concepts on the horizon I'm now slightly in favour of the current API design. Once those can be used in alpaka I believe we can remove a lot of internal code without hurting alpaka's feature set. |
Motivation
Alpaka gives users high flexibility and freedom for their implementations.
Alpaka is explicit everywhere and can therefore be controlled in fine granularity.
For IMO 90% of the users, simple usage - at least to get started with a library - is very important.
Proposal
Alpaka is from the view of a user very hard to use, therefore I like to do the first step and propose an example of our
vector add
written against a pseudo APIsimple
.Example
Additional option
Even if I show here a self assembled interface based of the current usage of alpaka we should think about of deriving an interface based on the SYCL standard. I also thought lot of creating a SYCL frondend with alpaka as backend, but the SYCL API based a lot of runtime polymorphic (which is maybe removed by the SYCL compiler).
CC-ing: @ComputationalRadiationPhysics/alpaka-developers @ComputationalRadiationPhysics/alpaka-maintainers
The text was updated successfully, but these errors were encountered: