I like your milder solution.   <br><br><div class="gmail_quote">On Thu, Jul 11, 2013 at 1:18 PM, Wei-keng Liao <span dir="ltr"><<a href="mailto:wkliao@ece.northwestern.edu" target="_blank">wkliao@ece.northwestern.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In netCDF, the put_att_<type> is allowed in data mode only when<br>
it is used to change an existing attribute. I consider<br>
this case rare, and thus am asking the community if this is<br>
a common practice.<br>
<br>
The solution of "rank 0 wins" does not solve the read case.<br>
For example, one process change a time stamp (as a global attribute)<br>
in data mode. This change will not be made aware to other processes.<br>
So, when other processes call get_att(), they will get the old value.<br>
Will this be OK?<br>
<br>
One milder solution is to make the APIs collective, if they are<br>
called in data mode.<br>
<span class="HOEnZb"><font color="#888888"><br>
Wei-keng<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Jul 11, 2013, at 1:21 PM, Rob Latham wrote:<br>
<br>
> On Thu, Jul 11, 2013 at 12:09:54PM -0500, Wei-keng Liao wrote:<br>
>> One minor correction. The last API in the list I intent to say<br>
>> is the family of ncmpi_put_att_<type> APIs. The <type> can be one<br>
>> of text, uchar, schar, short, int, ...<br>
>><br>
><br>
> I'm a little wary of changing our semantics in such a mature piece of<br>
> software.  I think you are right that most people are already doing<br>
> this, but it makes me a bit nervous.<br>
><br>
> the put_att_<type> change has me the most nervous.<br>
><br>
> It's not as nice as your proposal, but could we just say "rank 0 wins<br>
> if there is ever inconsistent metadata" ?<br>
><br>
> ==rob<br>
><br>
>> Wei-keng<br>
>><br>
>> On Jul 11, 2013, at 12:03 PM, Wei-keng Liao wrote:<br>
>><br>
>>> Dear PnetCDF users,<br>
>>><br>
>>> I am working on strengthening the PnetCDF's metadata consistency and<br>
>>> would like to change/limit the usage of APIs that modified the<br>
>>> metadata (file header) of a netCDF file. These APIs are:<br>
>>>   ncmpi_rename_dim(),<br>
>>>   ncmpi_rename_var(),<br>
>>>   ncmpi_copy_att(),<br>
>>>   ncmpi_rename_att(), and<br>
>>>   ncmpii_put_att().              <------- correction !<br>
>>><br>
>>> (The consistency here is referring to the consistency of file header<br>
>>> data stored in memory across all MPI processes.)<br>
>>><br>
>>> In netCDF, the above APIs are allowed in data mode if the space<br>
>>> required to store the new metadata (attributes, names, etc.) is<br>
>>> less than the old one. Otherwise, they must be called in the define<br>
>>> mode.<br>
>>><br>
>>> In PnetCDF, I would like to change that to allow these APIs only<br>
>>> in define mode. If your applications require the above APIs to<br>
>>> be called in data mode, please do let me know.<br>
>>><br>
>>> Here is my reason for the above change. In data mode, if metadata<br>
>>> is changed on one process's memory (or even the change is written<br>
>>> to the file by that process because NC_SHARE is set), there is no<br>
>>> way to propagate the change from this process to other processes,<br>
>>> until ncmpi_close() or ncmpi_sync() is called. If allowing these<br>
>>> APIs in define mode only, we can rely on ncmpi_endef() to<br>
>>> ensure/check the consistency.<br>
>>><br>
>>> Please let me know if your applications will have a problem with<br>
>>> such change.<br>
>>><br>
>>> (My plan is to make NC_SHARE the default mode for PnetCDF as<br>
>>> PnetCDF IS developed to handle parallel access to shared files.<br>
>>> The above suggested API changes is the first step of my plan.)<br>
>>><br>
>>><br>
>>> Wei-keng<br>
>>><br>
>><br>
><br>
> --<br>
> Rob Latham<br>
> Mathematics and Computer Science Division<br>
> Argonne National Lab, IL USA<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><pre>Jim Edwards<br><br><br></pre>