PnetCDF library: specific command question for F90

Wei-keng Liao wkliao at eecs.northwestern.edu
Thu Jul 20 11:07:39 CDT 2017


Hi, Louis

This element-wise reduction operation can be simply implemented using MPI_Allreduce
with MPI_SUM operator. Check its man page for the usage of other arguments.

        int MPI_Allreduce ( void *sendbuf, void *recvbuf, int count,
                           MPI_Datatype datatype, MPI_Op op, MPI_Comm comm )

The results of element-wise reduction are stored in recvbuf.
You can then use nf90mpi_put_var_all to write recvbuf to the file (by each
process writing a portion of the array). 

Let me know if this works for you.

For sorting particle data based on their IDs, you may consider a parallel sample sort.
I may have a C code (somewhere to be found, developed a long time ago) if you need it.

Wei-keng

On Jul 20, 2017, at 9:32 AM, Monier, Louis wrote:

> Dear Parallel-NetCDF users/developers,
> 
> I’m Louis Monier, a young undergraduate from France who joined Zhiming Kuang’s research group in Harvard university for 4 months (internship). I’m working on the optimization of a  code (related to atmospheric modelling) with the use of PnetCDF to speed up the output process. 
> 
> I’d have a specific question about a writing command of PnetCDF. 
> 
> Let’s say I have 4 different processors. Each one of them has a vector (length = 4 for example) filled with random integers:
> rank 0 : [0, 0, 23, 0]
> rank 1: [42, 0, 0, 0]
> rank 2: [0, 0, 0, 91]
> rank 3: [0, 71, 0, 0]
> (I don’t use a particular syntax of a programming langage here, just try to be as clear as possible)
> 
> Here is my question: does a F90 writing PnetCDF command exist that allows those 4 processors to write to the same location in the NetCDF file while summing the vectors ? 
> 
> If you see my point here, I would end up with a NetCDF file with, somewhere in the file (depend on my ’start’ variable): [42, 71, 23, 91]
> 
> 
> To say a little bit more about my project, I want to write (using PnetCDF) the positions of millions of particles into a NetCDF file. However, each particle has its own ID. When I write the data for each time step, I first have to sort them within each process and write them to the precise location in the NetCDF file related to their ID.
> 
> Thank you to inform me on this subject. 
> 
> Best regards, 
> 
> Louis Monier



More information about the parallel-netcdf mailing list