<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;">
<br>
<div>I can see the file header size of 20620 bytes. Because all attributes are stored</div>
<div>in the header, the cost of writing them should not be an issue. I also see no gap</div>
<div>between 2 consecutive variables, which is good, meaning the write requests made</div>
<div>by MPI-IO will be contiguous.
<div><br>
</div>
<div>If the call sequence of PnetCDF APIs is the same between pioperf and cesm, then</div>
<div>the performance should be similarly. Can you check the Lustre striping settings</div>
<div>of the 2 output files, using command "lfs getstripe"?</div>
<div><br>
</div>
<div>If you set any MPI-IO hints, they can also play a role in performance.</div>
<div>See the example in PnetCDF for how to dump all hints (function print_info().)</div>
<div><a href="https://github.com/Parallel-NetCDF/PnetCDF/blob/master/examples/C/get_info.c">https://github.com/Parallel-NetCDF/PnetCDF/blob/master/examples/C/get_info.c</a></div>
<div><br>
<div>If all the above checked out right, then using Darshan should reveal more information.</div>
<div><br>
</div>
<div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">BTW, what PnetCDF version is being used?</div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br>
</div>
</div>
<div>A comment about PIOc_put_att_tc.</div>
<div>* calling MPI_Bcast for checking the error code may not be necessary. PnetCDF does such</div>
<div> check and all metadata consistency check at ncmpi_enddef. If the number of variables</div>
<div> and their attributes are high, then calling lots of MPI_Bcast can be expensive.</div>
<div>
<div>https://github.com/NCAR/ParallelIO/blob/f45ba898bec31e6cd662ac41f43e0cff14f928b2/src/clib/pio_getput_int.c#L213</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div>Wei-keng</div>
<div><br>
<blockquote type="cite">
<div>On Aug 4, 2023, at 12:32 PM, Jim Edwards <jedwards@ucar.edu> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
Yes, _enddef is called only once. <br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<a href="https://urldefense.com/v3/__https://github.com/NCAR/ParallelIO/blob/main/src/clib/pio_getput_int.c*L128__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!Rb9IHCtwLvKBflvuPIGfD-peS-Hl1-epxN7yjpgkPoFWdSFS3DFGNkKhfb7WqrC_N0TBJDe-1bKKU_hw4F6HzDo$" target="_blank">Here</a> is
the code that writes attributes. <a href="https://urldefense.com/v3/__https://github.com/NCAR/ParallelIO/blob/main/src/clib/pio_darray_int.c*L661__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!Rb9IHCtwLvKBflvuPIGfD-peS-Hl1-epxN7yjpgkPoFWdSFS3DFGNkKhfb7WqrC_N0TBJDe-1bKKU_hwOC-tyLY$" target="_blank"> Here</a> is
where variables are written. <br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
ncoffsets -sg <a href="https://urldefense.com/v3/__http://pioperf.2-0256-1.nc__;!!Dq0X2DkFhyF93HkjWTBQKhk!Rb9IHCtwLvKBflvuPIGfD-peS-Hl1-epxN7yjpgkPoFWdSFS3DFGNkKhfb7WqrC_N0TBJDe-1bKKU_hwTlZDyu8$" target="_blank">pioperf.2-0256-1.nc</a><br>
netcdf <a href="https://urldefense.com/v3/__http://pioperf.2-0256-1.nc__;!!Dq0X2DkFhyF93HkjWTBQKhk!Rb9IHCtwLvKBflvuPIGfD-peS-Hl1-epxN7yjpgkPoFWdSFS3DFGNkKhfb7WqrC_N0TBJDe-1bKKU_hwTlZDyu8$" target="_blank">pioperf.2-0256-1.nc</a> {<br>
// file format: CDF-5<br>
<br>
file header:<br>
size = 7804 bytes<br>
extent = 8192 bytes<br>
<br>
dimensions:<br>
dim000001 = 10485762<br>
dim000002 = 58<br>
time = UNLIMITED // (1 currently)<br>
<br>
record variables:<br>
double vard0001(time, dim000002, dim000001):<br>
start file offset = 8192 (0th record)<br>
end file offset = 4865401760 (0th record)<br>
size in bytes = 4865393568 (of one record)<br>
gap from prev var = 388<br>
double vard0002(time, dim000002, dim000001):<br>
start file offset = 4865401760 (0th record)<br>
end file offset = 9730795328 (0th record)<br>
size in bytes = 4865393568 (of one record)<br>
gap from prev var = 0<br>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
snip</div>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
double vard0064(time, dim000002, dim000001):<br>
start file offset =306519802976 (0th record)<br>
end file offset =311385196544 (0th record)<br>
size in bytes = 4865393568 (of one record)<br>
gap from prev var = 0<br>
}</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
ncoffsets -sg run/<a href="https://urldefense.com/v3/__http://SMS_D_Ln9.mpasa7p5_mpasa7p5_mg17.QPC6.derecho_intel.cam-outfrq9s.20230726_094231_iz24v6.cam.h0.0001-01-01-03600.nc__;!!Dq0X2DkFhyF93HkjWTBQKhk!Rb9IHCtwLvKBflvuPIGfD-peS-Hl1-epxN7yjpgkPoFWdSFS3DFGNkKhfb7WqrC_N0TBJDe-1bKKU_hwdkm0FHQ$" target="_blank">SMS_D_Ln9.mpasa7p5_mpasa7p5_mg17.QPC6.derecho_intel.cam-outfrq9s.20230726_094231_iz24v6.cam.h0.0001-01-01-03600.nc</a><br>
netcdf run/<a href="https://urldefense.com/v3/__http://SMS_D_Ln9.mpasa7p5_mpasa7p5_mg17.QPC6.derecho_intel.cam-outfrq9s.20230726_094231_iz24v6.cam.h0.0001-01-01-03600.nc__;!!Dq0X2DkFhyF93HkjWTBQKhk!Rb9IHCtwLvKBflvuPIGfD-peS-Hl1-epxN7yjpgkPoFWdSFS3DFGNkKhfb7WqrC_N0TBJDe-1bKKU_hwdkm0FHQ$" target="_blank">SMS_D_Ln9.mpasa7p5_mpasa7p5_mg17.QPC6.derecho_intel.cam-outfrq9s.20230726_094231_iz24v6.cam.h0.0001-01-01-03600.nc</a> {<br>
// file format: CDF-5<br>
<br>
file header:<br>
size = 20620 bytes<br>
extent = 16777216 bytes<br>
<br>
dimensions:<br>
ncol = 10485762<br>
time = UNLIMITED // (1 currently)<br>
nbnd = 2<br>
chars = 8<br>
lev = 58<br>
ilev = 59<br>
<br>
fixed-size variables:<br>
double lat(ncol):<br>
start file offset = 16777216<br>
end file offset = 100663312<br>
size in bytes = 83886096<br>
gap from prev var = 16756596<br>
double lon(ncol):<br>
start file offset = 100663312<br>
end file offset = 184549408<br>
size in bytes = 83886096<br>
gap from prev var = 0<br>
</div>
</div>
</blockquote>
<div><br>
</div>
snip</div>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
int mdt:<br>
start file offset = 352322552<br>
end file offset = 352322556<br>
size in bytes = 4<br>
gap from prev var = 0<br>
<br>
record variables:<br>
double time(time):<br>
start file offset = 352322556 (0th record)<br>
end file offset = 352322564 (0th record)<br>
size in bytes = 8 (of one record)<br>
gap from prev var = 0<br>
int date(time):<br>
start file offset = 352322564 (0th record)<br>
end file offset = 352322568 (0th record)<br>
size in bytes = 4 (of one record)<br>
gap from prev var = 0<br>
</div>
</div>
</blockquote>
<div><br>
</div>
snip</div>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
double STEND_CLUBB(time, lev, ncol):<br>
start file offset =306872117448 (0th record)<br>
end file offset =311737511016 (0th record)<br>
size in bytes = 4865393568 (of one record)<br>
gap from prev var = 0<br>
}<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Aug 4, 2023 at 10:35 AM Wei-Keng Liao <<a href="mailto:wkliao@northwestern.edu" target="_blank">wkliao@northwestern.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div>Can you run command "ncoffsets -sg <a href="https://urldefense.com/v3/__http://file.nc__;!!Dq0X2DkFhyF93HkjWTBQKhk!Rb9IHCtwLvKBflvuPIGfD-peS-Hl1-epxN7yjpgkPoFWdSFS3DFGNkKhfb7WqrC_N0TBJDe-1bKKU_hwCtAtD9k$" target="_blank">file.nc</a>" that shows the sizes
of file header</div>
<div>and all variables? For the cesm case, is _enddef called only once?</div>
<div><br>
</div>
<div>Could you also point me to the program files that call PnetCDF APIs, including</div>
<div>writing attributes and variables?</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>Wei-keng </div>
<div><br>
<blockquote type="cite">
<div>On Aug 4, 2023, at 11:05 AM, Jim Edwards <<a href="mailto:jedwards@ucar.edu" target="_blank">jedwards@ucar.edu</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
I am using the new ncar system, <a href="https://urldefense.com/v3/__https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwigtcytrsOAAxWXHjQIHVoDD6YQFnoECBcQAQ&url=https*3A*2F*2Farc.ucar.edu*2Fknowledge_base*2F74317833&usg=AOvVaw2aXlWuOfLnua7fFmIgvfoV&opi=89978449__;JSUlJSU!!Dq0X2DkFhyF93HkjWTBQKhk!Xq6u5krREolkIRHG8AL2taDCmg6HsEdgcEoviUVyzqUINi-ipPM1EhtMcJkQfUYghDhutn7DfH5Wjm57wJ9lQhc$" target="_blank">derecho</a>,
which has a lustre parallel file system.</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
Looking at the difference between the two headers below makes me wonder if the issue is with variable attributes?<br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<br>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
snip</div>
<div><br>
<blockquote type="cite"><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Aug 4, 2023 at 9:39 AM Wei-Keng Liao <<a href="mailto:wkliao@northwestern.edu" target="_blank">wkliao@northwestern.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
Hi, Jim
<div><br>
</div>
<div>Can your provide the test program and the file header dumped by "ncdump -h", if that is available?</div>
<div>Also, what machine was used in the tests and its the parallel file system configuration is?</div>
<div>These can help diagnose.</div>
<div><br>
</div>
<div>
<div>Wei-keng </div>
<div><br>
<blockquote type="cite">
<div>On Aug 4, 2023, at 8:49 AM, Jim Edwards <<a href="mailto:jedwards@ucar.edu" target="_blank">jedwards@ucar.edu</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
I am using ncmpi_iput_varn and ncmpi_wait_all to write output from my model. I have a test program that does nothing but test the <br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
performance of the write operation. Attached is a plot of performance in the model and in the standalone application. I'm looking for <br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
clues as to why the model performance is scaling so badly with the number of variables but the standalone program performance is fine. <br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<br>
</div>
<div class="gmail_default" style="font-family: "comic sans ms", sans-serif; color: rgb(56, 118, 29);">
<br clear="all">
</div>
<br>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div>
<div>Jim Edwards<br>
<br>
</div>
<font size="1">CESM Software Engineer<br>
</font></div>
<font size="1">National Center for Atmospheric Research<br>
</font></div>
<font size="1">Boulder, CO</font> <br>
</div>
</div>
</div>
<span id="m_-8733781311756881360m_4857238735649148917m_2599353008599558804m_3752102915513421155m_3416875553179895269m_1419731810550872517m_-4661512969452605678cid:f_lkwn4kse0"><Screenshot 2023-07-27 at 11.49.03 AM.png></span></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br clear="all">
<br>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div>
<div>Jim Edwards<br>
<br>
</div>
<font size="1">CESM Software Engineer<br>
</font></div>
<font size="1">National Center for Atmospheric Research<br>
</font></div>
<font size="1">Boulder, CO</font> <br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br clear="all">
<br>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div>
<div>Jim Edwards<br>
<br>
</div>
<font size="1">CESM Software Engineer<br>
</font></div>
<font size="1">National Center for Atmospheric Research<br>
</font></div>
<font size="1">Boulder, CO</font> <br>
</div>
</div>
</blockquote>
</div>
</div>
<br class="Apple-interchange-newline" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
</div>
</body>
</html>