I still do not think it would work with ghosted Vecs, because those demand that 
the shared particles are at the end of the Vec, but Swarm has no idea about 
this division.

That’s my concern. What I’m doing is a MD code, so I need access to ghost 
values at vectors such as position to evaluate the potential.

Miguel

On Jan 19, 2026, at 3:30 PM, Matthew Knepley <[email protected]> wrote:

On Mon, Jan 19, 2026 at 7:56 AM MIGUEL MOLINOS PEREZ 
<[email protected]<mailto:[email protected]>> wrote:

Dear all,

I have a question about using DMSwarm data with Kokkos-enabled vectors.

My particle data (including ghost particles) are stored in a DMSwarm and for 
solver purposes I generate PETSc vectors using VecCreateGhostWithArray. I would 
like to use VecMPIKOKKOS for MPI+GPU computations. Am I correct that DMSwarm 
field memory cannot be directly wrapped into a VecMPIKOKKOS using 
VecCreateGhostWithArray or VecPlaceArray? Any idea on how to proceed?

You can use

  
https://urldefense.us/v3/__https://petsc.org/main/manualpages/DMSwarm/DMSwarmCreateGlobalVectorFromField/__;!!G_uCfscf7eWS!bQ47FGy_iSJU8ODIRPz-W5bpnPyoL-_CCMluodw_v8xbtgX1pbylov4V0-B3eea4bFiyEKjKMQJyYf-t3YvaIQ$
 

if you have a single field, which is no-copy. However, if you want multiple 
fields in the Vec, then you need a copy. We
do this in our PIC code, and the copy time is in the noise, so I would measure 
it before deciding you do not want a copy.

I still do not think it would work with ghosted Vecs, because those demand that 
the shared particles are at the end of the Vec, but Swarm has no idea about 
this division.

  Thanks,

      Matt


Thanks in advance.

Best,

Miguel


--
What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!bQ47FGy_iSJU8ODIRPz-W5bpnPyoL-_CCMluodw_v8xbtgX1pbylov4V0-B3eea4bFiyEKjKMQJyYf-gbn1yfA$
 
<https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!bQ47FGy_iSJU8ODIRPz-W5bpnPyoL-_CCMluodw_v8xbtgX1pbylov4V0-B3eea4bFiyEKjKMQJyYf85ClEsmw$
 >

Reply via email to