ParallelIO
Functions
pio_msg.c File Reference

PIO async message handling. More...

#include <config.h>
#include <pio.h>
#include <pio_internal.h>

Functions

int inq_type_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to handle nc_inq_type*() functions. More...
 
int inq_format_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to find netCDF file format. More...
 
int create_file_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to create a netCDF file. More...
 
int close_file_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to close a netCDF file. More...
 
int inq_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to inq a netCDF file. More...
 
int inq_dim_handler (iosystem_desc_t *ios, int msg)
 Do an inq_dim on a netCDF dimension. More...
 
int inq_dimid_handler (iosystem_desc_t *ios)
 Do an inq_dimid on a netCDF dimension name. More...
 
int inq_att_handler (iosystem_desc_t *ios)
 Handle attribute inquiry operations. More...
 
int inq_attname_handler (iosystem_desc_t *ios)
 Handle attribute inquiry operations. More...
 
int inq_attid_handler (iosystem_desc_t *ios)
 Handle attribute inquiry operations. More...
 
int att_put_handler (iosystem_desc_t *ios)
 Handle attribute operations. More...
 
int att_get_handler (iosystem_desc_t *ios)
 Handle attribute operations. More...
 
int put_vars_handler (iosystem_desc_t *ios)
 Handle var put operations. More...
 
int get_vars_handler (iosystem_desc_t *ios)
 Handle var get operations. More...
 
int inq_var_handler (iosystem_desc_t *ios)
 Do an inq_var on a netCDF variable. More...
 
int inq_varid_handler (iosystem_desc_t *ios)
 Do an inq_varid on a netCDF variable name. More...
 
int sync_file_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to sync a netCDF file. More...
 
int change_def_file_handler (iosystem_desc_t *ios, int msg)
 This function is run on the IO tasks to enddef a netCDF file. More...
 
int def_var_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to define a netCDF variable. More...
 
int def_dim_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to define a netCDF dimension. More...
 
int rename_dim_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to rename a netCDF dimension. More...
 
int rename_var_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to rename a netCDF dimension. More...
 
int rename_att_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to rename a netCDF attribute. More...
 
int delete_att_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to delete a netCDF attribute. More...
 
int open_file_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to open a netCDF file. More...
 
int delete_file_handler (iosystem_desc_t *ios)
 This function is run on the IO tasks to delete a netCDF file. More...
 
int initdecomp_dof_handler (iosystem_desc_t *ios)
 
int writedarray_handler (iosystem_desc_t *ios)
 
int readdarray_handler (iosystem_desc_t *ios)
 
int seterrorhandling_handler (iosystem_desc_t *ios)
 
int var_handler (iosystem_desc_t *ios, int msg)
 
int freedecomp_handler (iosystem_desc_t *ios)
 
int PIOc_noop_finalize (const int iosysid)
 
int finalize_handler (iosystem_desc_t *ios, int index)
 
int pio_callback_handler (iosystem_desc_t *ios, int msg)
 
int pio_msg_handler2 (int io_rank, int component_count, iosystem_desc_t **iosys, MPI_Comm io_comm)
 This function is called by the IO tasks. More...
 
int PIOc_Init_Async (MPI_Comm world, int num_io_procs, int *io_proc_list, int component_count, int *num_procs_per_comp, int **proc_list, int *iosysidp)
 Library initialization used when IO tasks are distinct from compute tasks. More...
 

Detailed Description

PIO async message handling.

This file contains the code which runs on the IO nodes when async is in use. This code waits for messages from the computation nodes, and responds to messages by running the appropriate netCDF function.

Author
Ed Hartnett

Function Documentation

§ att_get_handler()

int att_get_handler ( iosystem_desc_t ios)

Handle attribute operations.

This code only runs on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
msgthe message sent my the comp root task.
Returns
PIO_NOERR for success, error code otherwise.

§ att_put_handler()

int att_put_handler ( iosystem_desc_t ios)

Handle attribute operations.

This code only runs on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
msgthe message sent my the comp root task.
Returns
PIO_NOERR for success, error code otherwise.

§ change_def_file_handler()

int change_def_file_handler ( iosystem_desc_t ios,
int  msg 
)

This function is run on the IO tasks to enddef a netCDF file.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.

§ close_file_handler()

int close_file_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to close a netCDF file.

It is only ever run on the IO tasks.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.

§ create_file_handler()

int create_file_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to create a netCDF file.

§ def_dim_handler()

int def_dim_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to define a netCDF dimension.

§ def_var_handler()

int def_var_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to define a netCDF variable.

§ delete_att_handler()

int delete_att_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to delete a netCDF attribute.

§ delete_file_handler()

int delete_file_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to delete a netCDF file.

Parameters
iospointer to the iosystem_desc_t data.
Returns
PIO_NOERR for success, error code otherwise.

§ get_vars_handler()

int get_vars_handler ( iosystem_desc_t ios)

Handle var get operations.

This code only runs on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.

Length (in bytes) of this type.

Type of the data being written.

Number of dimensions.

Buffer for data storage.

Number of data elements in the buffer.

§ inq_att_handler()

int inq_att_handler ( iosystem_desc_t ios)

Handle attribute inquiry operations.

This code only runs on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
msgthe message sent my the comp root task.
Returns
PIO_NOERR for success, error code otherwise.

§ inq_attid_handler()

int inq_attid_handler ( iosystem_desc_t ios)

Handle attribute inquiry operations.

This code only runs on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
msgthe message sent my the comp root task.
Returns
PIO_NOERR for success, error code otherwise.

§ inq_attname_handler()

int inq_attname_handler ( iosystem_desc_t ios)

Handle attribute inquiry operations.

This code only runs on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
msgthe message sent my the comp root task.
Returns
PIO_NOERR for success, error code otherwise.

§ inq_dim_handler()

int inq_dim_handler ( iosystem_desc_t ios,
int  msg 
)

Do an inq_dim on a netCDF dimension.

This function is only run on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
msgthe message sent my the comp root task.
Returns
PIO_NOERR for success, error code otherwise.

§ inq_dimid_handler()

int inq_dimid_handler ( iosystem_desc_t ios)

Do an inq_dimid on a netCDF dimension name.

This function is only run on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.

§ inq_format_handler()

int inq_format_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to find netCDF file format.

§ inq_handler()

int inq_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to inq a netCDF file.

It is only ever run on the IO tasks.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.

§ inq_type_handler()

int inq_type_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to handle nc_inq_type*() functions.

§ inq_var_handler()

int inq_var_handler ( iosystem_desc_t ios)

Do an inq_var on a netCDF variable.

This function is only run on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
msgthe message sent my the comp root task.
Returns
PIO_NOERR for success, error code otherwise.

§ inq_varid_handler()

int inq_varid_handler ( iosystem_desc_t ios)

Do an inq_varid on a netCDF variable name.

This function is only run on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.

§ open_file_handler()

int open_file_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to open a netCDF file.

Parameters
iospointer to the iosystem_desc_t data.
Returns
PIO_NOERR for success, error code otherwise.

§ pio_msg_handler2()

int pio_msg_handler2 ( int  io_rank,
int  component_count,
iosystem_desc_t **  iosys,
MPI_Comm  io_comm 
)

This function is called by the IO tasks.

This function will not return, unless there is an error.

§ PIOc_Init_Async()

int PIOc_Init_Async ( MPI_Comm  world,
int  num_io_procs,
int *  io_proc_list,
int  component_count,
int *  num_procs_per_comp,
int **  proc_list,
int *  iosysidp 
)

Library initialization used when IO tasks are distinct from compute tasks.

This is a collective call. Input parameters are read on comp_rank=0 values on other tasks are ignored. This variation of PIO_init sets up a distinct set of tasks to handle IO, these tasks do not return from this call. Instead they go to an internal loop and wait to receive further instructions from the computational tasks.

Sequence of Events to do Asynch I/O

Here is the sequence of events that needs to occur when an IO operation is called from the collection of compute tasks. I'm going to use pio_put_var because write_darray has some special characteristics that make it a bit more complicated...

Compute tasks call pio_put_var with an integer argument

The MPI_Send sends a message from comp_rank=0 to io_rank=0 on union_comm (a comm defined as the union of io and compute tasks) msg is an integer which indicates the function being called, in this case the msg is PIO_MSG_PUT_VAR_INT

The iotasks now know what additional arguments they should expect to receive from the compute tasks, in this case a file handle, a variable id, the length of the array and the array itself.

The iotasks now have the information they need to complete the operation and they call the pio_put_var routine. (In pio1 this bit of code is in pio_get_put_callbacks.F90.in)

After the netcdf operation is completed (in the case of an inq or get operation) the result is communicated back to the compute tasks.

Parameters
worldthe communicator containing all the available tasks.
num_io_procsthe number of processes for the IO component.
io_proc_listan array of lenth num_io_procs with the processor number for each IO processor. If NULL then the IO processes are assigned starting at processes 0.
component_countnumber of computational components
num_procs_per_compan array of int, of length component_count, with the number of processors in each computation component.
proc_listan array of arrays containing the processor numbers for each computation component. If NULL then the computation components are assigned processors sequentially starting with processor num_io_procs.
iosysidppointer to array of length component_count that gets the iosysid for each component.
Returns
PIO_NOERR on success, error code otherwise.

§ put_vars_handler()

int put_vars_handler ( iosystem_desc_t ios)

Handle var put operations.

This code only runs on IO tasks.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.

Length (in bytes) of this type.

Type of the data being written.

Number of dimensions.

Buffer for data storage.

Number of data elements in the buffer.

§ rename_att_handler()

int rename_att_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to rename a netCDF attribute.

§ rename_dim_handler()

int rename_dim_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to rename a netCDF dimension.

§ rename_var_handler()

int rename_var_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to rename a netCDF dimension.

§ sync_file_handler()

int sync_file_handler ( iosystem_desc_t ios)

This function is run on the IO tasks to sync a netCDF file.

Parameters
iospointer to the iosystem_desc_t.
Returns
PIO_NOERR for success, error code otherwise.