<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I merged the fix for MatCreateVecs into next <div><br></div><div><a href="https://bitbucket.org/petsc/petsc/commits/248f4e93fc838f918a85fe2b6cf6cc3494943f33">https://bitbucket.org/petsc/petsc/commits/248f4e93fc838f918a85fe2b6cf6cc3494943f33</a></div><div><br></div><div>If we agree on MatGetDefaultVecType, I will create a new branch for it </div><div>Maybe we don’t need a new function, but just store the default vec type into Mat (defaulting to VECSTANDARD) and then have MPICUSP and others override the default when their are instantiated. What do you think?</div><div><br></div><div>Stefano</div><div><br></div><div><div><div>On Jun 25, 2015, at 8:10 PM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Yes. With this approach, only MatNest will need a specialized getvecs operation and we can get rid of the others.<br><br>On Jun 25, 2015, at 7:06 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br><br><blockquote type="cite"><br><blockquote type="cite">On Jun 25, 2015, at 12:32 PM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> wrote:<br><br>pushed a fix<br><a href="https://bitbucket.org/petsc/petsc/commits/ae287a2e7a141494f7c41f9dd537addb63b556e3">https://bitbucket.org/petsc/petsc/commits/ae287a2e7a141494f7c41f9dd537addb63b556e3</a><br><br>However, it appears that the functions below for CUSP, CUSPARSE and VIENNACL are mere copies of the interface.<br>What about defining the type of the Vec in the interface and get rid of these?<br></blockquote><br> What do you mean by "the type of Vec in the interface"? Do you mean have a method such as<br><br>MatGetDefaultVecType(mat,const VecType *vtype);<br><br>that defines the default vector type compatible with the matrix? So we could have <br><br>#undef __FUNCT__<br>#define __FUNCT__ "MatCreateVecs_Default"<br>PetscErrorCode MatCreateVecs_Default(Mat mat,Vec *right,Vec *left)<br>{<br> PetscErrorCode ierr;<br> PetscInt rbs,cbs;<br> const VecType vtype;<br><br> PetscFunctionBegin;<br> ierr = MatGetDefaultVecType(mat,&vtype);CHKERRQ(ierr);<br> ierr = MatGetBlockSizes(mat,&rbs,&cbs);CHKERRQ(ierr);<br> if (right) {<br> ierr = VecCreate(PetscObjectComm((PetscObject)mat),right);CHKERRQ(ierr);<br> ierr = VecSetSizes(*right,mat->cmap->n,PETSC_DETERMINE);CHKERRQ(ierr);<br> ierr = VecSetBlockSize(*right,cbs);CHKERRQ(ierr);<br> ierr = VecSetType(*right,vtype);CHKERRQ(ierr);<br> ierr = VecSetLayout(*right,mat->cmap);CHKERRQ(ierr);<br> }<br> if (left) {<br> ierr = VecCreate(PetscObjectComm((PetscObject)mat),left);CHKERRQ(ierr);<br> ierr = VecSetSizes(*left,mat->rmap->n,PETSC_DETERMINE);CHKERRQ(ierr);<br> ierr = VecSetBlockSize(*left,rbs);CHKERRQ(ierr);<br> ierr = VecSetType(*left,vtype);CHKERRQ(ierr);<br> ierr = VecSetLayout(*left,mat->rmap);CHKERRQ(ierr);<br> }<br> PetscFunctionReturn(0);<br>}<br><br>or something else?<br><br> Barry<br><br><br><blockquote type="cite"><br>src/mat/impls/aij/mpi/mpicusp/mpiaijcusp.cu: A->ops->getvecs = MatCreateVecs_MPIAIJCUSP;<br>src/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.cu: A->ops->getvecs = MatCreateVecs_MPIAIJCUSPARSE;<br>src/mat/impls/aij/mpi/mpiviennacl/mpiaijviennacl.cxx: A->ops->getvecs = MatCreateVecs_MPIAIJViennaCL;<br>src/mat/impls/aij/seq/seqcusp/aijcusp.cu: B->ops->getvecs = MatCreateVecs_SeqAIJCUSP;<br>src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu: B->ops->getvecs = MatCreateVecs_SeqAIJCUSPARSE;<br>src/mat/impls/aij/seq/seqviennacl/aijviennacl.cxx: B->ops->getvecs = MatCreateVecs_SeqAIJViennaCL;<br><br>Stefano<br><br><br>On Jun 25, 2015, at 4:34 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br><br><blockquote type="cite"><br>I think you are right, go ahead and make a pull request or send a patch<br><br>Barry<br><br><blockquote type="cite">On Jun 25, 2015, at 9:43 AM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> wrote:<br><br>Why the current interface in MatCreateVecs requires that a matrix has been already either allocated or setup ?<br>Shouldn’t be enough to check if the layout has been already setup?<br><br>Stefano<br><br></blockquote><br></blockquote><br></blockquote><br></blockquote><br></blockquote></div><br></div></body></html>