Commit c65c84a1 authored by Jonathan Jenkins's avatar Jonathan Jenkins

update use of max function (undef'd by ROSS)

parent 8c1f323e
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#define LP_CONFIG_NM (model_net_lp_config_names[DRAGONFLY]) #define LP_CONFIG_NM (model_net_lp_config_names[DRAGONFLY])
#define LP_METHOD_NM (model_net_method_names[DRAGONFLY]) #define LP_METHOD_NM (model_net_method_names[DRAGONFLY])
static double maxd(double a, double b) { return a < b ? b : a; }
// arrival rate // arrival rate
static double MEAN_INTERVAL=200.0; static double MEAN_INTERVAL=200.0;
/* radix of a dragonfly router = number of global channels + number of /* radix of a dragonfly router = number of global channels + number of
...@@ -428,7 +430,7 @@ void router_credit_send(router_state * s, tw_bf * bf, terminal_message * msg, tw ...@@ -428,7 +430,7 @@ void router_credit_send(router_state * s, tw_bf * bf, terminal_message * msg, tw
// Assume it takes 0.1 ns of serialization latency for processing the credits in the queue // Assume it takes 0.1 ns of serialization latency for processing the credits in the queue
int output_port = msg->saved_vc / num_vcs; int output_port = msg->saved_vc / num_vcs;
msg->saved_available_time = s->next_credit_available_time[output_port]; msg->saved_available_time = s->next_credit_available_time[output_port];
s->next_credit_available_time[output_port] = max(tw_now(lp), s->next_credit_available_time[output_port]); s->next_credit_available_time[output_port] = maxd(tw_now(lp), s->next_credit_available_time[output_port]);
ts = credit_delay + 0.1 + tw_rand_exponential(lp->rng, (double)credit_delay/1000); ts = credit_delay + 0.1 + tw_rand_exponential(lp->rng, (double)credit_delay/1000);
s->next_credit_available_time[output_port]+=ts; s->next_credit_available_time[output_port]+=ts;
...@@ -541,7 +543,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, tw_lp * ...@@ -541,7 +543,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, tw_lp *
msg->saved_available_time = s->terminal_available_time; msg->saved_available_time = s->terminal_available_time;
head_delay = (1/cn_bandwidth) * chunk_size; head_delay = (1/cn_bandwidth) * chunk_size;
ts = head_delay + tw_rand_exponential(lp->rng, (double)head_delay/200); ts = head_delay + tw_rand_exponential(lp->rng, (double)head_delay/200);
s->terminal_available_time = max(s->terminal_available_time, tw_now(lp)); s->terminal_available_time = maxd(s->terminal_available_time, tw_now(lp));
s->terminal_available_time += ts; s->terminal_available_time += ts;
//TODO: be annotation-aware //TODO: be annotation-aware
...@@ -662,7 +664,7 @@ if( msg->packet_ID == TRACK && msg->chunk_id == num_chunks-1) ...@@ -662,7 +664,7 @@ if( msg->packet_ID == TRACK && msg->chunk_id == num_chunks-1)
ts = credit_delay + 0.1 + tw_rand_exponential(lp->rng, credit_delay/1000); ts = credit_delay + 0.1 + tw_rand_exponential(lp->rng, credit_delay/1000);
msg->saved_credit_time = s->next_credit_available_time; msg->saved_credit_time = s->next_credit_available_time;
s->next_credit_available_time = max(s->next_credit_available_time, tw_now(lp)); s->next_credit_available_time = maxd(s->next_credit_available_time, tw_now(lp));
s->next_credit_available_time += ts; s->next_credit_available_time += ts;
tw_lpid router_dest_id; tw_lpid router_dest_id;
...@@ -1292,7 +1294,7 @@ if( msg->packet_ID == TRACK && next_stop != msg->dest_terminal_id && msg->chunk_ ...@@ -1292,7 +1294,7 @@ if( msg->packet_ID == TRACK && next_stop != msg->dest_terminal_id && msg->chunk_
msg->saved_available_time = s->next_output_available_time[output_port]; msg->saved_available_time = s->next_output_available_time[output_port];
ts = g_tw_lookahead + 0.1 + ((1/bandwidth) * chunk_size) + tw_rand_exponential(lp->rng, (double)chunk_size/200); ts = g_tw_lookahead + 0.1 + ((1/bandwidth) * chunk_size) + tw_rand_exponential(lp->rng, (double)chunk_size/200);
s->next_output_available_time[output_port] = max(s->next_output_available_time[output_port], tw_now(lp)); s->next_output_available_time[output_port] = maxd(s->next_output_available_time[output_port], tw_now(lp));
s->next_output_available_time[output_port] += ts; s->next_output_available_time[output_port] += ts;
// dest can be a router or a terminal, so we must check // dest can be a router or a terminal, so we must check
void * m_data; void * m_data;
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define LP_CONFIG_NM (model_net_lp_config_names[TORUS]) #define LP_CONFIG_NM (model_net_lp_config_names[TORUS])
#define LP_METHOD_NM (model_net_method_names[TORUS]) #define LP_METHOD_NM (model_net_method_names[TORUS])
static double maxd(double a, double b) { return a < b ? b : a; }
/* Torus network model implementation of codes, implements the modelnet API */ /* Torus network model implementation of codes, implements the modelnet API */
/* Link bandwidth for each torus link, configurable from the config file */ /* Link bandwidth for each torus link, configurable from the config file */
...@@ -811,7 +813,7 @@ static void credit_send( nodes_state * s, ...@@ -811,7 +813,7 @@ static void credit_send( nodes_state * s,
int src_dim = msg->source_dim; int src_dim = msg->source_dim;
msg->saved_available_time = s->next_credit_available_time[(2 * src_dim) + src_dir][0]; msg->saved_available_time = s->next_credit_available_time[(2 * src_dim) + src_dir][0];
s->next_credit_available_time[(2 * src_dim) + src_dir][0] = max(s->next_credit_available_time[(2 * src_dim) + src_dir][0], tw_now(lp)); s->next_credit_available_time[(2 * src_dim) + src_dir][0] = maxd(s->next_credit_available_time[(2 * src_dim) + src_dir][0], tw_now(lp));
ts = credit_delay + tw_rand_exponential(lp->rng, credit_delay/1000); ts = credit_delay + tw_rand_exponential(lp->rng, credit_delay/1000);
s->next_credit_available_time[(2 * src_dim) + src_dir][0] += ts; s->next_credit_available_time[(2 * src_dim) + src_dir][0] += ts;
...@@ -852,7 +854,7 @@ static void packet_send( nodes_state * s, ...@@ -852,7 +854,7 @@ static void packet_send( nodes_state * s,
// For reverse computation // For reverse computation
msg->saved_available_time = s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0]; msg->saved_available_time = s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0];
s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0] = max( s->next_link_available_time[ tmp_dir + ( tmp_dim * 2 )][0], tw_now(lp) ); s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0] = maxd( s->next_link_available_time[ tmp_dir + ( tmp_dim * 2 )][0], tw_now(lp) );
s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0] += ts; s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0] += ts;
//e = tw_event_new( dst_lp, s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0] - tw_now(lp), lp ); //e = tw_event_new( dst_lp, s->next_link_available_time[tmp_dir + ( tmp_dim * 2 )][0] - tw_now(lp), lp );
......
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