Skip to content

Commit a2b6bfc

Browse files
authored
Merge pull request #174 from ROSS-org/release-7.2.1
Release 7.2.1 - Includes Random Cleanup (#169)
2 parents 5eb95cf + 80204c0 commit a2b6bfc

File tree

12 files changed

+94
-108
lines changed

12 files changed

+94
-108
lines changed

CMakeLists.txt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,11 @@ if (COVERALLS)
4747
coveralls_turn_on_coverage()
4848
endif()
4949

50-
# Old way to do this
51-
# Data Structure for Unprocessed Event List
52-
#SET(QUEUE calendar) #Calendar Queue
53-
#SET(QUEUE heap) #Push/Down Heap
54-
#SET(QUEUE splay) #Splay Tree
55-
#SET(QUEUE kp_splay) #Splay Tree in KPs
56-
57-
# New way as of CMake 2.8
58-
# The default value for the QUEUE variable is splay
59-
# The other options are presented at config time by cmake-gui
60-
SET(QUEUE splay CACHE STRING "Queue type chosen by the user at configure time")
61-
SET_PROPERTY(CACHE QUEUE PROPERTY STRINGS splay calendar heap kp_splay)
50+
# Priority Queue Implementation
51+
SET(QUEUE splay)
52+
# Other queue implementations are no longer supported.
53+
# SET(QUEUE splay CACHE STRING "Queue type chosen by the user at configure time")
54+
# SET_PROPERTY(CACHE QUEUE PROPERTY STRINGS splay calendar heap kp_splay)
6255

6356
# Random Library
6457
SET(RAND clcg4)

core/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ tw-timing.c
5353

5454
tw-sched.c
5555
tw-setup.c
56-
tw-signal.c
5756
tw-stats.c
5857
tw-util.c
5958

@@ -94,7 +93,7 @@ set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
9493

9594
# Data Structure for remote Events
9695
# If AVL_TREE is OFF, ROSS reverts to hashing
97-
OPTION(AVL_TREE "Use AVL trees for optimistic mode events? (hash tabels otherwise)" ON)
96+
OPTION(AVL_TREE "Use AVL trees for optimistic mode events? (hash tables otherwise)" ON)
9897
IF(AVL_TREE)
9998
SET(ross_srcs ${ross_srcs} avl_tree.h avl_tree.c)
10099
ENDIF(AVL_TREE)

core/gvt/mpi_allreduce.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ static const tw_optdef gvt_opts [] =
1313
{
1414
TWOPT_GROUP("ROSS MPI GVT"),
1515
TWOPT_UINT("gvt-interval", g_tw_gvt_interval, "GVT Interval: Iterations through scheduling loop (synch=1,2,3,4), or ms between GVTs (synch=5)"),
16-
TWOPT_DOUBLE("report-interval", gvt_print_interval,
17-
"percent of runtime to print GVT"),
16+
TWOPT_DOUBLE("report-interval", gvt_print_interval, "percent of runtime to print GVT"),
1817
TWOPT_END()
1918
};
2019

core/network-mpi.c

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ int custom_communicator = 0;
77
/**
88
* @struct act_q
99
* @brief Keeps track of posted send or recv operations.
10+
*
11+
* This list structure is used *only* by the network mpi layer (this
12+
* file). Within this file, two lists are used, for MPI Irecv and
13+
* Isend requests. The MPI requests and statusus are linked with an
14+
* event buffer through this struct.
1015
*/
1116
struct act_q
1217
{
13-
const char *name;
18+
const char *name; /**< name of the list, used in error printouts */
1419

1520
tw_event **event_list; /**< list of event pointers in this queue */
1621
MPI_Request *req_list; /**< list of MPI request handles */
@@ -27,8 +32,8 @@ static struct act_q posted_sends;
2732
static struct act_q posted_recvs;
2833
static tw_eventq outq;
2934

30-
static unsigned int read_buffer = 16;
31-
static unsigned int send_buffer = 1024;
35+
static unsigned int read_buffer = 16; /**< Number of Irecv's to buffer, length of posted_recvs queue */
36+
static unsigned int send_buffer = 1024; /**< Number of Isend's to buffer, length of posted_sends queue */
3237
static int world_size = 1;
3338

3439
static const tw_optdef mpi_opts[] = {
@@ -85,20 +90,13 @@ tw_net_init(int *argc, char ***argv)
8590
* @param[in] name name of the queue
8691
*/
8792
static void
88-
init_q(struct act_q *q, const char *name)
93+
init_q(struct act_q *q, const char *name, unsigned int size)
8994
{
90-
unsigned int n;
91-
92-
if(q == &posted_sends)
93-
n = send_buffer;
94-
else
95-
n = read_buffer;
96-
9795
q->name = name;
98-
q->event_list = (tw_event **) tw_calloc(TW_LOC, name, sizeof(*q->event_list), n);
99-
q->req_list = (MPI_Request *) tw_calloc(TW_LOC, name, sizeof(*q->req_list), n);
100-
q->idx_list = (int *) tw_calloc(TW_LOC, name, sizeof(*q->idx_list), n);
101-
q->status_list = (MPI_Status *) tw_calloc(TW_LOC, name, sizeof(*q->status_list), n);
96+
q->event_list = (tw_event **) tw_calloc(TW_LOC, name, sizeof(tw_event *), size);
97+
q->req_list = (MPI_Request *) tw_calloc(TW_LOC, name, sizeof(MPI_Request), size);
98+
q->idx_list = (int *) tw_calloc(TW_LOC, name, sizeof(int), size);
99+
q->status_list = (MPI_Status *) tw_calloc(TW_LOC, name, sizeof(MPI_Status), size);
102100
}
103101

104102
unsigned int
@@ -110,6 +108,7 @@ tw_nnodes(void)
110108
void
111109
tw_net_start(void)
112110
{
111+
// sets value of tw_nnodes
113112
if (MPI_Comm_size(MPI_COMM_ROSS, &world_size) != MPI_SUCCESS)
114113
tw_error(TW_LOC, "Cannot get MPI_Comm_size(MPI_COMM_ROSS)");
115114

@@ -131,22 +130,12 @@ tw_net_start(void)
131130

132131
tw_pe_init();
133132

134-
//If we're in (some variation of) optimistic mode, we need this hash
135-
if (g_tw_synchronization_protocol == OPTIMISTIC ||
136-
g_tw_synchronization_protocol == OPTIMISTIC_DEBUG ||
137-
g_tw_synchronization_protocol == OPTIMISTIC_REALTIME) {
138-
g_tw_pe->hash_t = tw_hash_create();
139-
} else {
140-
g_tw_pe->hash_t = NULL;
141-
}
142-
143-
if (send_buffer < 1)
144-
tw_error(TW_LOC, "network send buffer must be >= 1");
145-
if (read_buffer < 1)
146-
tw_error(TW_LOC, "network read buffer must be >= 1");
133+
// these values are command line options
134+
if (send_buffer < 1) tw_error(TW_LOC, "network send buffer must be >= 1");
135+
if (read_buffer < 1) tw_error(TW_LOC, "network read buffer must be >= 1");
147136

148-
init_q(&posted_sends, "MPI send queue");
149-
init_q(&posted_recvs, "MPI recv queue");
137+
init_q(&posted_sends, "MPI send queue", send_buffer);
138+
init_q(&posted_recvs, "MPI recv queue", read_buffer);
150139

151140
g_tw_net_device_size = read_buffer;
152141

core/queue/tw-queue.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ unsigned int tw_pq_max_size(tw_pq *);
1313
#ifdef ROSS_QUEUE_kp_splay
1414
tw_eventpq * tw_eventpq_create(void);
1515
#endif
16-

core/ross-extern.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@ extern void tw_scheduler_optimistic(tw_pe * me);
143143
extern void tw_scheduler_optimistic_debug(tw_pe * me);
144144
extern void tw_scheduler_optimistic_realtime(tw_pe * me);
145145

146-
/*
147-
* tw-signal.c
148-
*/
149-
extern void tw_sigsegv(int sig);
150-
extern void tw_sigterm(int sig);
151-
152146
/*
153147
* tw-state.c
154148
*/

core/ross-types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ struct tw_pe {
379379
tw_eventq event_q; /**< @brief Linked list of events sent to this PE */
380380
tw_event *cancel_q; /**< @brief List of canceled events */
381381
tw_pq *pq; /**< @brief Priority queue used to sort events */
382-
tw_kp *kp_list; /**< @brief */
383382

384383
tw_eventq free_q; /**< @brief Linked list of free tw_events */
385384
tw_event *abort_event; /**< @brief Placeholder event for when free_q is empty */

core/tw-event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void tw_event_send(tw_event * event) {
3131
#endif
3232

3333
// moved from network-mpi.c in order to give all events a seq_num
34-
event->event_id = (tw_eventid) ++send_pe->seq_num;
34+
event->event_id = (tw_eventid) ++send_pe->seq_num;
3535

3636
// call LP remote mapping function to get dest_pe
3737
dest_peid = (*src_lp->type->map) ((tw_lpid) event->dest_lp);

core/tw-eventq.h

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
#include <ross.h>
77

8+
/**
9+
* debug assitant fuction
10+
*/
811
static inline void
912
tw_eventq_debug(tw_eventq * q)
1013
{
@@ -39,6 +42,9 @@ tw_eventq_debug(tw_eventq * q)
3942
#endif
4043
}
4144

45+
/**
46+
* push the contents of one list onto another??
47+
*/
4248
static inline void
4349
tw_eventq_push_list(tw_eventq * q, tw_event * h, tw_event * t, long cnt)
4450
{
@@ -115,6 +121,15 @@ tw_eventq_push_list(tw_eventq * q, tw_event * h, tw_event * t, long cnt)
115121
tw_eventq_debug(q);
116122
}
117123

124+
/**
125+
* Given a list, move the portion of its contents that is older than GVT to
126+
* the free list.
127+
*
128+
* Assumptions:
129+
* - The provided q is not the free_q
130+
* - The head of the list has the maximum time stamp in the list. Therefore,
131+
* if the head is older than GVT, everything in the list is as well.
132+
*/
118133
static inline void
119134
tw_eventq_fossil_collect(tw_eventq *q, tw_pe *pe)
120135
{
@@ -164,6 +179,9 @@ tw_eventq_fossil_collect(tw_eventq *q, tw_pe *pe)
164179
}
165180
}
166181

182+
/**
183+
* allocate a events into a given tw_eventq
184+
*/
167185
static inline void
168186
tw_eventq_alloc(tw_eventq * q, unsigned int cnt)
169187
{
@@ -198,7 +216,6 @@ tw_eventq_alloc(tw_eventq * q, unsigned int cnt)
198216
g_tw_event_msg_sz = event_len;
199217

200218
// compute number of events needed for the network.
201-
g_tw_gvt_threshold = (int) ceil(g_tw_net_device_size / g_tw_event_msg_sz);
202219
g_tw_gvt_threshold = g_tw_net_device_size;
203220
g_tw_events_per_pe += g_tw_gvt_threshold;
204221
cnt += g_tw_gvt_threshold;
@@ -233,6 +250,9 @@ tw_eventq_alloc(tw_eventq * q, unsigned int cnt)
233250
q->tail = event;
234251
}
235252

253+
/**
254+
* push to tail of list
255+
*/
236256
static inline void
237257
tw_eventq_push(tw_eventq *q, tw_event *e)
238258
{
@@ -253,12 +273,18 @@ tw_eventq_push(tw_eventq *q, tw_event *e)
253273
tw_eventq_debug(q);
254274
}
255275

276+
/**
277+
* peek to tail of list
278+
*/
256279
static inline tw_event *
257280
tw_eventq_peek(tw_eventq *q)
258281
{
259282
return q->tail;
260283
}
261284

285+
/**
286+
* pop to tail of list
287+
*/
262288
static inline tw_event *
263289
tw_eventq_pop(tw_eventq * q)
264290
{
@@ -287,6 +313,9 @@ tw_eventq_pop(tw_eventq * q)
287313
return t;
288314
}
289315

316+
/**
317+
* push to head of list
318+
*/
290319
static inline void
291320
tw_eventq_unshift(tw_eventq *q, tw_event *e)
292321
{
@@ -308,12 +337,18 @@ tw_eventq_unshift(tw_eventq *q, tw_event *e)
308337
tw_eventq_debug(q);
309338
}
310339

340+
/**
341+
* peek at head of list
342+
*/
311343
static inline tw_event *
312344
tw_eventq_peek_head(tw_eventq *q)
313345
{
314346
return q->head;
315347
}
316348

349+
/**
350+
* pop from head of list
351+
*/
317352
static inline tw_event *
318353
tw_eventq_shift(tw_eventq *q)
319354
{
@@ -342,6 +377,9 @@ tw_eventq_shift(tw_eventq *q)
342377
return h;
343378
}
344379

380+
/**
381+
* delete an event from anywhere in the list
382+
*/
345383
static inline void
346384
tw_eventq_delete_any(tw_eventq *q, tw_event *e)
347385
{
@@ -366,6 +404,10 @@ tw_eventq_delete_any(tw_eventq *q, tw_event *e)
366404
tw_eventq_debug(q);
367405
}
368406

407+
/**
408+
* pop the entire list.
409+
* After this operation, the size of the provided q is 0.
410+
*/
369411
static inline tw_event *
370412
tw_eventq_pop_list(tw_eventq * q)
371413
{
@@ -377,7 +419,7 @@ tw_eventq_pop_list(tw_eventq * q)
377419
return h;
378420
}
379421

380-
/*
422+
/**
381423
* The purpose of this function is to be able to remove some
382424
* part of a list.. could be all of list, from head to some inner
383425
* buffer, or from some inner buffer to tail. I only care about the

core/tw-pe.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,39 @@ tw_pe_settype(const tw_petype * type)
2222
#undef copy_pef
2323
}
2424

25-
/*
26-
* tw_pe_init: initialize individual PE structs
25+
/**
26+
* initialize individual PE structs
27+
*
28+
* must be called after tw_nnodes / MPI world size is set.
2729
*
2830
*/
2931
void
3032
tw_pe_init(void)
3133
{
32-
if (g_tw_pe)
33-
tw_error(TW_LOC, "PE %u already initialized", g_tw_mynode);
34+
if (g_tw_pe) tw_error(TW_LOC, "PE %u already initialized", g_tw_mynode);
3435

3536
g_tw_pe = (tw_pe*)tw_calloc(TW_LOC, "PE Struct", sizeof(*g_tw_pe), 1);
36-
tw_petype no_type;
3737

38-
memset(&no_type, 0, sizeof(no_type));
38+
g_tw_pe->id = g_tw_mynode;
3939

40-
g_tw_pe->id = g_tw_mynode;
41-
tw_pe_settype(&no_type);
40+
tw_petype no_type;
41+
memset(&no_type, 0, sizeof(no_type));
42+
tw_pe_settype(&no_type);
4243

43-
g_tw_pe->trans_msg_ts = TW_STIME_MAX;
44-
g_tw_pe->gvt_status = 0;
44+
g_tw_pe->trans_msg_ts = DBL_MAX;
45+
g_tw_pe->gvt_status = 0;
4546

4647
// TODO is the PE RNG ever actually used?
47-
g_tw_pe->rng = tw_rand_init(31, 41);
48+
g_tw_pe->rng = tw_rand_init(31, 41);
49+
50+
//If we're in (some variation of) optimistic mode, we need this hash
51+
if (g_tw_synchronization_protocol == OPTIMISTIC ||
52+
g_tw_synchronization_protocol == OPTIMISTIC_DEBUG ||
53+
g_tw_synchronization_protocol == OPTIMISTIC_REALTIME) {
54+
g_tw_pe->hash_t = tw_hash_create();
55+
} else {
56+
g_tw_pe->hash_t = NULL;
57+
}
4858

4959
}
5060

0 commit comments

Comments
 (0)