Parallel example showing the very basic usage of SIONlib using MPI.
More examples can be found in 'examples' folder of the SIONlib installation.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
#define FNAMELEN 255
#define BUFSIZE (1024 * 1024)
int main(int argc, char** argv)
{
  
  char       fname[FNAMELEN];
  int        numFiles = 0;
  MPI_Comm   gComm, lComm;
  sion_int64 chunksize  = 0;
  sion_int32 fsblksize  = 0;
  int        globalrank = 0;
  FILE*      fileptr    = NULL;
  char*      newfname   = NULL;
  
  int        rank        = 0;
  int        size        = 0;
  int        sid         = 0;
  sion_int64 left        = 0;
  size_t     btoread     = 0;
  size_t     bread       = 0;
  size_t     bwrote      = 0;
  char*      localbuffer = NULL;
  MPI_Init(&argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, &size);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  
  localbuffer = (char*)malloc(BUFSIZE);
  memset(localbuffer, 'A', BUFSIZE);
  
  strcpy(fname, "parfile.sion");
  numFiles   = 1;
  gComm      = lComm = MPI_COMM_WORLD;
  chunksize  = 10 * 1024 * 1024;
  fsblksize  = -1;
  globalrank = rank;
  fileptr    = NULL;
  
                         &fsblksize, &globalrank, &fileptr, &newfname);
  left   = BUFSIZE;
  printf("Task %02d: wrote bytes: %zd\n", rank, bwrote);
  printf("Task %02d: wrote sionfile -> %s\n", rank, newfname);
  
                         &fsblksize, &globalrank, &fileptr, &newfname);
    printf("Task %02d: read bytes: %zd\n", rank, bread);
  }
  printf("Task %02d: read sionfile -> %s\n", rank, newfname);
  MPI_Finalize();
  return 0;
}