libCEED icon indicating copy to clipboard operation
libCEED copied to clipboard

Multivector/batching/Kronecker support

Open jedbrown opened this issue 4 years ago • 0 comments

We should support batched application of CeedOperator to vectors. One approach is to make a new constructor

int CeedOperatorCreateKroneckerProduct(CeedOperator J, CeedInt m, const CeedScalar *T, CeedOperator *JxT);

where T is an m × m dense matrix (could be identity) and we'll apply this new operator J ⊗ T to normal vectors. Common cases in machine learning would be batch sizes that are powers of 2, like 16, 32, etc. The operator T exists to avoid extra passes over the data in stochastic Galerkin and related methods. To support fused methods for implicit Runge-Kutta, we'd instead have operators of the form J ⊗ T + I ⊗ S where I is the identity in the spatial domain. This is supported in PETSc's "KAIJ" matrix format where J is an assembled sparse matrix.

The other approach is to make a multivector type or an attribute of CeedVector that endows it with multiple columns. If we assume row-aligned (good for vectorization), then it's the same as J ⊗ I applied to a single vector. This case is more restricted, but easier to explain to people who only want the simplest batching.

Cc: @stefanozampini

jedbrown avatar Dec 15 '20 04:12 jedbrown