43template <Platform PLATFORM>
62template <ProcessingContext CONTEXT>
69 #define any_platform __device__ __host__
71 #define platform_constant constexpr __constant__
72 #define platform_constant_definition constexpr __constant__
74 #define platform_constant constexpr
75 #define platform_constant_definition constexpr
79 #define platform_constant constexpr
80 #define platform_constant_definition constexpr
87template <
typename CONCRETIZABLE,
typename F>
91#ifdef PLATFORM_CPU_SISD
93 return f(
static_cast<typename CONCRETIZABLE::template type<Platform::CPU_SISD>*
>(ptr));
95#ifdef PLATFORM_CPU_SIMD
97 return f(
static_cast<typename CONCRETIZABLE::template type<Platform::CPU_SIMD>*
>(ptr));
99#ifdef PLATFORM_GPU_CUDA
101 return f(
static_cast<typename CONCRETIZABLE::template type<Platform::GPU_CUDA>*
>(ptr));
104 throw std::invalid_argument(
"Invalid PLATFORM");
112#ifdef PLATFORM_CPU_SISD
117#ifdef PLATFORM_CPU_SIMD
122#ifdef PLATFORM_GPU_CUDA
128 throw std::invalid_argument(
"Invalid PLATFORM");
132template <
typename CONCRETIZABLE,
typename... ARGS>
136#ifdef PLATFORM_CPU_SISD
138 return new typename CONCRETIZABLE::template type<Platform::CPU_SISD>(std::forward<
decltype(args)>(args)...);
140#ifdef PLATFORM_CPU_SIMD
142 return new typename CONCRETIZABLE::template type<Platform::CPU_SIMD>(std::forward<
decltype(args)>(args)...);
144#ifdef PLATFORM_GPU_CUDA
146 return new typename CONCRETIZABLE::template type<Platform::GPU_CUDA>(std::forward<
decltype(args)>(args)...);
149 throw std::invalid_argument(
"Invalid PLATFORM");
156#ifdef PLATFORM_CPU_SISD
160#ifdef PLATFORM_CPU_SIMD
164#ifdef PLATFORM_GPU_CUDA
169 throw std::invalid_argument(
"Invalid PLATFORM");
Top level namespace for all of OpenLB.
auto callUsingConcretePlatform(Platform platform, typename CONCRETIZABLE::base_t *ptr, F f)
Dispatcher for concrete platform access.
ProcessingContext
OpenLB processing contexts.
@ Simulation
Data available on host for e.g. functor evaluation.
Platform
OpenLB execution targets.
@ CPU_SIMD
Basic scalar CPU.
@ GPU_CUDA
Vector CPU (AVX2 / AVX-512 collision)
void checkPlatform()
Verifies requirements for using PLATFORM.
constexpr bool isPlatformCPU(Platform platform)
Returns true if platform is equal to Platform::CPU_*.
CONCRETIZABLE::base_t * constructUsingConcretePlatform(Platform platform, ARGS &&... args)