root/orte/test/system/iof_stress.c

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

DEFINITIONS

This source file includes following definitions.
  1. main

   1 #include <stdio.h>
   2 #include <signal.h>
   3 #include <math.h>
   4 
   5 #include "orte/runtime/orte_globals.h"
   6 
   7 #include "orte/runtime/runtime.h"
   8 
   9 #define MAX_COUNT 3
  10 #define ORTE_IOF_BASE_MSG_MAX   2048
  11 
  12 
  13 int
  14 main(int argc, char *argv[]){
  15     int count;
  16     int msgsize;
  17     unsigned char msg[ORTE_IOF_BASE_MSG_MAX];
  18     int i, j, rc;
  19     double maxpower;
  20     unsigned char chr;
  21     bool readstdin;
  22 
  23     /*
  24      * Init
  25      */
  26     orte_init(&argc, &argv, ORTE_PROC_NON_MPI);
  27 
  28     if (argc >= 2) {
  29         count = atoi(argv[1]);
  30         if (count < 0) {
  31             count = INT_MAX-1;
  32         }
  33     } else {
  34         count = MAX_COUNT;
  35     }
  36 
  37     if (argc == 3) {
  38         /* read from stdin */
  39         readstdin = true;
  40     } else {
  41         readstdin = false;
  42     }
  43 
  44     if (0 == ORTE_PROC_MY_NAME->vpid && readstdin) {
  45         while (0 != (msgsize = read(0, msg, ORTE_IOF_BASE_MSG_MAX))) {
  46             if (msgsize > 0) {
  47                 msg[msgsize] = '\n';
  48                  write(1, msg, msgsize);
  49             }
  50         }
  51     }
  52 
  53     for (j=1; j < count+1; j++) {
  54 
  55 #if 0
  56         maxpower = (double)(j%7);
  57 #endif
  58 
  59         chr = (j % 26) + 65;
  60         memset(msg, chr, ORTE_IOF_BASE_MSG_MAX);
  61         msgsize = 10;
  62         msg[msgsize-1] = '\n';
  63 
  64         write(1, msg, msgsize);
  65 
  66     }
  67 
  68     orte_finalize();
  69 
  70     return 0;
  71 }

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