[petsc-dev] Backend independent VecGetArray for GPUs

Karl Rupp rupp at iue.tuwien.ac.at
Fri Oct 24 01:56:31 CDT 2014


Hi,

 >> I pushed a function for obtaining the CUDA pointer from a CUSP 
vector here:
>> https://bitbucket.org/petsc/petsc/commits/d831094ec27070ea54a249045841367f8aab0976
>
> Karl, I think this is half-way to meed our needs, and the missing bits
> are related to out-of-sync CPU/GPU buffers. To improve the
> implementation and make it useful for petsc4py (and other plain-C
> consumers), I would suggest the following:
>
> 1) Implement VecCUSPGetCUDAArray() by calling
> VecCUSPGetArrayReadWrite(), this automatically handles calling
> VecCUSPCopyToGPU()
>
> 2) I think we still need a VecCUSPRestoreCUDAArray(), you can
> implement it by basically calling
> VecCUSPRestoreArrayReadWrite(vec,NULL) to update the valid_GPU_array
> flag and the internal object state.

Both 1) and 2) are now pushed to the feature branch. Any feedback 
appreciated :-)

Best regards,
Karli




More information about the petsc-dev mailing list