SCORPIO  1.7.0
Data Types | Modules | Functions/Subroutines
examplePio.f90 File Reference

A simple Fortran example for the ParallelIO Library. More...

Data Types

type  pioexample::pioexampleclass
 A class to hold example code and data. More...
 

Modules

module  pioexample
 

Functions/Subroutines

subroutine pioexample::init (this)
 Initialize MPI, ParallelIO, and example data. More...
 
program main
 Main execution of example code. More...
 

Detailed Description

A simple Fortran example for the ParallelIO Library.

Function/Subroutine Documentation

◆ main()

program main

Main execution of example code.

This is an example program for the ParallelIO library.

This program creates a netCDF output file with the ParallelIO library, then writes and reads some data to and from the file.

This example does the following:

  • initialization initializes the MPI library, initializes the ParallelIO library with PIO_init. Then allocate memory for a data array of sample data to write, and an array to read the data back into. Also allocate an array to hold decomposition information.
  • creation of decomposition by calling PIO_initdecomp.
  • creation of netCDF file with PIO_createfile.
  • define netCDF metadata with PIO_def_dim and PIO_def_var. Then end define mode with PIO_enddef.
  • write the sample data with PIO_write_darray. Then sync the file with PIO_syncfile.
  • read the sample data with PIO_read_darray.
  • close the netCDF file with PIO_closefile.
  • clean up local memory, ParallelIO library resources with PIO_freedecomp and PIO_finalize, and MPI library resources.