<div dir="ltr">Nice! Thank you so much, Wei-keng!<div><br></div><div>All the best,</div><div>Thiago.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 18, 2014 at 12:21 PM, Wei-keng Liao <span dir="ltr"><<a href="mailto:wkliao@eecs.northwestern.edu" target="_blank">wkliao@eecs.northwestern.edu</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can also use PnetCDF flexible APIs.<br>
First, you need to create an MPI derived data type.<br>
See example program in examples/F77/flexible_api.f<br>
<br>
          ! create an MPI datatype using MPI_Type_create_subarray()<br>
          array_of_sizes(1)    = 100<br>
          array_of_sizes(2)    = 100<br>
          array_of_subsizes(1) = 80<br>
          array_of_subsizes(2) = 80<br>
          array_of_starts(1)   = 10<br>
          array_of_starts(2)   = 10<br>
          call MPI_Type_create_subarray(2, array_of_sizes,<br>
     +         array_of_subsizes, array_of_starts, MPI_ORDER_FORTRAN,<br>
     +         MPI_REAL, buftype, err)<br>
          call MPI_Type_commit(buftype, err)<br>
<br>
          bufcount = 1<br>
          err = nfmpi_put_vara_all(ncid, varid, start, count, data, bufcount, buftype)<br>
          call MPI_Type_free(buftype, err)<br>
<span class="HOEnZb"><font color="#888888"><br>
Wei-keng<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Dec 18, 2014, at 11:08 AM, Thiago Quirino - NOAA Federal wrote:<br>
<br>
> Thank you, Wei-keng.<br>
><br>
> Won't that result in a temporary argument array being created? The actual arrays in my program are very large. Is there a method to achieve the same effect without resulting in the creation of a temporary array.<br>
><br>
> Again, thank you so much,<br>
> Thiago.<br>
><br>
><br>
> On Thu, Dec 18, 2014 at 11:55 AM, Wei-keng Liao <<a href="mailto:wkliao@eecs.northwestern.edu">wkliao@eecs.northwestern.edu</a>> wrote:<br>
> Hi, Thiago<br>
><br>
> You can use data(10:90, 10:90). For example,<br>
><br>
> err = nfmpi_put_vara_real_all(ncid, varid, start, count, data(10:90, 10:90))<br>
><br>
> In this case, your have to make sure the write amounts are matched, i.e.<br>
>   count(1)*count(2) must be equal to 80*80<br>
><br>
> Wei-keng<br>
><br>
> On Dec 18, 2014, at 10:36 AM, Thiago Quirino - NOAA Federal wrote:<br>
><br>
> > Hello, folks.<br>
> ><br>
> > I've reading through the Fortran examples and documentation in the Pnetcdf website, and it seems like all calls to nfmpi_put_var* subroutines will write a specified 2D/3D data array found in memory starting at location (1,1) of the array. Suppose that I have a 2D fortran real array of 100x100 elements. For example:<br>
> ><br>
> > real(4) :: data(100,100)<br>
> ><br>
> > Is it possible to write out only a portion of this 2D array to file without copying the desired portion to another smaller 2D array? For example, can all the elements between data(10,10) and data(90,90) (or 80x80 elements) be written out to file directly, that is, ignoring 10 rows and columns on each side of the data array? These ignored rows and columns correspond to halo points in my application that don't need to be written out.<br>
> ><br>
> > Thank you so much,<br>
> > Thiago.<br>
> ><br>
> ><br>
> ><br>
> > ---------------------------------------------------<br>
> > Thiago Quirino, Ph.D.<br>
> > NOAA Hurricane Research Division<br>
> > Numerical Modeling Group<br>
> > 4301 Rickenbacker Cswy.<br>
> > Miami, FL 33149<br>
> > P: 305-361-4337<br>
> > E: <a href="mailto:Thiago.Quirino@noaa.gov">Thiago.Quirino@noaa.gov</a><br>
> > <a href="http://hwrf.aoml.noaa.gov" target="_blank">http://hwrf.aoml.noaa.gov</a><br>
><br>
<br>
</div></div></blockquote></div></div>