https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private 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.
 
KOKKOS_FUNCTION const MeshkokkosMesh () const
 Get the const reference of the Kokkos mesh.
 
KOKKOS_FUNCTION const AssemblykokkosAssembly () const
 Get the const reference of the Kokkos assembly.
 
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.
 
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.
 

Protected Member Functions

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

Protected Attributes

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

Private Attributes

const Mesh_mesh_host
 Host reference of the Kokkos mesh.
 
const Mesh _mesh_device
 Device copy of the Kokkos mesh.
 
const Assembly_assembly_host
 Host reference of the Kokkos assembly.
 
const Assembly _assembly_device
 Device copy of the Kokkos assembly.
 

Detailed Description

Definition at line 24 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 89 of file KokkosReducerBase.h.

90 {
91 ::Kokkos::realloc(_reduction_buffer, size);
92 }
::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 71 of file KokkosReducerBase.h.

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

◆ init()

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

Definition at line 59 of file KokkosReducerBase.h.

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

◆ join()

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

Definition at line 53 of file KokkosReducerBase.h.

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

◆ 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 634 of file KokkosAssembly.h.

635 {
636 KOKKOS_IF_ON_HOST(return _assembly_host;)
637
638 return _assembly_device;
639 }
const Assembly _assembly_device
Device copy of the Kokkos assembly.
const Assembly & _assembly_host
Host reference of the Kokkos assembly.

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

◆ 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 651 of file KokkosMesh.h.

652 {
653 KOKKOS_IF_ON_HOST(
655 "kokkosMesh() was called too early. Kokkos mesh is available after problem "
656 "initialization. Override initialSetup() if you need to setup your object data "
657 "using the Kokkos mesh.");
658
659 return _mesh_host;)
660
661 return _mesh_device;
662 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
const Mesh & _mesh_host
Host reference of the Kokkos mesh.
Definition KokkosMesh.h:669
const Mesh _mesh_device
Device copy of the Kokkos mesh.
Definition KokkosMesh.h:673
bool initialized() const
Get whether the mesh was initialized.
Definition KokkosMesh.h:68

Referenced by Moose::Kokkos::Assembly::computePhysicalMap(), Moose::Kokkos::Assembly::computePhysicalMap(), Moose::Kokkos::LinearFVFluxKernel::operator()(), Moose::Kokkos::LinearFVBoundaryCondition::operator()(), Moose::Kokkos::LinearFVFluxKernel::operator()(), Moose::Kokkos::LinearFVBoundaryCondition::operator()(), Moose::Kokkos::LinearFVFluxKernel::operator()(), Moose::Kokkos::LinearFVFluxKernel::operator()(), Moose::Kokkos::LinearFVElementalKernel::operator()(), Moose::Kokkos::IntegratedBC::operator()(), Moose::Kokkos::VectorIntegratedBC::operator()(), Moose::Kokkos::Kernel::operator()(), Moose::Kokkos::VectorKernel::operator()(), Moose::Kokkos::LinearFVElementalKernel::operator()(), Moose::Kokkos::Datum::q_point(), and KokkosBoundNodalKernel::skipOnBoundary().

◆ 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 47 of file KokkosReducerBase.h.

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

Member Data Documentation

◆ _assembly_device

const Assembly Moose::Kokkos::AssemblyHolder::_assembly_device
privateinherited

Device copy of the Kokkos assembly.

Definition at line 650 of file KokkosAssembly.h.

Referenced by Moose::Kokkos::AssemblyHolder::kokkosAssembly().

◆ _assembly_host

const Assembly& Moose::Kokkos::AssemblyHolder::_assembly_host
privateinherited

Host reference of the Kokkos assembly.

Definition at line 646 of file KokkosAssembly.h.

Referenced by Moose::Kokkos::AssemblyHolder::kokkosAssembly().

◆ _mesh_device

const Mesh Moose::Kokkos::MeshHolder::_mesh_device
privateinherited

Device copy of the Kokkos mesh.

Definition at line 673 of file KokkosMesh.h.

Referenced by Moose::Kokkos::MeshHolder::kokkosMesh().

◆ _mesh_host

const Mesh& Moose::Kokkos::MeshHolder::_mesh_host
privateinherited

Host reference of the Kokkos mesh.

Definition at line 669 of file KokkosMesh.h.

Referenced by Moose::Kokkos::MeshHolder::kokkosMesh().

◆ _reducer_dispatcher

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

Kokkos functor dispatcher.

Definition at line 101 of file KokkosReducerBase.h.

◆ _reducer_object

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

MOOSE object.

Definition at line 97 of file KokkosReducerBase.h.

◆ _reduction_buffer

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

Reduction buffer.

Definition at line 105 of file KokkosReducerBase.h.

Referenced by allocateReductionBuffer().


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