10 #define HOP_LINK_DELAY 10e-6
11 #define HOP_PROC_DELAY 10e-6
19 LBTopology(int p
): npes(p
) {}
20 virtual ~LBTopology() {}
21 virtual int max_neighbors() = 0;
22 virtual void neighbors(int mype
, int* _n
, int &nb
) = 0;
23 //added by zshao1, these defaults mean the the topology does not support these methods
24 virtual int get_dimension() { return -1;}
25 virtual bool get_processor_coordinates(int processor_id
, int* processor_coordinates
) { return false; }
26 virtual bool get_processor_id(const int* processor_coordinates
, int* processor_id
) { return false; }
27 virtual bool coordinate_difference(const int* my_coordinates
, const int* target_coordinates
, int* difference
) { return false;}
28 virtual bool coordinate_difference(int my_processor_id
, int target_processor_id
, int* difference
) { return false; }
29 virtual int get_hop_count(int src
,int dest
);
30 virtual int rec_hop_count(int src
,int dest
,int max_neigh
,int count
,int *visited_srcs
,int min_hop_cnt
);
31 virtual double per_hop_delay(int last_hop
);
32 virtual void get_pairwise_hop_count(double **dist
);
35 #define LBTOPO_MACRO(x) \
36 static LBTopology * create##x(int np) { \
40 class LBTopo_ring
: public LBTopology
{
42 LBTopo_ring(int p
): LBTopology(p
) {}
43 virtual int max_neighbors();
44 virtual void neighbors(int mype
, int* _n
, int &nb
);
45 virtual int get_hop_count(int src
,int dest
);
48 class LBTopo_torus2d
: public LBTopology
{
51 int goodcoor(int, int);
53 LBTopo_torus2d(int p
);
54 virtual int max_neighbors();
55 virtual void neighbors(int mype
, int* _n
, int &nb
);
56 virtual int get_hop_count(int src
,int dest
);
59 class LBTopo_torus3d
: public LBTopology
{
62 int goodcoor(int, int, int);
64 LBTopo_torus3d(int p
);
65 virtual int max_neighbors();
66 virtual void neighbors(int mype
, int* _n
, int &nb
);
69 class LBTopo_mesh3d
: public LBTopology
{
72 int goodcoor(int, int, int);
75 virtual int max_neighbors();
76 virtual void neighbors(int mype
, int* _n
, int &nb
);
79 class LBTopo_graph
: public LBTopology
{
81 LBTopo_graph(int p
): LBTopology(p
) {}
82 virtual int max_neighbors();
83 virtual void neighbors(int mype
, int* _n
, int &nb
);
86 typedef LBTopology
* (*LBtopoFn
)(int);
89 typedef void* (*LBtopoFn
)();
90 #endif /* __cplusplus */
95 LBtopoFn
LBTopoLookup(char *);
96 int getTopoMaxNeighbors(void *topo
);
97 void getTopoNeighbors(void *topo
, int myid
, int* na
, int *n
);