Intrepid2
Intrepid2_PAMatrixDef.hpp File Reference

Header file for the Intrepid2::PAMatrix implementations; provides support for matrix partial assembly. More...

#include "Intrepid2_PAMatrix.hpp"
#include "Intrepid2_DataDimensionInfo.hpp"
#include "Intrepid2_DataTools.hpp"
#include "Intrepid2_OrientationTools.hpp"
#include <Teuchos_Assert.hpp>
#include <Teuchos_BLAS.hpp>
#include <Teuchos_TimeMonitor.hpp>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <string>
#include <type_traits>

Go to the source code of this file.

Classes

struct  Intrepid2::Impl::PAMatrixGEMMStatistics
 process-wide GEMM statistics state for PAMatrix; see PAMatrix::setGEMMStatisticsEnabled() More...

Functions

template<typename DeviceType>
constexpr bool Intrepid2::Impl::isHostDevice ()
template<typename DeviceType>
constexpr bool Intrepid2::Impl::gemmUsesTeuchosBLAS ()
template<typename DeviceType>
constexpr bool Intrepid2::Impl::gemmSupported ()
template<typename DeviceType, typename Scalar>
void Intrepid2::Impl::gemm (const char transA, const char transB, const ordinal_type M, const ordinal_type N, const ordinal_type K, const Scalar alpha, const Scalar *A, const ordinal_type LDA, const Scalar *B, const Scalar beta, Scalar *C)
 Column-major GEMM, C = alpha * op(A) * op(B) + beta * C, with op(A) of size M x K and op(B) of size K x N, on data accessible from DeviceType. LDA is the leading dimension of A; B and C are packed (LDB = K or N, LDC = M). The backend is chosen from DeviceType: Teuchos::BLAS for host devices, and KokkosBlas::gemm on DeviceType's execution space otherwise (e.g., CUDA, HIP). Returns once the result is available to subsequent kernels on DeviceType's execution space, and to the host if DeviceType is a host device.
double Intrepid2::Impl::parsePositiveEnvironmentNumber (const char *name, const char *value)
 Parses a positive number from an environment variable; throws if the value is not a positive number.
template<typename DeviceType, class Scalar>
void Intrepid2::Impl::pointDataMultiply (const ordinal_type numDataCells, const ordinal_type startCell, const ordinal_type Cw, const ordinal_type numPoints, const ordinal_type aSpan, const ordinal_type bSpan, const Scalar *A, const Scalar *B, Scalar *C, const ordinal_type N)
 For point data A(C,P,Da,Db) and vector-valued B(P[,Db],N,Cw), computes the pointwise matrix-vector product C(N,Cw,P[,Da]) for cells startCell..startCell+Cw-1 of A. A's cell extent is numDataCells, which is either the total number of cells or 1 (for data that is constant in the cell).
template<typename DeviceType, class Scalar>
Data< Scalar, DeviceType > Intrepid2::Impl::allocateComposedWeightedTransform (const Data< Scalar, DeviceType > &composedTransform, const TensorData< Scalar, DeviceType > &pointWeights)
 Given (C,P[,D,D]) transform and (C,P) pointwise weights, construct a suitable container for storing the pointwise weighted transform.
template<typename DeviceType, class Scalar, class OpDataType>
Kokkos::View< Scalar *, DeviceType > Intrepid2::Impl::pack1DOperator (const OpDataType &opData, const bool transposeToPoints)
 Packs a (F,P) or (F,P,D) 1D operator into a 1D view; if transposeToPoints, the layout is (P[,D],F) (layout left), else (F,P[,D]).
template<class Scalar>
ordinal_type Intrepid2::pamatrixWorksetSize (const double budgetMB, const size_t perCellEntries, const ordinal_type numCells)
 the number of cells per workset that fit perCellEntries entries of Scalar per cell within budgetMB, in [1, numCells]
template<typename DeviceType, class Scalar>
bool Intrepid2::pamatrixAssembleUsesUnitColumnPath (const PAMatrix< DeviceType, Scalar > &matrix)
 Deprecated: use PAMatrix::supportsDirectAssembly().

Detailed Description

Header file for the Intrepid2::PAMatrix implementations; provides support for matrix partial assembly.

Author
Created by Nathan V. Roberts.

Definition in file Intrepid2_PAMatrixDef.hpp.

Function Documentation

◆ allocateComposedWeightedTransform()

template<typename DeviceType, class Scalar>
Data< Scalar, DeviceType > Intrepid2::Impl::allocateComposedWeightedTransform ( const Data< Scalar, DeviceType > & composedTransform,
const TensorData< Scalar, DeviceType > & pointWeights )

◆ gemm()

template<typename DeviceType, typename Scalar>
void Intrepid2::Impl::gemm ( const char transA,
const char transB,
const ordinal_type M,
const ordinal_type N,
const ordinal_type K,
const Scalar alpha,
const Scalar * A,
const ordinal_type LDA,
const Scalar * B,
const Scalar beta,
Scalar * C )

Column-major GEMM, C = alpha * op(A) * op(B) + beta * C, with op(A) of size M x K and op(B) of size K x N, on data accessible from DeviceType. LDA is the leading dimension of A; B and C are packed (LDB = K or N, LDC = M). The backend is chosen from DeviceType: Teuchos::BLAS for host devices, and KokkosBlas::gemm on DeviceType's execution space otherwise (e.g., CUDA, HIP). Returns once the result is available to subsequent kernels on DeviceType's execution space, and to the host if DeviceType is a host device.

Definition at line 95 of file Intrepid2_PAMatrixDef.hpp.

◆ gemmSupported()

template<typename DeviceType>
bool Intrepid2::Impl::gemmSupported ( )
constexpr

True if PAMatrix<DeviceType,...> supports GEMMs, i.e., its operations can be used in this build. Non-host devices (e.g., CUDA, HIP, SYCL) require Intrepid2 to be built with KokkosKernels.

Definition at line 79 of file Intrepid2_PAMatrixDef.hpp.

◆ gemmUsesTeuchosBLAS()

template<typename DeviceType>
bool Intrepid2::Impl::gemmUsesTeuchosBLAS ( )
constexpr

True if PAMatrix<DeviceType,...> issues its GEMMs through Teuchos::BLAS: all host devices, serial or threaded (e.g., OpenMP), with or without KokkosKernels. The host BLAS is the fastest host GEMM available, and calling it directly does not depend on KokkosBlas::gemm's view-layout conditions for using it (a LayoutStride A falls back to the native KokkosKernels implementation, which is several times slower).

Definition at line 71 of file Intrepid2_PAMatrixDef.hpp.

◆ isHostDevice()

template<typename DeviceType>
bool Intrepid2::Impl::isHostDevice ( )
constexpr

True if a DeviceType's execution space runs on the host and its memory is host-accessible, so that GEMMs can be issued directly to the host BLAS (Teuchos::BLAS).

Definition at line 58 of file Intrepid2_PAMatrixDef.hpp.

◆ pack1DOperator()

template<typename DeviceType, class Scalar, class OpDataType>
Kokkos::View< Scalar *, DeviceType > Intrepid2::Impl::pack1DOperator ( const OpDataType & opData,
const bool transposeToPoints )

Packs a (F,P) or (F,P,D) 1D operator into a 1D view; if transposeToPoints, the layout is (P[,D],F) (layout left), else (F,P[,D]).

Definition at line 255 of file Intrepid2_PAMatrixDef.hpp.

◆ pamatrixAssembleUsesUnitColumnPath()

template<typename DeviceType, class Scalar>
bool Intrepid2::pamatrixAssembleUsesUnitColumnPath ( const PAMatrix< DeviceType, Scalar > & matrix)

Deprecated: use PAMatrix::supportsDirectAssembly().

Definition at line 1021 of file Intrepid2_PAMatrixDef.hpp.

References Intrepid2::PAMatrix< DeviceType, Scalar >::supportsDirectAssembly().

◆ pamatrixWorksetSize()

template<class Scalar>
ordinal_type Intrepid2::pamatrixWorksetSize ( const double budgetMB,
const size_t perCellEntries,
const ordinal_type numCells )

the number of cells per workset that fit perCellEntries entries of Scalar per cell within budgetMB, in [1, numCells]

Definition at line 328 of file Intrepid2_PAMatrixDef.hpp.

◆ parsePositiveEnvironmentNumber()

double Intrepid2::Impl::parsePositiveEnvironmentNumber ( const char * name,
const char * value )
inline

Parses a positive number from an environment variable; throws if the value is not a positive number.

Definition at line 162 of file Intrepid2_PAMatrixDef.hpp.

◆ pointDataMultiply()

template<typename DeviceType, class Scalar>
void Intrepid2::Impl::pointDataMultiply ( const ordinal_type numDataCells,
const ordinal_type startCell,
const ordinal_type Cw,
const ordinal_type numPoints,
const ordinal_type aSpan,
const ordinal_type bSpan,
const Scalar * A,
const Scalar * B,
Scalar * C,
const ordinal_type N )

For point data A(C,P,Da,Db) and vector-valued B(P[,Db],N,Cw), computes the pointwise matrix-vector product C(N,Cw,P[,Da]) for cells startCell..startCell+Cw-1 of A. A's cell extent is numDataCells, which is either the total number of cells or 1 (for data that is constant in the cell).

Definition at line 176 of file Intrepid2_PAMatrixDef.hpp.