<html aria-label="message body">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div><font color="#000000">Understood! </font></div>
<div><span style="color: rgb(0, 0, 0);"><br>
</span></div>
<div><span style="color: rgb(0, 0, 0);">I think I can make it work because the way I create ghost particles in my code is with:</span></div>
<div><font color="#000000"><span style="background-color: rgb(255, 255, 255);"><span style="white-space: pre;">(i)DMSwarmAddNPoints, </span></span></font></div>
<div><font color="#000000"><span style="background-color: rgb(255, 255, 255);"><span style="white-space: pre;">(ii) two auxiliar
</span><span style="caret-color: rgb(99, 99, 36); white-space: pre;">variables named idx_ghost and
</span></span><span style="white-space: pre; background-color: rgb(255, 255, 255);">rank_ghost, </span></font></div>
<div><font color="#000000"><span style="white-space: pre; background-color: rgb(255, 255, 255);">(iii) and </span><span style="white-space: pre; background-color: rgb(255, 255, 255);">DMSWARM_MIGRATE_BASIC for the migration. </span></font></div>
<div><font color="#000000"><span style="white-space: pre; background-color: rgb(255, 255, 255);"><br>
</span></font></div>
<div>
<div><font color="#000000">In summary, shared particles are indeed at the end of the Vec. </font></div>
</div>
<div><br>
</div>
<div><font color="#000000"><span style="white-space: pre; background-color: rgb(255, 255, 255);">Actually you helped me with this hack months ago :-).</span><span style="white-space: pre; background-color: rgb(255, 255, 255);">
</span></font></div>
<div><br>
</div>
<div><font color="#000000">I think I can use the code you mentioned as</font><span style="color: rgb(0, 0, 0);"> an inspiration… let's see!</span></div>
<font color="#000000">
<div><font color="#000000"><br>
</font></div>
Miguel</font><br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On Jan 19, 2026, at 7:26 PM, Matthew Knepley <knepley@gmail.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">The code is the right place to look. For example
<div><br>
</div>
<div> <a href="https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/swarm/swarm.c?ref_type=heads*L307__;Iw!!G_uCfscf7eWS!dB-a-Zi9Mzr_7h5tsaTEWhXfpl8M-dAWMu3CsQ4axsXQNCXMO3XGub6G8G8OaSjDdg5zakXL6G1r8et7--tHHA$">https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/swarm/swarm.c?ref_type=heads#L307</a></div>
<div><br>
</div>
<div>So the Vec will get the right type. This means that when the initial data comes in on the host, it will be copied to the device when we execute an operation.</div>
<div><br>
</div>
<div>We (really Joe) are working on an update that allows swarm data to be held on the device.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">On Mon, Jan 19, 2026 at 1:22 PM MIGUEL MOLINOS PEREZ <<a href="mailto:mmolinos@us.es">mmolinos@us.es</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>I’ll check the documentation more carefully to see if I can find this.
<div><br>
</div>
<div>Thanks,</div>
<div>Miguel<br id="m_3500957309135574339lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On Jan 19, 2026, at 6:42 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-line:none;text-decoration-style:solid">
<div dir="ltr">On Mon, Jan 19, 2026 at 12:19 PM MIGUEL MOLINOS PEREZ <<a href="mailto:mmolinos@us.es" target="_blank">mmolinos@us.es</a>> wrote:</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>I don’t think so because DMSwarm data is allocated on host. This is right Matt?</div>
</blockquote>
<div><br>
</div>
<div>I believe there is code in there to move it if you give a device type.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>Thanks, </div>
<div>Miguel<br id="m_3500957309135574339m_3779122599512868894lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On Jan 19, 2026, at 5:44 PM, Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div>With VecCreateGhostWithArray, do you already have the array ready on device?</div>
<div><br>
</div>
<div>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">--Junchao Zhang</div>
</div>
</div>
<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Jan 19, 2026 at 6:56 AM MIGUEL MOLINOS PEREZ <<a href="mailto:mmolinos@us.es" target="_blank">mmolinos@us.es</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Dear all,</p>
<p>I have a question about using DMSwarm data with Kokkos-enabled vectors.</p>
<p>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?</p>
<p>Thanks in advance.</p>
<p>Best,</p>
<p>Miguel</p>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span class="gmail_signature_prefix">--<span> </span></span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!dB-a-Zi9Mzr_7h5tsaTEWhXfpl8M-dAWMu3CsQ4axsXQNCXMO3XGub6G8G8OaSjDdg5zakXL6G1r8evBevKFTQ$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!dB-a-Zi9Mzr_7h5tsaTEWhXfpl8M-dAWMu3CsQ4axsXQNCXMO3XGub6G8G8OaSjDdg5zakXL6G1r8evBevKFTQ$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</body>
</html>