A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
model-checker : New public functions to take a snapshot and compare two snapshots...
[simgrid.git]
/
src
/
simix
/
smx_network.c
diff --git
a/src/simix/smx_network.c
b/src/simix/smx_network.c
index
85d4d52
..
8d9e915
100644
(file)
--- a/
src/simix/smx_network.c
+++ b/
src/simix/smx_network.c
@@
-13,12
+13,15
@@
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix,
"Logging specific to SIMIX (network)");
static xbt_dict_t rdv_points = NULL;
"Logging specific to SIMIX (network)");
static xbt_dict_t rdv_points = NULL;
-
unsigned long int
smx_total_comms = 0;
+
XBT_IMPORT_NO_EXPORT(unsigned long int)
smx_total_comms = 0;
static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
static void SIMIX_comm_copy_data(smx_action_t comm);
static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type);
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
static void SIMIX_comm_copy_data(smx_action_t comm);
static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type);
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
+static smx_action_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *user_data, smx_action_t my_action);
static smx_action_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
int (*match_fun)(void *, void *,smx_action_t),
void *user_data, smx_action_t my_action);
static smx_action_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
int (*match_fun)(void *, void *,smx_action_t),
void *user_data, smx_action_t my_action);
@@
-27,6
+30,8
@@
static void SIMIX_rdv_free(void *data);
void SIMIX_network_init(void)
{
rdv_points = xbt_dict_new_homogeneous(SIMIX_rdv_free);
void SIMIX_network_init(void)
{
rdv_points = xbt_dict_new_homogeneous(SIMIX_rdv_free);
+ if(MC_is_active())
+ MC_ignore(&smx_total_comms, sizeof(smx_total_comms));
}
void SIMIX_network_exit(void)
}
void SIMIX_network_exit(void)
@@
-383,7
+388,7
@@
smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
other_action->comm.match_fun = match_fun;
other_action->comm.match_fun = match_fun;
- if (MC_
IS_ENABLED
) {
+ if (MC_
is_active()
) {
other_action->state = SIMIX_RUNNING;
return other_action;
}
other_action->state = SIMIX_RUNNING;
return other_action;
}
@@
-467,7
+472,7
@@
smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
SIMIX_comm_copy_data(other_action);*/
SIMIX_comm_copy_data(other_action);*/
- if (MC_
IS_ENABLED
) {
+ if (MC_
is_active()
) {
other_action->state = SIMIX_RUNNING;
return other_action;
}
other_action->state = SIMIX_RUNNING;
return other_action;
}
@@
-484,13
+489,19
@@
smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
XBT_DEBUG("iprobe from %p %p\n", rdv, rdv->comm_fifo);
smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
XBT_DEBUG("iprobe from %p %p\n", rdv, rdv->comm_fifo);
smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
- smx_action_t other_action;
+ smx_action_t other_action
=NULL
;
if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){
//find a match in the already received fifo
if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){
//find a match in the already received fifo
+ XBT_DEBUG("first try in the perm recv mailbox \n");
+
other_action = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
other_action = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
- }else{
- other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
}
}
+ // }else{
+ if(!other_action){
+ XBT_DEBUG("second try in the other mailbox");
+ other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
+ }
+// }
if(other_action)other_action->comm.refcount--;
SIMIX_comm_destroy(this_action);
if(other_action)other_action->comm.refcount--;
SIMIX_comm_destroy(this_action);
@@
-510,7
+521,7
@@
void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double time
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
- if (MC_
IS_ENABLED
) {
+ if (MC_
is_active()
) {
if (idx == 0) {
action->state = SIMIX_DONE;
} else {
if (idx == 0) {
action->state = SIMIX_DONE;
} else {
@@
-548,7
+559,7
@@
void SIMIX_pre_comm_test(smx_simcall_t simcall)
{
smx_action_t action = simcall->comm_test.comm;
{
smx_action_t action = simcall->comm_test.comm;
- if(MC_
IS_ENABLED
){
+ if(MC_
is_active()
){
simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
if(simcall->comm_test.result){
action->state = SIMIX_DONE;
simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
if(simcall->comm_test.result){
action->state = SIMIX_DONE;
@@
-576,7
+587,7
@@
void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx)
xbt_dynar_t actions = simcall->comm_testany.comms;
simcall->comm_testany.result = -1;
xbt_dynar_t actions = simcall->comm_testany.comms;
simcall->comm_testany.result = -1;
- if (MC_
IS_ENABLED
){
+ if (MC_
is_active()
){
if(idx == -1){
SIMIX_simcall_answer(simcall);
}else{
if(idx == -1){
SIMIX_simcall_answer(simcall);
}else{
@@
-606,7
+617,7
@@
void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx)
unsigned int cursor = 0;
xbt_dynar_t actions = simcall->comm_waitany.comms;
unsigned int cursor = 0;
xbt_dynar_t actions = simcall->comm_waitany.comms;
- if (MC_
IS_ENABLED
){
+ if (MC_
is_active()
){
action = xbt_dynar_get_as(actions, idx, smx_action_t);
xbt_fifo_push(action->simcalls, simcall);
simcall->comm_waitany.result = idx;
action = xbt_dynar_get_as(actions, idx, smx_action_t);
xbt_fifo_push(action->simcalls, simcall);
simcall->comm_waitany.result = idx;
@@
-704,7
+715,7
@@
void SIMIX_comm_finish(smx_action_t action)
return it as the result of the simcall */
if (simcall->call == SIMCALL_COMM_WAITANY) {
SIMIX_waitany_remove_simcall_from_actions(simcall);
return it as the result of the simcall */
if (simcall->call == SIMCALL_COMM_WAITANY) {
SIMIX_waitany_remove_simcall_from_actions(simcall);
- if (!MC_
IS_ENABLED
)
+ if (!MC_
is_active()
)
simcall->comm_waitany.result = xbt_dynar_search(simcall->comm_waitany.comms, &action);
}
simcall->comm_waitany.result = xbt_dynar_search(simcall->comm_waitany.comms, &action);
}
@@
-857,7
+868,7
@@
void SIMIX_comm_cancel(smx_action_t action)
SIMIX_rdv_remove(action->comm.rdv, action);
action->state = SIMIX_CANCELED;
}
SIMIX_rdv_remove(action->comm.rdv, action);
action->state = SIMIX_CANCELED;
}
- else if (!MC_
IS_ENABLED
/* when running the MC there are no surf actions */
+ else if (!MC_
is_active()
/* when running the MC there are no surf actions */
&& (action->state == SIMIX_READY || action->state == SIMIX_RUNNING)) {
surf_workstation_model->action_cancel(action->comm.surf_comm);
&& (action->state == SIMIX_READY || action->state == SIMIX_RUNNING)) {
surf_workstation_model->action_cancel(action->comm.surf_comm);