[petsc-dev] Interface for supporting MKL sparse inspector-executor model?
Barry Smith
bsmith at mcs.anl.gov
Mon Feb 13 21:44:48 CST 2017
Richard,
My gut feeling is that the "hint" based system should be used by default, who uses linear stuff only once (only people not doing real problems :-)). So you could just provide a single flag to say don't use hints, useful for numerical comparisons. (This is all experimental, stuff anyways and will evolve).
Barry
> On Feb 13, 2017, at 9:33 PM, Richard Mills <richardtmills at gmail.com> wrote:
>
> Hi Barry,
>
> I was thinking along those lines when I first considered putting together an MKL-based matrix class, but I decided that I wanted to be able to support the standard MKL sparse BLAS routines as well as the inspector-executor model ones. My plan was to add some logic to check to see if a "matrix optimization" phase has been done, and use the inspector-executor routines (where possible) if so. Maybe it would be better to have two matrix classes (one for the standard MKL sparse BLAS, the other using the inspector-executor stuff), but that seemed to be adding more classes than necessary (recognizing that we also need a BAIJMKL class for the block CSR case).
>
> Unfortunately, I note that, in my very limited experimentation so far, the standard sparse BLAS routines from MKL are slightly slower than the PETSc-provided kernels. Which is good for PETSc, but bad for showing any utility of my hacking on this front. =)
>
> --Richard
>
> On Mon, Feb 13, 2017 at 5:48 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> At this time I would hide the hints and just set reasonable ones and then have the MatAssemblyEnd for the new class provide the default hints and then call the optimize, but keep all of that stuff hidden from the PETSc API.
>
> Barry
>
> > On Feb 13, 2017, at 6:03 PM, Richard Mills <richardtmills at gmail.com> wrote:
> >
> > Hi All,
> >
> > I've finally gotten around to putting together a matrix class (called AIJMKL for now) that inherits from AIJ but uses some methods provided by Intel MKL. One thing I'd like to support is the "SpMV 2" sparse inspector-executor routines, detailed in the MKL reference manual starting at
> >
> > https://software.intel.com/en-us/node/590105
> >
> > The basic usage model is this: You set some hints (see the functions at https://software.intel.com/en-us/node/590120) about how a matrix you have is going to be used, e.g., you call 'mkl_sparse_mv_hint' to set a guess about the number of upcoming matrix-vector multiplications that will be performed with this matrix. When you've set various hints, then you call 'mkl_sparse_optimize' to start an analysis operation in which MKL examines the sparsity structure and maybe does some internal things for optimizations. Then you can then apply mkl_sparse_d_mv to perform mat-vec operations.
> >
> > I am wondering what a proper way to provide a PETSc interface to these is. I can think of a few ways to do this. The most straightforward way is probably.
> >
> > * Add MatAIJMKLSetMVHint(), MatAIJMKLSetMMHint(), etc.
> > * Add MatAIJMKLOptimize() call.
> >
> > I also will be adding a BAIJMKL class for BAIJ matrices, so I'd duplicate these. Does this option sound OK? Or do others think I should do something more general?
> >
> > --Richard
>
>
More information about the petsc-dev
mailing list