torus.h 2.46 KB
Newer Older
1 2 3 4 5 6 7 8 9
/*
 * Copyright (C) 2014 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

#ifndef TORUS_H
#define TORUS_H

Jonathan Jenkins's avatar
Jonathan Jenkins committed
10 11 12 13
#ifdef __cplusplus
extern "C" {
#endif

14 15 16
typedef struct nodes_message nodes_message;

/* event type of each torus message, can be packet generate, flit arrival, flit send or credit */
17
typedef enum nodes_event_t
18 19 20 21 22
{
  GENERATE = 1,
  ARRIVAL, 
  SEND,
  CREDIT,
23 24 25
  T_COLLECTIVE_INIT,
  T_COLLECTIVE_FAN_IN,
  T_COLLECTIVE_FAN_OUT  
26
} nodes_event_t;
27 28 29 30 31 32 33 34 35 36

struct nodes_message
{
  /* category: comes from codes message */
  char category[CATEGORY_NAME_MAX];
  /* time the packet was generated */
  tw_stime travel_start_time;
  /* for reverse event computation*/
  tw_stime saved_available_time;

37 38
  /* message saved collective time */
  tw_stime saved_collective_init_time;
39 40 41 42

  /* for saving recv and total times*/
  tw_stime saved_recv_time;
  tw_stime saved_total_time;
43
  tw_stime saved_busy_time;
44

45 46 47 48 49 50
  /* packet ID */
  unsigned long long packet_ID;
  /* event type of the message */
  nodes_event_t	 type;

  /* for reverse computation */
51
  int saved_channel;
52 53 54 55 56 57 58 59

  /* coordinates of the destination torus nodes */
  int* dest;

  /* final destination LP ID, comes from codes, can be a server or any other I/O LP type */
  tw_lpid final_dest_gid;
  /* destination torus node of the message */
  tw_lpid dest_lp;
60 61 62 63 64 65
  /* LP ID of the sender, comes from codes, can be a server or any other I/O LP type. Should not change
     during network operations. */
  tw_lpid sender_svr;

  /* LP ID of the sending node, has to be a network node in the torus */
  tw_lpid sender_node;
66 67 68 69 70 71 72 73 74 75 76

  /* number of hops traversed by the packet */
  int my_N_hop;
  /* source dimension of the message */
  int source_dim;
  /* source direction of the message */
  int source_direction;
  /* next torus hop that the packet will traverse */
  int next_stop;
  /* size of the torus packet */
  uint64_t packet_size;
77 78 79 80

 /* for reverse computation of a node's fan in*/
  int saved_fan_nodes;

81 82 83
  int source_channel;

  int saved_queue;
84
  /* chunk id of the flit (distinguishes flits) */
85
  uint64_t chunk_id;
86

87
  model_net_event_return event_rc;
88 89 90 91 92 93 94 95
  int is_pull;
  uint64_t pull_size;

  /* for codes local and remote events, only carried by the last packet of the message */
  int local_event_size_bytes;
  int remote_event_size_bytes;
};

Jonathan Jenkins's avatar
Jonathan Jenkins committed
96 97 98 99
#ifdef __cplusplus
}
#endif

100 101 102 103 104 105 106 107 108 109 110
#endif /* end of include guard: TORUS_H */

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