https://mooseframework.inl.gov
Public Member Functions | Private Attributes | List of all members
Moose::Kokkos::MemoryPool Class Reference

The Kokkos class that manages memory pool for dynamically-sized temporary arrays in Kokkos parallel functions. More...

#include <KokkosMemoryPool.h>

Public Member Functions

 MemoryPool (dof_id_type size, unsigned int ways)
 Constructor. More...
 
template<typename T >
KOKKOS_FUNCTION MemoryChunk< T > allocate (dof_id_type idx, unsigned int size) const
 Allocate a memory chunk The returned object should be alive while the memory chunk is used. More...
 

Private Attributes

Array<::Kokkos::MemoryPool< MemSpace > > _pools
 Kokkos memory pools. More...
 

Detailed Description

The Kokkos class that manages memory pool for dynamically-sized temporary arrays in Kokkos parallel functions.

Definition at line 77 of file KokkosMemoryPool.h.

Constructor & Destructor Documentation

◆ MemoryPool()

Moose::Kokkos::MemoryPool::MemoryPool ( dof_id_type  size,
unsigned int  ways 
)

Constructor.

Parameters
sizeThe memory pool size in the number of bytes
waysThe number of parallel ways

Member Function Documentation

◆ allocate()

template<typename T >
KOKKOS_FUNCTION MemoryChunk<T> Moose::Kokkos::MemoryPool::allocate ( dof_id_type  idx,
unsigned int  size 
) const
inline

Allocate a memory chunk The returned object should be alive while the memory chunk is used.

Parameters
indxThe index to select pool
sizeThe memory chunk size in the number of elements
Returns
The memory chunk object containing the pointer to the memory chunk

Definition at line 95 of file KokkosMemoryPool.h.

96  {
97  auto pool = idx % _pools.size();
98 
99  return MemoryChunk<T>(_pools[pool], size * sizeof(T));
100  }
Array<::Kokkos::MemoryPool< MemSpace > > _pools
Kokkos memory pools.
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)

Member Data Documentation

◆ _pools

Array<::Kokkos::MemoryPool<MemSpace> > Moose::Kokkos::MemoryPool::_pools
private

Kokkos memory pools.

Definition at line 106 of file KokkosMemoryPool.h.

Referenced by Moose::Kokkos::MemoryPool< MemSpace >::allocate().


The documentation for this class was generated from the following file: