https://mooseframework.inl.gov
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Moose::Kokkos::ReducerBase Class Referenceabstract

#include <KokkosReducerBase.h>

Inheritance diagram for Moose::Kokkos::ReducerBase:
[legend]

Classes

struct  ReducerLoop
 Kokkos function tag. More...
 

Public Member Functions

 ReducerBase (const MooseObject *object)
 
 ReducerBase (const ReducerBase &reducer)
 Copy constructor for parallel dispatch. More...
 
KOKKOS_FUNCTION const MeshkokkosMesh () const
 Get the const reference of the Kokkos mesh. More...
 
KOKKOS_FUNCTION const AssemblykokkosAssembly () const
 Get the const reference of the Kokkos assembly. More...
 
KOKKOS_FUNCTION const Array< System > & kokkosSystems () const
 Get the const reference of the Kokkos systems. More...
 
Array< System > & kokkosSystems ()
 Get the writeable host reference of the Kokkos systems. More...
 
KOKKOS_FUNCTION const SystemkokkosSystem (unsigned int sys) const
 Get the const reference of a Kokkos system. More...
 
SystemkokkosSystem (unsigned int sys)
 Get the writeable reference of a Kokkos system. More...
 
template<typename Derived >
KOKKOS_FUNCTION void reduce (Datum &, Real *) const
 Default methods to prevent compile errors even when these methods were not defined in the derived class. More...
 
template<typename Derived >
KOKKOS_FUNCTION void join (Real *, const Real *) const
 
template<typename Derived >
KOKKOS_FUNCTION void init (Real *) const
 

Static Public Member Functions

template<typename Derived >
static auto defaultReduce ()
 Function used to check if users have overriden the hook method. More...
 

Protected Member Functions

virtual void computeReducer ()
 Dispatch reduction operation. More...
 
virtual ThreadID numReducerThreads () const =0
 Get the number of threads. More...
 
void allocateReductionBuffer (const unsigned int size)
 Allocate reduction buffer. More...
 

Protected Attributes

const MooseObject_reducer_object
 MOOSE object. More...
 
std::unique_ptr< DispatcherBase_reducer_dispatcher
 Kokkos functor dispatcher. More...
 
::Kokkos::View< Real *, ::Kokkos::HostSpace > _reduction_buffer
 Reduction buffer. More...
 

Detailed Description

Definition at line 23 of file KokkosReducerBase.h.

Constructor & Destructor Documentation

◆ ReducerBase() [1/2]

Moose::Kokkos::ReducerBase::ReducerBase ( const MooseObject object)

◆ ReducerBase() [2/2]

Moose::Kokkos::ReducerBase::ReducerBase ( const ReducerBase reducer)

Copy constructor for parallel dispatch.

Member Function Documentation

◆ allocateReductionBuffer()

void Moose::Kokkos::ReducerBase::allocateReductionBuffer ( const unsigned int  size)
inlineprotected

Allocate reduction buffer.

Definition at line 88 of file KokkosReducerBase.h.

89  {
90  ::Kokkos::realloc(_reduction_buffer, size);
91  }
::Kokkos::View< Real *, ::Kokkos::HostSpace > _reduction_buffer
Reduction buffer.

◆ computeReducer()

virtual void Moose::Kokkos::ReducerBase::computeReducer ( )
protectedvirtual

Dispatch reduction operation.

◆ defaultReduce()

template<typename Derived >
static auto Moose::Kokkos::ReducerBase::defaultReduce ( )
inlinestatic

Function used to check if users have overriden the hook method.

Returns
The function pointer of the default hook method

Definition at line 70 of file KokkosReducerBase.h.

71  {
72  return &ReducerBase::reduce<Derived>;
73  }

◆ init()

template<typename Derived >
KOKKOS_FUNCTION void Moose::Kokkos::ReducerBase::init ( Real ) const
inline

Definition at line 58 of file KokkosReducerBase.h.

59  {
60  ::Kokkos::abort("Default init() should never be called. Make sure you properly redefined this "
61  "method in your class without typos.");
62  }

◆ join()

template<typename Derived >
KOKKOS_FUNCTION void Moose::Kokkos::ReducerBase::join ( Real ,
const Real  
) const
inline

Definition at line 52 of file KokkosReducerBase.h.

53  {
54  ::Kokkos::abort("Default join() should never be called. Make sure you properly redefined this "
55  "method in your class without typos.");
56  }

◆ kokkosAssembly()

KOKKOS_FUNCTION const Assembly& Moose::Kokkos::AssemblyHolder::kokkosAssembly ( ) const
inlineinherited

Get the const reference of the Kokkos assembly.

Returns
The const reference of the Kokkos assembly depending on the architecture this function is being called on

Definition at line 569 of file KokkosAssembly.h.

Referenced by Moose::Kokkos::System::getVectorQpADGrad(), Moose::Kokkos::System::getVectorQpADGradFace(), Moose::Kokkos::System::getVectorQpADValue(), Moose::Kokkos::System::getVectorQpADValueFace(), Moose::Kokkos::System::getVectorQpGradFace(), Moose::Kokkos::System::getVectorQpValueFace(), Moose::Kokkos::ElementReducer::operator()(), Moose::Kokkos::SideReducer::operator()(), Moose::Kokkos::NodalReducer::operator()(), Moose::Kokkos::NodalUserObject::operator()(), Moose::Kokkos::SideUserObject::operator()(), Moose::Kokkos::ElementUserObject::operator()(), Moose::Kokkos::ADNodalBC::operator()(), Moose::Kokkos::ADKernel::operator()(), Moose::Kokkos::ADIntegratedBC::operator()(), Moose::Kokkos::AuxKernel::operator()(), Moose::Kokkos::Material::operator()(), Moose::Kokkos::NodalBC::operator()(), Moose::Kokkos::NodalKernel::operator()(), Moose::Kokkos::IntegratedBC::operator()(), and Moose::Kokkos::Kernel::operator()().

570  {
571  KOKKOS_IF_ON_HOST(return _assembly_host;)
572 
573  return _assembly_device;
574  }
const Assembly _assembly_device
Device copy of the Kokkos assembly.
const Assembly & _assembly_host
Host reference of the Kokkos assembly.

◆ kokkosMesh()

KOKKOS_FUNCTION const Mesh& Moose::Kokkos::MeshHolder::kokkosMesh ( ) const
inlineinherited

Get the const reference of the Kokkos mesh.

Returns
The const reference of the Kokkos mesh depending on the architecture this function is being called on

Definition at line 452 of file KokkosMesh.h.

Referenced by Moose::Kokkos::Assembly::computePhysicalMap(), Moose::Kokkos::Kernel::operator()(), Moose::Kokkos::IntegratedBC::operator()(), Moose::Kokkos::Datum::q_point(), and KokkosBoundNodalKernel::skipOnBoundary().

453  {
454  KOKKOS_IF_ON_HOST(
456  "kokkosMesh() was called too early. Kokkos mesh is available after problem "
457  "initialization. Override initialSetup() if you need to setup your object data "
458  "using the Kokkos mesh.");
459 
460  return _mesh_host;)
461 
462  return _mesh_device;
463  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool initialized() const
Get whether the mesh was initialized.
Definition: KokkosMesh.h:68
const Mesh _mesh_device
Device copy of the Kokkos mesh.
Definition: KokkosMesh.h:474
const Mesh & _mesh_host
Host reference of the Kokkos mesh.
Definition: KokkosMesh.h:470

◆ kokkosSystem() [1/2]

KOKKOS_FUNCTION const System& Moose::Kokkos::SystemHolder::kokkosSystem ( unsigned int  sys) const
inlineinherited

◆ kokkosSystem() [2/2]

System& Moose::Kokkos::SystemHolder::kokkosSystem ( unsigned int  sys)
inlineinherited

Get the writeable reference of a Kokkos system.

Parameters
sysThe system number
Returns
The writeable host reference of the Kokkos system

Definition at line 803 of file KokkosSystem.h.

803 { return _systems_host[sys]; }
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:810

◆ kokkosSystems() [1/2]

KOKKOS_FUNCTION const Array<System>& Moose::Kokkos::SystemHolder::kokkosSystems ( ) const
inlineinherited

◆ kokkosSystems() [2/2]

Array<System>& Moose::Kokkos::SystemHolder::kokkosSystems ( )
inlineinherited

Get the writeable host reference of the Kokkos systems.

Returns
The writeable host reference of the Kokkos systems

Definition at line 785 of file KokkosSystem.h.

785 { return _systems_host; }
Array< System > & _systems_host
Host reference of the Kokkos systems.
Definition: KokkosSystem.h:810

◆ numReducerThreads()

virtual ThreadID Moose::Kokkos::ReducerBase::numReducerThreads ( ) const
protectedpure virtual

◆ reduce()

template<typename Derived >
KOKKOS_FUNCTION void Moose::Kokkos::ReducerBase::reduce ( Datum ,
Real  
) const
inline

Default methods to prevent compile errors even when these methods were not defined in the derived class.

Definition at line 46 of file KokkosReducerBase.h.

47  {
48  ::Kokkos::abort("Default reduce() should never be called. Make sure you properly redefined "
49  "this method in your class without typos.");
50  }

Member Data Documentation

◆ _reducer_dispatcher

std::unique_ptr<DispatcherBase> Moose::Kokkos::ReducerBase::_reducer_dispatcher
protected

Kokkos functor dispatcher.

Definition at line 100 of file KokkosReducerBase.h.

◆ _reducer_object

const MooseObject* Moose::Kokkos::ReducerBase::_reducer_object
protected

MOOSE object.

Definition at line 96 of file KokkosReducerBase.h.

◆ _reduction_buffer

::Kokkos::View<Real *, ::Kokkos::HostSpace> Moose::Kokkos::ReducerBase::_reduction_buffer
protected

Reduction buffer.

Definition at line 104 of file KokkosReducerBase.h.

Referenced by allocateReductionBuffer().


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