This directory contains example python programs that make use of PnetCDF to perform file I/O in parallel. Detailed description of each program and run instructions can be found at the beginning of each file.
- Use command
mpiexec
to run individual programs. For example, command line below runcollective_write.py
on 4 MPI processes.mpiexec -n 4 python collective_write.py [output_dir]
- The optional argument
output_dir
enables the testing program to save the generated output files in the specified directory. Default is the current directory.
-
- A directory contains an example of
Pytorch MNIST,
using Pytorch module
DistributedDataParallel
for parallel training andPnetCDF-Python
for reading data from a NetCDF files.
- A directory contains an example of
Pytorch MNIST,
using Pytorch module
-
- A directory contains examples that make use of Pytorch Distributed Data Parallel module to run python programs in parallel.
-
- A directory contains examples that make use of nonblocking I/O APIs.
- nonblocking_write.py --
Similar to
collective_write.py
, this example uses nonblocking APIs instead. It creates a netcdf file in CDF-5 format and writes a number of 3D integer non-record variables. - nonblocking_read.py --
A read counterpart of
nonblocking_write.py
. It reads the output file generated fromnonblocking_write.py
. - nonblocking_write_def.py --
This example is the same as
nonblocking_write.py
expect all nonblocking write requests (calls toiput
andbput
) are posted in define mode. It creates a netcdf file in CDF-5 format and writes a number of 3D integer non-record variables.
- nonblocking_write.py --
Similar to
- A directory contains examples that make use of nonblocking I/O APIs.
-
- This example shows how to use
File
class constructor to create a NetCDF file and to open the file for read only.
- This example shows how to use
-
- This example shows how to use
Variable
method put_var() to write a 2D integer array in parallel. The data partitioning pattern is a column-wise partitioning across all processes.
- This example shows how to use
-
- This example is the read counterpart of put_var.py, which
shows how to use to
Variable
method get_var() read a 2D 4-byte integer array in parallel.
- This example is the read counterpart of put_var.py, which
shows how to use to
-
- This example writes multiple 3D subarrays to non-record variables of int type using collective I/O mode.
-
- This example shows how to use
Variable
method to write a 2D array user buffer with ghost cells.
- This example shows how to use
-
- This example shows how to use
Variable
class methods andFile
class methods to set the fill mode of variables and fill values.set_fill()
to enable fill mode of the filedef_fill()
to enable fill mode and define the variable's fill valueinq_var_fill()
to inquire the variable's fill mode informationput_var_all()
to write two 2D 4-byte integer array in parallel.
- This example shows how to use
-
- This example shows how to use
File
methodput_att()
to write a global attribute to a file.
- This example shows how to use
-
- This example shows how to use
Variable
flexible API methods put_var() and iput_var() to write a 2D 4-byte integer array in parallel.
- This example shows how to use
-
- This example sets two PnetCDF hints:
nc_header_align_size
andnc_var_align_size
and prints the hint values as well as the header size, header extent, and two variables' starting file offsets.
- This example sets two PnetCDF hints:
-
- This example prints all MPI-IO hints used.
-
- This example shows how to use
Variable
methodput_var()
to write a 2D integer array variable into a file. The variable in the file is a dimensional transposed array from the one stored in memory.
- This example shows how to use
-
- This example shows how to use
Variable
methodput_var()
to write six 3D integer array variables into a file. Each variable in the file is a dimensional transposed array from the one stored in memory. In memory, a 3D array is partitioned among all processes in a block-block-block fashion and in ZYX (i.e. C) order. The dimension structures of the transposed six arrays are- int ZYX_var(Z, Y, X) ; ZYX -> ZYX
- int ZXY_var(Z, X, Y) ; ZYX -> ZXY
- int YZX_var(Y, Z, X) ; ZYX -> YZX
- int YXZ_var(Y, X, Z) ; ZYX -> YXZ
- int XZY_var(X, Z, Y) ; ZYX -> XZY
- int XYZ_var(X, Y, Z) ; ZYX -> XYZ
- This example shows how to use
-
- This example shows how to use a single call of
Variable
methodput_varn()
to write a sequence of subarray requests to a variable with arbitrary array indices and lengths.
- This example shows how to use a single call of