smash-MPI

A runtime library for injecting faults and delays into Open MPI.
git clone git@git.mpah.dev/smash-MPI.git
Log | Files | Refs | README | LICENSE

parser.h (925B)


      1 #ifndef PARSER_H
      2 #define PARSER_H
      3 
      4 #define CFG_DELAY_PATH "SMASH_MPI_DELAY"
      5 #define CFG_FAILURE_PATH "SMASH_MPI_FAILURE"
      6 
      7 enum CFG { CFG_DELAY, CFG_FAILURE };
      8 
      9 int smash_parse_cfg(enum CFG ctype, void **data);
     10 
     11 struct cfg_delay {
     12 	unsigned long int delay;
     13 	unsigned int src, dst;
     14 	int msg;
     15 };
     16 
     17 struct cfg_failure {
     18 	unsigned long int time;
     19 	unsigned int node;
     20 };
     21 
     22 /*
     23  * Structure tail padding optimization 
     24  * with flexible array member, valid in C99.
     25  *
     26  * To allocate do: 
     27  *
     28  *  struct cfg_delays *delays;
     29  *
     30  *  delays = malloc(sizeof(struct cfg_delays) + VECTOR_SIZE * sizeof(config_delay));
     31  *  delays->size = VECTOR_SIZE;
     32  *
     33  *  and to free everything do:
     34  *  free(delays)
     35  *
     36  *  Where VECTOR_SIZE is the number of lines in one config file.
     37  */
     38 
     39 struct cfg_delays {
     40 	unsigned int size;
     41 	struct cfg_delay delays[];
     42 };
     43 
     44 struct cfg_failures {
     45 	unsigned int size;
     46 	struct cfg_failure failures[];
     47 };
     48 
     49 #endif /* PARSER_H */