"double spmvm" kernel

Issue #265 new
Jonas Thies
created an issue

For two matrices A and B with the same local permutation, compute y_j = alphay_j + beta(A+sigma[j]B)x_j

This operation is needed for generalized EVP and can save some loads of x if the pattern of B is a subset of the pattern of B (which is typically the case)

Comments (6)

  1. Jonas Thies reporter

    doing y=(alphaA+etaB)*x requires certain conditions on the two matrices so that it can be done with a single "halo Import". I think the context must be the defining data structure here: two sparsemats who share the same context can be combined in such a kernel. The context defines the halo Import as the union of all entries required by A and B. When constructing the matrices, the column indices must be determined by the context. A first Approach would be

    • create A without a context
    • obtain the context from A and pass it to the construction of B
    • return an error code if the B would require more/different halo elements thann the context provides. Do not re-initialize the communication in the context here.

    in a next step we could provide an Interface to pass in two row functions and create the context required for the two resulting matrices A and B to be compatible in the above sense.

  2. Martin Galgon

    Somewhat related, while the above operation can be decomposed into two separate matrix multiplications, compatibility of x_j with both, A and B would be required. The same issue currently hits me with our Rayleigh-Ritz procedure where both matrices have to be multiplied with the same subspace basis.

    This is a showstopper for any application where matrices with varying sparsity patterns are involved. I think the priority should be increased.

    Currently, grabbing the context from the matrix with more complex structure and feeding it to the creation routine of the matrix with less complex structure (in my case even a subset, but that will not always be the case) just crashes.

    I'll probably work around this by injecting some explicit zeros for now, since both matrices are read from file, but this is not a solution I would be happy with in the long run.

    @Dominik Ernst I'll link you since you seem to have inherited Moritz' position.

  3. Jonas Thies reporter

    Hi @Martin Galgon, there is a corresponding kernel in the phist Interface that calls two ghost spmvms as a fallback (fused_spmv_pair). You need to create the second Matrix with the context of the first. I presently force sigma=1 in phist+ghost/SELL-C-sigma because I couldn't get the matrices consistently ordered otherwise. We routinely solve generalized EVP with this kernel and it works fine. If you want to update your own ghost Interface you can look at the phist/src/kernels/ghost/kernels_def.hpp, functions sparseMat_createFromRowFuncAndContext and phist/src/kernels/common/kernels_no_fused_spmv_pair.cpp (the fallback implementation for the missing kernel). This ticket is purely for Performance reasons (you can sqve Memory and Network traffic if the matrices have similar sparsity Patterns).

  4. Log in to comment