Commit 6e378c26 authored by Neil McGlohon's avatar Neil McGlohon

model-net-mpi-replay: Fix random permutation pattern init

Somehow the bug where the first destination of the random permutation
pattern wasn't randomized (but instead defaulted to rank 0) returned.
This resulted in attempted self messages if terminal 0 is allocated
for the random permutation workload as it will, by default, attempt
to send messages to itself resulting in a failed assert.

This fix checks to see if the rank has generated any data yet. If
it hasn't, then it will pick a non-self random destination and will
send to that destination until the random permutation threshold has
been met.
parent dac6c39d
...@@ -687,6 +687,9 @@ static void gen_synthetic_tr_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp ...@@ -687,6 +687,9 @@ static void gen_synthetic_tr_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp
if(bf->c5) if(bf->c5)
s->is_finished = 0; s->is_finished = 0;
if(bf->c7)
tw_rand_reverse_unif(lp->rng);
} }
/* generate synthetic traffic */ /* generate synthetic traffic */
...@@ -730,6 +733,16 @@ static void gen_synthetic_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * l ...@@ -730,6 +733,16 @@ static void gen_synthetic_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * l
length = 1; length = 1;
dest_svr = (int*) calloc(1, sizeof(int)); dest_svr = (int*) calloc(1, sizeof(int));
if(s->gen_data == 0)
{
/*initialize the perm destination to something that is nonzero and thus preventing
possible attempt at self message*/
bf->c7 = 1;
s->saved_perm_dest = tw_rand_integer(lp->rng, 0, num_clients - 1);
if (s->saved_perm_dest == s->local_rank)
s->saved_perm_dest = (s->local_rank + num_clients/2) % num_clients;
}
if(s->gen_data - s->prev_switch >= perm_switch_thresh) if(s->gen_data - s->prev_switch >= perm_switch_thresh)
{ {
// printf("%d - %d >= %d\n",s->gen_data,s->prev_switch,perm_switch_thresh); // printf("%d - %d >= %d\n",s->gen_data,s->prev_switch,perm_switch_thresh);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment