root/orte/test/system/orte_exit.c

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

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /* -*- C -*-
   2  *
   3  * $HEADER$
   4  *
   5  * A program that just spins, with vpid 3 aborting - provides mechanism for testing
   6  * abnormal program termination
   7  */
   8 
   9 #include "orte_config.h"
  10 
  11 #include <stdio.h>
  12 #include <unistd.h>
  13 
  14 #include "orte/runtime/runtime.h"
  15 #include "orte/util/proc_info.h"
  16 #include "orte/util/name_fns.h"
  17 #include "orte/runtime/orte_globals.h"
  18 #include "orte/mca/errmgr/errmgr.h"
  19 
  20 int main(int argc, char* argv[])
  21 {
  22 
  23     int i, rc;
  24     double pi;
  25     pid_t pid;
  26     char hostname[OPAL_MAXHOSTNAMELEN];
  27 
  28     if (0 > (rc = orte_init(&argc, &argv, ORTE_PROC_NON_MPI))) {
  29         fprintf(stderr, "orte_abort: couldn't init orte - error code %d\n", rc);
  30         return rc;
  31     }
  32     pid = getpid();
  33     gethostname(hostname, sizeof(hostname));
  34 
  35     printf("orte_abort: Name %s Host: %s Pid %ld\n", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
  36            hostname, (long)pid);
  37 
  38     i = 0;
  39     while (1) {
  40         i++;
  41         pi = i / 3.14159256;
  42         if (i == 9995) {
  43             if (ORTE_PROC_MY_NAME->vpid == 1) {
  44                 orte_finalize();
  45                 exit(77);
  46             } else {
  47                 i=0;
  48             }
  49         }
  50     }
  51 
  52     return 0;
  53 }

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