Commit a9d21e30 authored by Jonathan Jenkins's avatar Jonathan Jenkins

move to simpler packet_event using model_net_request

parent 21293ecc
......@@ -27,26 +27,15 @@ struct model_net_method
* uses it) */
void (*mn_register)(tw_lptype *base_type);
tw_stime (*model_net_method_packet_event)(
char const * category,
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp, // destination modelnet lp, computed by sender
uint64_t packet_size,
int is_pull,
uint64_t pull_size, /* only used when is_pull==1 */
tw_stime offset,
// this parameter is used to propagate message specific parameters
// to modelnet models that need it. Required by routing-related
// functions (currently just model_net_method_send_msg_recv_event)
//
// TODO: make this param more general
const mn_sched_params *sched_params,
int remote_event_size, /* 0 means don't deliver remote event */
const void* remote_event,
int self_event_size, /* 0 means don't deliver self event */
const void* self_event,
tw_lpid src_lp, // original caller of model_net_(pull_)event
tw_lp *sender, // lp message is being called from (base LP)
int is_last_pckt);
model_net_request const * req,
uint64_t message_offset, // offset in the context of the whole message
uint64_t packet_size, // needed in case message < packet
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt);
void (*model_net_method_packet_event_rc)(tw_lp *sender);
tw_stime (*model_net_method_recv_msg_event)(
const char * category,
......
......@@ -761,12 +761,16 @@ void router_setup(router_state * r, tw_lp * lp)
/* dragonfly packet event , generates a dragonfly packet on the compute node */
static tw_stime dragonfly_packet_event(const char* category,
tw_lpid final_dest_lp, tw_lpid dest_mn_lp,
uint64_t packet_size, int is_pull,
uint64_t pull_size, tw_stime offset, const mn_sched_params *sched_params,
int remote_event_size, const void* remote_event, int self_event_size,
const void* self_event, tw_lpid src_lp, tw_lp *sender, int is_last_pckt)
static tw_stime dragonfly_packet_event(
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt)
{
tw_event * e_new;
tw_stime xfer_to_nic_time;
......@@ -779,30 +783,30 @@ static tw_stime dragonfly_packet_event(const char* category,
//msg = tw_event_data(e_new);
e_new = model_net_method_event_new(sender->gid, xfer_to_nic_time+offset,
sender, DRAGONFLY, (void**)&msg, (void**)&tmp_ptr);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
msg->sender_lp=src_lp;
strcpy(msg->category, req->category);
msg->final_dest_gid = req->final_dest_lp;
msg->sender_lp=req->src_lp;
msg->packet_size = packet_size;
msg->remote_event_size_bytes = 0;
msg->local_event_size_bytes = 0;
msg->type = T_GENERATE;
msg->is_pull = is_pull;
msg->pull_size = pull_size;
msg->is_pull = req->is_pull;
msg->pull_size = req->pull_size;
msg->magic = terminal_magic_num;
if(is_last_pckt) /* Its the last packet so pass in remote and local event information*/
{
if(remote_event_size > 0)
if(req->remote_event_size > 0)
{
msg->remote_event_size_bytes = remote_event_size;
memcpy(tmp_ptr, remote_event, remote_event_size);
tmp_ptr += remote_event_size;
msg->remote_event_size_bytes = req->remote_event_size;
memcpy(tmp_ptr, remote_event, req->remote_event_size);
tmp_ptr += req->remote_event_size;
}
if(self_event_size > 0)
if(req->self_event_size > 0)
{
msg->local_event_size_bytes = self_event_size;
memcpy(tmp_ptr, self_event, self_event_size);
tmp_ptr += self_event_size;
msg->local_event_size_bytes = req->self_event_size;
memcpy(tmp_ptr, self_event, req->self_event_size);
tmp_ptr += req->self_event_size;
}
}
//printf("\n dragonfly remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time);
......
......@@ -110,21 +110,15 @@ static void loggp_set_params(const char * config_file, loggp_param * params);
/* Issues a loggp packet event call */
static tw_stime loggp_packet_event(
char const * category,
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp,
uint64_t packet_size,
int is_pull,
uint64_t pull_size, /* only used when is_pull==1 */
tw_stime offset,
const mn_sched_params *sched_params,
int remote_event_size,
const void* remote_event,
int self_event_size,
const void* self_event,
tw_lpid src_lp,
tw_lp *sender,
int is_last_pckt);
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt);
static void loggp_packet_event_rc(tw_lp *sender);
tw_stime loggp_recv_msg_event(
......@@ -608,21 +602,15 @@ static void handle_msg_start_event(
/*This method will serve as an intermediate layer between loggp and modelnet.
* It takes the packets from modelnet layer and calls underlying loggp methods*/
static tw_stime loggp_packet_event(
char const* category,
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp,
uint64_t packet_size,
int is_pull,
uint64_t pull_size, /* only used when is_pull==1 */
tw_stime offset,
const mn_sched_params *sched_params,
int remote_event_size,
const void* remote_event,
int self_event_size,
const void* self_event,
tw_lpid src_lp,
tw_lp *sender,
int is_last_pckt)
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt)
{
tw_event * e_new;
tw_stime xfer_to_nic_time;
......@@ -634,18 +622,18 @@ static tw_stime loggp_packet_event(
sender, LOGGP, (void**)&msg, (void**)&tmp_ptr);
//e_new = tw_event_new(dest_id, xfer_to_nic_time+offset, sender);
//msg = tw_event_data(e_new);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
msg->dest_mn_lp = dest_mn_lp;
msg->src_gid = src_lp;
strcpy(msg->category, req->category);
msg->final_dest_gid = req->final_dest_lp;
msg->dest_mn_lp = req->dest_mn_lp;
msg->src_gid = req->src_lp;
msg->src_mn_lp = sender->gid;
msg->magic = loggp_get_magic();
msg->net_msg_size_bytes = packet_size;
msg->event_size_bytes = 0;
msg->local_event_size_bytes = 0;
msg->event_type = LG_MSG_START;
msg->is_pull = is_pull;
msg->pull_size = pull_size;
msg->is_pull = req->is_pull;
msg->pull_size = req->pull_size;
msg->sched_params = *sched_params;
//tmp_ptr = (char*)msg;
......@@ -655,17 +643,17 @@ static tw_stime loggp_packet_event(
/*Fill in loggp information*/
if(is_last_pckt) /* Its the last packet so pass in remote event information*/
{
if(remote_event_size)
if(req->remote_event_size)
{
msg->event_size_bytes = remote_event_size;
memcpy(tmp_ptr, remote_event, remote_event_size);
tmp_ptr += remote_event_size;
msg->event_size_bytes = req->remote_event_size;
memcpy(tmp_ptr, remote_event, req->remote_event_size);
tmp_ptr += req->remote_event_size;
}
if(self_event_size)
if(req->self_event_size)
{
msg->local_event_size_bytes = self_event_size;
memcpy(tmp_ptr, self_event, self_event_size);
tmp_ptr += self_event_size;
msg->local_event_size_bytes = req->self_event_size;
memcpy(tmp_ptr, self_event, req->self_event_size);
tmp_ptr += req->self_event_size;
}
// printf("\n Last packet size: %d ", loggp_get_msg_sz() + remote_event_size + self_event_size);
}
......
......@@ -264,12 +264,9 @@ int fcfs_next(
"from %lu to %lu at %1.5e (last:%d)\n",
lp->gid, psize, q->rem, q->req.src_lp, q->req.final_dest_lp,
tw_now(lp), is_last_packet);
*poffset = s->method->model_net_method_packet_event(q->req.category,
q->req.final_dest_lp, q->req.dest_mn_lp, psize, q->req.is_pull,
q->req.pull_size, 0.0, &q->sched_params,
q->req.remote_event_size, q->remote_event,
q->req.self_event_size, q->local_event, q->req.src_lp, lp,
is_last_packet);
*poffset = s->method->model_net_method_packet_event(&q->req,
q->req.msg_size - q->rem, psize, 0.0, &q->sched_params,
q->remote_event, q->local_event, lp, is_last_packet);
}
// if last packet - remove from list, free, save for rc
......@@ -337,11 +334,11 @@ void fcfs_next_rc(
if (q->rem == 0){ // processed exactly a packet's worth of data
q->rem = q->req.packet_size;
}
void * e_dat = rc_event_save;
const void * e_dat = rc_event_save;
if (q->req.remote_event_size > 0){
q->remote_event = malloc(q->req.remote_event_size);
memcpy(q->remote_event, e_dat, q->req.remote_event_size);
e_dat = (char*) e_dat + q->req.remote_event_size;
e_dat = (const char*) e_dat + q->req.remote_event_size;
}
else { q->remote_event = NULL; }
if (q->req.self_event_size > 0) {
......
......@@ -92,21 +92,15 @@ static void sn_configure();
*/
/* Issues a simplenet packet event call */
static tw_stime simplenet_packet_event(
char const * category,
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp,
uint64_t packet_size,
int is_pull,
uint64_t pull_size, /* only used when is_pull==1 */
tw_stime offset,
const mn_sched_params *sched_params,
int remote_event_size,
const void* remote_event,
int self_event_size,
const void* self_event,
tw_lpid src_lp,
tw_lp *sender,
int is_last_pckt);
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt);
static void simplenet_packet_event_rc(tw_lp *sender);
......@@ -521,21 +515,15 @@ static void handle_msg_start_event(
/*This method will serve as an intermediate layer between simplenet and modelnet.
* It takes the packets from modelnet layer and calls underlying simplenet methods*/
static tw_stime simplenet_packet_event(
char const * category,
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp,
uint64_t packet_size,
int is_pull,
uint64_t pull_size, /* only used when is_pull == 1 */
tw_stime offset,
const mn_sched_params *sched_params,
int remote_event_size,
const void* remote_event,
int self_event_size,
const void* self_event,
tw_lpid src_lp,
tw_lp *sender,
int is_last_pckt)
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt)
{
tw_event * e_new;
tw_stime xfer_to_nic_time;
......@@ -546,33 +534,33 @@ static tw_stime simplenet_packet_event(
// this is a self message
e_new = model_net_method_event_new(sender->gid, xfer_to_nic_time+offset,
sender, SIMPLENET, (void**)&msg, (void**)&tmp_ptr);
strcpy(msg->category, category);
msg->src_gid = src_lp;
strcpy(msg->category, req->category);
msg->src_gid = req->src_lp;
msg->src_mn_lp = sender->gid;
msg->final_dest_gid = final_dest_lp;
msg->dest_mn_lp = dest_mn_lp;
msg->final_dest_gid = req->final_dest_lp;
msg->dest_mn_lp = req->dest_mn_lp;
msg->magic = sn_get_magic();
msg->net_msg_size_bytes = packet_size;
msg->event_size_bytes = 0;
msg->local_event_size_bytes = 0;
msg->event_type = SN_MSG_START;
msg->is_pull = is_pull;
msg->pull_size = pull_size;
msg->is_pull = req->is_pull;
msg->pull_size = req->pull_size;
/*Fill in simplenet information*/
if(is_last_pckt) /* Its the last packet so pass in remote event information*/
{
if(remote_event_size)
if(req->remote_event_size)
{
msg->event_size_bytes = remote_event_size;
memcpy(tmp_ptr, remote_event, remote_event_size);
tmp_ptr += remote_event_size;
msg->event_size_bytes = req->remote_event_size;
memcpy(tmp_ptr, remote_event, req->remote_event_size);
tmp_ptr += req->remote_event_size;
}
if(self_event_size)
if(req->self_event_size)
{
msg->local_event_size_bytes = self_event_size;
memcpy(tmp_ptr, self_event, self_event_size);
tmp_ptr += self_event_size;
msg->local_event_size_bytes = req->self_event_size;
memcpy(tmp_ptr, self_event, req->self_event_size);
tmp_ptr += req->self_event_size;
}
}
tw_event_send(e_new);
......
......@@ -124,19 +124,13 @@ static void simple_wan_collective_rc();
/* Issues a simplep2p packet event call */
static tw_stime simplep2p_packet_event(
char const * category,
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp,
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
int is_pull,
uint64_t pull_size, /* only used when is_pull == 1 */
tw_stime offset,
const mn_sched_params *sched_params,
int remote_event_size,
const void* remote_event,
int self_event_size,
const void* self_event,
tw_lpid src_lp,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt);
......@@ -801,19 +795,13 @@ static void handle_msg_start_event(
/*This method will serve as an intermediate layer between simplep2p and modelnet.
* It takes the packets from modelnet layer and calls underlying simplep2p methods*/
static tw_stime simplep2p_packet_event(
char const * category,
tw_lpid final_dest_lp,
tw_lpid dest_mn_lp,
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
int is_pull,
uint64_t pull_size, /* only used when is_pull == 1 */
tw_stime offset,
const mn_sched_params *sched_params,
int remote_event_size,
const void* remote_event,
int self_event_size,
const void* self_event,
tw_lpid src_lp,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt)
{
......@@ -826,41 +814,41 @@ static tw_stime simplep2p_packet_event(
#if SIMPLEP2P_DEBUG
printf("%lu: final %lu packet sz %d remote sz %d self sz %d is_last_pckt %d latency %lf\n",
(src_lp - 1) / 2, final_dest_lp, packet_size,
remote_event_size, self_event_size, is_last_pckt,
(src_lp - 1) / 2, req->final_dest_lp, packet_size,
req->remote_event_size, req->self_event_size, is_last_pckt,
xfer_to_nic_time+offset);
#endif
e_new = model_net_method_event_new(sender->gid, xfer_to_nic_time+offset,
sender, SIMPLEP2P, (void**)&msg, (void**)&tmp_ptr);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
msg->dest_mn_lp = dest_mn_lp;
msg->src_gid = src_lp;
strcpy(msg->category, req->category);
msg->final_dest_gid = req->final_dest_lp;
msg->dest_mn_lp = req->dest_mn_lp;
msg->src_gid = req->src_lp;
msg->src_mn_lp = sender->gid;
msg->magic = sp_get_magic();
msg->net_msg_size_bytes = packet_size;
msg->event_size_bytes = 0;
msg->local_event_size_bytes = 0;
msg->event_type = SP_MSG_START;
msg->is_pull = is_pull;
msg->pull_size = pull_size;
msg->is_pull = req->is_pull;
msg->pull_size = req->pull_size;
//printf("\n Sending to LP %d msg magic %d ", (int)dest_id, sp_get_magic());
/*Fill in simplep2p information*/
if(is_last_pckt) /* Its the last packet so pass in remote event information*/
{
if(remote_event_size)
if(req->remote_event_size)
{
msg->event_size_bytes = remote_event_size;
memcpy(tmp_ptr, remote_event, remote_event_size);
tmp_ptr += remote_event_size;
msg->event_size_bytes = req->remote_event_size;
memcpy(tmp_ptr, remote_event, req->remote_event_size);
tmp_ptr += req->remote_event_size;
}
if(self_event_size)
if(req->self_event_size)
{
msg->local_event_size_bytes = self_event_size;
memcpy(tmp_ptr, self_event, self_event_size);
tmp_ptr += self_event_size;
msg->local_event_size_bytes = req->self_event_size;
memcpy(tmp_ptr, self_event, req->self_event_size);
tmp_ptr += req->self_event_size;
}
// printf("\n Last packet size: %d ", sp_get_msg_sz() + remote_event_size + self_event_size);
}
......
......@@ -346,47 +346,56 @@ static int torus_get_msg_sz(void)
}
/* torus packet event , generates a torus packet on the compute node */
static tw_stime torus_packet_event(char const * category, tw_lpid final_dest_lp, tw_lpid dest_mn_lp, uint64_t packet_size, int is_pull, uint64_t pull_size, tw_stime offset, const mn_sched_params *sched_params, int remote_event_size, const void* remote_event, int self_event_size, const void* self_event, tw_lpid src_lp, tw_lp *sender, int is_last_pckt)
static tw_stime torus_packet_event(
model_net_request const * req,
uint64_t message_offset,
uint64_t packet_size,
tw_stime offset,
mn_sched_params const * sched_params,
void const * remote_event,
void const * self_event,
tw_lp *sender,
int is_last_pckt)
{
tw_event * e_new;
tw_stime xfer_to_nic_time;
nodes_message * msg;
char* tmp_ptr;
xfer_to_nic_time = g_tw_lookahead + codes_local_latency(sender); /* Throws an error of found last KP time > current event time otherwise */
//e_new = tw_event_new(local_nic_id, xfer_to_nic_time+offset, sender);
//msg = tw_event_data(e_new);
e_new = model_net_method_event_new(sender->gid, xfer_to_nic_time+offset,
sender, TORUS, (void**)&msg, (void**)&tmp_ptr);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
msg->dest_lp = dest_mn_lp;
msg->sender_svr= src_lp;
strcpy(msg->category, req->category);
msg->final_dest_gid = req->final_dest_lp;
msg->dest_lp = req->dest_mn_lp;
msg->sender_svr= req->src_lp;
msg->sender_node = sender->gid;
msg->packet_size = packet_size;
msg->remote_event_size_bytes = 0;
msg->local_event_size_bytes = 0;
msg->chunk_id = 0;
msg->type = GENERATE;
msg->is_pull = is_pull;
msg->pull_size = pull_size;
msg->is_pull = req->is_pull;
msg->pull_size = req->pull_size;
if(is_last_pckt) /* Its the last packet so pass in remote event information*/
{
if(remote_event_size > 0)
{
msg->remote_event_size_bytes = remote_event_size;
memcpy(tmp_ptr, remote_event, remote_event_size);
tmp_ptr += remote_event_size;
}
if(self_event_size > 0)
{
msg->local_event_size_bytes = self_event_size;
memcpy(tmp_ptr, self_event, self_event_size);
tmp_ptr += self_event_size;
}
// printf("\n torus remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time);
}
{
if(req->remote_event_size > 0)
{
msg->remote_event_size_bytes = req->remote_event_size;
memcpy(tmp_ptr, remote_event, req->remote_event_size);
tmp_ptr += req->remote_event_size;
}
if(req->self_event_size > 0)
{
msg->local_event_size_bytes = req->self_event_size;
memcpy(tmp_ptr, self_event, req->self_event_size);
tmp_ptr += req->self_event_size;
}
// printf("\n torus remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time);
}
tw_event_send(e_new);
return xfer_to_nic_time;
}
......
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