MATSELL — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# MATSELL

MATSELL = “sell” - A matrix type to be used for sparse matrices, [ZMRS18] This matrix type is identical to `MATSEQSELL` when constructed with a single process communicator, and `MATMPISELL` otherwise. As a result, for single process communicators, `MatSeqSELLSetPreallocation()` is supported, and similarly `MatMPISELLSetPreallocation()` is supported for communicators controlling multiple processes. It is recommended that you call both of the above preallocation routines for simplicity.

## Options Database Key

- -mat_type sell - sets the matrix type to “sell” during a call to MatSetFromOptions()

## Notes

This format is only supported for real scalars, double precision, and 32-bit indices (the defaults).

It can provide better performance on Intel and AMD processes with AVX2 or AVX512 support for matrices that have a similar number of non-zeros in contiguous groups of rows. However if the computation is memory bandwidth limited it may not provide much improvement.

## Developer Notes

On Intel (and AMD) systems some of the matrix operations use SIMD (AVX) instructions to achieve higher performance.

The sparse matrix format is as follows. For simplicity we assume a slice size of 2, it is actually 8

                                (2 0  3 4)
       Consider the matrix A =  (5 0  6 0)
                                (0 0  7 8)
                                (0 0  9 9)

       symbolically the Ellpack format can be written as

            (2 3 4 |)           (0 2 3 |)
       v =  (5 6 0 |)  colidx = (0 2 2 |)
            --------            ---------
            (7 8 |)             (2 3 |)
            (9 9 |)             (2 3 |)

        The data for 2 contiguous rows of the matrix are stored together (in column-major format) (with any left-over rows handled as a special case).
        Any of the rows in a slice fewer columns than the rest of the slice (row 1 above) are padded with a previous valid column in their "extra" colidx[] locations and
        zeros in their "extra" v locations so that the matrix operations do not need special code to handle different length rows within the 2 rows in a slice.

        The one-dimensional representation of v used in the code is (2 5 3 6 4 0 7 9 8 9)  and for colidx is (0 0 2 2 3 2 2 2 3 3)

See `MatMult_SeqSELL()` for how this format is used with the SIMD operations to achieve high performance.

## References

[ZMRS18]

Hong Zhang, Richard T. Mills, Karl Rupp, and Barry F. Smith. Vectorized parallel sparse matrix-vector multiplication in PETSc using AVX-512. In Proceedings of the 47th International Conference on Parallel Processing. 2018.

## See Also

`Mat`, `MatCreateSeqSELL()`, `MatCreateSeqAIJ()`, `MatCreateSELL()`, `MATSEQSELL`, `MATMPISELL`, `MATSEQAIJ`, `MATMPIAIJ`, `MATAIJ`

## Level

beginner

## Location

src/mat/impls/sell/seq/sell.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages