<html><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;">Please always keep the list in copy.<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 13 Jun 2025, at 11:55 AM, SCOTTO Alexandre <alexandre.scotto@irt-saintexupery.com> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span lang="FR" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Hello Pierre,<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span lang="FR" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Thank you for you answer.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I think I see the subtlety here, and it makes realized that I have not properly understood yet how index sets should be manipulated, in particular whether the provided indices are local or global.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">It seems that this code solves my issue:<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">index_set_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(78, 201, 176);">PETSc</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.IS().createStride(<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">   <span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.local_size,<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">first</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.owner_range[</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">0</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">],<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">step</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">index_set_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(78, 201, 176);">PETSc</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.IS().createStride(<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">   <span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.local_size,<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">first</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.owner_range[</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">0</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">],<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">step</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">scatter</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"><span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(78, 201, 176);">PETSc</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.Scatter().create(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">index_set_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">index_set_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">scatter</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.scatter(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="Apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">addv</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(86, 156, 214);">True</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Do you think that this is a decent manner of transfering the whole content of a vector to another of same dimension?<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I have a lot of this scattering to perform so if you have a better recommendation I would be pleased.</span></div></div></div></blockquote><div><br></div><div>The “scattering” you are defining and using is basically a VecAXPY(), so using a scatter for such an operation is definitely _not_ the way to go.</div><div><br></div><div>Thanks,</div><div>Pierre</div><br><blockquote type="cite"><div><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Best regards,<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Alexandre.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(225, 225, 225) currentcolor currentcolor; border-image: none; padding: 3pt 0cm 0cm;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><b><span lang="FR" style="font-size: 11pt; font-family: Calibri, sans-serif;">De :</span></b><span lang="FR" style="font-size: 11pt; font-family: Calibri, sans-serif;"><span class="Apple-converted-space"> </span>Pierre Jolivet <pierre@joliv.et><br><b>Envoyé :</b><span class="Apple-converted-space"> </span>vendredi 13 juin 2025 11:43<br><b>À :</b><span class="Apple-converted-space"> </span>SCOTTO Alexandre <alexandre.scotto@irt-saintexupery.com><br><b>Cc :</b><span class="Apple-converted-space"> </span>petsc-users@mcs.anl.gov<br><b>Objet :</b><span class="Apple-converted-space"> </span>Re: [petsc-users] Insertion mode for Scatter<o:p></o:p></span></div></div></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><o:p> </o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><o:p> </o:p></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><br><br><o:p></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;">On 13 Jun 2025, at 11:32 AM, SCOTTO Alexandre via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" style="color: rgb(149, 79, 114); text-decoration: underline;">petsc-users@mcs.anl.gov</a>> wrote:<o:p></o:p></div></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><o:p> </o:p></div><div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span lang="FR" style="font-size: 11pt; font-family: Calibri, sans-serif;">Dear PETSc community,</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span lang="FR" style="font-size: 11pt; font-family: Calibri, sans-serif;"> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">I am currently struggling with the ADD_VALUE mode of the Scatter object. Here is a simple piece of (Python) code to illustrate the issue:<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(78, 201, 176);">PETSc</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.Vec().createMPI(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">size</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">10</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.shift(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">2.0</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(78, 201, 176);">PETSc</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.Vec().createMPI(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">size</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">10</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.shift(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">1.0</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">index_set</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(78, 201, 176);">PETSc</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.IS().createStride(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">10</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">step</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(181, 206, 168);">1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">scatter</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(78, 201, 176);">PETSc</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.Scatter().create(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">index_set</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">index_set</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif; line-height: 12pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">scatter</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">.scatter(</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_1</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">vec_2</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(156, 220, 254);">addv</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(212, 212, 212);">=</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(86, 156, 214);">True</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(204, 204, 204);">)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Vectors vec_1 and vec_2 are respectively filled-in with 2.0 and 1.0. After the scattering, I would expect to have in vec_2 the sum of the values initially in vec_2 (that is  1.0) plus the values coming from vec_1 (that is 2.0).<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">But instead of having vec_2 filled in with 3.0 it is filled-in with 9.0. My understanding is that the number of processes (here 4 processes) plays a role since 9.0 = 1.0 (initial value) + 2.0 (values coming from vec_1) x 4 (number of processes).<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Is there a way to have simply 3.0 as a result?<o:p></o:p></span></div></div></div></blockquote><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><o:p> </o:p></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;">With the index_set you are supplying, you are basically saying that each process should scatter the complete vector (not just its local portion).<o:p></o:p></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;">If you use an index_set which does not induce communication (e.g., of size the local size of the Vec and with the same start as the first local row of the Vec), then you’ll get 3.0 as a result.<o:p></o:p></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><o:p> </o:p></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;">Thanks,<o:p></o:p></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;">Pierre<o:p></o:p></div></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><br><br><o:p></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Hoping to have been clear enough, best regards,<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: "Times New Roman", serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Alexandre.</span></div></div></div></blockquote></div></div></div></blockquote></div><br></body></html>