Kokkos Node API and Local Linear Algebra Kernels Version of the Day

Classes  
struct  Kokkos::DefaultKernels< Scalar, Ordinal, Node > 
Traits class providing default kernel types for CRS, block CRS and relaxation kernels. More...  
class  Kokkos::FirstTouchSparseOps< Scalar, Ordinal, Node > 
Sparse matrixvector multiplication and solve routines with firsttouch allocation of matrix data.Effectively, this class is identical to DefaultSparseOps, except for the allocRowPtrs() and allocStorage() methods, which are modified to use a firsttouch allocation. The relationship is done using private inheritence, though this class should never be accessed via a reference to its parent class. (Tpetra is unaware this relationship, and so will never do that.) More...  
class  DefaultDeviceSparseOps< Scalar, Ordinal, Node > 
Default implementation of sparse matrixvector multiplication and solve routines, for devicebased nodes. More...  
class  Kokkos::CrsGraphBase< Ordinal, Node > 
An abstract base class providing a template for Kokkoslevel sparse graph objects.The Tpetra classes do not utilize this base class for interacting with Kokkoslevel objects, and the local sparse graph objects are there not required to inherit from this interface. However, this class illustrates the methods that are required by Tpetra objects, and therefore provides a potential starting point for extending Tpetra via new local graph and matrix types. More...  
class  Kokkos::CrsMatrixBase< Scalar, Ordinal, Node > 
An abstract base class providing a template for Kokkoslevel sparse matrix objects.The matrix data is packed into a single contiguous array. The array is of length numtotalnonzeros. Two auxiliary arrays give indices to the beginning of each row, according to the standard compressed sparse row (CSR) format. More...  
class  Kokkos::CUSPARSEOps< Scalar, Node > 
Default implementation of sparse matrixvector multiply and solve routines, for hostbased Kokkos Node types. More...  
class  Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node > 
Default implementation of sparse matrixvector multiply and solve routines, for hostbased Kokkos Node types. More...  
class  Kokkos::SeqSparseOps< Scalar, Ordinal, Node > 
Implementation of local sequential sparse matrixvector multiply and solve routines, for hostbased Kokkos Node types. More...  
class  KokkosExamples::EmptySparseKernel< Scalar, Node > 
Stub showing the interface that a Kokkos sparse operations provider must implement. More... 
In order to facilitate the substitution of sparse matrix kernels in classes such as Tpetra::CrsMatrix, Kokkos separates the data structure interface for a compressedsparserow (CRS) matrix from the kernel for implemeneting sparse matrixvector multiplication and solves. However, the appropriate implementation of these kernels for a particular platform may dictate some of the design of the storage classes. Furthermore, for reasons of efficiency and generic programming reach, these are implemented statically. The approach that Tpetra employs is to template the distributed Tpetra::CrsMatrix objects on the type of the local matrix kernels. This decision permeates down to the level of the CRS objects in the Kokkos linear algebra library.
The primary object in this discussion is the class providing the sparse matrix kernels. The simplest way to modify the operation of the Tpetra objects is to first create a new sparse kernels class and then to template the Tpetra::CrsMatrix and Tpetra::CrsGraph objects on this kernel class.
The following simplified code demonstrates the relationship between these objects and their typical usage:
typedef typename SparseKernels::graph< int,Node>::graph_type Graph; typedef typename SparseKernels::matrix<double,int,Node>::matrix_type Matrix; Graph G(numRows,node); Matri M(G); SparseKernels ops; ops.setGraphAndMatrix( G, M ); ops.multiply( x, y ); ops.solve( b, x );
In this example, we instantiate a graph and a matrix. Note, the type of CrsGraph
and CrsMatrix
is dictated by the SparesKernels
class. By parametrizing these classes in this way, we can effect the design of these classes according to the sparse kernels that we are interested in using. After creating the sparse graph and sparse matrix objets, we instantiate a SparseKernel
object and submit the data. Finally, the sparse kernel object can be used to apply the sparse matrix mutiply and solve routines.
The sparse kernel class must obviously provide the functionality for matrixvector multiply and matrixvector solve. Some other functionality is required of this class as well.
The code below illustrates these use cases for a sparse kernel provider, as they appear in Tpetra and other Kokkosenabled linear algebra packages. This example is located at kokkos/LinAlg/examples/DummySparseKernelDriver.cpp.
This example makes use of the sparse kernel provider stubbed in the class KokkosExamples::DummySparseKernel, located in the file kokkos/LinAlg/examples/Kokkos_DummySparseKernelClass.hpp. This file, along with the unit test kokkos/LinAlg/test/CrsMatrix/CrsMatrix_DefaultMultiply.cpp, demonstrate the implementation requirements for a sparse kernel provider.