alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::onHost Namespace Reference

Functionality which is usable on the host CPU controller thread. More...

Namespaces

namespace  concepts
namespace  cpu
namespace  example
namespace  internal
namespace  logger
namespace  trait
namespace  unifiedCudaHip

Classes

struct  Demangled
struct  Device
 Description of a specific device that one can schedule kernels on. More...
struct  DeviceProperties
 Properties of a device. More...
struct  DeviceSelector
struct  DeviceSpec
 Concept for a combination of an API and device kind. More...
struct  Event
struct  Event< Device< T_Api, T_DeviceKind > >
struct  FrameSpec
 Device/Api-agnostic description of the logical parallelism exposed to a kernel. More...
struct  MakeAccessibleOnAcc
 Provides an instance of an object which can be used within the compute kernel. More...
struct  Queue
struct  Queue< Device< T_Api, T_DeviceKind >, T_QueueKind >
struct  SharedBuffer
 Life time managed buffer with contiguous data. More...
struct  ThreadSpec
 Backend-specific description of the actual block and thread launch shape. More...

Typedefs

template<typename T>
using Handle = std::shared_ptr<T>

Functions

template<alpaka::concepts::Api... T_Apis>
consteval auto allBackends (std::tuple< T_Apis... > const &usedApis, auto const listOfExecutors)
 Generate the full set of backend dictionaries for a set of APIs.
template<alpaka::concepts::DeviceSpec... T_DevicesSpecs>
consteval auto allBackends (std::tuple< T_DevicesSpecs... > const &usedDeviceSpecs, auto const &listOfExecutors)
 Generate the full set of backend dictionaries for a set of device kinds.
auto cpuid (std::uint32_t, std::uint32_t, std::uint32_t ex[4]) -> void
constexpr auto createBackendList (auto const devSpecList, auto const listOfExecutors)
 Create the complete backend list for all device specifications and executors.
constexpr auto createBackendsFor (auto const deviceSpec, auto const listOfExecutors)
 Build a tuple of backends for a single device specification.
constexpr auto defaultExecutor (internal::concepts::DeviceHandle auto deviceHandle)
 Select a default executor for the given device.
template<typename T>
constexpr auto demangledName ()
template<typename T>
constexpr auto demangledName (T const &)
template<typename T_Device>
 Device (Handle< T_Device > &&) -> Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Device >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Device >()))>
template<alpaka::concepts::DeviceSpec T_DeviceSpec>
 DeviceSelector (T_DeviceSpec const &deviceSpec) -> DeviceSelector< ALPAKA_TYPEOF(getApi(deviceSpec)), ALPAKA_TYPEOF(getDeviceKind(deviceSpec))>
template<alpaka::concepts::DeviceSpec T_DeviceSpec>
 DeviceSpec (T_DeviceSpec const &deviceSpec) -> DeviceSpec< ALPAKA_TYPEOF(getApi(deviceSpec)), ALPAKA_TYPEOF(getDeviceKind(deviceSpec))>
template<typename T>
constexpr auto EmbedTypeIntoSignature ()
template<typename T_Event>
 Event (Handle< T_Event > &&) -> Event< Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Event >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Event >()))> >
template<template< typename... > class T_TupleLike, typename... T_Entries>
int executeForEach (auto &&callable, T_TupleLike< T_Entries... > const &tuple)
 !
template<alpaka::concepts::DeviceSpec... T_DeviceSpecs>
int executeForEachIfHasDevice (auto &&callable, std::tuple< T_DeviceSpecs... > const &tupleOfDeviceSpecs)
 !
template<alpaka::concepts::VectorOrScalar T_NumFrames, alpaka::concepts::VectorOrScalar T_FrameExtents>
 FrameSpec (T_NumFrames const &, T_FrameExtents const &) -> FrameSpec< alpaka::trait::getVec_t< T_NumFrames >, alpaka::trait::getVec_t< T_FrameExtents >, alpaka::exec::AnyExecutor >
template<alpaka::concepts::VectorOrScalar T_NumFrames, alpaka::concepts::VectorOrScalar T_FrameExtents, alpaka::concepts::Executor T_Executor>
 FrameSpec (T_NumFrames const &, T_FrameExtents const &, T_Executor) -> FrameSpec< alpaka::trait::getVec_t< T_NumFrames >, alpaka::trait::getVec_t< T_FrameExtents >, T_Executor >
auto getCpuName () -> std::string
constexpr auto getDeviceSpecsFor (auto const api)
 Create a tuple of device specifications for a single API.
template<alpaka::concepts::Api... T_Apis>
constexpr auto getDeviceSpecsFor (std::tuple< T_Apis... > const apiList)
 Create a flattened tuple of device specification objects for a list of APIs.
template<onHost::concepts::ThreadSpec T_ThreadSpec, alpaka::concepts::KernelBundle T_KernelBundle>
constexpr uint32_t getDynSharedMemBytes (T_ThreadSpec spec, T_KernelBundle const &kernelBundle)
template<typename T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
constexpr concepts::FrameSpec auto getFrameSpec (Device< T_Api, T_DeviceKind > const &device, alpaka::concepts::Executor auto executor, alpaka::concepts::VectorOrScalar auto const &extents)
 Provides a frame specification to operate on a given index range.
auto getFreeGlobalMemBytes () -> std::size_t
auto getGlobalMemCapacityBytes () -> std::size_t
template<alpaka::concepts::Api T_Api, alpaka::concepts::DeviceKind T_DeviceKind, alpaka::concepts::Executor T_Exec>
consteval uint32_t getMaxThreadsPerBlock (T_Api api, T_DeviceKind deviceKind, T_Exec exec)
 A safe(ish) compile time lower bound on max threads per block for a given combination of API, device kind and executor.
auto getNativeHandle (auto const &handle)
 Get the native handle of an handle.
size_t getPageSize ()
template<typename T_Data>
auto getScanBufferSize (alpaka::concepts::VectorOrScalar auto const &extents)
 For a scan of some size, this function returns the necessary buffer size in bytes.
template<typename T_DataType, typename T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
constexpr concepts::FrameSpec auto getSimdFrameSpec (Device< T_Api, T_DeviceKind > const &device, alpaka::concepts::Executor auto executor, alpaka::concepts::VectorOrScalar auto const &extents)
 Provides a frame specification to operate on a given index range.
template<onHost::concepts::ThreadSpec T_ThreadSpec, alpaka::concepts::KernelBundle T_KernelBundle>
consteval bool hasUserDefinedDynSharedMemBytes (T_ThreadSpec spec, T_KernelBundle const &kernelBundle)
bool isDataAccessible (concepts::Device auto const &device, alpaka::concepts::IView auto const &view)
 Check if the given view is accessible on the given device.
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
bool isDataAccessible (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::IView auto const &view)
 Check if the given view is accessible on the device of the given queue.
consteval bool isExecutorSupportedBy (auto executor, internal::concepts::DeviceHandle auto const &deviceHandle)
consteval bool isPlatformAvaiable (alpaka::concepts::Api auto api)
template<typename T_Object, typename... T_Args>
auto make_sharedSingleton (T_Args &&... args)
auto makeAcc (alpaka::onHost::concepts::ThreadSpec auto const &threadSpec, uint32_t numaIdx, bool setThreadAffinity)
decltype(auto) makeAccessibleOnAcc (auto &&any)
 Provides an instance of an object which can be used within the compute kernel.
auto makeDeviceSelector (alpaka::concepts::Api auto api, alpaka::concepts::DeviceKind auto deviceTag)
template<alpaka::concepts::DeviceSpec T_DeviceSpec>
auto makeDeviceSelector (T_DeviceSpec deviceSpec)
 create an object to get access to devices
template<alpaka::concepts::DeviceSpec T_DeviceSpec>
auto makeDeviceSpec (T_DeviceSpec any)
 Create a device specification object.
template<typename deferEvaluation = void>
auto makeHostDevice ()
std::ostream & operator<< (std::ostream &s, concepts::FrameSpec auto const &d)
std::ostream & operator<< (std::ostream &s, concepts::ThreadSpec auto const &t)
std::ostream & operator<< (std::ostream &s, DeviceProperties const &p)
template<alpaka::concepts::Api T_Api, typename T_Type, alpaka::concepts::Vector T_Extents, alpaka::concepts::Alignment T_MemAlignment>
std::ostream & operator<< (std::ostream &s, SharedBuffer< T_Api, T_Type, T_Extents, T_MemAlignment > const &buff)
template<typename T_Queue, alpaka::concepts::QueueKind T_QueueKind>
 Queue (Handle< T_Queue > &&, T_QueueKind) -> Queue< Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Queue >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Queue >()))>, T_QueueKind >
template<alpaka::concepts::HasApi T_Any, typename T_Type, alpaka::concepts::Vector T_UserExtents, alpaka::concepts::Vector T_UserPitches>
 SharedBuffer (T_Any const &, T_Type *, T_UserExtents const &, T_UserPitches const &, std::invocable<> auto) -> SharedBuffer< ALPAKA_TYPEOF(getApi(std::declval< T_Any >())), T_Type, typename T_UserPitches::UniVec, Alignment<> >
template<alpaka::concepts::HasApi T_Any, typename T_Type, alpaka::concepts::Vector T_UserExtents, alpaka::concepts::Vector T_UserPitches, alpaka::concepts::Alignment T_MemAlignment>
 SharedBuffer (T_Any const &, T_Type *, T_UserExtents const &, T_UserPitches const &, std::invocable<> auto, T_MemAlignment const) -> SharedBuffer< ALPAKA_TYPEOF(getApi(std::declval< T_Any >())), T_Type, typename T_UserPitches::UniVec, T_MemAlignment >
std::string simplifyFunctionSignature (std::string const &deName)
 Simplify the C++ signature of a function.
constexpr auto supportedDevices (auto const api)
constexpr auto supportedExecutors (internal::concepts::DeviceHandle auto deviceHandle, auto const listOfExecutors)
template<alpaka::concepts::VectorOrScalar T_NumBlocks, alpaka::concepts::VectorOrScalar T_NumThreads>
 ThreadSpec (T_NumBlocks const &, T_NumThreads const &) -> ThreadSpec< alpaka::trait::getVec_t< T_NumBlocks >, alpaka::trait::getVec_t< T_NumThreads > >
template<alpaka::concepts::VectorOrScalar T_NumBlocks, alpaka::concepts::VectorOrScalar T_NumThreads, alpaka::concepts::Executor T_Executor>
 ThreadSpec (T_NumBlocks const &, T_NumThreads const &, T_Executor) -> ThreadSpec< alpaka::trait::getVec_t< T_NumBlocks >, alpaka::trait::getVec_t< T_NumThreads >, T_Executor >
void wait (alpaka::concepts::HasGet auto &handle)
 wait for all work to be finished
template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void concurrent (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::Executor auto const exec, alpaka::concepts::VectorOrScalar auto const &extents, auto &&fn, alpaka::concepts::IDataSource auto &&... inOut)
 Execute an n-nary function on each element of all input data.
template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void concurrent (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::VectorOrScalar auto const &extents, auto &&fn, alpaka::concepts::IDataSource auto &&... inOut)
 An available default executor will be selected automatically.
template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::is_convertible_v<T_DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out0)>> && std::conjunction_v< std::is_convertible<T_DataType, typename alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(outOther)>>...>)
void iota (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::Executor auto const exec, T_DataType const &initValue, alpaka::concepts::IMdSpan auto &&out0, alpaka::concepts::IMdSpan auto &&... outOther)
 Fill data with sequentially increasing index (iota value).
template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::is_convertible_v<T_DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out0)>> && std::conjunction_v< std::is_convertible<T_DataType, typename alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(outOther)>>...>)
void iota (Queue< T_Device, T_QueueKind > const &queue, T_DataType const &initValue, alpaka::concepts::IMdSpan auto &&out0, alpaka::concepts::IMdSpan auto &&... outOther)
 An available default executor will be selected automatically.
template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void reduce (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::Executor auto const exec, DataType const &neutralElement, alpaka::concepts::IMdSpan auto out, auto &&binaryReduceFn, auto &&in)
 accumulate the results into a scalar value.
template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void reduce (Queue< T_Device, T_QueueKind > const &queue, DataType const &neutralElement, alpaka::concepts::IMdSpan auto out, auto &&binaryReduceFn, alpaka::concepts::IDataSource auto &&in)
 An available default executor will be selected automatically.
void inclusiveScan (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &buffer, alpaka::concepts::IMdSpan auto &outputVec, alpaka::concepts::IDataSource auto const &inputVec)
 Perform an inclusive scan on the input data and write the result to the output data.
void inclusiveScan (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &outputVec, alpaka::concepts::IDataSource auto const &inputVec)
 Perform an inclusive scan on the input data and write the result to the output data.
void inclusiveScanInPlace (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &buffer, alpaka::concepts::IMdSpan auto &dataVec)
 Perform an inclusive scan on data in-place.
void inclusiveScanInPlace (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &dataVec)
 Perform an inclusive scan on data in-place.
void exclusiveScan (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &buffer, alpaka::concepts::IMdSpan auto &outputVec, alpaka::concepts::IDataSource auto const &inputVec)
 Perform an exclusive scan on the input data and write the result to the output data.
void exclusiveScan (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &outputVec, alpaka::concepts::IDataSource auto const &inputVec)
 Perform an exclusive scan on the input data and write the result to the output data.
void exclusiveScanInPlace (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &buffer, alpaka::concepts::IMdSpan auto &dataVec)
 Perform an exclusive scan on data in-place.
void exclusiveScanInPlace (auto const &queue, alpaka::concepts::Executor auto exec, alpaka::concepts::IMdSpan auto &dataVec)
 Perform an exclusive scan on data in-place.
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void transform (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::Executor auto const exec, alpaka::concepts::IMdSpan auto &&out, auto &&fn, alpaka::concepts::IDataSource auto &&... in)
 Transform the input data with the given function and write the result to the output data.
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void transform (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::IMdSpan auto &&out, auto &&fn, alpaka::concepts::IDataSource auto &&... in)
 An available default executor will be selected automatically.
template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void transformReduce (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::Executor auto const exec, DataType const &neutralElement, alpaka::concepts::IMdSpan auto out, auto &&binaryReduceFn, auto &&transformFn, alpaka::concepts::IDataSource auto &&... in)
 Transform the input data with the given function and accumulate the results into a scalar value.
template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void transformReduce (Queue< T_Device, T_QueueKind > const &queue, DataType const &neutralElement, alpaka::concepts::IMdSpan auto out, auto &&binaryReduceFn, auto &&transformFn, alpaka::concepts::IDataSource auto &&... in)
 An available default executor will be selected automatically.
Device allocations
template<typename T_Type>
auto alloc (concepts::Device auto const &device, alpaka::concepts::VectorOrScalar auto const &extents)
 Allocate memory on the given device.
template<typename T_Type>
auto allocUnified (concepts::Device auto const &device, alpaka::concepts::VectorOrScalar auto const &extents)
 Allocate memory on the given device with unified virtual memory.
template<typename T_Type, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto allocUnified (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::VectorOrScalar auto const &extents)
 Allocates unified memory on the device associated with the given queue.
template<typename T_Type>
auto allocMapped (concepts::Device auto const &device, alpaka::concepts::VectorOrScalar auto const &extents)
 Allocate pinned memory on the host which is mapped into the address space of the device.
template<typename T_Type, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto allocMapped (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::VectorOrScalar auto const &extents)
 Allocate pinned memory on the host which is mapped into the address space of the device.
auto allocLike (concepts::Device auto const &device, auto const &view)
 Allocate memory on the given device based on a view.
Query extents
decltype(auto) getExtents (auto &&any)
 Object extents.
decltype(auto) getExtents (alpaka::concepts::HasGet auto &&handle)
 Handle extents.
Query multi-dimensional pitches
decltype(auto) getPitches (auto &&any)
 Object pitches.
decltype(auto) getPitches (alpaka::concepts::HasGet auto &&handle)
 Handle pitches.
Query the name
std::convertible_to< std::string > auto getStaticName (auto const &any)
 Compile-time available name for a given object.
std::convertible_to< std::string > auto getStaticName (concepts::StaticNameHandle auto const &handle)
 Compile-time available name of an handle.
std::convertible_to< std::string > auto getName (auto &&any)
 Runtime name for a given object.
std::convertible_to< std::string > auto getName (concepts::NameHandle auto const &handle)
 Runtime name for a given handle.
Query raw pointer
decltype(auto) data (auto &&any)
 pointer to data of an object
decltype(auto) data (alpaka::concepts::HasGet auto &&handle)
 pointer to data of an handle
Host allocations
template<typename T_ValueType>
auto allocHost (alpaka::concepts::VectorOrScalar auto const &extents)
 Allocate host memory for a given element type and extents.
auto allocHostLike (auto const &view)
 Allocate host memory with the same value type and extents as an existing view.
Device selection utilities
constexpr auto getExecutorsList (auto const deviceSpec, auto const listOfExecutors)
 Resolve the list of executors supported for a device specification.
Memory modifiers
Attention
For input/output memory the caller should ensure that the memory is valid until the operation is completed not until the execution handle is given back because alpaka is not extending the life-time until the operation is finished.
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void memcpy (Queue< T_Device, T_QueueKind > const &queue, auto &&dest, auto const &source)
 copy data byte wise from one to another container
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void memcpy (Queue< T_Device, T_QueueKind > const &queue, auto &&dest, auto const &source, alpaka::concepts::VectorOrScalar auto const &extents)
 copy data byte wise from one to another container
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind, typename T_Storage, typename T>
void memcpy (Queue< T_Device, T_QueueKind > const &queue, onAcc::internal::GlobalDeviceMemoryWrapper< T_Storage, T > dest, auto &&source)
 copy data byte wise from a container or host pointer to global device memory
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind, typename T_Storage, typename T>
void memcpy (Queue< T_Device, T_QueueKind > const &queue, auto &&dest, onAcc::internal::GlobalDeviceMemoryWrapper< T_Storage, T > source)
 copy data byte wise from global device memory to a container or host pointer
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void memset (Queue< T_Device, T_QueueKind > const &queue, auto &&dest, uint8_t byteValue)
 fill memory byte wise
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void memset (Queue< T_Device, T_QueueKind > const &queue, auto &&dest, uint8_t byteValue, alpaka::concepts::VectorOrScalar auto const &extents)
 fill memory byte wise
template<typename T_Value, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::same_as<alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(dest)>, T_Value> && std::same_as<ALPAKA_TYPEOF(alpaka::internal::getApi(queue)), ALPAKA_TYPEOF(alpaka::internal::getApi(dest))>)
void fill (Queue< T_Device, T_QueueKind > const &queue, auto &&dest, T_Value elementValue)
 fill memory element wise
template<typename T_Value, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::same_as<alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(dest)>, T_Value> && std:: same_as<ALPAKA_TYPEOF(alpaka::internal::getApi(queue)), ALPAKA_TYPEOF(alpaka::internal::getApi(dest))>)
void fill (Queue< T_Device, T_QueueKind > const &queue, auto &&dest, T_Value elementValue, alpaka::concepts::VectorOrScalar auto const &extents)
 fill memory element wise
Deferred device allocations
template<typename T_Type, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto allocDeferred (Queue< T_Device, T_QueueKind > const &queue, alpaka::concepts::VectorOrScalar auto const &extents)
 allocate memory that is accessible after it is processed in the queue
template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto allocLikeDeferred (Queue< T_Device, T_QueueKind > const &queue, auto const &view)
 allocate memory that is accessible after it is processed in the queue

Variables

constexpr auto apis = std::make_tuple(api::host, api::cuda, api::hip, api::oneApi)
constexpr auto enabledApis = meta::filter([](auto api) constexpr { return isPlatformAvaiable(api); }, apis)
constexpr auto enabledDeviceSpecs
 list of enabled device specifications
template<typename T>
constexpr bool isFrameSpec_v = trait::IsFrameSpec<T>::value
template<typename T>
constexpr bool isThreadSpec_v = trait::IsThreadSpec<T>::value
constexpr int NO_CPUID = 0
constexpr int UNKNOWN_COMPILER = 1
constexpr int UNKNOWN_CPU = 0

Detailed Description

Functionality which is usable on the host CPU controller thread.

Typedef Documentation

◆ Handle

template<typename T>
using alpaka::onHost::Handle = std::shared_ptr<T>

Definition at line 30 of file Handle.hpp.

Function Documentation

◆ allBackends() [1/2]

template<alpaka::concepts::Api... T_Apis>
auto alpaka::onHost::allBackends ( std::tuple< T_Apis... > const & usedApis,
auto const listOfExecutors )
consteval

Generate the full set of backend dictionaries for a set of APIs.

The result contains a backend entry for each combination of supported device specification for the APIs and executors.

Parameters
usedApistuple of alpaka APIs to consider
listOfExecutorstuple of executor types
Returns
a tuple of backend dictionaries covering all APIs and executors

Definition at line 320 of file interface.hpp.

◆ allBackends() [2/2]

template<alpaka::concepts::DeviceSpec... T_DevicesSpecs>
auto alpaka::onHost::allBackends ( std::tuple< T_DevicesSpecs... > const & usedDeviceSpecs,
auto const & listOfExecutors )
consteval

Generate the full set of backend dictionaries for a set of device kinds.

The result contains a backend entry for each combination of supported device specification and executors.

Parameters
usedDeviceSpecstuple of alpaka device kinds
listOfExecutorstuple of executor types
Returns
a tuple of backend dictionaries covering all device kinds and executors

Definition at line 338 of file interface.hpp.

◆ alloc()

template<typename T_Type>
auto alpaka::onHost::alloc ( concepts::Device auto const & device,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

Allocate memory on the given device.

Template Parameters
T_Typetype of the data elements
Parameters
devicedevice handle
extentsnumber of elements for each dimension
Returns
memory owning view to the allocated memory

Definition at line 180 of file Device.hpp.

◆ allocDeferred()

template<typename T_Type, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto alpaka::onHost::allocDeferred ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

allocate memory that is accessible after it is processed in the queue

Deferred allocation means that the pointer in the returned buffer is valid after the function is returning. It is allowed to slice the buffer or use the encapsulated pointer for address calculations. In any cases the pointer is not allowed to be dereferenced before the memory allocation is processed in the queue. All tasks performing any memory access must be executed after the memory allocation is processed in the queue. This can be achieved by waiting on the queue or describing queue dependencies via waitFor(). The memory is allowed to be used in other queues too. To avoid that a view to the memory is still in use during the deallocation you can use

See also
addDestructorAction() and wait for a queue if it differs to the queue used for the allocation. The first access could have higher latency compared to alpaka::onHost::alloc() due to the initial setup of the caching allocator used by some APIs. But subsequent accesses should have lower latency.
Attention
It is allowed that the function is blocking the caller until the memory is created.
Template Parameters
T_Typetype of the data elements
Parameters
queuequeue handle
extentsnumber of elements for each dimension
Returns
Shared buffer to the allocated memory. The buffer will be freed after the last instance to the memory is destroyed. The deallocation is asynchronous performed in the queue which is used for the allocation.

Definition at line 430 of file Queue.hpp.

◆ allocHost()

template<typename T_ValueType>
auto alpaka::onHost::allocHost ( alpaka::concepts::VectorOrScalar auto const & extents)
inline

Allocate host memory for a given element type and extents.

The allocation is performed on the host controller device (api::host ans deviceKind::cpu). The returned view owns the allocated memory.

Template Parameters
T_ValueTypetype of the data elements
Parameters
extentsnumber of elements per dimension (vector or scalar)
Returns
a view owning the newly allocated memory

Definition at line 190 of file interface.hpp.

◆ allocHostLike()

auto alpaka::onHost::allocHostLike ( auto const & view)
inline

Allocate host memory with the same value type and extents as an existing view.

The content of the source view is not copied. The function deduces the element type and extents from view and creates a new shared buffer on the host controller device.

Parameters
viewa view (e.g. std::vector, std::array, or any compatible type)
Returns
a view owning the newly allocated memory

Definition at line 208 of file interface.hpp.

◆ allocLike()

auto alpaka::onHost::allocLike ( concepts::Device auto const & device,
auto const & view )
inline

Allocate memory on the given device based on a view.

Derives type and extents of the memory from the view. The content of the memory is NOT copied to the created allocated memory.

Parameters
devicedevice handle
[in]viewmemory where properties will be derived from
Returns
memory owning view to the allocated memory

Definition at line 281 of file Device.hpp.

◆ allocLikeDeferred()

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto alpaka::onHost::allocLikeDeferred ( Queue< T_Device, T_QueueKind > const & queue,
auto const & view )
inline

allocate memory that is accessible after it is processed in the queue

In any cases the pointer is not allowed to be dereferenced before the memory allocation is processed in the queue. All tasks performing any memory access must be executed after the memory allocation is processed in the queue. This can be achieved by waiting on the queue or describing queue dependencies via waitFor(). The memory is allowed to be used in other queues too. To avoid that a view to the memory is still in use during the deallocation you can use

See also
addDestructorAction() and wait for a queue if it differs to the queue used for the allocation. The first access could have higher latency compared to alpaka::onHost::alloc() due to the initial setup of the caching allocator used by some APIs. But subsequent accesses should have lower latency.
Attention
It is allowed that the function is blocking the caller until the memory is created.
Parameters
queuequeue handle
[in]viewother memory where the extents will be derived from
Returns
Shared buffer to the allocated memory. The buffer will be freed after the last instance to the memory is destroyed. The deallocation is asynchronous performed in the queue which is used for the allocation.

Definition at line 460 of file Queue.hpp.

◆ allocMapped() [1/2]

template<typename T_Type>
auto alpaka::onHost::allocMapped ( concepts::Device auto const & device,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

Allocate pinned memory on the host which is mapped into the address space of the device.

Mapped memory is located on the host and is transferred for each access via the PCIe/Nvlink bus. The performance on the device is mostly pure. Mapped memory should be used for host memory if you transfer memory between host and device via onHost::memcpy() because the transfer will be optimized for latency and performance.

Template Parameters
T_Typetype of the data elements
Parameters
devicedevice handle
extentsnumber of elements for each dimension

Definition at line 245 of file Device.hpp.

◆ allocMapped() [2/2]

template<typename T_Type, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto alpaka::onHost::allocMapped ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

Allocate pinned memory on the host which is mapped into the address space of the device.

Mapped memory is located on the host and is transferred for each access via the PCIe/Nvlink bus. The performance on the device is mostly pure. Mapped memory should be used for host memory if you transfer memory between host and device via onHost::memcpy() because the transfer will be optimized for latency and performance.

Template Parameters
T_Typetype of the data elements
Parameters
queuequeue handle
extentsnumber of elements for each dimension

Definition at line 264 of file Device.hpp.

◆ allocUnified() [1/2]

template<typename T_Type>
auto alpaka::onHost::allocUnified ( concepts::Device auto const & device,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

Allocate memory on the given device with unified virtual memory.

This memory can be accessed from all devices with the same Api and device kind. Depending on the backend e.g. OneApi memory can be accessed by other device kind devices if they are using the same native context. It is not allowed to access the data on two devices at the same time, this must be avoided by explicit synchronizations. Unified memory follows the rules of UVM memory of the device backend e.g. CUDA, HIP, ...

Template Parameters
T_Typetype of the data elements
Parameters
devicedevice handle
extentsnumber of elements for each dimension
Returns
Managed view to the allocated memory

Definition at line 201 of file Device.hpp.

◆ allocUnified() [2/2]

template<typename T_Type, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
auto alpaka::onHost::allocUnified ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

Allocates unified memory on the device associated with the given queue.

This memory can be accessed from all devices with the same Api and device kind. Depending on the backend e.g. OneApi memory can be accessed by other device kind devices if they are using the same native context. It is not allowed to access the data on two devices at the same time, this must be avoided by explicit synchronizations. Unified memory follows the rules of UVM memory of the device backend e.g. CUDA, HIP, ...

Template Parameters
T_Typetype of the data elements
Parameters
queuequeue handle
extentsnumber of elements for each dimension

Definition at line 223 of file Device.hpp.

◆ concurrent() [1/2]

template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::concurrent ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::Executor auto const exec,
alpaka::concepts::VectorOrScalar auto const & extents,
auto && fn,
alpaka::concepts::IDataSource auto &&... inOut )
inline

Execute an n-nary function on each element of all input data.

Concurrent is quite equal to a for-each algorithm with the difference that the functor is allowed to write to any argument. So it allows to implement a transform with a free number of output arguments.

Parameters
queueThe queue to execute the transformation.
execThe executor to use for the kernel execution.
extentsmulti dimensional or scalar number of elements
fnThe function to apply to each element of the input data. The functor should support
See also
SimdPtr and therefore can be used for stencil evaluations. It is not required to wrapp the functor with
StencilFunc. If a stencil lookup is executed you should take care to not read outside of valid memory ranges by using sub-views to your input/output data. Optionally, a function can have an accelerator as its first argument.
Parameters
inOutThe input/output data, all data is passed to fn.

examples for a unary add one functor:

struct Foo {
constexpr auto operator()(onAcc::concepts::Acc auto const&, concepts::SimdPtr auto const& a) const {
a = a.load() + 1;
}
};
struct Bar {
constexpr auto operator()(concepts::SimdPtr auto const& a) const {
a = a.load() + 1;
}
};
Concept to check if a type is a SIMD pointer.
Definition SimdPtr.hpp:41
Concept to check if a type is an accelerator.
Definition Acc.hpp:119

Definition at line 45 of file concurrent.hpp.

◆ concurrent() [2/2]

template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::concurrent ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::VectorOrScalar auto const & extents,
auto && fn,
alpaka::concepts::IDataSource auto &&... inOut )
inline

An available default executor will be selected automatically.

The default executor is an executor with most parallelism/performance.

Definition at line 70 of file concurrent.hpp.

◆ cpuid()

auto alpaka::onHost::cpuid ( std::uint32_t ,
std::uint32_t ,
std::uint32_t ex[4] ) -> void
inline

Definition at line 71 of file sysInfo.hpp.

◆ createBackendList()

auto alpaka::onHost::createBackendList ( auto const devSpecList,
auto const listOfExecutors )
constexpr

Create the complete backend list for all device specifications and executors.

Parameters
devSpecListtuple of device specifications
listOfExecutorstuple of executor types
Returns
a tuple of backend objects, for all executors

Definition at line 302 of file interface.hpp.

◆ createBackendsFor()

auto alpaka::onHost::createBackendsFor ( auto const deviceSpec,
auto const listOfExecutors )
constexpr

Build a tuple of backends for a single device specification.

A backend is the combination of a device specification and an executor. Query its executor via alpaka::getExecutor(backend) and recover its device specification via alpaka::onHost::DeviceSpec{backend}.

Parameters
deviceSpecthe device specification to associate with the executors
listOfExecutorstuple of executor types
Returns
a tuple of backend objects, one per executor

Definition at line 282 of file interface.hpp.

◆ data() [1/2]

decltype(auto) alpaka::onHost::data ( alpaka::concepts::HasGet auto && handle)
inline

pointer to data of an handle

For multi-dimensional data the data is not required to be continuous.

Parameters
handlehandle providing data access (e.g. view)
Returns
raw pointer to the underlying data

Definition at line 169 of file interface.hpp.

◆ data() [2/2]

decltype(auto) alpaka::onHost::data ( auto && any)
inline

pointer to data of an object

For multi-dimensional data the data is not required to be continuous.

Parameters
anyobject providing data access (e.g. std::vector)
Returns
raw pointer to the underlying data (equivalent to std::data)

Definition at line 157 of file interface.hpp.

◆ defaultExecutor()

auto alpaka::onHost::defaultExecutor ( internal::concepts::DeviceHandle auto deviceHandle)
constexpr

Select a default executor for the given device.

Picks the first executor (with the most parallelism) supported by the device out of all known executors.

Definition at line 169 of file trait.hpp.

◆ demangledName() [1/2]

template<typename T>
auto alpaka::onHost::demangledName ( )
constexpr

Definition at line 49 of file demangledName.hpp.

◆ demangledName() [2/2]

template<typename T>
auto alpaka::onHost::demangledName ( T const & )
constexpr

Definition at line 55 of file demangledName.hpp.

◆ Device()

template<typename T_Device>
alpaka::onHost::Device ( Handle< T_Device > && ) -> Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Device >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Device >()))>

◆ DeviceSelector()

template<alpaka::concepts::DeviceSpec T_DeviceSpec>
alpaka::onHost::DeviceSelector ( T_DeviceSpec const & deviceSpec) -> DeviceSelector< ALPAKA_TYPEOF(getApi(deviceSpec)), ALPAKA_TYPEOF(getDeviceKind(deviceSpec))>

◆ DeviceSpec()

template<alpaka::concepts::DeviceSpec T_DeviceSpec>
alpaka::onHost::DeviceSpec ( T_DeviceSpec const & deviceSpec) -> DeviceSpec< ALPAKA_TYPEOF(getApi(deviceSpec)), ALPAKA_TYPEOF(getDeviceKind(deviceSpec))>

◆ EmbedTypeIntoSignature()

template<typename T>
auto alpaka::onHost::EmbedTypeIntoSignature ( )
constexpr

Definition at line 26 of file demangledName.hpp.

◆ Event()

template<typename T_Event>
alpaka::onHost::Event ( Handle< T_Event > && ) -> Event< Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Event >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Event >()))> >

◆ exclusiveScan() [1/2]

void alpaka::onHost::exclusiveScan ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & buffer,
alpaka::concepts::IMdSpan auto & outputVec,
alpaka::concepts::IDataSource auto const & inputVec )

Perform an exclusive scan on the input data and write the result to the output data.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
outputVecThe output data. To perform an in-place scan, use the overload with only one data object.
inputVecThe input data. Can be const.

Definition at line 140 of file scan.hpp.

◆ exclusiveScan() [2/2]

void alpaka::onHost::exclusiveScan ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & outputVec,
alpaka::concepts::IDataSource auto const & inputVec )

Perform an exclusive scan on the input data and write the result to the output data.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
outputVecThe output data. To perform an in-place scan, use the overload with only one data object.
inputVecThe input data. Can be const.

Definition at line 162 of file scan.hpp.

◆ exclusiveScanInPlace() [1/2]

void alpaka::onHost::exclusiveScanInPlace ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & buffer,
alpaka::concepts::IMdSpan auto & dataVec )

Perform an exclusive scan on data in-place.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
dataVecThe vector to scan, will be overwritten with the result.

Definition at line 191 of file scan.hpp.

◆ exclusiveScanInPlace() [2/2]

void alpaka::onHost::exclusiveScanInPlace ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & dataVec )

Perform an exclusive scan on data in-place.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
dataVecThe vector to scan, will be overwritten with the result.

Definition at line 206 of file scan.hpp.

◆ executeForEach()

template<template< typename... > class T_TupleLike, typename... T_Entries>
int alpaka::onHost::executeForEach ( auto && callable,
T_TupleLike< T_Entries... > const & tuple )
inline

!

Execute a callable for each tuple entry.

Attention
: Execution is short-circuited and stops after the first error.
Parameters
callableCallable that can be invoked with each tuple entry and returns an execution status. A return value of zero (EXIT_SUCCESS) indicates success; any non-zero value indicates a failure.
tupleTuple like list of entries used to invoke the callable.
Returns
The disjunction of all returned error codes. If false, the result is EXIT_SUCCESS; otherwise, at least a failure occurred.

Definition at line 28 of file executeForEach.hpp.

◆ executeForEachIfHasDevice()

template<alpaka::concepts::DeviceSpec... T_DeviceSpecs>
int alpaka::onHost::executeForEachIfHasDevice ( auto && callable,
std::tuple< T_DeviceSpecs... > const & tupleOfDeviceSpecs )
inline

!

execute a callable for each device specification if there is a device available

The function contains a runtime check if at least one device is available, if there is no device the callable will not be executed. Not executed combinations will return EXIT_SUCCESS.

Attention
: Execution is short-circuited and stops after the first error.
Parameters
callableCallable that can be invoked with device specification and returns an execution status. A return value of zero (EXIT_SUCCESS) indicates success; any non-zero value indicates a failure.
tupleTuple like list of device specifications used to invoke the callable. otherwise, at least one failure occurred.
Returns
The disjunction of all returned error codes. If false, the result is EXIT_SUCCESS; otherwise, at least a failure occurred.

Definition at line 61 of file executeForEach.hpp.

◆ fill() [1/2]

template<typename T_Value, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::same_as<alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(dest)>, T_Value> && std::same_as<ALPAKA_TYPEOF(alpaka::internal::getApi(queue)), ALPAKA_TYPEOF(alpaka::internal::getApi(dest))>)
void alpaka::onHost::fill ( Queue< T_Device, T_QueueKind > const & queue,
auto && dest,
T_Value elementValue )
inline

fill memory element wise

Parameters
[in,out]destcan be a container/view where the data should be written to The caller should ensure that the memory is valid until the operation is completed not until the execution handle is given back because alpaka is not extending the life-time until the operation is finished.
elementValuevalue to be written to each element

Definition at line 366 of file Queue.hpp.

◆ fill() [2/2]

template<typename T_Value, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::same_as<alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(dest)>, T_Value> && std:: same_as<ALPAKA_TYPEOF(alpaka::internal::getApi(queue)), ALPAKA_TYPEOF(alpaka::internal::getApi(dest))>)
void alpaka::onHost::fill ( Queue< T_Device, T_QueueKind > const & queue,
auto && dest,
T_Value elementValue,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

fill memory element wise

Parameters
[in,out]destcan be a container/view where the data should be written to The caller should ensure that the memory is valid until the operation is completed not until the execution handle is given back because alpaka is not extending the life-time until the operation is finished.
elementValuevalue to be written to each element
extentsM-dimensional data extents in elements, can be smaller than the container capacity

Definition at line 384 of file Queue.hpp.

◆ FrameSpec() [1/2]

alpaka::onHost::FrameSpec ( T_NumFrames const & ,
T_FrameExtents const &  ) -> FrameSpec< alpaka::trait::getVec_t< T_NumFrames >, alpaka::trait::getVec_t< T_FrameExtents >, alpaka::exec::AnyExecutor >

◆ FrameSpec() [2/2]

alpaka::onHost::FrameSpec ( T_NumFrames const & ,
T_FrameExtents const & ,
T_Executor  ) -> FrameSpec< alpaka::trait::getVec_t< T_NumFrames >, alpaka::trait::getVec_t< T_FrameExtents >, T_Executor >

◆ getCpuName()

auto alpaka::onHost::getCpuName ( ) -> std::string
inline
Returns
The name of the CPU the code is running on.

Definition at line 78 of file sysInfo.hpp.

◆ getDeviceSpecsFor() [1/2]

auto alpaka::onHost::getDeviceSpecsFor ( auto const api)
constexpr

Create a tuple of device specifications for a single API.

Each device specifications combines the supplied API with one of the supported device types for that API.

Parameters
apia single alpaka API (e.g. api::cuda, api::hip)
Returns
a tuple containing all device specifications for the given API

Definition at line 254 of file interface.hpp.

◆ getDeviceSpecsFor() [2/2]

template<alpaka::concepts::Api... T_Apis>
auto alpaka::onHost::getDeviceSpecsFor ( std::tuple< T_Apis... > const apiList)
constexpr

Create a flattened tuple of device specification objects for a list of APIs.

Parameters
apiLista std::tuple containing the APIs
Returns
a tuple containing all device specifications for the given API

Definition at line 267 of file interface.hpp.

◆ getDynSharedMemBytes()

template<onHost::concepts::ThreadSpec T_ThreadSpec, alpaka::concepts::KernelBundle T_KernelBundle>
uint32_t alpaka::onHost::getDynSharedMemBytes ( T_ThreadSpec spec,
T_KernelBundle const & kernelBundle )
constexpr

Definition at line 185 of file trait.hpp.

◆ getExecutorsList()

auto alpaka::onHost::getExecutorsList ( auto const deviceSpec,
auto const listOfExecutors )
constexpr

Resolve the list of executors supported for a device specification.

This helper is used internally to build backend dictionaries.

Parameters
deviceSpecdevice specification to be used
listOfExecutorstuple of executor types to be filtered
Returns
a tuple containing the supported executor types

Definition at line 229 of file interface.hpp.

◆ getExtents() [1/2]

decltype(auto) alpaka::onHost::getExtents ( alpaka::concepts::HasGet auto && handle)
inline

Handle extents.

Parameters
handlecan be a view, a data
Returns
the extents of the object

Definition at line 35 of file interface.hpp.

◆ getExtents() [2/2]

decltype(auto) alpaka::onHost::getExtents ( auto && any)
inline

Object extents.

Parameters
anycan be a std::vector, std::array, ...
Returns
the extents of the object

Definition at line 25 of file interface.hpp.

◆ getFrameSpec()

template<typename T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
concepts::FrameSpec auto alpaka::onHost::getFrameSpec ( Device< T_Api, T_DeviceKind > const & device,
alpaka::concepts::Executor auto executor,
alpaka::concepts::VectorOrScalar auto const & extents )
inlineconstexpr

Provides a frame specification to operate on a given index range.

Parameters
extentssize of the index range
Returns
frame specification

Definition at line 330 of file Device.hpp.

◆ getFreeGlobalMemBytes()

auto alpaka::onHost::getFreeGlobalMemBytes ( ) -> std::size_t
inline
Returns
The free number of bytes of global memory.
Exceptions
std::logic_errorif not implemented on the system and std::runtime_error on other errors.

Definition at line 210 of file sysInfo.hpp.

◆ getGlobalMemCapacityBytes()

auto alpaka::onHost::getGlobalMemCapacityBytes ( ) -> std::size_t
inline
Returns
The total number of bytes of global memory. Adapted from David Robert Nadeau: http://nadeausoftware.com/articles/2012/09/c_c_tip_how_get_physical_memory_size_system

Definition at line 147 of file sysInfo.hpp.

◆ getMaxThreadsPerBlock()

uint32_t alpaka::onHost::getMaxThreadsPerBlock ( T_Api api,
T_DeviceKind deviceKind,
T_Exec exec )
consteval

A safe(ish) compile time lower bound on max threads per block for a given combination of API, device kind and executor.

Returns the minimum number of threads-per-block guaranteed to be supported across all devices of the executor's backend family. The actual device may support more; this is a conservative bound for compile-time clamping of block sizes.

Attention
Due to lmem, shared memory or register usage the actual limit could be lower. In this case the kernel launched using this compile time max will fail at runtime with invalid kernel configuration. We can not avoid this at compile time.

Definition at line 210 of file trait.hpp.

◆ getName() [1/2]

std::convertible_to< std::string > auto alpaka::onHost::getName ( auto && any)
inline

Runtime name for a given object.

Parameters
anyobject whose name shall be queried
Returns
a std::string-compatible value holding the name

Definition at line 106 of file interface.hpp.

◆ getName() [2/2]

std::convertible_to< std::string > auto alpaka::onHost::getName ( concepts::NameHandle auto const & handle)
inline

Runtime name for a given handle.

Parameters
handleobject whose name shall be queried
Returns
a std::string-compatible value holding the name

Definition at line 116 of file interface.hpp.

◆ getNativeHandle()

auto alpaka::onHost::getNativeHandle ( auto const & handle)
inline

Get the native handle of an handle.

The native handle can be passed to the underlying backend API (e.g. CUDA, HIP, OpenMP) for low-level operations.

Parameters
handleobject exposing a native handle
Returns
the native handle returned by the backend-specific implementation

Definition at line 131 of file interface.hpp.

◆ getPageSize()

size_t alpaka::onHost::getPageSize ( )
inline
Returns
Pagesize in bytes used by the system.

Definition at line 125 of file sysInfo.hpp.

◆ getPitches() [1/2]

decltype(auto) alpaka::onHost::getPitches ( alpaka::concepts::HasGet auto && handle)
inline

Handle pitches.

Parameters
handlecan be a view, a data
Returns
Multidimensional value with number of bytes to jump to the next value within the corresponding dimension. The inner-most dimension (x) is sizeof(value_type), the next dimension (y) is the byte-stride of a full row including padding, and so on for higher dimensions. Given an ND index, the element-wise product with the pitches summed (dot product) yields the byte offset from the start of the buffer to that data element.

Definition at line 70 of file interface.hpp.

◆ getPitches() [2/2]

decltype(auto) alpaka::onHost::getPitches ( auto && any)
inline

Object pitches.

Parameters
anycan be a std::vector, std::array, ...
Returns
Multidimensional value with number of bytes to jump to the next value within the corresponding dimension. The inner-most dimension (x) is sizeof(value_type), the next dimension (y) is the byte-stride of a full row including padding, and so on for higher dimensions. Given an ND index, the element-wise product with the pitches summed (dot product) yields the byte offset from the start of the buffer to that data element.

Definition at line 55 of file interface.hpp.

◆ getScanBufferSize()

template<typename T_Data>
auto alpaka::onHost::getScanBufferSize ( alpaka::concepts::VectorOrScalar auto const & extents)

For a scan of some size, this function returns the necessary buffer size in bytes.

When multiple scans of the same extents are needed (for example in a loop), this function can be used to only allocate an intermediate buffer once, removing alloc/free overhead. For unique scan calls, the buffer can be omitted in the scan call, in which case it will be allocated and freed on the fly.

Template Parameters
T_DataThe type of the data to be scanned.
Parameters
extentsThe extents of the scan.
Returns
The size of the buffer to allocate in number of bytes.

Definition at line 27 of file scan.hpp.

◆ getSimdFrameSpec()

template<typename T_DataType, typename T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
concepts::FrameSpec auto alpaka::onHost::getSimdFrameSpec ( Device< T_Api, T_DeviceKind > const & device,
alpaka::concepts::Executor auto executor,
alpaka::concepts::VectorOrScalar auto const & extents )
inlineconstexpr

Provides a frame specification to operate on a given index range.

The frame specification will be optimized for SIMD executions in the highest dimension for a flat non-hierarchical execution via onAcc::worker::threadsInGrid. Do not use this functions for kernel using hierarchical thread parallelism, in many cases the frame specification depends on the outer parallelism in the kernel.

Template Parameters
T_DataTypethe data type for which you would like to SIMD optimize
Parameters
extentsnumber of elements for each dimension of the type T_DataType
Returns
frame specification

Definition at line 356 of file Device.hpp.

◆ getStaticName() [1/2]

std::convertible_to< std::string > auto alpaka::onHost::getStaticName ( auto const & any)
inline

Compile-time available name for a given object.

Parameters
anyobject whose name shall be queried
Returns
a std::string-compatible value holding the static name

Definition at line 86 of file interface.hpp.

◆ getStaticName() [2/2]

std::convertible_to< std::string > auto alpaka::onHost::getStaticName ( concepts::StaticNameHandle auto const & handle)
inline

Compile-time available name of an handle.

Parameters
handleobject whose name shall be queried
Returns
a std::string-compatible value holding the static name

Definition at line 96 of file interface.hpp.

◆ hasUserDefinedDynSharedMemBytes()

template<onHost::concepts::ThreadSpec T_ThreadSpec, alpaka::concepts::KernelBundle T_KernelBundle>
bool alpaka::onHost::hasUserDefinedDynSharedMemBytes ( T_ThreadSpec spec,
T_KernelBundle const & kernelBundle )
consteval

Definition at line 191 of file trait.hpp.

◆ inclusiveScan() [1/2]

void alpaka::onHost::inclusiveScan ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & buffer,
alpaka::concepts::IMdSpan auto & outputVec,
alpaka::concepts::IDataSource auto const & inputVec )

Perform an inclusive scan on the input data and write the result to the output data.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
outputVecThe output data. To perform an in-place scan, use the overload with only one data object.
inputVecThe input data. Can be const.

Definition at line 45 of file scan.hpp.

◆ inclusiveScan() [2/2]

void alpaka::onHost::inclusiveScan ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & outputVec,
alpaka::concepts::IDataSource auto const & inputVec )

Perform an inclusive scan on the input data and write the result to the output data.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
outputVecThe output data. To perform an in-place scan, use the overload with only one data object.
inputVecThe input data. Can be const.

Definition at line 67 of file scan.hpp.

◆ inclusiveScanInPlace() [1/2]

void alpaka::onHost::inclusiveScanInPlace ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & buffer,
alpaka::concepts::IMdSpan auto & dataVec )

Perform an inclusive scan on data in-place.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
dataVecThe vector to scan, will be overwritten with the result.

Definition at line 96 of file scan.hpp.

◆ inclusiveScanInPlace() [2/2]

void alpaka::onHost::inclusiveScanInPlace ( auto const & queue,
alpaka::concepts::Executor auto exec,
alpaka::concepts::IMdSpan auto & dataVec )

Perform an inclusive scan on data in-place.

Parameters
queueThe queue to enqueue to.
execThe executor to run with.
buffer(optional) The internally used buffer. Use the scanBufferSize() function to check how big the buffer needs to be. If omitted, it will be allocated and destructed on the fly. If you call this method repeatedly, it is recommended to reuse the buffer whenever possible, or to provide a buffer allocated with onHost::allocDeferred() to reduce the overhead of allocating and deallocating the buffer on each call.
dataVecThe vector to scan, will be overwritten with the result.

Definition at line 111 of file scan.hpp.

◆ iota() [1/2]

template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::is_convertible_v<T_DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out0)>> && std::conjunction_v< std::is_convertible<T_DataType, typename alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(outOther)>>...>)
void alpaka::onHost::iota ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::Executor auto const exec,
T_DataType const & initValue,
alpaka::concepts::IMdSpan auto && out0,
alpaka::concepts::IMdSpan auto &&... outOther )
inline

Fill data with sequentially increasing index (iota value).

For multidimensional memory, the iota value is increased fastest in the last dimension.

Template Parameters
T_DataTypeIota type which is used. Type must be convertible to the value type of the output data. Only fundamental types are allowed.
Parameters
queueThe queue to execute the algorithm.
execThe executor to use for the kernel execution.
initValueIndex of the first element.
out0Output data to set the iota value. Any kind of alpaka View/MdSpan is supported. The product of the extents must fit into the precision of the index_type.
outOtherAdditional output data to set the iota value. The extents must be at least as large as out0. Any kind of alpaka View/MdSpan is supported.

Definition at line 31 of file iota.hpp.

◆ iota() [2/2]

template<typename T_DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires ( std::is_convertible_v<T_DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out0)>> && std::conjunction_v< std::is_convertible<T_DataType, typename alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(outOther)>>...>)
void alpaka::onHost::iota ( Queue< T_Device, T_QueueKind > const & queue,
T_DataType const & initValue,
alpaka::concepts::IMdSpan auto && out0,
alpaka::concepts::IMdSpan auto &&... outOther )
inline

An available default executor will be selected automatically.

The default executor is the executor with the most parallelism/performance.

Definition at line 68 of file iota.hpp.

◆ isDataAccessible() [1/2]

bool alpaka::onHost::isDataAccessible ( concepts::Device auto const & device,
alpaka::concepts::IView auto const & view )
inline

Check if the given view is accessible on the given device.

Parameters
devicedevice handle
viewmemory where properties will be derived from
Returns
true if the view is accessible on the device, false otherwise. alpaka can not detect all memory access types therefore the result can be false even if the memory is accessible because the view was allocated with a UVM allocator.

Definition at line 297 of file Device.hpp.

◆ isDataAccessible() [2/2]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
bool alpaka::onHost::isDataAccessible ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::IView auto const & view )
inline

Check if the given view is accessible on the device of the given queue.

Parameters
queuequeue handle

Definition at line 313 of file Device.hpp.

◆ isExecutorSupportedBy()

bool alpaka::onHost::isExecutorSupportedBy ( auto executor,
internal::concepts::DeviceHandle auto const & deviceHandle )
consteval

Definition at line 150 of file trait.hpp.

◆ isPlatformAvaiable()

bool alpaka::onHost::isPlatformAvaiable ( alpaka::concepts::Api auto api)
consteval

Definition at line 145 of file trait.hpp.

◆ make_sharedSingleton()

template<typename T_Object, typename... T_Args>
auto alpaka::onHost::make_sharedSingleton ( T_Args &&... args)
inline

Definition at line 14 of file Handle.hpp.

◆ makeAcc()

auto alpaka::onHost::makeAcc ( alpaka::onHost::concepts::ThreadSpec auto const & threadSpec,
uint32_t numaIdx,
bool setThreadAffinity )
inline

Definition at line 92 of file Serial.hpp.

◆ makeAccessibleOnAcc()

decltype(auto) alpaka::onHost::makeAccessibleOnAcc ( auto && any)
inline

Provides an instance of an object which can be used within the compute kernel.

Returns
compute kernel compatible object if MakeAccessibleOnAcc is specialized else the identity

Definition at line 45 of file KernelBundle.hpp.

◆ makeDeviceSelector() [1/2]

auto alpaka::onHost::makeDeviceSelector ( alpaka::concepts::Api auto api,
alpaka::concepts::DeviceKind auto deviceTag )
inline

Definition at line 83 of file DeviceSelector.hpp.

◆ makeDeviceSelector() [2/2]

template<alpaka::concepts::DeviceSpec T_DeviceSpec>
auto alpaka::onHost::makeDeviceSelector ( T_DeviceSpec deviceSpec)
inline

create an object to get access to devices

Definition at line 78 of file DeviceSelector.hpp.

◆ makeDeviceSpec()

template<alpaka::concepts::DeviceSpec T_DeviceSpec>
auto alpaka::onHost::makeDeviceSpec ( T_DeviceSpec any)
inline

Create a device specification object.

Parameters
anyAny device specification description providing an api and device kind.

Definition at line 88 of file DeviceSpec.hpp.

◆ makeHostDevice()

template<typename deferEvaluation = void>
auto alpaka::onHost::makeHostDevice ( )
inline

Definition at line 89 of file DeviceSelector.hpp.

◆ memcpy() [1/4]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::memcpy ( Queue< T_Device, T_QueueKind > const & queue,
auto && dest,
auto const & source )
inline

copy data byte wise from one to another container

Parameters
queuethe copy will be executed after all previous work in this queue is finished
[in,out]destcan be a container/view where the data should be written to
[in]sourcecan be a container/view from which the data will be copied

Definition at line 257 of file Queue.hpp.

◆ memcpy() [2/4]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::memcpy ( Queue< T_Device, T_QueueKind > const & queue,
auto && dest,
auto const & source,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

copy data byte wise from one to another container

Parameters
queuethe copy will be executed after all previous work in this queue is finished
[in,out]destcan be a container/view where the data should be written to
[in]sourcecan be a container/view from which the data will be copied
extentsM-dimensional data extents in elements, can be smaller than the container capacity

Definition at line 270 of file Queue.hpp.

◆ memcpy() [3/4]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind, typename T_Storage, typename T>
void alpaka::onHost::memcpy ( Queue< T_Device, T_QueueKind > const & queue,
auto && dest,
onAcc::internal::GlobalDeviceMemoryWrapper< T_Storage, T > source )
inline

copy data byte wise from global device memory to a container or host pointer

Parameters
queuethe copy will be executed after all previous work in this queue is finished
[in,out]destcan be a container/view or host accessible pointer the data should be written to
[in]sourcemust be device global memory on the device of the queue from which the data will be copied

Definition at line 309 of file Queue.hpp.

◆ memcpy() [4/4]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind, typename T_Storage, typename T>
void alpaka::onHost::memcpy ( Queue< T_Device, T_QueueKind > const & queue,
onAcc::internal::GlobalDeviceMemoryWrapper< T_Storage, T > dest,
auto && source )
inline

copy data byte wise from a container or host pointer to global device memory

Parameters
queuethe copy will be executed after all previous work in this queue is finished
[in,out]destmust be device global memory on the device of the queue the data should be written to
[in]sourcecan be a container/view or host accessible pointer from which the data will be copied

Definition at line 291 of file Queue.hpp.

◆ memset() [1/2]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::memset ( Queue< T_Device, T_QueueKind > const & queue,
auto && dest,
uint8_t byteValue )
inline

fill memory byte wise

Parameters
[in,out]destcan be a container/view where the data should be written to The caller should ensure that the memory is valid until the operation is completed not until the execution handle is given back because alpaka is not extending the life-time until the operation is finished.
byteValuevalue to be written to each byte

Definition at line 329 of file Queue.hpp.

◆ memset() [2/2]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::memset ( Queue< T_Device, T_QueueKind > const & queue,
auto && dest,
uint8_t byteValue,
alpaka::concepts::VectorOrScalar auto const & extents )
inline

fill memory byte wise

Parameters
[in,out]destcan be a container/view where the data should be written to The caller should ensure that the memory is valid until the operation is completed not until the execution handle is given back because alpaka is not extending the life-time until the operation is finished.
byteValuevalue to be written to each byte
extentsM-dimensional data extents in elements, can be smaller than the container capacity

Definition at line 344 of file Queue.hpp.

◆ operator<<() [1/4]

std::ostream & alpaka::onHost::operator<< ( std::ostream & s,
concepts::FrameSpec auto const & d )

Definition at line 143 of file FrameSpec.hpp.

◆ operator<<() [2/4]

std::ostream & alpaka::onHost::operator<< ( std::ostream & s,
concepts::ThreadSpec auto const & t )

Definition at line 121 of file ThreadSpec.hpp.

◆ operator<<() [3/4]

std::ostream & alpaka::onHost::operator<< ( std::ostream & s,
DeviceProperties const & p )
inline

Definition at line 113 of file DeviceProperties.hpp.

◆ operator<<() [4/4]

template<alpaka::concepts::Api T_Api, typename T_Type, alpaka::concepts::Vector T_Extents, alpaka::concepts::Alignment T_MemAlignment>
std::ostream & alpaka::onHost::operator<< ( std::ostream & s,
SharedBuffer< T_Api, T_Type, T_Extents, T_MemAlignment > const & buff )

Definition at line 330 of file SharedBuffer.hpp.

◆ Queue()

template<typename T_Queue, alpaka::concepts::QueueKind T_QueueKind>
alpaka::onHost::Queue ( Handle< T_Queue > && ,
T_QueueKind  ) -> Queue< Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Queue >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Queue >()))>, T_QueueKind >

◆ reduce() [1/2]

template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void alpaka::onHost::reduce ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::Executor auto const exec,
DataType const & neutralElement,
alpaka::concepts::IMdSpan auto out,
auto && binaryReduceFn,
auto && in )
inline

accumulate the results into a scalar value.

Parameters
queueThe queue to execute the transformation.
execThe executor to use for the kernel execution.
neutralElementThe neutral element in respect to binaryReduceFn.
outMdSpan for the result. The value_type must be equal to neutralElement and the result of the binary reduce functor type. The result is written to the first element of the output data.
binaryReduceFnReduce binary functor, the functor operation must be transitive and commutative. The atomic operation atomic::alpakaAtomicInvoke(ReduceFnType, onAcc::concepts::Acc, auto* destination,auto source) must be overloaded. The functor execution order is not specified. The functor should support Simd packages, if not you can enforce the element wise execution by wrapping into ScalarFunc.
inThe input data which should be reduced.

Definition at line 29 of file reduce.hpp.

◆ reduce() [2/2]

template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void alpaka::onHost::reduce ( Queue< T_Device, T_QueueKind > const & queue,
DataType const & neutralElement,
alpaka::concepts::IMdSpan auto out,
auto && binaryReduceFn,
alpaka::concepts::IDataSource auto && in )
inline

An available default executor will be selected automatically.

The default executor is an executor with most parallelism/performance.

Definition at line 64 of file reduce.hpp.

◆ SharedBuffer() [1/2]

template<alpaka::concepts::HasApi T_Any, typename T_Type, alpaka::concepts::Vector T_UserExtents, alpaka::concepts::Vector T_UserPitches>
alpaka::onHost::SharedBuffer ( T_Any const & ,
T_Type * ,
T_UserExtents const & ,
T_UserPitches const & ,
std::invocable<> auto ) -> SharedBuffer< ALPAKA_TYPEOF(getApi(std::declval< T_Any >())), T_Type, typename T_UserPitches::UniVec, Alignment<> >

◆ SharedBuffer() [2/2]

template<alpaka::concepts::HasApi T_Any, typename T_Type, alpaka::concepts::Vector T_UserExtents, alpaka::concepts::Vector T_UserPitches, alpaka::concepts::Alignment T_MemAlignment>
alpaka::onHost::SharedBuffer ( T_Any const & ,
T_Type * ,
T_UserExtents const & ,
T_UserPitches const & ,
std::invocable<> auto,
T_MemAlignment const  ) -> SharedBuffer< ALPAKA_TYPEOF(getApi(std::declval< T_Any >())), T_Type, typename T_UserPitches::UniVec, T_MemAlignment >

◆ simplifyFunctionSignature()

std::string alpaka::onHost::simplifyFunctionSignature ( std::string const & deName)
inline

Simplify the C++ signature of a function.

Template parameters will be left out and the alpaka namespace will be removed.

Definition at line 64 of file demangledName.hpp.

◆ supportedDevices()

auto alpaka::onHost::supportedDevices ( auto const api)
constexpr

Definition at line 174 of file trait.hpp.

◆ supportedExecutors()

auto alpaka::onHost::supportedExecutors ( internal::concepts::DeviceHandle auto deviceHandle,
auto const listOfExecutors )
constexpr

Definition at line 155 of file trait.hpp.

◆ ThreadSpec() [1/2]

alpaka::onHost::ThreadSpec ( T_NumBlocks const & ,
T_NumThreads const &  ) -> ThreadSpec< alpaka::trait::getVec_t< T_NumBlocks >, alpaka::trait::getVec_t< T_NumThreads > >

◆ ThreadSpec() [2/2]

alpaka::onHost::ThreadSpec ( T_NumBlocks const & ,
T_NumThreads const & ,
T_Executor  ) -> ThreadSpec< alpaka::trait::getVec_t< T_NumBlocks >, alpaka::trait::getVec_t< T_NumThreads >, T_Executor >

◆ transform() [1/2]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::transform ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::Executor auto const exec,
alpaka::concepts::IMdSpan auto && out,
auto && fn,
alpaka::concepts::IDataSource auto &&... in )
inline

Transform the input data with the given function and write the result to the output data.

fn can be a lambda function if all arguments are specialized. This fully specialized functor must mostly wrapped by

See also
ScalarFunc. Generic lambdas are for some backends e.g. CUDA/HIP not supported. A lambda must be of the following form and should capture arguments only by copy.
#define ALPAKA_FN_ACC
All functions that can be used on an accelerator have to be attributed with ALPAKA_FN_ACC or ALPAKA_F...
Definition common.hpp:31
Parameters
queueThe queue to execute the transformation.
execThe executor to use for the kernel execution.
outThe output data to write the result to.
fnThe function to apply to each element of the input data. The functor should support Simd packages. If not you can enforce the element wise execution by wrapping into
See also
ScalarFunc. If you would like to support stencil executions wrapp fn into
StencilFunc. StencilFunc is getting all arguments as
SimdPtr. If StencilFunc is used you should take care to not read outside of valid memory ranges by using sub-views to your input and output data. Optionally a fn can have a accelerator as first argument.
Parameters
inThe input data to transform, all input data is passed to fn.

examples for a identity unary transform functor:

struct Foo {
constexpr auto operator()(onAcc::concepts::Acc auto const&, concepts::SimdPtr auto const& a) const {
return a.load();
}
};
struct Bar {
constexpr auto operator()(concepts::SimdPtr auto const& a) const {
return a.load();
}
};

Definition at line 51 of file transform.hpp.

◆ transform() [2/2]

template<typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
void alpaka::onHost::transform ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::IMdSpan auto && out,
auto && fn,
alpaka::concepts::IDataSource auto &&... in )
inline

An available default executor will be selected automatically.

The default executor is an executor with most parallelism/performance.

Definition at line 76 of file transform.hpp.

◆ transformReduce() [1/2]

template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void alpaka::onHost::transformReduce ( Queue< T_Device, T_QueueKind > const & queue,
alpaka::concepts::Executor auto const exec,
DataType const & neutralElement,
alpaka::concepts::IMdSpan auto out,
auto && binaryReduceFn,
auto && transformFn,
alpaka::concepts::IDataSource auto &&... in )
inline

Transform the input data with the given function and accumulate the results into a scalar value.

transformFn can be a lambda function if all arguments are specialized. This fully specialized functor must mostly wrapped by

See also
ScalarFunc. Generic lambdas are for some backends e.g. CUDA/HIP not supported. A lambda must be of the following form and should capture arguments only by copy.
Parameters
queueThe queue to execute the transformation.
execThe executor to use for the kernel execution.
neutralElementThe neutral element in respect to binaryReduceFn.
outMdSpan for the result. The value_type must be equal to neutralElement and the result of the binary reduce functor type. The result is written to the first element of the output data.
binaryReduceFnReduce binary functor, the functor operation must be transitive and commutative. The atomic operation atomic::alpakaAtomicInvoke(ReduceFnType, onAcc::concepts::Acc, auto* destination,auto source) must be overloaded. The functor execution order is not specified. The functor should support Simd packages, if not you can enforce the element wise execution by wrapping into
See also
ScalarFunc.
Parameters
transformFnThe function to apply to each element of the input data. The functor should support Simd packages. If not you can enforce the element wise execution by wrapping into ScalarFunc. If you would like to support stencil executions wrapp fn into StencilFunc. StencilFunc is getting all arguments as SimdPtr. If StencilFunc is used you should take care to not read outside of valid memory ranges by using sub-views to your input and output data. Optionally a transformFn can have an accelerator as first argument.
inThe input data to transform, all input data is passed to fn. transformFn must support as many arguments as input data is provided. An optional argument for the accelerator is support as first argument if needed.

examples for a identity unary transform functor:

struct Foo {
constexpr auto operator()(onAcc::concepts::Acc auto const&, concepts::SimdPtr auto const& a) const {
return a.load();
}
};
struct Bar {
constexpr auto operator()(concepts::SimdPtr auto const& a) const {
return a.load();
}
};

Definition at line 60 of file transformReduce.hpp.

◆ transformReduce() [2/2]

template<typename DataType, typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
requires (std::same_as<DataType, alpaka::trait::GetValueType_t<ALPAKA_TYPEOF(out)>>)
void alpaka::onHost::transformReduce ( Queue< T_Device, T_QueueKind > const & queue,
DataType const & neutralElement,
alpaka::concepts::IMdSpan auto out,
auto && binaryReduceFn,
auto && transformFn,
alpaka::concepts::IDataSource auto &&... in )
inline

An available default executor will be selected automatically.

The default executor is the executor with the most parallelism/performance.

Definition at line 97 of file transformReduce.hpp.

◆ wait()

void alpaka::onHost::wait ( alpaka::concepts::HasGet auto & handle)
inline

wait for all work to be finished

Waits until all work submitted to any before this call has finished

Parameters
handlequeue/device/event

Definition at line 142 of file interface.hpp.

Variable Documentation

◆ apis

auto alpaka::onHost::apis = std::make_tuple(api::host, api::cuda, api::hip, api::oneApi)
constexpr

Definition at line 41 of file api.hpp.

◆ enabledApis

auto alpaka::onHost::enabledApis = meta::filter([](auto api) constexpr { return isPlatformAvaiable(api); }, apis)
constexpr

Definition at line 43 of file api.hpp.

◆ enabledDeviceSpecs

auto alpaka::onHost::enabledDeviceSpecs
constexpr

list of enabled device specifications

  • device specifications can be dis-/enabled by the CMake options alpaka_<API>_<DeviceKindType>
  • the second way to disable a device specifications is to define the preprocessor define ALPAKA_DISABLE_<ApiType>_<DeviceKindType>, else the device specification is enabled

Definition at line 99 of file DeviceSpec.hpp.

◆ isFrameSpec_v

template<typename T>
bool alpaka::onHost::isFrameSpec_v = trait::IsFrameSpec<T>::value
constexpr

Definition at line 118 of file FrameSpec.hpp.

◆ isThreadSpec_v

template<typename T>
bool alpaka::onHost::isThreadSpec_v = trait::IsThreadSpec<T>::value
constexpr

Definition at line 102 of file ThreadSpec.hpp.

◆ NO_CPUID

int alpaka::onHost::NO_CPUID = 0
constexpr

Definition at line 48 of file sysInfo.hpp.

◆ UNKNOWN_COMPILER

int alpaka::onHost::UNKNOWN_COMPILER = 1
constexpr

Definition at line 50 of file sysInfo.hpp.

◆ UNKNOWN_CPU

int alpaka::onHost::UNKNOWN_CPU = 0
constexpr

Definition at line 49 of file sysInfo.hpp.