Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Classes
Kokkos Compresssed-Row Sparse API

Classes

struct  Kokkos::DefaultKernels< Scalar, Ordinal, Node >
 Traits class providing default kernel types for CRS, block CRS and relaxation kernels. More...
class  Kokkos::DefaultHostSparseOps< void, Ordinal, Node, Allocator >
 Partial specialization of DefaultHostSparseOps for Scalar=void. More...
class  Kokkos::AltSparseOps< Scalar, Ordinal, Node, Allocator >
 Alternate implementation of local sparse matrix-vector multiply and solve routines, for host-based Kokkos Node types. More...
class  Kokkos::CrsGraphBase< Ordinal, Node >
 An abstract base class providing a template for Kokkos-level sparse graph objects.The Tpetra classes do not utilize this base class for interacting with Kokkos-level 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 Kokkos-level sparse matrix objects.The matrix data is packed into a single contiguous array. The array is of length num-total-nonzeros. 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 matrix-vector multiply and solve routines, for host-based Kokkos Node types. More...
class  Kokkos::CuspOps< Scalar, Ordinal, Node >
 Default implementation of sparse matrix-vector multiply and solve routines, for host-based Kokkos Node types. More...
class  Kokkos::DefaultHostSparseOps< Scalar, Ordinal, Node, Allocator >
 Default implementation of sparse matrix-vector multiply and solve routines, for host-based Kokkos Node types. More...
class  KokkosExamples::EmptySparseKernel< Scalar, Node >
 Stub showing the interface that a Kokkos sparse operations provider must implement. More...

Detailed Description

In order to facilitate the substitution of sparse matrix kernels in classes such as Tpetra::CrsMatrix, Kokkos separates the data structure interface for a compressed-sparse-row (CRS) matrix from the kernel for implemeneting sparse matrix-vector 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.

Note:
It may seem strange that the Kokkos and Tpetra CRS graph objects are templated on the sparse kernels class, as the graph object does not provide multiplication and solve methods. However, because the sparse kernels may dictate the storage, they must have some input into the design of the sparse graph class, in addition to their obvious significance to the matrix 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 matrix-vector multiply and matrix-vector 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 Kokkos-enabled 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.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends