On Mon, Jan 19, 2026 at 12:17 PM MIGUEL MOLINOS PEREZ <[email protected]>
wrote:
> 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.
>
That would work, just not the naie local-to-global maps.
Thanks,
Matt
> 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]>
> 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!a_jPC7NylpspVjXQgq9aDBNQ_XOXmSByj-wvc6qzC4vcK8m5RpIj3HzaoAz9upKM3JB97V5HvtwTpdPcz1u9$
>
>
> 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!a_jPC7NylpspVjXQgq9aDBNQ_XOXmSByj-wvc6qzC4vcK8m5RpIj3HzaoAz9upKM3JB97V5HvtwTpQM9O25F$
>
> <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!a_jPC7NylpspVjXQgq9aDBNQ_XOXmSByj-wvc6qzC4vcK8m5RpIj3HzaoAz9upKM3JB97V5HvtwTpalO8rtz$
> >
>
>
>
--
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!a_jPC7NylpspVjXQgq9aDBNQ_XOXmSByj-wvc6qzC4vcK8m5RpIj3HzaoAz9upKM3JB97V5HvtwTpQM9O25F$
<https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!a_jPC7NylpspVjXQgq9aDBNQ_XOXmSByj-wvc6qzC4vcK8m5RpIj3HzaoAz9upKM3JB97V5HvtwTpalO8rtz$
>