Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
codes
codes
Commits
ae285cf3
Commit
ae285cf3
authored
Aug 04, 2015
by
Jonathan Jenkins
Browse files
convert modelnet to provide map-ctx APIs, use map-ctx internally
parent
0d807b5f
Changes
18
Hide whitespace changes
Inline
Side-by-side
codes/model-net-method.h
View file @
ae285cf3
...
...
@@ -29,6 +29,7 @@ struct model_net_method
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 */
...
...
@@ -62,10 +63,6 @@ struct model_net_method
const
tw_lptype
*
(
*
mn_get_lp_type
)();
int
(
*
mn_get_msg_sz
)();
void
(
*
mn_report_stats
)();
tw_lpid
(
*
model_net_method_find_local_device
)(
const
char
*
annotation
,
int
ignore_annotations
,
tw_lpid
sender_gid
);
void
(
*
mn_collective_call
)(
char
const
*
category
,
int
message_size
,
int
remote_event_size
,
const
void
*
remote_event
,
tw_lp
*
sender
);
void
(
*
mn_collective_call_rc
)(
int
message_size
,
tw_lp
*
sender
);
};
...
...
codes/model-net.h
View file @
ae285cf3
...
...
@@ -7,10 +7,11 @@
#ifndef MODELNET_H
#define MODELNET_H
#include "ross.h"
#include "codes/lp-type-lookup.h"
#include "codes/configuration.h"
#include "codes/lp-io.h"
#include <ross.h>
#include <codes/lp-type-lookup.h>
#include <codes/configuration.h>
#include <codes/lp-io.h>
#include <codes/codes-mapping-context.h>
#include <stdint.h>
#define PULL_MSG_SIZE 128
...
...
@@ -73,6 +74,7 @@ extern char * model_net_method_names[];
// not the user)
typedef
struct
model_net_request
{
tw_lpid
final_dest_lp
;
tw_lpid
dest_mn_lp
;
// destination modelnet lp
tw_lpid
src_lp
;
uint64_t
msg_size
;
uint64_t
packet_size
;
...
...
@@ -167,10 +169,10 @@ void model_net_event_collective_rc(
* - sender: pointer to the tw_lp structure of the API caller. This is
* identical to the sender argument to tw_event_new().
*
* The modelnet LP used for communication is
the LP in the same group, same
*
repetition, using net_id to differentiate different model types. If
*
more than one modelnet model of the same type but different annotation exist,
*
t
hen
the first one listed will be used.
* The modelnet LP used for communication is
determined by the default CODES
*
map context (see codes-base, codes/codes-mapping-context.h), using net_id
*
to differentiate different model types. Note that the map context is used
*
w
hen
calculating *both* sender and receiver modelnet LPs
*/
// first argument becomes the network ID
void
model_net_event
(
...
...
@@ -189,7 +191,8 @@ void model_net_event(
*
* Unlike model_net_event, this function uses the annotation to differentiate
* multiple modelnet LPs with the same type but different annotation. The caller
* annotation is not consulted here.
* annotation is not consulted here. The corresponding CODES map context is
* CODES_MCTX_GROUP_MODULO with the supplied annotation arguments.
*/
void
model_net_event_annotated
(
int
net_id
,
...
...
@@ -203,10 +206,32 @@ void model_net_event_annotated(
int
self_event_size
,
void
const
*
self_event
,
tw_lp
*
sender
);
/*
* See model_net_event for a general description.
*
* This variant uses CODES map contexts to calculate the sender and receiver
* modelnet LPs
*/
void
model_net_event_mctx
(
int
net_id
,
struct
codes_mctx
const
*
send_map_ctx
,
struct
codes_mctx
const
*
recv_map_ctx
,
char
const
*
category
,
tw_lpid
final_dest_lp
,
uint64_t
message_size
,
tw_stime
offset
,
int
remote_event_size
,
void
const
*
remote_event
,
int
self_event_size
,
void
const
*
self_event
,
tw_lp
*
sender
);
/* model_net_find_local_device()
*
* returns the LP id of the network card attached to the calling LP
* returns the LP id of the network card attached to the calling LP using the
* default CODES mapping context if ignore_annotations is true, and
* CODES_MCTX_GROUP_MODULO with the supplied annotation parameters otherwise
*/
tw_lpid
model_net_find_local_device
(
int
net_id
,
...
...
@@ -214,6 +239,12 @@ tw_lpid model_net_find_local_device(
int
ignore_annotations
,
tw_lpid
sender_gid
);
/* same as ^, except use the supplied mapping context */
tw_lpid
model_net_find_local_device_mctx
(
int
net_id
,
struct
codes_mctx
const
*
map_ctx
,
tw_lpid
sender_gid
);
int
model_net_get_msg_sz
(
int
net_id
);
/* model_net_event_rc()
...
...
@@ -263,6 +294,17 @@ void model_net_pull_event_annotated(
int
self_event_size
,
void
const
*
self_event
,
tw_lp
*
sender
);
void
model_net_pull_event_mctx
(
int
net_id
,
struct
codes_mctx
*
const
send_map_ctx
,
struct
codes_mctx
*
const
recv_map_ctx
,
char
const
*
category
,
tw_lpid
final_dest_lp
,
uint64_t
message_size
,
tw_stime
offset
,
int
self_event_size
,
void
const
*
self_event
,
tw_lp
*
sender
);
void
model_net_pull_event_rc
(
int
net_id
,
tw_lp
*
sender
);
...
...
codes/net/dragonfly.h
View file @
ae285cf3
...
...
@@ -29,8 +29,9 @@ struct terminal_message
tw_lpid
final_dest_gid
;
/*sending LP ID from CODES, can be a server or any other LP type */
tw_lpid
sender_lp
;
tw_lpid
sender_mn_lp
;
// source modelnet id
/* destination terminal ID of the dragonfly */
unsigned
int
dest_terminal_id
;
tw_lpid
dest_terminal_id
;
/* source terminal ID of the dragonfly */
unsigned
int
src_terminal_id
;
/* local LP ID to calculate the radix of the sender node/router */
...
...
codes/net/loggp.h
View file @
ae285cf3
...
...
@@ -23,7 +23,9 @@ struct loggp_message
int
magic
;
/* magic number */
enum
loggp_event_type
event_type
;
tw_lpid
src_gid
;
/* who transmitted this msg? */
tw_lpid
src_mn_lp
;
// src modelnet id, provided by sender
tw_lpid
final_dest_gid
;
/* who is eventually targetted with this msg? */
tw_lpid
dest_mn_lp
;
// destination modelnet id, provided by sender
uint64_t
net_msg_size_bytes
;
/* size of modeled network message */
int
event_size_bytes
;
/* size of simulator event message that will be tunnelled to destination */
int
local_event_size_bytes
;
/* size of simulator event message that delivered locally upon local completion */
...
...
codes/net/simplenet-upd.h
View file @
ae285cf3
...
...
@@ -21,7 +21,9 @@ struct sn_message
int
magic
;
/* magic number */
enum
sn_event_type
event_type
;
tw_lpid
src_gid
;
/* who transmitted this msg? */
tw_lpid
src_mn_lp
;
// src modelnet id, provided by sender
tw_lpid
final_dest_gid
;
/* who is eventually targetted with this msg? */
tw_lpid
dest_mn_lp
;
// destination modelnet id, provided by sender
uint64_t
net_msg_size_bytes
;
/* size of modeled network message */
int
event_size_bytes
;
/* size of simulator event message that will be tunnelled to destination */
int
local_event_size_bytes
;
/* size of simulator event message that delivered locally upon local completion */
...
...
codes/net/simplep2p.h
View file @
ae285cf3
...
...
@@ -20,7 +20,9 @@ struct sp_message
int
magic
;
/* magic number */
enum
sp_event_type
event_type
;
tw_lpid
src_gid
;
/* who transmitted this msg? */
tw_lpid
src_mn_lp
;
// src modelnet id, provided by sender
tw_lpid
final_dest_gid
;
/* who is eventually targetted with this msg? */
tw_lpid
dest_mn_lp
;
// destination modelnet id, provided by sender
/* relative ID of the sending simplep2p message (for latency/bandwidth lookup) */
int
src_mn_rel_id
;
int
dest_mn_rel_id
;
/* included to make rc easier */
...
...
src/models/networks/model-net/dragonfly.c
View file @
ae285cf3
...
...
@@ -423,7 +423,7 @@ void dragonfly_collective_init(terminal_state * s,
}
/* dragonfly packet event , generates a dragonfly packet on the compute node */
static
tw_stime
dragonfly_packet_event
(
char
*
category
,
tw_lpid
final_dest_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
(
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
)
{
tw_event
*
e_new
;
tw_stime
xfer_to_nic_time
;
...
...
@@ -438,7 +438,9 @@ static tw_stime dragonfly_packet_event(char* category, tw_lpid final_dest_lp, ui
sender
,
DRAGONFLY
,
(
void
**
)
&
msg
,
(
void
**
)
&
tmp_ptr
);
strcpy
(
msg
->
category
,
category
);
msg
->
final_dest_gid
=
final_dest_lp
;
msg
->
dest_terminal_id
=
dest_mn_lp
;
msg
->
sender_lp
=
src_lp
;
msg
->
sender_mn_lp
=
sender
->
gid
;
msg
->
packet_size
=
packet_size
;
msg
->
remote_event_size_bytes
=
0
;
msg
->
local_event_size_bytes
=
0
;
...
...
@@ -576,11 +578,6 @@ void router_credit_send(router_state * s, tw_bf * bf, terminal_message * msg, tw
/* generates packet at the current dragonfly compute node */
void
packet_generate
(
terminal_state
*
s
,
tw_bf
*
bf
,
terminal_message
*
msg
,
tw_lp
*
lp
)
{
tw_lpid
dest_terminal_id
;
dest_terminal_id
=
model_net_find_local_device
(
DRAGONFLY
,
s
->
anno
,
0
,
msg
->
final_dest_gid
);
msg
->
dest_terminal_id
=
dest_terminal_id
;
const
dragonfly_param
*
p
=
s
->
params
;
tw_stime
ts
;
...
...
@@ -613,7 +610,6 @@ void packet_generate(terminal_state * s, tw_bf * bf, terminal_message * msg, tw_
e
=
model_net_method_event_new
(
lp
->
gid
,
i
+
ts
,
lp
,
DRAGONFLY
,
(
void
**
)
&
m
,
&
m_data
);
memcpy
(
m
,
msg
,
sizeof
(
terminal_message
));
m
->
dest_terminal_id
=
dest_terminal_id
;
void
*
m_data_src
=
model_net_method_get_edata
(
DRAGONFLY
,
msg
);
if
(
msg
->
remote_event_size_bytes
){
memcpy
(
m_data
,
m_data_src
,
msg
->
remote_event_size_bytes
);
...
...
@@ -803,10 +799,14 @@ if( msg->packet_ID == TRACK && msg->chunk_id == num_chunks-1)
void
*
tmp_ptr
=
model_net_method_get_edata
(
DRAGONFLY
,
msg
);
ts
=
g_tw_lookahead
+
0
.
1
+
(
1
/
s
->
params
->
cn_bandwidth
)
*
msg
->
remote_event_size_bytes
;
if
(
msg
->
is_pull
){
struct
codes_mctx
mc_dst
=
codes_mctx_set_global_direct
(
msg
->
sender_mn_lp
);
struct
codes_mctx
mc_src
=
codes_mctx_set_global_direct
(
lp
->
gid
);
int
net_id
=
model_net_get_id
(
LP_METHOD_NM
);
model_net_event
(
net_id
,
msg
->
category
,
msg
->
sender_lp
,
msg
->
pull_size
,
ts
,
msg
->
remote_event_size_byte
s
,
tmp_ptr
,
0
,
NULL
,
lp
);
model_net_event
_mctx
(
net_id
,
&
mc_src
,
&
mc_dst
,
msg
->
category
,
msg
->
sender_lp
,
msg
->
pull_size
,
t
s
,
msg
->
remote_event_size_bytes
,
tmp_ptr
,
0
,
NULL
,
lp
);
}
else
{
e
=
tw_event_new
(
msg
->
final_dest_gid
,
ts
,
lp
);
...
...
@@ -1982,22 +1982,6 @@ static const tw_lptype* dragonfly_get_router_lp_type(void)
return
(
&
dragonfly_lps
[
1
]);
}
static
tw_lpid
dragonfly_find_local_device
(
const
char
*
annotation
,
int
ignore_annotations
,
tw_lp
*
sender
)
{
int
mapping_grp_id
,
mapping_rep_id
,
mapping_type_id
,
mapping_offset
;
tw_lpid
dest_id
;
codes_mapping_get_lp_info
(
sender
->
gid
,
lp_group_name
,
&
mapping_grp_id
,
NULL
,
&
mapping_type_id
,
NULL
,
&
mapping_rep_id
,
&
mapping_offset
);
codes_mapping_get_lp_id
(
lp_group_name
,
LP_CONFIG_NM
,
annotation
,
ignore_annotations
,
mapping_rep_id
,
mapping_offset
,
&
dest_id
);
return
(
dest_id
);
}
static
void
dragonfly_register
(
tw_lptype
*
base_type
)
{
lp_type_register
(
LP_CONFIG_NM
,
base_type
);
lp_type_register
(
"dragonfly_router"
,
&
dragonfly_lps
[
1
]);
...
...
@@ -2015,7 +1999,6 @@ struct model_net_method dragonfly_method =
.
mn_get_lp_type
=
dragonfly_get_cn_lp_type
,
.
mn_get_msg_sz
=
dragonfly_get_msg_sz
,
.
mn_report_stats
=
dragonfly_report_stats
,
.
model_net_method_find_local_device
=
NULL
,
.
mn_collective_call
=
dragonfly_collective
,
.
mn_collective_call_rc
=
dragonfly_collective_rc
};
...
...
src/models/networks/model-net/loggp.c
View file @
ae285cf3
...
...
@@ -110,8 +110,9 @@ 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
*
category
,
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 */
...
...
@@ -142,11 +143,6 @@ void loggp_recv_msg_event_rc(tw_lp *sender);
static
void
loggp_report_stats
();
static
tw_lpid
loggp_find_local_device
(
const
char
*
annotation
,
int
ignore_annotations
,
tw_lp
*
sender
);
static
const
struct
param_table_entry
*
find_params
(
uint64_t
msg_size
,
const
loggp_param
*
params
);
...
...
@@ -163,7 +159,6 @@ struct model_net_method loggp_method =
.
mn_get_lp_type
=
loggp_get_lp_type
,
.
mn_get_msg_sz
=
loggp_get_msg_sz
,
.
mn_report_stats
=
loggp_report_stats
,
.
model_net_method_find_local_device
=
NULL
,
.
mn_collective_call
=
loggp_collective
,
.
mn_collective_call_rc
=
loggp_collective_rc
};
...
...
@@ -438,10 +433,14 @@ static void handle_msg_ready_event(
//tmp_ptr += loggp_get_msg_sz();
if
(
m
->
is_pull
){
/* call the model-net event */
struct
codes_mctx
mc_dst
=
codes_mctx_set_global_direct
(
m
->
src_mn_lp
);
struct
codes_mctx
mc_src
=
codes_mctx_set_global_direct
(
lp
->
gid
);
int
net_id
=
model_net_get_id
(
LP_METHOD_NM
);
model_net_event
(
net_id
,
m
->
category
,
m
->
src_gid
,
m
->
pull_size
,
recv_queue_time
,
m
->
event_size_bytes
,
tmp_ptr
,
0
,
NULL
,
lp
);
model_net_event
_mctx
(
net_id
,
&
mc_src
,
&
mc_dst
,
m
->
category
,
m
->
src_gid
,
m
->
pull_size
,
recv_queue_time
,
m
->
event_size_bytes
,
tmp_ptr
,
0
,
NULL
,
lp
);
}
else
{
e_new
=
tw_event_new
(
m
->
final_dest_gid
,
recv_queue_time
,
lp
);
...
...
@@ -503,9 +502,6 @@ static void handle_msg_start_event(
loggp_message
*
m_new
;
tw_stime
send_queue_time
=
0
;
mn_stats
*
stat
;
int
mapping_grp_id
,
mapping_type_id
,
mapping_rep_id
,
mapping_offset
;
tw_lpid
dest_id
;
char
lp_group_name
[
MAX_NAME_LENGTH
];
int
total_event_size
;
double
xmit_time
;
const
struct
param_table_entry
*
param
;
...
...
@@ -549,10 +545,6 @@ static void handle_msg_start_event(
ns
->
net_send_next_idle
=
tw_now
(
lp
);
ns
->
net_send_next_idle
+=
xmit_time
+
param
->
g
*
1000
.
0
;
/* create new event to send msg to receiving NIC */
dest_id
=
model_net_find_local_device
(
LOGGP
,
ns
->
anno
,
0
,
m
->
final_dest_gid
);
dprintf
(
"%lu (mn): start msg %lu->%lu, size %lu (%3s last)
\n
"
" now:%0.3le, idle[prev:%0.3le, next:%0.3le], "
"q-time:%0.3le
\n
"
,
...
...
@@ -562,16 +554,13 @@ static void handle_msg_start_event(
send_queue_time
);
#if USE_RECV_QUEUE
model_net_method_send_msg_recv_event
(
m
->
final_dest_gid
,
dest_
id
,
m
->
src_gid
,
m
->
net_msg_size_bytes
,
m
->
is_pull
,
m
->
pull_size
,
model_net_method_send_msg_recv_event
(
m
->
final_dest_gid
,
m
->
dest_
mn_lp
,
m
->
src_gid
,
m
->
net_msg_size_bytes
,
m
->
is_pull
,
m
->
pull_size
,
m
->
event_size_bytes
,
&
m
->
sched_params
,
m
->
category
,
LOGGP
,
m
,
send_queue_time
,
lp
);
#else
void
*
m_data
;
// printf("\n msg start sending to %d ", dest_id);
//e_new = tw_event_new(dest_id, send_queue_time, lp);
//m_new = tw_event_data(e_new);
e_new
=
model_net_method_event_new
(
dest_id
,
send_queue_time
,
lp
,
LOGGP
,
e_new
=
model_net_method_event_new
(
m
->
dest_mn_lp
,
send_queue_time
,
lp
,
LOGGP
,
(
void
**
)
&
m_new
,
&
m_data
);
/* copy entire previous message over, including payload from user of
* this module
...
...
@@ -618,8 +607,9 @@ 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
*
category
,
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 */
...
...
@@ -645,7 +635,9 @@ static tw_stime loggp_packet_event(
//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
;
msg
->
src_mn_lp
=
sender
->
gid
;
msg
->
magic
=
loggp_get_magic
();
msg
->
net_msg_size_bytes
=
packet_size
;
msg
->
event_size_bytes
=
0
;
...
...
@@ -834,25 +826,6 @@ static const struct param_table_entry* find_params(
return
(
&
params
->
table
[
i
]);
}
static
tw_lpid
loggp_find_local_device
(
const
char
*
annotation
,
int
ignore_annotations
,
tw_lp
*
sender
)
{
char
lp_group_name
[
MAX_NAME_LENGTH
];
int
mapping_grp_id
,
mapping_rep_id
,
mapping_type_id
,
mapping_offset
;
tw_lpid
dest_id
;
//TODO: be annotation-aware
codes_mapping_get_lp_info
(
sender
->
gid
,
lp_group_name
,
&
mapping_grp_id
,
NULL
,
&
mapping_type_id
,
NULL
,
&
mapping_rep_id
,
&
mapping_offset
);
codes_mapping_get_lp_id
(
lp_group_name
,
LP_CONFIG_NM
,
annotation
,
ignore_annotations
,
mapping_rep_id
,
mapping_offset
,
&
dest_id
);
return
(
dest_id
);
}
/*
* Local variables:
* c-indent-level: 4
...
...
src/models/networks/model-net/model-net-lp.c
View file @
ae285cf3
...
...
@@ -534,6 +534,8 @@ void model_net_method_send_msg_recv_event(
m
->
msg
.
m_base
.
req
.
final_dest_lp
=
final_dest_lp
;
m
->
msg
.
m_base
.
req
.
src_lp
=
src_lp
;
// for "recv" events, set the "dest" to this LP in the case of a pull event
m
->
msg
.
m_base
.
req
.
dest_mn_lp
=
sender
->
gid
;
m
->
msg
.
m_base
.
req
.
msg_size
=
is_pull
?
pull_size
:
msg_size
;
m
->
msg
.
m_base
.
req
.
packet_size
=
m
->
msg
.
m_base
.
req
.
msg_size
;
m
->
msg
.
m_base
.
req
.
net_id
=
net_id
;
...
...
src/models/networks/model-net/model-net-sched-impl.c
View file @
ae285cf3
...
...
@@ -264,8 +264,9 @@ int fcfs_next(
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
,
psize
,
q
->
req
.
is_pull
,
q
->
req
.
msg_size
,
0
.
0
,
&
q
->
sched_params
,
q
->
req
.
remote_event_size
,
q
->
remote_event
,
q
->
req
.
final_dest_lp
,
q
->
req
.
dest_mn_lp
,
psize
,
q
->
req
.
is_pull
,
q
->
req
.
msg_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
);
}
...
...
src/models/networks/model-net/model-net.c
View file @
ae285cf3
...
...
@@ -223,8 +223,8 @@ struct mn_stats* model_net_find_stats(char const * category, mn_stats mn_stats_a
static
void
model_net_event_impl_base
(
int
net_id
,
char
const
*
annotation
,
int
ignore_annotations
,
struct
codes_mctx
const
*
send_map_ctx
,
struct
codes_mctx
const
*
recv_map_ctx
,
char
const
*
category
,
tw_lpid
final_dest_lp
,
uint64_t
message_size
,
...
...
@@ -245,15 +245,18 @@ static void model_net_event_impl_base(
return
;
}
tw_lpid
mn_lp
=
model_net_find_local_device
(
net_id
,
annotation
,
ignore_annotations
,
sender
->
gid
);
tw_lpid
src_mn_lp
=
model_net_find_local_device_mctx
(
net_id
,
send_map_ctx
,
sender
->
gid
);
tw_lpid
dest_mn_lp
=
model_net_find_local_device_mctx
(
net_id
,
recv_map_ctx
,
final_dest_lp
);
tw_stime
poffset
=
codes_local_latency
(
sender
);
if
(
mn_in_seqence
){
tw_stime
tmp
=
mn_msg_offset
;
mn_msg_offset
+=
poffset
;
poffset
+=
tmp
;
}
tw_event
*
e
=
codes_event_new
(
mn_lp
,
poffset
+
offset
,
sender
);
tw_event
*
e
=
codes_event_new
(
src_
mn_lp
,
poffset
+
offset
,
sender
);
model_net_wrap_msg
*
m
=
tw_event_data
(
e
);
msg_set_header
(
model_net_base_magic
,
MN_BASE_NEW_MSG
,
sender
->
gid
,
&
m
->
h
);
...
...
@@ -262,6 +265,7 @@ static void model_net_event_impl_base(
model_net_request
*
r
=
&
m
->
msg
.
m_base
.
req
;
r
->
net_id
=
net_id
;
r
->
final_dest_lp
=
final_dest_lp
;
r
->
dest_mn_lp
=
dest_mn_lp
;
r
->
src_lp
=
sender
->
gid
;
r
->
msg_size
=
message_size
;
r
->
remote_event_size
=
remote_event_size
;
...
...
@@ -310,9 +314,10 @@ void model_net_event(
void
const
*
self_event
,
tw_lp
*
sender
)
{
model_net_event_impl_base
(
net_id
,
NULL
,
1
,
category
,
final_dest_lp
,
message_size
,
0
,
offset
,
remote_event_size
,
remote_event
,
self_event_size
,
self_event
,
sender
);
model_net_event_impl_base
(
net_id
,
CODES_MCTX_DEFAULT
,
CODES_MCTX_DEFAULT
,
category
,
final_dest_lp
,
message_size
,
0
,
offset
,
remote_event_size
,
remote_event
,
self_event_size
,
self_event
,
sender
);
}
void
model_net_event_annotated
(
...
...
@@ -327,11 +332,30 @@ void model_net_event_annotated(
int
self_event_size
,
void
const
*
self_event
,
tw_lp
*
sender
){
model_net_event_impl_base
(
net_id
,
annotation
,
0
,
category
,
final_dest_lp
,
struct
codes_mctx
mc
=
codes_mctx_set_group_modulo
(
annotation
,
true
);
model_net_event_impl_base
(
net_id
,
&
mc
,
&
mc
,
category
,
final_dest_lp
,
message_size
,
0
,
offset
,
remote_event_size
,
remote_event
,
self_event_size
,
self_event
,
sender
);
}
void
model_net_event_mctx
(
int
net_id
,
struct
codes_mctx
const
*
send_map_ctx
,
struct
codes_mctx
const
*
recv_map_ctx
,
char
const
*
category
,
tw_lpid
final_dest_lp
,
uint64_t
message_size
,
tw_stime
offset
,
int
remote_event_size
,
void
const
*
remote_event
,
int
self_event_size
,
void
const
*
self_event
,
tw_lp
*
sender
){
model_net_event_impl_base
(
net_id
,
send_map_ctx
,
recv_map_ctx
,
category
,
final_dest_lp
,
message_size
,
0
,
offset
,
remote_event_size
,
remote_event
,
self_event_size
,
self_event
,
sender
);
}
void
model_net_pull_event
(
int
net_id
,
char
const
*
category
,
...
...
@@ -343,9 +367,9 @@ void model_net_pull_event(
tw_lp
*
sender
){
/* NOTE: for a pull, we are filling the *remote* event - it will be remote
* from the destination's POV */
model_net_event_impl_base
(
net_id
,
NULL
,
0
,
category
,
final_dest_lp
,
message_size
,
1
,
offset
,
self_event_size
,
self_event
,
0
,
NULL
,
sender
);
model_net_event_impl_base
(
net_id
,
CODES_MCTX_DEFAULT
,
CODES_MCTX_DEFAULT
,
category
,
final_dest_lp
,
message_size
,
1
,
offset
,
self_event_size
,
self_event
,
0
,
NULL
,
sender
);
}
void
model_net_pull_event_annotated
(
...
...
@@ -360,11 +384,30 @@ void model_net_pull_event_annotated(
tw_lp
*
sender
){
/* NOTE: for a pull, we are filling the *remote* event - it will be remote
* from the destination's POV */
model_net_event_impl_base
(
net_id
,
annotation
,
1
,
category
,
final_dest_lp
,
struct
codes_mctx
mc
=
codes_mctx_set_group_modulo
(
annotation
,
true
);
model_net_event_impl_base
(
net_id
,
&
mc
,
&
mc
,
category
,
final_dest_lp
,
message_size
,
1
,
offset
,
self_event_size
,
self_event
,
0
,
NULL
,
sender
);
}
void
model_net_pull_event_mctx
(
int
net_id
,
struct
codes_mctx
*
const
send_map_ctx
,
struct
codes_mctx
*
const
recv_map_ctx
,
char
const
*
category
,
tw_lpid
final_dest_lp
,
uint64_t
message_size
,
tw_stime
offset
,
int
self_event_size
,
void
const
*
self_event
,
tw_lp
*
sender
){
/* NOTE: for a pull, we are filling the *remote* event - it will be remote
* from the destination's POV */
model_net_event_impl_base
(
net_id
,
send_map_ctx
,
recv_map_ctx
,
category
,
final_dest_lp
,
message_size
,
1
,
offset
,
self_event_size
,
self_event
,
0
,
NULL
,
sender
);
}
void
model_net_event_rc
(
int
net_id
,
tw_lp
*
sender
,
...
...
@@ -477,45 +520,30 @@ void model_net_report_stats(int net_id)
return
;
}
static
tw_lpid
model_net_find_local_device
_default
(
tw_lpid
model_net_find_local_device
(
int
net_id
,
const
char
*
annotation
,
int
ignore_annotations
,
tw_lpid
sender_gid
)
{
char
group_name
[
MAX_NAME_LENGTH
];
int
dummy
,
mapping_rep
,
mapping_offset
;
int
num_mn_lps
;
tw_lpid
rtn
;
codes_mapping_get_lp_info
(
sender_gid
,
group_name
,
&
dummy
,
NULL
,
&
dummy
,
NULL
,
&
mapping_rep
,
&
mapping_offset
);
num_mn_lps
=
codes_mapping_get_lp_count
(
group_name
,
1
,
model_net_lp_config_names
[
net_id
],
annotation
,
ignore_annotations
);
if
(
num_mn_lps
<=
0
)
{
tw_error
(
TW_LOC
,
"ERROR: Found no modelnet lps in group %s "
"(source lpid %lu) with network type %s, annotation %s
\n
"
,
group_name
,
sender_gid
,
model_net_lp_config_names
[
net_id
],
(
ignore_annotations
)
?
"<ignored>"
:
annotation
);
tw_lpid
sender_gid
)
{
struct
codes_mctx
const
*
mc_p
;
struct
codes_mctx
mc
;
if
(
ignore_annotations
)
mc_p
=
CODES_MCTX_DEFAULT
;
else
{
mc
=
codes_mctx_set_group_modulo
(
annotation
,
ignore_annotations
);
mc_p
=
&
mc
;
}
codes_mapping_get_lp_id
(
group_name
,
model_net_lp_config_names
[
net_id
],
annotation
,
ignore_annotations
,
mapping_rep
,
mapping_offset
%
num_mn_lps
,
&
rtn
);
return
rtn
;
return
model_net_find_local_device_mctx
(
net_id
,
mc_p
,
sender_gid
);
}
tw_lpid
model_net_find_local_device
(
int
net_id
,
const
char
*
annotation
,
int
ignore_annotations
,
tw_lpid
sender_gid
)
tw_lpid
model_net_find_local_device_mctx
(
int
net_id
,
struct
codes_mctx
const
*
map_ctx
,
tw_lpid
sender_gid
)
{
if
(
method_array
[
net_id
]
->
model_net_method_find_local_device
==
NULL
)
return
model_net_find_local_device_default
(
net_id
,
annotation
,
ignore_annotations
,
sender_gid
);
else
return
(
method_array
[
net_id
]
->
model_net_method_find_local_device
(
annotation
,
ignore_annotations
,
sender_gid
));
return
codes_mctx_to_lpid
(
map_ctx
,
model_net_lp_config_names
[
net_id
],