I saw "Mat" also ... we don't have device set values for vectors, I am pretty sure. But it is not hard to do for setting local data. I don't see an easy way to do off-processor data ... we have not gotten to this.
See https://petsc.org/main/docs/manualpages/Vec/VecGetArrayWriteAndMemType.html You get a pointer to the raw data and pass that down to your device functions. If it is a device vector it will give you the device data. You then add to it yourself in your kernel. On Thu, Mar 17, 2022 at 5:44 PM Jed Brown <[email protected]> wrote: > The question is about vectors. I think it will work, but haven't tested. > > Barry Smith <[email protected]> writes: > > > We seem to be emphasizing using MatSetValuesCOO() for GPUs (can also > be for CPUs); in the main branch you can find a simple example in > src/mat/tutorials/ex18.c which demonstrates its use. > > > > Barry > > > > > >> On Mar 17, 2022, at 4:46 PM, Sajid Ali Syed <[email protected]> wrote: > >> > >> Hi PETSc-developers, > >> > >> Is it possible to use VecSetValues with distributed-memory CUDA & > Kokkos vectors from the device, i.e. can I call VecSetValues with GPU > memory pointers and expect PETSc to figure out how to stash on the device > it until I call VecAssemblyBegin (at which point PETSc could use GPU-aware > MPI to populate off-process values) ? > >> > >> If this is not currently supported, is supporting this on the roadmap? > Thanks in advance! > >> > >> Thank You, > >> Sajid Ali (he/him) | Research Associate > >> Scientific Computing Division > >> Fermi National Accelerator Laboratory > >> s-sajid-ali.github.io <http://s-sajid-ali.github.io/> >
