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>
#include "sion.h"
#define BUFFER_SIZE (1024 * 1024)
int main(int argc, char** argv)
{
  MPI_Init(&argc, &argv);
  int size, rank;
  MPI_Comm_size(MPI_COMM_WORLD, &size);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  char localbuffer[BUFFER_SIZE];
  memset(localbuffer, 'A', BUFFER_SIZE);
  size_t bwrote = 
sion_write(localbuffer, 1, BUFFER_SIZE, sid);
   printf("Task %02d: wrote bytes: %zu\n", rank, bwrote);
  size_t bread = 
sion_read(localbuffer, 1, BUFFER_SIZE, sid);
   printf("Task %02d: read bytes: %zu\n", rank, bread);
  printf(
"Task %02d: at end of file: %s\n", rank, (
sion_eof(sid)) ? 
"true" : 
"false");
  MPI_Finalize();
  return 0;
}