Hector,

   You asked at just the right time. Mark Adams has started to implement some 
code to do this https://gitlab.com/petsc/petsc/-/merge_requests/3137 
<https://gitlab.com/petsc/petsc/-/merge_requests/3137> it is now in the PETSc 
master branch. It is preliminary and not yet well documented but hopefully if 
you read through the MR (above) it will give you the main ideas. 

   Please feel free to ask questions on this topic at GitLab or on 
[email protected] <mailto:[email protected]> we are eager to have users 
for this material and improve it to make it practical and straightforward.


  Barry


> On Sep 30, 2020, at 9:49 AM, Héctor Barreiro Cabrera <[email protected]> 
> wrote:
> 
> Greetings fellow PETSc users!
> 
> I have recently started working on a project that requires assembling and 
> solving a large sparse linear system directly on the GPU using CUDA. I have 
> just discovered that PETSc has support for building and solving such a system 
> through cuSparse (MatSeqAICUSPARSE), which is quite cool because this opens 
> up the possibility of using PETSc's awesome functionalities.
> 
> However, I have not been able to find information about how (or even if it is 
> possible) to assemble the matrix from data stored in device memory. From the 
> documentation, it seems that vectors (VecSeqCUDA) expose the raw device 
> pointer through VecCUDAGetArrayRead and VecCUDAGetArrayWrite functions which 
> I could use to update the systems' RHS vector, but I couldn't find anything 
> alike for matrices. Is there anything equivalent?
> 
> Ideally I would like to generate all the assembly information from a kernel, 
> avoiding any data synchronization with the host (except maybe updating the 
> pointers). Is this even possible?
> 
> Thank you very much for your help!
> 
> Greetings,
> Hector Barreiro

Reply via email to