[petsc-dev] Backend independent VecGetArray for GPUs

Lisandro Dalcin dalcinl at gmail.com
Mon Oct 27 05:49:47 CDT 2014


On 27 October 2014 04:13, Ashwin Srinath <ashwinsrnth at gmail.com> wrote:
> Matthew, I think this fixes the scalar issue:
>
> https://github.com/ashwinsrnth/petsc-pycuda/commit/145b5f138ecbdddf3c8a2ab4caa86e132ece347f
>

OK, this is my proposal. We should split this code in two parts:

1) petsc4py will provide a method Vec.getCUDAAddress() that will
return a plain Python integer (and a corresponding
restoreCUDAAddress()). Any other name to suggest? Using "CUDAArray"
would be a bit misleading in Python land.

2) With the address as a Python Integer users can use PyCUDA to build
an GPUArray instance by themselves in pure Python code.

Rationale: I do not want to introduce a dependency on PyCUDA in
petsc4py. Moreover, users could potentially use the addresses with
other tools (like ctypes or cffi, or SWIG wrappers that pass GPU
pointers around).

Does it make sense for all of you?

-- 
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