codes-nw-workload.h 3.51 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * Copyright (C) 2013 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

#ifndef CODES_NW_WORKLOAD_H
#define CODES_NW_WORKLOAD_H

#include "ross.h"

12
#define MAX_NAME_LENGTH 512
13 14 15 16 17

/* struct to hold the actual data from a single MPI event*/
typedef struct mpi_event_list mpi_event_list;
typedef struct scala_trace_params scala_trace_params;

18 19 20 21
#ifdef USE_DUMPI
typedef struct dumpi_trace_params dumpi_trace_params;
#endif

22 23 24 25 26 27
struct scala_trace_params
{
   char offset_file_name[MAX_NAME_LENGTH];
   char nw_wrkld_file_name[MAX_NAME_LENGTH];
};

28 29 30 31 32 33 34
#ifdef USE_DUMPI
struct dumpi_trace_params
{
   char file_name[MAX_NAME_LENGTH];
};
#endif

35 36 37
enum NW_WORKLOADS
{
   SCALA_TRACE = 1,
38 39 40
#ifdef USE_DUMPI
   DUMPI,
#endif
41 42 43 44 45 46 47 48
   OTHERS, /* add the names of other workload generators here */
};
enum mpi_workload_type
{
    /* terminator; there are no more operations for this rank */
     CODES_NW_END = 1,
    /* sleep/delay to simulate computation or other activity */
     CODES_NW_DELAY,
49
    /* MPI blocking send operation */
50
     CODES_NW_SEND,
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    /* MPI blocking recv operation */
     CODES_NW_RECV,
    /* MPI non-blocking send operation */
     CODES_NW_ISEND,
    /* MPI non-blocking receive operation */
     CODES_NW_IRECV,
    /* MPI broadcast operation */
     CODES_NW_BCAST,
    /* MPI Allgather operation */
     CODES_NW_ALLGATHER,
     /* MPI Allgatherv operation */
     CODES_NW_ALLGATHERV,
    /* MPI Alltoall operation */
     CODES_NW_ALLTOALL,
    /* MPI Alltoallv operation */
     CODES_NW_ALLTOALLV,
    /* MPI Reduce operation */
     CODES_NW_REDUCE,
    /* MPI Allreduce operation */
     CODES_NW_ALLREDUCE,
    /* Generic collective operation */
    CODES_NW_COL
73 74 75 76 77 78 79 80
};

/* data structure for holding data from a MPI event (coming through scala-trace) 
*  can be a delay, isend, irecv or a collective call */
struct mpi_event_list
{
    /* what type of operation this is */
    enum mpi_workload_type op_type;
81 82
    double start_time;
    double end_time;
83 84 85 86 87 88

   /* parameters for each operation type */
    union
    {
  	struct
  	{
89 90
	   double nsecs;
	   double seconds;
91 92 93 94 95
  	} delay;
        struct
  	{
      	    int source_rank;/* source rank of MPI send message */
            int dest_rank; /* dest rank of MPI send message */
96
	    int num_bytes;
97
            int blocking; /* boolean value to indicate if message is blocking or non-blocking*/
98
	} send;
99 100 101 102
       struct
       {
     	    int source_rank;/* source rank of MPI recv message */
     	    int dest_rank;/* dest rank of MPI recv message */
103
	    int num_bytes;
104
     	    int blocking;/* boolean value to indicate if message is blocking or non-blocking*/
105 106 107 108 109
       } recv; 
      struct
      {
	  int num_bytes;
      } collective;
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
    }u;
};


/* read in the metadata file about the MPI event information
   and populate the MPI events array */
int codes_nw_workload_load(const char* type_name, const char* params, int rank);

/* retrieves the next network operation to execute. the wkld_id is the 
   identifier returned by the init() function.  The op argument is a pointer
   to a structure to be filled in with network operation information */
void codes_nw_workload_get_next(int wkld_id, int rank, struct mpi_event_list *op); 

/* Reverse of the above function */
void codes_nw_workload_get_next_rc(int wkld_id, int rank, const struct mpi_event_list* op);

void codes_nw_workload_print_op(FILE* f, struct mpi_event_list* op, int rank);
#endif /* CODES_NW_WORKLOAD_H */

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ft=c ts=8 sts=4 sw=4 expandtab
 */