20using Executor = std::variant<SerialExecutor, CPUExecutor, GPUExecutor>;
25 if (std::holds_alternative<NeoN::GPUExecutor>(exec))
34 std::unique_ptr<AllocatorStrategy> strategy = std::make_unique<DefaultAllocator>()
37#if defined(KOKKOS_ENABLE_CUDA)
39#elif defined(KOKKOS_ENABLE_HIP)
41#elif defined(KOKKOS_ENABLE_SYCL)
45#if defined(KOKKOS_ENABLE_OPENMP)
47#elif defined(KOKKOS_ENABLE_THREADS)
56 []<
typename Exec>(
const Exec& concExec) {
return concExec.name(); }
66 []<
typename Exec>(
const Exec& concExec) {
return concExec.memorySpace(); }, exec
73 return std::visit([](
auto e) {
return e.getLogger(); }, exec);
79 std::visit([logger](
auto& e) { e.setLogger(logger); }, exec);
93 typename ExecRhs>([[maybe_unused]]
const ExecLhs&, [[maybe_unused]]
const ExecRhs&)
95 if constexpr (std::is_same_v<ExecLhs, ExecRhs>)
97 return typename ExecLhs::exec() ==
typename ExecRhs::exec();
118 return !(lhs == rhs);
Executor for handling multicore CPU based parallelization.
Executor for GPU offloading.
Reference executor for serial CPU execution.
Integer types used throughout NeoN.
MemorySpace memorySpace(const Executor &exec)
void setLogger(Executor &exec, std::shared_ptr< Logging::BaseLogger > logger)
void fence(const Executor &exec)
std::shared_ptr< const Logging::BaseLogger > getLogger(const Executor &exec)
std::string executorName(const Executor &exec)
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Executor createDefaultExecutor(std::unique_ptr< AllocatorStrategy > strategy=std::make_unique< DefaultAllocator >())
bool operator==(const Executor &lhs, const Executor &rhs)
Checks if two executors are equal, i.e. they are of the same type.
bool operator!=(const Executor &lhs, const Executor &rhs)
Checks if two executors are not equal, i.e. they are not of the same type.