[petsc-dev] MatPinToCPU
Mark Adams
mfadams at lbl.gov
Tue Jul 23 19:32:34 CDT 2019
>
>
> What are the symptoms of it not working? Does it appear to be still
> copying the matrices to the GPU? then running the functions on the GPU?
>
>
The object is dispatching the CUDA mat-vec etc.
I suspect the pinning is incompletely done for CUDA (and MPIOpenCL)
> matrices.
>
>
Yes, git grep MatPinToCPU shows stuff for ViennaCL but not CUDA.
I guess I can add something like this below. Do we need to set the device
methods? They are already set when this method is set, right?
> We need the equivalent of
>
> static PetscErrorCode MatPinToCPU_SeqAIJViennaCL(Mat A,PetscBool flg)
> {
> PetscFunctionBegin;
> A->pinnedtocpu = flg;
> if (flg) {
> A->ops->mult = MatMult_SeqAIJ;
> A->ops->multadd = MatMultAdd_SeqAIJ;
> A->ops->assemblyend = MatAssemblyEnd_SeqAIJ;
> A->ops->duplicate = MatDuplicate_SeqAIJ;
> } else {
> A->ops->mult = MatMult_SeqAIJViennaCL;
> A->ops->multadd = MatMultAdd_SeqAIJViennaCL;
> A->ops->assemblyend = MatAssemblyEnd_SeqAIJViennaCL;
> A->ops->destroy = MatDestroy_SeqAIJViennaCL;
> A->ops->duplicate = MatDuplicate_SeqAIJViennaCL;
> }
> PetscFunctionReturn(0);
> }
>
> for MPIViennaCL and MPISeqAIJ Cusparse but it doesn't look like it has
> been written yet.
>
>
> >
> > It does not seem to work. It does not look like CUDA has an
> MatCreateVecs. Should I add one and copy this flag over?
>
> We do need this function. But I don't see how it relates to pinning.
> When the matrix is pinned to the CPU we want it to create CPU vectors which
> I assume it does.
>
>
> >
> > Mark
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190723/1707a63f/attachment.html>
More information about the petsc-dev
mailing list