pnetcdf-write-nb.c non-blocking

Rob Latham robl at mcs.anl.gov
Mon Sep 14 14:45:48 CDT 2015



On 09/07/2015 04:25 PM, Wei-keng Liao wrote:
> Hi,
>
> The example program is buggy.
> The write buffers for the two iput calls should be different.
> FYI. Once a nonblocking iput/iget API is posted, the contents
> of the buffers should not be touched before the call to
> ncmpi_wait_all/ncmpi_wait. Otherwise, the results can be incorrect.
>
> Please see the bug fix in http://trac.mcs.anl.gov/projects/parallel-netcdf/changeset/2095
> Thanks for reporting this problem.

Hi Wei-keng:  I wrote that example and did indeed follow the rule that 
the contents of the buffers should not be touched before the call to 
ncmpi_wait_all. -- the 'data' buffer is the same for both calls and is 
unmodified.

My mistake was that I remembered the buffer reuse rule (for both MPI and 
pnetcdf) as "don't change the buffer" but it's more than that: I just 
wanted to make it clear that the rules for buffer reuse prohibit not 
only modification but any reads as well.

==rob

>
> Wei-keng
>
> On Sep 7, 2015, at 1:52 PM, W. Miah wrote:
>
>> Hello,
>>
>> I have downloaded pNetCDF and am browsing through the example code
>> parallel-netcdf-1.6.0/examples/tutorial/pnetcdf-write-nb.c (attached
>> with this email) which should write the MPI ranks into two arrays, but
>> instead seems to be writing random values:
>>
>> [miahw at bengal tutorial]$ ncdump output.nc
>> netcdf output {
>> dimensions:
>>     d1 = 4 ;
>> variables:
>>     int v1(d1) ;
>>     int v2(d1) ;
>>
>> // global attributes:
>>         :string = "Hello World\n",
>>             "" ;
>> data:
>>
>> v1 = 0, 16777216, 33554432, 50331648 ;
>>
>> v2 = 0, 16777216, 33554432, 50331648 ;
>> }
>>
>> I have looked at the code but can't see anything wrong with it. Could
>> it be that the library has a bug?
>>
>> Regards,
>>
>> --
>> web: http://miahw.wordpress.com
>> gnupg: 2E29 B22F
>> <pnetcdf-write-nb.c>
>

-- 
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA


More information about the parallel-netcdf mailing list