<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
  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?<br>
<br></blockquote><div><br></div><div>The object is dispatching the CUDA mat-vec etc.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  I suspect the pinning is incompletely done for CUDA (and MPIOpenCL) matrices. <br>
<br></blockquote><div><br></div><div>Yes, git grep MatPinToCPU shows stuff for ViennaCL but not CUDA.<br></div><div><br></div><div>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?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
We need the equivalent of <br>
<br>
static PetscErrorCode MatPinToCPU_SeqAIJViennaCL(Mat A,PetscBool flg)<br>
{<br>
  PetscFunctionBegin;<br>
  A->pinnedtocpu = flg;<br>
  if (flg) {<br>
    A->ops->mult           = MatMult_SeqAIJ;<br>
    A->ops->multadd        = MatMultAdd_SeqAIJ;<br>
    A->ops->assemblyend    = MatAssemblyEnd_SeqAIJ;<br>
    A->ops->duplicate      = MatDuplicate_SeqAIJ;<br>
  } else {<br>
    A->ops->mult           = MatMult_SeqAIJViennaCL;<br>
    A->ops->multadd        = MatMultAdd_SeqAIJViennaCL;<br>
    A->ops->assemblyend    = MatAssemblyEnd_SeqAIJViennaCL;<br>
    A->ops->destroy        = MatDestroy_SeqAIJViennaCL;<br>
    A->ops->duplicate      = MatDuplicate_SeqAIJViennaCL;<br>
  }<br>
  PetscFunctionReturn(0);<br>
}<br>
<br>
for MPIViennaCL and MPISeqAIJ Cusparse but it doesn't look like it has been written yet. <br>
<br>
<br>
> <br>
> It does not seem to work. It does not look like CUDA has an MatCreateVecs. Should I add one and copy this flag over?<br>
<br>
   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.<br>
<br>
<br>
> <br>
> Mark<br>
<br>
</blockquote></div></div>