[petsc-dev] Backend independent VecGetArray for GPUs

Lisandro Dalcin dalcinl at gmail.com
Tue Oct 21 13:25:24 CDT 2014


On 20 October 2014 08:06, Karl Rupp <rupp at iue.tuwien.ac.at> wrote:
> 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.


-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459



More information about the petsc-dev mailing list