<div dir="ltr">Thanks everyone for the help! I will try that. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 10, 2022 at 8:54 AM Latham, Robert J. <<a href="mailto:robl@mcs.anl.gov">robl@mcs.anl.gov</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">On Mon, 2022-05-09 at 12:51 -0700, Pascale Garaud wrote:<br>
> Is there a best way to do that efficiently? The code currently uses a<br>
> collective PUT_VAR_ALL to write the 3D dataset to file, but that<br>
> would not work for the slice (and hangs when I try). <br>
<br>
These collective I/O calls require all processes to participate in the call... but not all processes need to have data.<br>
<br>
For proceses that do not have any data, you can set the 'count': Consider the common "put_vara_float_all" call for one example:<br>
<br>
int ncmpi_put_vara_float_all(int ncid, int varid, const MPI_Offset *start,<br>
const MPI_Offset *count, const float *op);<br>
<br>
that 'count' parameter can just be an N dimensional array of 0 for the processes with no data<br>
<br>
> I could just copy the whole data for the slice into a single<br>
> processor, and then do an "independent" write for that processor, but<br>
> that doesn't seem to be very efficient. <br>
<br>
indeed! please don't do this<br>
<br>
> I tried to understand how to use IPUT instead, but I am very confused<br>
> about the syntax / procedure, especially given that all of the<br>
> examples I have seen end up using all processors for the write. <br>
<br>
IPUT is a fun optimization. Once you get the hang of the "blocking" versions, revisit the "non-blocking" routines, especially if you have writes to multiple variables.<br>
<br>
==rob<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">--------------------------------------------------------------------------------------------------------------<div>Pascale Garaud</div><div>Professor in Applied Mathematics</div><div>UC Santa Cruz, California</div><div>(831)-459-1055</div><div>--------------------------------------------------------------------------------------------------------------</div></div></div>