root/orte/test/mpi/abort.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /* -*- C -*-
   2  *
   3  * $HEADER$
   4  *
   5  * The most basic of MPI applications
   6  */
   7 
   8 #include <stdio.h>
   9 #include <stdlib.h>
  10 #include <unistd.h>
  11 
  12 #include "mpi.h"
  13 
  14 int main(int argc, char* argv[])
  15 {
  16     int rank, size;
  17     int errcode;
  18 
  19     if (1 < argc) {
  20         errcode = strtol(argv[1], NULL, 10);
  21     } else {
  22         errcode = 2;
  23     }
  24 
  25     MPI_Init(&argc, &argv);
  26     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  27     MPI_Comm_size(MPI_COMM_WORLD, &size);
  28 
  29     printf("Hello, World, I am %d of %d\n", rank, size);
  30 
  31     if (1 == size) {
  32             MPI_Abort(MPI_COMM_WORLD, errcode);
  33     } else {
  34         if (1 == rank) {
  35             MPI_Abort(MPI_COMM_WORLD, errcode);
  36         } else {
  37             errcode = 0;
  38             sleep(99999999);
  39         }
  40     }
  41 
  42     MPI_Finalize();
  43     return errcode;
  44 }

/* [<][>][^][v][top][bottom][index][help] */