Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
codes
codes
Commits
5022b2e6
Commit
5022b2e6
authored
Jul 13, 2016
by
Elsa Gonsiorowski (Eris)
Browse files
merge with commit_f changes. Several whitespace changes due to my editor
parent
78745f23
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
doc/example/example.c
View file @
5022b2e6
...
...
@@ -53,7 +53,7 @@ enum svr_event
LOCAL
/* local event */
};
/* this struct serves as the ***persistent*** state of the LP representing the
/* this struct serves as the ***persistent*** state of the LP representing the
* server in question. This struct is setup when the LP initialization function
* ptr is called */
struct
svr_state
...
...
@@ -107,7 +107,8 @@ tw_lptype svr_lp = {
(
pre_run_f
)
NULL
,
(
event_f
)
svr_event
,
(
revent_f
)
svr_rev_event
,
(
final_f
)
svr_finalize
,
(
commit_f
)
NULL
,
(
final_f
)
svr_finalize
,
(
map_f
)
codes_mapping
,
sizeof
(
svr_state
),
};
...
...
@@ -193,9 +194,9 @@ int main(
/* ROSS initialization function calls */
tw_opt_add
(
app_opt
);
/* add user-defined args */
/* initialize ROSS and parse args. NOTE: tw_init calls MPI_Init */
tw_init
(
&
argc
,
&
argv
);
tw_init
(
&
argc
,
&
argv
);
if
(
!
conf_file_name
[
0
])
if
(
!
conf_file_name
[
0
])
{
fprintf
(
stderr
,
"Expected
\"
codes-config
\"
option, please see --help.
\n
"
);
MPI_Finalize
();
...
...
@@ -204,9 +205,9 @@ int main(
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
nprocs
);
/* loading the config file into the codes-mapping utility, giving us the
* parsed config object in return.
* parsed config object in return.
* "config" is a global var defined by codes-mapping */
if
(
configuration_load
(
conf_file_name
,
MPI_COMM_WORLD
,
&
config
)){
fprintf
(
stderr
,
"Error loading config file %s.
\n
"
,
conf_file_name
);
...
...
@@ -222,7 +223,7 @@ int main(
/* Setup takes the global config object, the registered LPs, and
* generates/places the LPs as specified in the configuration file.
* This should only be called after ALL LP types have been registered in
* This should only be called after ALL LP types have been registered in
* codes */
codes_mapping_setup
();
...
...
@@ -233,7 +234,7 @@ int main(
assert
(
num_nets
==
1
);
net_id
=
*
net_ids
;
free
(
net_ids
);
/* in this example, we are using simplenet, which simulates point to point
/* in this example, we are using simplenet, which simulates point to point
* communication between any two entities (other networks are trickier to
* setup). Hence: */
if
(
net_id
!=
SIMPLENET
)
...
...
@@ -242,7 +243,7 @@ int main(
MPI_Finalize
();
return
0
;
}
/* calculate the number of servers in this simulation,
* ignoring annotations */
num_servers
=
codes_mapping_get_lp_count
(
group_name
,
0
,
"server"
,
NULL
,
1
);
...
...
@@ -253,7 +254,7 @@ int main(
configuration_get_value_int
(
&
config
,
param_group_nm
,
num_reqs_key
,
NULL
,
&
num_reqs
);
configuration_get_value_int
(
&
config
,
param_group_nm
,
payload_sz_key
,
NULL
,
&
payload_sz
);
/* begin simulation */
/* begin simulation */
tw_run
();
/* model-net has the capability of outputting network transmission stats */
...
...
@@ -270,7 +271,7 @@ const tw_lptype* svr_get_lp_type()
static
void
svr_add_lp_type
()
{
/* lp_type_register should be called exactly once per process per
/* lp_type_register should be called exactly once per process per
* LP type */
lp_type_register
(
"server"
,
svr_get_lp_type
());
}
...
...
@@ -282,7 +283,7 @@ static void svr_init(
tw_event
*
e
;
svr_msg
*
m
;
tw_stime
kickoff_time
;
memset
(
ns
,
0
,
sizeof
(
*
ns
));
/* each server sends a dummy event to itself that will kick off the real
...
...
@@ -290,12 +291,12 @@ static void svr_init(
*/
/* skew each kickoff event slightly to help avoid event ties later on */
kickoff_time
=
g_tw_lookahead
+
tw_rand_unif
(
lp
->
rng
);
kickoff_time
=
g_tw_lookahead
+
tw_rand_unif
(
lp
->
rng
);
/* first create the event (time arg is an offset, not absolute time) */
e
=
tw_event_new
(
lp
->
gid
,
kickoff_time
,
lp
);
/* after event is created, grab the allocated message and set msg-specific
* data */
* data */
m
=
tw_event_data
(
e
);
m
->
svr_event_type
=
KICKOFF
;
/* event is ready to be processed, send it off */
...
...
@@ -324,7 +325,7 @@ static void svr_event(
handle_kickoff_event
(
ns
,
b
,
m
,
lp
);
break
;
case
LOCAL
:
handle_local_event
(
ns
,
b
,
m
,
lp
);
handle_local_event
(
ns
,
b
,
m
,
lp
);
break
;
default:
printf
(
"
\n
Invalid message type %d "
,
m
->
svr_event_type
);
...
...
@@ -353,7 +354,7 @@ static void svr_rev_event(
handle_kickoff_rev_event
(
ns
,
b
,
m
,
lp
);
break
;
case
LOCAL
:
handle_local_rev_event
(
ns
,
b
,
m
,
lp
);
handle_local_rev_event
(
ns
,
b
,
m
,
lp
);
break
;
default:
assert
(
0
);
...
...
@@ -368,7 +369,7 @@ static void svr_finalize(
svr_state
*
ns
,
tw_lp
*
lp
)
{
printf
(
"server %llu recvd %d bytes in %lf seconds, %lf MiB/s sent_count %d recvd_count %d local_count %d
\n
"
,
printf
(
"server %llu recvd %d bytes in %lf seconds, %lf MiB/s sent_count %d recvd_count %d local_count %d
\n
"
,
(
unsigned
long
long
)(
lp
->
gid
/
2
),
payload_sz
*
ns
->
msg_recvd_count
,
ns_to_s
(
ns
->
end_ts
-
ns
->
start_ts
),
...
...
@@ -395,7 +396,7 @@ static tw_stime s_to_ns(tw_stime ns)
tw_lpid
get_next_server
(
tw_lpid
sender_id
)
{
tw_lpid
rtn_id
;
/* first, get callers LP and group info from codes-mapping. Caching this
/* first, get callers LP and group info from codes-mapping. Caching this
* info in the LP struct isn't a bad idea for preventing a huge number of
* lookups */
char
grp_name
[
MAX_NAME_LENGTH
],
lp_type_name
[
MAX_NAME_LENGTH
],
...
...
@@ -404,8 +405,8 @@ tw_lpid get_next_server(tw_lpid sender_id)
int
dest_rep_id
;
codes_mapping_get_lp_info
(
sender_id
,
grp_name
,
&
grp_id
,
lp_type_name
,
&
lp_type_id
,
annotation
,
&
grp_rep_id
,
&
off
);
/* in this example, we assume that, for our group of servers, each
* "repetition" consists of a single server/NIC pair. Hence, we grab the
/* in this example, we assume that, for our group of servers, each
* "repetition" consists of a single server/NIC pair. Hence, we grab the
* server ID for the next repetition, looping around if necessary */
num_reps
=
codes_mapping_get_group_reps
(
grp_name
);
dest_rep_id
=
(
grp_rep_id
+
1
)
%
num_reps
;
...
...
@@ -429,7 +430,7 @@ static void handle_kickoff_event(
/* normally, when using ROSS, events are allocated as a result of the event
* creation process. However, since we are now asking model-net to
* communicate with an entity on our behalf, we need to generate both the
* message to the recipient and an optional callback message
* message to the recipient and an optional callback message
* - thankfully, memory need not persist past the model_net_event call - it
* copies the messages */
svr_msg
m_local
;
...
...
@@ -443,9 +444,9 @@ static void handle_kickoff_event(
/* record when transfers started on this server */
ns
->
start_ts
=
tw_now
(
lp
);
/* each server sends a request to the next highest server
/* each server sends a request to the next highest server
* In this simulation, LP determination is simple: LPs are assigned
* round robin as in serv_1, net_1, serv_2, net_2, etc.
* round robin as in serv_1, net_1, serv_2, net_2, etc.
* However, that may not always be the case, so we also show a more
* complicated way to map through codes_mapping */
if
(
use_brute_force_map
)
...
...
@@ -457,13 +458,13 @@ static void handle_kickoff_event(
/* model-net needs to know about (1) higher-level destination LP which is a neighboring server in this case
* (2) struct and size of remote message and (3) struct and size of local message (a local message can be null) */
m
->
ret
=
model_net_event
(
net_id
,
"test"
,
dest_id
,
payload_sz
,
0
.
0
,
sizeof
(
svr_msg
),
m
->
ret
=
model_net_event
(
net_id
,
"test"
,
dest_id
,
payload_sz
,
0
.
0
,
sizeof
(
svr_msg
),
(
const
void
*
)
&
m_remote
,
sizeof
(
svr_msg
),
(
const
void
*
)
&
m_local
,
lp
);
ns
->
msg_sent_count
++
;
}
/* at the moment, no need for local callbacks from model-net, so we maintain a
* count for debugging purposes */
* count for debugging purposes */
static
void
handle_local_event
(
svr_state
*
ns
,
tw_bf
*
b
,
...
...
@@ -492,7 +493,7 @@ static void handle_ack_event(
* destination server */
/* safety check that this request got to the right server, both with our
* brute-force lp calculation and our more generic codes-mapping
* brute-force lp calculation and our more generic codes-mapping
* calculation */
assert
(
m
->
src
==
(
lp
->
gid
+
offset
)
%
(
num_servers
*
2
)
&&
m
->
src
==
get_next_server
(
lp
->
gid
));
...
...
@@ -509,11 +510,11 @@ static void handle_ack_event(
m_remote
.
src
=
lp
->
gid
;
/* send another request */
m
->
ret
=
model_net_event
(
net_id
,
"test"
,
m
->
src
,
payload_sz
,
0
.
0
,
sizeof
(
svr_msg
),
m
->
ret
=
model_net_event
(
net_id
,
"test"
,
m
->
src
,
payload_sz
,
0
.
0
,
sizeof
(
svr_msg
),
(
const
void
*
)
&
m_remote
,
sizeof
(
svr_msg
),
(
const
void
*
)
&
m_local
,
lp
);
ns
->
msg_sent_count
++
;
m
->
incremented_flag
=
1
;
}
else
{
...
...
@@ -541,7 +542,7 @@ static void handle_req_event(
m_remote
.
src
=
lp
->
gid
;
/* safety check that this request got to the right server */
assert
(
lp
->
gid
==
(
m
->
src
+
offset
)
%
(
num_servers
*
2
)
&&
lp
->
gid
==
get_next_server
(
m
->
src
));
ns
->
msg_recvd_count
++
;
...
...
@@ -550,8 +551,8 @@ static void handle_req_event(
/* simulated payload of 1 MiB */
/* also trigger a local event for completion of payload msg */
/* remote host will get an ack event */
m
->
ret
=
model_net_event
(
net_id
,
"test"
,
m
->
src
,
payload_sz
,
0
.
0
,
sizeof
(
svr_msg
),
m
->
ret
=
model_net_event
(
net_id
,
"test"
,
m
->
src
,
payload_sz
,
0
.
0
,
sizeof
(
svr_msg
),
(
const
void
*
)
&
m_remote
,
sizeof
(
svr_msg
),
(
const
void
*
)
&
m_local
,
lp
);
return
;
}
...
...
@@ -582,7 +583,7 @@ static void handle_req_rev_event(
(
void
)
b
;
(
void
)
m
;
ns
->
msg_recvd_count
--
;
/* model-net has its own reverse computation support */
/* model-net has its own reverse computation support */
model_net_event_rc2
(
lp
,
&
m
->
ret
);
return
;
...
...
doc/example_heterogeneous/example.c
View file @
5022b2e6
...
...
@@ -15,7 +15,7 @@
/**** BEGIN SIMULATION DATA STRUCTURES ****/
/* 'magic' numbers used as sanity check on events */
static
int
node_magic
;
static
int
node_magic
;
static
int
forwarder_magic
;
/* counts of the various types of nodes in the example system */
...
...
@@ -55,8 +55,8 @@ enum forwarder_event
};
typedef
struct
forwarder_state_s
{
int
id
;
// index w.r.t. forwarders in my group
int
is_in_foo
;
int
id
;
// index w.r.t. forwarders in my group
int
is_in_foo
;
int
fwd_node_count
;
int
fwd_forwarder_count
;
}
forwarder_state
;
...
...
@@ -98,7 +98,7 @@ void node_finalize(
// messages
int
mult
;
if
(
ns
->
is_in_foo
){
mult
=
1
;
mult
=
1
;
}
else
{
mult
=
(
num_foo_nodes
/
num_bar_nodes
)
+
...
...
@@ -197,7 +197,7 @@ void node_event_handler(
tw_lp
*
lp
){
(
void
)
b
;
assert
(
m
->
h
.
magic
==
node_magic
);
switch
(
m
->
h
.
event_type
){
case
NODE_KICKOFF
:
// nodes from foo ping to nodes in bar
...
...
@@ -223,7 +223,8 @@ static tw_lptype node_lp = {
(
pre_run_f
)
NULL
,
(
event_f
)
node_event_handler
,
(
revent_f
)
NULL
,
(
final_f
)
node_finalize
,
(
commit_f
)
NULL
,
(
final_f
)
node_finalize
,
(
map_f
)
codes_mapping
,
sizeof
(
node_state
),
};
...
...
@@ -243,7 +244,7 @@ void node_register(){
void
forwarder_lp_init
(
forwarder_state
*
ns
,
tw_lp
*
lp
){
// like nodes, forwarders in this example are addressed logically
// like nodes, forwarders in this example are addressed logically
ns
->
id
=
codes_mapping_get_lp_relative_id
(
lp
->
gid
,
1
,
0
);
int
id_all
=
codes_mapping_get_lp_relative_id
(
lp
->
gid
,
0
,
0
);
ns
->
is_in_foo
=
(
id_all
<
num_foo_forwarders
);
...
...
@@ -261,7 +262,7 @@ void handle_forwarder_fwd(
forwarder_state
*
ns
,
forwarder_msg
*
m
,
tw_lp
*
lp
){
// compute the forwarder lpid to forward to
// compute the forwarder lpid to forward to
int
mod
;
const
char
*
dest_group
;
char
*
category
;
...
...
@@ -295,13 +296,13 @@ void handle_forwarder_recv(
forwarder_state
*
ns
,
forwarder_msg
*
m
,
tw_lp
*
lp
)
{
// compute the node to relay the message to
// compute the node to relay the message to
const
char
*
dest_group
;
const
char
*
annotation
;
char
*
category
;
int
net_id
;
if
(
ns
->
is_in_foo
){
dest_group
=
"FOO_CLUSTER"
;
dest_group
=
"FOO_CLUSTER"
;
annotation
=
"foo"
;
category
=
"pong"
;
net_id
=
net_id_foo
;
...
...
@@ -354,7 +355,8 @@ static tw_lptype forwarder_lp = {
(
pre_run_f
)
NULL
,
(
event_f
)
forwarder_event_handler
,
(
revent_f
)
NULL
,
(
final_f
)
forwarder_finalize
,
(
commit_f
)
NULL
,
(
final_f
)
forwarder_finalize
,
(
map_f
)
codes_mapping
,
sizeof
(
forwarder_state
),
};
...
...
@@ -395,16 +397,16 @@ int main(int argc, char *argv[])
/* ROSS initialization function calls */
tw_opt_add
(
app_opt
);
/* add user-defined args */
/* initialize ROSS and parse args. NOTE: tw_init calls MPI_Init */
tw_init
(
&
argc
,
&
argv
);
tw_init
(
&
argc
,
&
argv
);
if
(
!
conf_file_name
[
0
])
{
tw_error
(
TW_LOC
,
tw_error
(
TW_LOC
,
"Expected
\"
codes-config
\"
option, please see --help.
\n
"
);
return
1
;
}
/* loading the config file into the codes-mapping utility, giving us the
* parsed config object in return.
* parsed config object in return.
* "config" is a global var defined by codes-mapping */
if
(
configuration_load
(
conf_file_name
,
MPI_COMM_WORLD
,
&
config
)){
tw_error
(
TW_LOC
,
"Error loading config file %s.
\n
"
,
conf_file_name
);
...
...
@@ -470,7 +472,7 @@ int main(int argc, char *argv[])
}
free
(
net_ids
);
/* begin simulation */
/* begin simulation */
tw_run
();
tw_end
();
...
...
src/network-workloads/model-net-mpi-replay.c
View file @
5022b2e6
This diff is collapsed.
Click to expand it.
src/network-workloads/model-net-synthetic.c
View file @
5022b2e6
...
...
@@ -99,6 +99,7 @@ tw_lptype svr_lp = {
(
pre_run_f
)
NULL
,
(
event_f
)
svr_event
,
(
revent_f
)
svr_rev_event
,
(
commit_f
)
NULL
,
(
final_f
)
svr_finalize
,
(
map_f
)
codes_mapping
,
sizeof
(
svr_state
),
...
...
@@ -169,11 +170,11 @@ static void handle_kickoff_rev_event(
if
(
b
->
c1
)
tw_rand_reverse_unif
(
lp
->
rng
);
model_net_event_rc
(
net_id
,
lp
,
PAYLOAD_SZ
);
ns
->
msg_sent_count
--
;
tw_rand_reverse_unif
(
lp
->
rng
);
}
}
static
void
handle_kickoff_event
(
svr_state
*
ns
,
tw_bf
*
b
,
...
...
@@ -190,7 +191,7 @@ static void handle_kickoff_event(
char
anno
[
MAX_NAME_LENGTH
];
tw_lpid
local_dest
=
-
1
,
global_dest
=
-
1
;
svr_msg
*
m_local
=
malloc
(
sizeof
(
svr_msg
));
svr_msg
*
m_remote
=
malloc
(
sizeof
(
svr_msg
));
...
...
@@ -215,7 +216,7 @@ static void handle_kickoff_event(
{
local_dest
=
(
local_id
+
num_nodes_per_grp
)
%
num_nodes
;
//printf("\n LP %ld sending to %ld num nodes %d ", local_id, local_dest, num_nodes);
}
}
else
if
(
traffic
==
NEAREST_NEIGHBOR
)
{
local_dest
=
(
local_id
+
1
)
%
num_nodes
;
...
...
@@ -226,13 +227,13 @@ static void handle_kickoff_event(
global_dest
=
codes_mapping_get_lpid_from_relative
(
local_dest
,
group_name
,
lp_type_name
,
NULL
,
0
);
ns
->
msg_sent_count
++
;
model_net_event
(
net_id
,
"test"
,
global_dest
,
PAYLOAD_SZ
,
0
.
0
,
sizeof
(
svr_msg
),
(
const
void
*
)
m_remote
,
sizeof
(
svr_msg
),
(
const
void
*
)
m_local
,
lp
);
issue_event
(
ns
,
lp
);
return
;
}
static
void
handle_remote_rev_event
(
svr_state
*
ns
,
svr_state
*
ns
,
tw_bf
*
b
,
svr_msg
*
m
,
tw_lp
*
lp
)
...
...
@@ -383,7 +384,7 @@ int main(
num_servers_per_rep
=
codes_mapping_get_lp_count
(
"MODELNET_GRP"
,
1
,
"server"
,
NULL
,
1
);
configuration_get_value_int
(
&
config
,
"PARAMS"
,
"num_routers"
,
NULL
,
&
num_routers_per_grp
);
num_groups
=
(
num_routers_per_grp
*
(
num_routers_per_grp
/
2
)
+
1
);
num_nodes
=
num_groups
*
num_routers_per_grp
*
(
num_routers_per_grp
/
2
);
num_nodes_per_grp
=
num_routers_per_grp
*
(
num_routers_per_grp
/
2
);
...
...
src/networks/model-net/dragonfly.c
View file @
5022b2e6
This diff is collapsed.
Click to expand it.
src/networks/model-net/loggp.c
View file @
5022b2e6
...
...
@@ -77,7 +77,7 @@ struct loggp_state
struct
mn_stats
loggp_stats_array
[
CATEGORY_MAX
];
};
/* annotation-specific parameters (unannotated entry occurs at the
/* annotation-specific parameters (unannotated entry occurs at the
* last index) */
static
uint64_t
num_params
=
0
;
static
loggp_param
*
all_params
=
NULL
;
...
...
@@ -185,6 +185,7 @@ tw_lptype loggp_lp = {
(
pre_run_f
)
NULL
,
(
event_f
)
loggp_event
,
(
revent_f
)
loggp_rev_event
,
(
commit_f
)
NULL
,
(
final_f
)
loggp_finalize
,
(
map_f
)
codes_mapping
,
sizeof
(
loggp_state
),
...
...
@@ -344,7 +345,7 @@ static void handle_msg_ready_rev_event(
struct
mn_stats
*
stat
;
ns
->
net_recv_next_idle
=
m
->
net_recv_next_idle_saved
;
stat
=
model_net_find_stats
(
m
->
category
,
ns
->
loggp_stats_array
);
stat
->
recv_count
--
;
stat
->
recv_bytes
-=
m
->
net_msg_size_bytes
;
...
...
@@ -421,7 +422,7 @@ static void handle_msg_ready_event(
if
(
m
->
event_size_bytes
)
{
/* schedule event to final destination for when the recv is complete */
// printf("\n Remote message to LP %d ", m->final_dest_gid);
// printf("\n Remote message to LP %d ", m->final_dest_gid);
void
*
tmp_ptr
=
model_net_method_get_edata
(
LOGGP
,
m
);
//char* tmp_ptr = (char*)m;
...
...
@@ -524,15 +525,15 @@ static void handle_msg_start_event(
stat
->
max_event_size
=
total_event_size
;
/* calculate send time stamp */
send_queue_time
=
(
param
->
L
)
*
1000
.
0
;
send_queue_time
=
(
param
->
L
)
*
1000
.
0
;
/* bump up time if the NIC send queue isn't idle right now */
if
(
ns
->
net_send_next_idle
>
tw_now
(
lp
))
send_queue_time
+=
ns
->
net_send_next_idle
-
tw_now
(
lp
);
/* move the next idle time ahead to after this transmission is
* _complete_ from the sender's perspective, include gap paramater (g)
* at this point.
*/
* at this point.
*/
m
->
net_send_next_idle_saved
=
ns
->
net_send_next_idle
;
if
(
ns
->
net_send_next_idle
<
tw_now
(
lp
))
ns
->
net_send_next_idle
=
tw_now
(
lp
);
...
...
@@ -551,7 +552,7 @@ static void handle_msg_start_event(
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
#else
void
*
m_data
;
e_new
=
model_net_method_event_new
(
m
->
dest_mn_lp
,
send_queue_time
,
lp
,
LOGGP
,
(
void
**
)
&
m_new
,
&
m_data
);
...
...
@@ -565,7 +566,7 @@ static void handle_msg_start_event(
}
m_new
->
event_type
=
LG_MSG_READY
;
tw_event_send
(
e_new
);
#endif
...
...
@@ -587,7 +588,7 @@ static void handle_msg_start_event(
void
*
m_loc
=
(
char
*
)
model_net_method_get_edata
(
LOGGP
,
m
)
+
m
->
event_size_bytes
;
//local_event = (char*)m;
//local_event += loggp_get_msg_sz() + m->event_size_bytes;
//local_event += loggp_get_msg_sz() + m->event_size_bytes;
/* copy just the local event data over */
memcpy
(
m_new
,
m_loc
,
m
->
local_event_size_bytes
);
tw_event_send
(
e_new
);
...
...
@@ -597,7 +598,7 @@ static void handle_msg_start_event(
/* Model-net function calls */
/*This method will serve as an intermediate layer between loggp and modelnet.
/*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
(
model_net_request
const
*
req
,
...
...
@@ -637,9 +638,9 @@ static tw_stime loggp_packet_event(
//tmp_ptr = (char*)msg;
//tmp_ptr += loggp_get_msg_sz();
//printf("\n Sending to LP %d msg magic %d ", (int)dest_id, loggp_get_magic());
/*Fill in loggp information*/
//printf("\n Sending to LP %d msg magic %d ", (int)dest_id, loggp_get_magic());
/*Fill in loggp information*/
if
(
is_last_pckt
)
/* Its the last packet so pass in remote event information*/
{
if
(
req
->
remote_event_size
)
...
...
@@ -772,7 +773,7 @@ void loggp_set_params(const char * config_file, loggp_param * params){
&
params
->
table
[
params
->
table_size
].
lsqu_gG
);
if
(
ret
!=
11
)
{
fprintf
(
stderr
,
"Error: malformed line %d in %s
\n
"
,
line_nr
,
fprintf
(
stderr
,
"Error: malformed line %d in %s
\n
"
,
line_nr
,
config_file
);
assert
(
0
);
}
...
...
@@ -782,7 +783,7 @@ void loggp_set_params(const char * config_file, loggp_param * params){
printf
(
"Parsed %d loggp table entries.
\n
"
,
params
->
table_size
);
fclose
(
conf
);
return
;
}
...
...
src/networks/model-net/model-net-lp.c
View file @
5022b2e6
...
...
@@ -29,7 +29,7 @@ typedef struct model_net_base_params_s {
int
use_recv_queue
;
}
model_net_base_params
;
/* annotation-specific parameters (unannotated entry occurs at the
/* annotation-specific parameters (unannotated entry occurs at the
* last index) */
static
int
num_params
=
0
;
static
const
char
*
annos
[
CONFIGURATION_MAX_ANNOS
];
...
...
@@ -61,7 +61,7 @@ typedef struct model_net_base_state {
/**** BEGIN LP, EVENT PROCESSING FUNCTION DECLS ****/
/* ROSS LP processing functions */
/* ROSS LP processing functions */
static
void
model_net_base_lp_init
(
model_net_base_state
*
ns
,
tw_lp
*
lp
);
...
...
@@ -107,7 +107,8 @@ tw_lptype model_net_base_lp = {
(
pre_run_f
)
NULL
,
(
event_f
)
model_net_base_event
,
(
revent_f
)
model_net_base_event_rc
,
(
final_f
)
model_net_base_finalize
,
(
commit_f
)
NULL
,
(
final_f
)
model_net_base_finalize
,
(
map_f
)
codes_mapping
,
sizeof
(
model_net_base_state
),
};
...
...
@@ -176,7 +177,7 @@ static void base_read_config(const char * anno, model_net_base_params *p){
}
if
(
i
==
MAX_SCHEDS
){
tw_error
(
TW_LOC
,
"Unknown value for PARAMS:modelnet-scheduler : "
"%s"
,
sched
);
"%s"
,
sched
);
}
}
else
{
...
...
@@ -186,7 +187,7 @@ static void base_read_config(const char * anno, model_net_base_params *p){
// get scheduler-specific parameters
if
(
p
->
sched_params
.
type
==
MN_SCHED_PRIO
){
// prio scheduler uses default parameters
// prio scheduler uses default parameters
int
*
num_prios
=
&
p
->
sched_params
.
u
.
prio
.
num_prios
;
enum
sched_type
*
sub_stype
=
&
p
->
sched_params
.
u
.
prio
.
sub_stype
;
// number of priorities to allocate
...
...
@@ -314,7 +315,7 @@ void model_net_base_lp_init(
char
lp_type_name
[
MAX_NAME_LENGTH
],
anno
[
MAX_NAME_LENGTH
];
int
dummy
;
codes_mapping_get_lp_info
(
lp
->
gid
,
NULL
,
&
dummy
,
codes_mapping_get_lp_info
(
lp
->
gid
,
NULL
,
&
dummy
,
lp_type_name
,
&
dummy
,
anno
,
&
dummy
,
&
dummy
);
ns
->
msg_id
=
0
;
...
...
@@ -338,7 +339,7 @@ void model_net_base_lp_init(
ns
->
sched_send
=
malloc
(
sizeof
(
model_net_sched
));
ns
->
sched_recv
=
malloc
(
sizeof
(
model_net_sched
));
// init both the sender queue and the 'receiver' queue
// init both the sender queue and the 'receiver' queue
model_net_sched_init
(
&
ns
->
params
->
sched_params
,
0
,
method_array
[
ns
->
net_id
],
ns
->
sched_send
);
model_net_sched_init
(
&
ns
->
params
->
sched_params
,
1
,
method_array
[
ns
->
net_id
],
...
...
@@ -473,15 +474,15 @@ void handle_new_msg(
if
(
r
->
self_event_size
>
0
){
local
=
m_data
;
}
// set message-specific params
int
is_from_remote
=
m
->
msg
.
m_base
.
is_from_remote
;
model_net_sched
*
ss
=
is_from_remote
?
ns
->
sched_recv
:
ns
->
sched_send
;
int
*
in_sched_loop
=
is_from_remote
?
int
*
in_sched_loop
=
is_from_remote
?
&
ns
->
in_sched_recv_loop
:
&
ns
->
in_sched_send_loop
;
model_net_sched_add
(
r
,
&
m
->
msg
.
m_base
.
sched_params
,
r
->
remote_event_size
,
remote
,
r
->
self_event_size
,
local
,
ss
,
&
m
->
msg
.
m_base
.
rc
,
lp
);
if
(
*
in_sched_loop
==
0
){
b
->
c31
=
1
;
/* No need to issue an extra sched-next event if we're currently idle */
...
...
@@ -501,7 +502,7 @@ void handle_new_msg_rc(
tw_lp
*
lp
){
int
is_from_remote
=
m
->
msg
.
m_base
.
is_from_remote
;
model_net_sched
*
ss
=
is_from_remote
?
ns
->
sched_recv
:
ns
->
sched_send
;
int
*
in_sched_loop
=
is_from_remote
?
int
*
in_sched_loop
=
is_from_remote
?
&
ns
->
in_sched_recv_loop
:
&
ns
->
in_sched_send_loop
;
if
(
b
->
c31
)
{
...
...
@@ -535,7 +536,7 @@ void handle_sched_next(
// For all others, we need to schedule the next packet
// immediately
else
if
(
ns
->
net_id
==
SIMPLEP2P
||
ns
->
net_id
==
TORUS
){
tw_event
*
e
=
tw_event_new
(
lp
->
gid
,
tw_event
*
e
=
tw_event_new
(
lp
->
gid
,