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

add executor object #76

Open
SimeonEhrig opened this issue Feb 1, 2022 · 3 comments
Open

add executor object #76

SimeonEhrig opened this issue Feb 1, 2022 · 3 comments
Milestone

Comments

@SimeonEhrig
Copy link
Member

The executor should be a container object, which contains all types and objects, which are required to launch a vikunja algorithm. His task is it to simplify the API.

Possible implementation for the basics:

executor.hpp

template<typename TAcc, typename TDev, typename TQueue>
class Executor {
public:
     using Acc = typename TAcc;

     TDev dev;
     TQueue queue;

     Executor(TDev dev, TQueue queue) dev(dev), queue(queue) {}
}

reduce.hpp

// fully compatible with alpaka types
template<Typename TAcc, typename TDev, typename TQueue>
reduce(TQueue queue, buffer input, int sum, Func functor){
   // actual reduce algorithm 
}

template<typename TAcc, typename TDev, typename TQueue>
reduce(Executor<TAcc, TDev, TQueue> executor, buffer input, int sum, Func functor){
  reduce<Executor<TAcc, TDev, TQueue>::Acc>(executor.queue, input, sum, functor);
}

main.cpp

// ...

reduce(executor, input, sum, reduce_func);
// instead
// reduce<Acc>(queue, input, sum, reduce_func);

The complete definition and properties are not fixed yet.
It should be still possible to use all possibilities of alpaka. The executor object should only simplify the default case.

@SimeonEhrig
Copy link
Member Author

cc @j-stephan @psychocoderHPC

@SimeonEhrig SimeonEhrig added this to the release 0.2 milestone Feb 1, 2022
@SimeonEhrig
Copy link
Member Author

TODO: view Sycl API

@j-stephan
Copy link
Member

SYCL is a bit more low-level than vikunja (it doesn't provide host-side algorithms like reduce). What @psychocoderHPC was talking about today is the distinction SYCL makes between different objects. Memory is separate from queues and queues are separate from devices... they are not combined into god-like objects.

I like your proposed API. For reference, this is how the C++ executor proposal looks like:

executor auto ex = /* ... */;

std::reduce(std::execution::par.on(ex), /* first */, /* last */, /* init */, /* op */);
std::transform(std::execution::par.on(ex), /* first */, /* last */, /* out */, /* op */);

I believe we can achieve something similar with vikunja executors.

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

No branches or pull requests

2 participants