The Kokkos system class. More...
#include <KokkosSystem.h>
Classes | |
struct | Sparsity |
CSR format sparsity data. More... | |
Public Member Functions | |
System (SystemBase &system) | |
Constructor. More... | |
void | sync (const MemcpyKind dir) |
Synchronize the active tagged vectors and matrices between host and device. More... | |
void | sync (const std::set< TagID > &tags, const MemcpyKind dir) |
Synchronize the specified tagged vectors between host and device. More... | |
void | reinit () |
Allocate the quadrature point solution vectors for active variable and tags and cache quadrature point values. More... | |
void | setActiveVariables (const std::set< MooseVariableFieldBase *> &vars) |
Set the active variables. More... | |
void | setActiveVariableTags (const std::set< TagID > &tags) |
Set the active solution tags. More... | |
void | setActiveResidualTags (const std::set< TagID > &tags) |
Set the active residual tags. More... | |
void | setActiveMatrixTags (const std::set< TagID > &tags) |
Set the active matrix tags. More... | |
void | clearActiveVariables () |
Clear the cached active variables. More... | |
void | clearActiveVariableTags () |
Clear the cached active solution tags. More... | |
void | clearActiveResidualTags () |
Clear the cached active residual tags. More... | |
void | clearActiveMatrixTags () |
Clear the cached active matrix tags. More... | |
const auto & | getSystem () const |
Get the MOOSE system. More... | |
const auto & | getDofMap () const |
Get the libMesh DOF map. More... | |
const auto & | getComm () const |
Get the libMesh communicator. More... | |
const auto & | getLocalCommList () const |
Get the list of local DOF indices to communicate. More... | |
const auto & | getGhostCommList () const |
Get the list of ghost DOF indices to communicate. More... | |
const auto & | getSparsity () const |
Get the sparisty pattern data. More... | |
KOKKOS_FUNCTION const auto & | getCoupling (unsigned int var) const |
Get the list of off-diagonal coupled variable numbers of a variable. More... | |
KOKKOS_FUNCTION bool | isVariableActive (unsigned int var, ContiguousSubdomainID subdomain) const |
Check whether a variable is active on a subdomain. More... | |
KOKKOS_FUNCTION bool | isResidualTagActive (TagID tag) const |
Check whether a residual tag is active. More... | |
KOKKOS_FUNCTION bool | isMatrixTagActive (TagID tag) const |
Check whether a matrix tag is active. More... | |
KOKKOS_FUNCTION bool | hasNodalBC (dof_id_type dof) const |
Check whether a local DOF index is covered by a nodal BC. More... | |
KOKKOS_FUNCTION bool | hasNodalBCResidualTag (dof_id_type dof, TagID tag) const |
Check whether a local DOF index is covered by a nodal BC for an extra residual tag. More... | |
KOKKOS_FUNCTION bool | hasNodalBCMatrixTag (dof_id_type dof, TagID tag) const |
Check whether a local DOF index is associated with a nodal BC for an extra matrix tag. More... | |
KOKKOS_FUNCTION unsigned int | getFETypeID (unsigned int var) const |
Get the FE type ID of a variable. More... | |
KOKKOS_FUNCTION dof_id_type | getNumLocalDofs () const |
Get the number of local DOFs. More... | |
KOKKOS_FUNCTION dof_id_type | getNumGhostDofs () const |
Get the number of ghost DOFs. More... | |
KOKKOS_FUNCTION unsigned int | getMaxDofsPerElem (unsigned int var) const |
Get the maximum number of DOFs per element of a variable This number is local to each process. More... | |
KOKKOS_FUNCTION dof_id_type | getElemLocalDofIndex (ContiguousElementID elem, unsigned int i, unsigned int var) const |
Get the local DOF index of a variable for an element. More... | |
KOKKOS_FUNCTION dof_id_type | getNodeLocalDofIndex (ContiguousNodeID node, unsigned int var) const |
Get the local DOF index of a variable for a node. More... | |
KOKKOS_FUNCTION dof_id_type | getElemGlobalDofIndex (ContiguousElementID elem, unsigned int i, unsigned int var) const |
Get the global DOF index of a variable for an element. More... | |
KOKKOS_FUNCTION dof_id_type | getNodeGlobalDofIndex (ContiguousNodeID node, unsigned int var) const |
Get the global DOF index of a variable for a node. More... | |
KOKKOS_FUNCTION dof_id_type | localToGlobalDofIndex (dof_id_type dof) const |
Get the global DOF index of a local DOF index. More... | |
KOKKOS_FUNCTION bool | isNodalDefined (ContiguousNodeID node, unsigned int var) const |
Get whether a variable is defined on a node. More... | |
KOKKOS_FUNCTION auto & | getVector (TagID tag) const |
Get a tagged Kokkos vector. More... | |
KOKKOS_FUNCTION auto & | getMatrix (TagID tag) const |
Get a tagged Kokkos matrix. More... | |
KOKKOS_FUNCTION Real & | getVectorDofValue (dof_id_type dof, TagID tag) const |
Get the DOF value of a tagged vector. More... | |
KOKKOS_FUNCTION Real & | getVectorQpValue (ElementInfo info, dof_id_type qp, unsigned int var, TagID tag) const |
Get the quadrature value of a variable from a tagged vector. More... | |
KOKKOS_FUNCTION Real3 & | getVectorQpGrad (ElementInfo info, dof_id_type qp, unsigned int var, TagID tag) const |
Get the quadrature gradient of a variable from a tagged vector. More... | |
KOKKOS_FUNCTION Real | getVectorQpValueFace (const ElementInfo info, const unsigned int side, const unsigned int qp, const unsigned int var, const TagID tag) const |
Get the face quadrature value of a variable from a tagged vector. More... | |
KOKKOS_FUNCTION Real3 | getVectorQpGradFace (const ElementInfo info, const unsigned int side, const Real33 jacobian, const unsigned int qp, const unsigned int var, const TagID tag) const |
Get the face quadrature gradient of a variable from a tagged vector. More... | |
KOKKOS_FUNCTION Real & | getMatrixValue (dof_id_type row, dof_id_type col, TagID tag) const |
Get an entry from a tagged matrix. More... | |
KOKKOS_FUNCTION void | operator() (const ThreadID tid) const |
Kokkos function for caching variable values on element quadrature points. More... | |
KOKKOS_FUNCTION const Mesh & | kokkosMesh () const |
Get the const reference of the Kokkos mesh. More... | |
KOKKOS_FUNCTION const Assembly & | kokkosAssembly () const |
Get the const reference of the Kokkos assembly. More... | |
Private Member Functions | |
void | setupVariables () |
Setup variable data. More... | |
void | setupDofs () |
Setup DOF data. More... | |
void | setupSparsity () |
Setup sparsity data. More... | |
void | checkNodalBCs () |
Check if the DOFs are covered by nodal BCs. More... | |
void | getNodalBCDofs (const NodalBCBase *nbc, Array< bool > &dofs) |
Get the list of DOFs covered by a nodal BC. More... | |
Private Attributes | |
Thread | _thread |
Kokkos thread object. More... | |
SystemBase & | _system |
Reference of the MOOSE system. More... | |
const MooseMesh & | _mesh |
Reference of the MOOSE mesh. More... | |
const libMesh::DofMap & | _dof_map |
Reference of the libMesh DOF map. More... | |
const Parallel::Communicator & | _comm |
Reference of the libMesh communicator. More... | |
const unsigned int | _num_vars |
Number of variables. More... | |
const dof_id_type | _num_local_dofs |
Number of local DOFs. More... | |
const dof_id_type | _num_ghost_dofs |
Number of ghost DOFs. More... | |
Array< dof_id_type > | _local_to_global_dof_index |
Map from local DOF index to global DOF index. More... | |
Array< unsigned int > | _max_dofs_per_elem |
Maximum number of DOFs per element for each variable. More... | |
Array< unsigned int > | _var_fe_types |
FE type ID of each variable. More... | |
Array2D< bool > | _var_subdomain_active |
Whether each variable is active on subdomains. More... | |
Array< Array< unsigned int > > | _coupling |
Off-diagonal coupled variable numbers of each variable. More... | |
Array< unsigned int > | _active_variables |
List of active variable numbers. More... | |
Array< bool > | _nbc_dof |
Flag whether each DOF is covered by a nodal BC. More... | |
Sparsity | _sparsity |
Matrix sparsity pattern data. More... | |
Array< Vector > | _vectors |
Kokkos vectors and matrices on device. More... | |
Array< Matrix > | _matrices |
Array< Array2D< Array< Real > > > | _qp_solutions |
Cached elemental quadrature values and gradients. More... | |
Array< Array2D< Array< Real3 > > > | _qp_solutions_grad |
Array< Array2D< dof_id_type > > | _local_elem_dof_index |
Local DOF index of each variable. More... | |
Array< Array< dof_id_type > > | _local_node_dof_index |
Array< TagID > | _active_variable_tags |
List of active tags. More... | |
Array< TagID > | _active_residual_tags |
Array< TagID > | _active_matrix_tags |
Array< bool > | _residual_tag_active |
Flag whether each tag is active. More... | |
Array< bool > | _matrix_tag_active |
Array< Array< bool > > | _nbc_residual_tag_dof |
Flag whether each DOF is covered by a nodal BC for extra residual tags. More... | |
Array< Array< bool > > | _nbc_matrix_tag_dof |
Array< Array< dof_id_type > > | _local_comm_list |
List of DOFs to send and receive. More... | |
Array< Array< dof_id_type > > | _ghost_comm_list |
The Kokkos system class.
Each nonlinear and auxiliary system in MOOSE has a corresponding Kokkos system.
Definition at line 35 of file KokkosSystem.h.
Moose::Kokkos::System::System | ( | SystemBase & | system | ) |
Constructor.
system | The associated MOOSE system |
|
private |
Check if the DOFs are covered by nodal BCs.
|
inline |
Clear the cached active matrix tags.
Definition at line 100 of file KokkosSystem.h.
|
inline |
Clear the cached active residual tags.
Definition at line 92 of file KokkosSystem.h.
|
inline |
Clear the cached active variables.
Definition at line 84 of file KokkosSystem.h.
|
inline |
Clear the cached active solution tags.
Definition at line 88 of file KokkosSystem.h.
|
inline |
Get the libMesh communicator.
Definition at line 119 of file KokkosSystem.h.
|
inline |
Get the list of off-diagonal coupled variable numbers of a variable.
var | The variable number |
Definition at line 140 of file KokkosSystem.h.
|
inline |
Get the libMesh DOF map.
Definition at line 114 of file KokkosSystem.h.
|
inline |
Get the global DOF index of a variable for an element.
elem | The contiguous element ID |
i | The element-local DOF index |
var | The variable number |
Definition at line 248 of file KokkosSystem.h.
|
inline |
Get the local DOF index of a variable for an element.
elem | The contiguous element ID |
i | The element-local DOF index |
var | The variable number |
Definition at line 225 of file KokkosSystem.h.
Referenced by Moose::Kokkos::ResidualObject::accumulateTaggedElementalMatrix(), Moose::Kokkos::ResidualObject::accumulateTaggedElementalResidual(), getVectorQpGradFace(), and getVectorQpValueFace().
Get the FE type ID of a variable.
var | The variable number |
Definition at line 197 of file KokkosSystem.h.
|
inline |
Get the list of ghost DOF indices to communicate.
Definition at line 129 of file KokkosSystem.h.
|
inline |
Get the list of local DOF indices to communicate.
Definition at line 124 of file KokkosSystem.h.
|
inline |
Get a tagged Kokkos matrix.
tag | The matrix tag |
Definition at line 294 of file KokkosSystem.h.
|
inline |
Get an entry from a tagged matrix.
row | The local row index |
col | The global column index |
tag | The matrix tag |
Definition at line 368 of file KokkosSystem.h.
|
inline |
Get the maximum number of DOFs per element of a variable This number is local to each process.
var | The variable number |
Definition at line 214 of file KokkosSystem.h.
|
private |
Get the list of DOFs covered by a nodal BC.
nbc | The Kokkos nodal BC object |
dofs | The flag whether each DOF is covered by the nodal BC |
|
inline |
Get the global DOF index of a variable for a node.
node | The contiguous node ID |
var | The variable number |
Definition at line 260 of file KokkosSystem.h.
|
inline |
Get the local DOF index of a variable for a node.
node | The contiguous node ID |
var | The variable number |
Definition at line 237 of file KokkosSystem.h.
Referenced by Moose::Kokkos::ResidualObject::accumulateTaggedNodalMatrix(), and Moose::Kokkos::ResidualObject::accumulateTaggedNodalResidual().
|
inline |
Get the number of ghost DOFs.
Definition at line 207 of file KokkosSystem.h.
|
inline |
Get the number of local DOFs.
Definition at line 202 of file KokkosSystem.h.
|
inline |
Get the sparisty pattern data.
Definition at line 134 of file KokkosSystem.h.
|
inline |
Get the MOOSE system.
Definition at line 109 of file KokkosSystem.h.
|
inline |
Get a tagged Kokkos vector.
tag | The vector tag |
Definition at line 288 of file KokkosSystem.h.
|
inline |
Get the DOF value of a tagged vector.
dof | The local DOF index |
tag | The vector tag |
Definition at line 301 of file KokkosSystem.h.
Referenced by getVectorQpGradFace(), and getVectorQpValueFace().
|
inline |
Get the quadrature gradient of a variable from a tagged vector.
info | The element information object |
qp | The global quadrature point index |
var | The variable number |
tag | The vector tag |
Definition at line 327 of file KokkosSystem.h.
|
inline |
Get the face quadrature gradient of a variable from a tagged vector.
info | The element information object |
side | The side index |
jacobian | The inverse Jacobian matrix |
qp | The local quadrature point index |
var | The variable number |
tag | The vector tag |
Definition at line 549 of file KokkosSystem.h.
|
inline |
Get the quadrature value of a variable from a tagged vector.
info | The element information object |
qp | The global quadrature point index |
var | The variable number |
tag | The vector tag |
Definition at line 314 of file KokkosSystem.h.
|
inline |
Get the face quadrature value of a variable from a tagged vector.
info | The element information object |
side | The side index |
qp | The local quadrature point index |
var | The vriable number |
tag | The vector tag |
Definition at line 534 of file KokkosSystem.h.
|
inline |
Check whether a local DOF index is covered by a nodal BC.
dof | The local DOF index |
Definition at line 168 of file KokkosSystem.h.
|
inline |
Check whether a local DOF index is associated with a nodal BC for an extra matrix tag.
dof | The local DOF index |
tag | The extra matrix tag |
Definition at line 188 of file KokkosSystem.h.
|
inline |
Check whether a local DOF index is covered by a nodal BC for an extra residual tag.
dof | The local DOF index |
tag | The extra residual tag |
Definition at line 178 of file KokkosSystem.h.
|
inline |
Check whether a matrix tag is active.
tag | The matrix tag |
Definition at line 162 of file KokkosSystem.h.
|
inline |
Get whether a variable is defined on a node.
node | The contiguous node ID |
var | The variable number |
Definition at line 279 of file KokkosSystem.h.
|
inline |
Check whether a residual tag is active.
tag | The residual tag |
Definition at line 156 of file KokkosSystem.h.
|
inline |
Check whether a variable is active on a subdomain.
var | The variable number |
subdomain | The contiguous subdomain ID |
Definition at line 147 of file KokkosSystem.h.
|
inlineinherited |
Get the const reference of the Kokkos assembly.
Definition at line 499 of file KokkosAssembly.h.
Referenced by getVectorQpGradFace(), and getVectorQpValueFace().
|
inlineinherited |
Get the const reference of the Kokkos mesh.
Definition at line 360 of file KokkosMesh.h.
Referenced by Moose::Kokkos::Assembly::computePhysicalMap().
|
inline |
Get the global DOF index of a local DOF index.
dof | The local DOF index |
Definition at line 269 of file KokkosSystem.h.
Kokkos function for caching variable values on element quadrature points.
void Moose::Kokkos::System::reinit | ( | ) |
Allocate the quadrature point solution vectors for active variable and tags and cache quadrature point values.
Set the active matrix tags.
vars | The active matrix tags |
Set the active residual tags.
tags | The active residual tags |
void Moose::Kokkos::System::setActiveVariables | ( | const std::set< MooseVariableFieldBase *> & | vars | ) |
Set the active variables.
vars | The active MOOSE variables |
Set the active solution tags.
tags | The active solution tags |
|
private |
Setup DOF data.
|
private |
Setup sparsity data.
|
private |
Setup variable data.
void Moose::Kokkos::System::sync | ( | const MemcpyKind | dir | ) |
Synchronize the active tagged vectors and matrices between host and device.
dir | Copy direction |
void Moose::Kokkos::System::sync | ( | const std::set< TagID > & | tags, |
const MemcpyKind | dir | ||
) |
Synchronize the specified tagged vectors between host and device.
tags | The vector tags |
dir | Copy direction |
Definition at line 498 of file KokkosSystem.h.
Referenced by clearActiveMatrixTags().
Definition at line 497 of file KokkosSystem.h.
Referenced by clearActiveResidualTags().
List of active tags.
Definition at line 496 of file KokkosSystem.h.
Referenced by clearActiveVariableTags().
List of active variable numbers.
Definition at line 491 of file KokkosSystem.h.
Referenced by clearActiveVariables().
|
private |
Reference of the libMesh communicator.
Definition at line 432 of file KokkosSystem.h.
Referenced by getComm().
Off-diagonal coupled variable numbers of each variable.
Definition at line 486 of file KokkosSystem.h.
Referenced by getCoupling().
|
private |
Reference of the libMesh DOF map.
Definition at line 428 of file KokkosSystem.h.
|
private |
Definition at line 523 of file KokkosSystem.h.
Referenced by getGhostCommList().
|
private |
List of DOFs to send and receive.
Definition at line 522 of file KokkosSystem.h.
Referenced by getLocalCommList().
|
private |
Local DOF index of each variable.
Definition at line 464 of file KokkosSystem.h.
Referenced by getElemGlobalDofIndex(), and getElemLocalDofIndex().
|
private |
Definition at line 465 of file KokkosSystem.h.
Referenced by getNodeGlobalDofIndex(), getNodeLocalDofIndex(), and isNodalDefined().
|
private |
Map from local DOF index to global DOF index.
Definition at line 470 of file KokkosSystem.h.
Referenced by getElemGlobalDofIndex(), getNodeGlobalDofIndex(), and localToGlobalDofIndex().
Definition at line 451 of file KokkosSystem.h.
Referenced by getMatrix(), and getMatrixValue().
|
private |
Definition at line 505 of file KokkosSystem.h.
Referenced by clearActiveMatrixTags(), and isMatrixTagActive().
Maximum number of DOFs per element for each variable.
Definition at line 474 of file KokkosSystem.h.
Referenced by getMaxDofsPerElem().
|
private |
Reference of the MOOSE mesh.
Definition at line 424 of file KokkosSystem.h.
|
private |
Flag whether each DOF is covered by a nodal BC.
Definition at line 510 of file KokkosSystem.h.
Referenced by hasNodalBC().
Definition at line 516 of file KokkosSystem.h.
Referenced by hasNodalBCMatrixTag().
Flag whether each DOF is covered by a nodal BC for extra residual tags.
Definition at line 515 of file KokkosSystem.h.
Referenced by hasNodalBCResidualTag().
|
private |
Number of ghost DOFs.
Definition at line 444 of file KokkosSystem.h.
Referenced by getNumGhostDofs().
|
private |
Number of local DOFs.
Definition at line 440 of file KokkosSystem.h.
Referenced by getNumLocalDofs().
|
private |
Number of variables.
Definition at line 436 of file KokkosSystem.h.
Cached elemental quadrature values and gradients.
Definition at line 457 of file KokkosSystem.h.
Referenced by getVectorQpValue().
Definition at line 458 of file KokkosSystem.h.
Referenced by getVectorQpGrad().
|
private |
Flag whether each tag is active.
Definition at line 504 of file KokkosSystem.h.
Referenced by clearActiveResidualTags(), and isResidualTagActive().
|
private |
Matrix sparsity pattern data.
Definition at line 529 of file KokkosSystem.h.
Referenced by getSparsity().
|
private |
Reference of the MOOSE system.
Definition at line 420 of file KokkosSystem.h.
Referenced by getDofMap(), and getSystem().
|
private |
Kokkos thread object.
Definition at line 416 of file KokkosSystem.h.
FE type ID of each variable.
Definition at line 478 of file KokkosSystem.h.
Referenced by getFETypeID(), getVectorQpGradFace(), and getVectorQpValueFace().
|
private |
Whether each variable is active on subdomains.
Definition at line 482 of file KokkosSystem.h.
Referenced by isVariableActive().
Kokkos vectors and matrices on device.
Definition at line 450 of file KokkosSystem.h.
Referenced by getVector(), and getVectorDofValue().