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
cosmetics
[simgrid.git]
/
src
/
smpi
/
smpi_sender.c
diff --git
a/src/smpi/smpi_sender.c
b/src/smpi/smpi_sender.c
index
1df105f
..
26f5125
100644
(file)
--- a/
src/smpi/smpi_sender.c
+++ b/
src/smpi/smpi_sender.c
@@
-20,6
+20,8
@@
int smpi_sender(int argc, char **argv)
smx_action_t action;
smx_action_t action;
+ e_surf_action_state_t state;
+
smpi_received_message_t message;
int dindex;
smpi_received_message_t message;
int dindex;
@@
-31,7
+33,7
@@
int smpi_sender(int argc, char **argv)
// make sure root is done before own initialization
SIMIX_mutex_lock(smpi_global->start_stop_mutex);
// make sure root is done before own initialization
SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-
if
(!smpi_global->root_ready) {
+
while
(!smpi_global->root_ready) {
SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
}
SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
}
SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
@@
-46,11
+48,12
@@
int smpi_sender(int argc, char **argv)
// wait for all nodes to signal initializatin complete
SIMIX_mutex_lock(smpi_global->start_stop_mutex);
smpi_global->ready_process_count++;
// wait for all nodes to signal initializatin complete
SIMIX_mutex_lock(smpi_global->start_stop_mutex);
smpi_global->ready_process_count++;
- if (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
- SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
- } else {
+ if (smpi_global->ready_process_count >= 3 * smpi_global->host_count) {
SIMIX_cond_broadcast(smpi_global->start_stop_cond);
}
SIMIX_cond_broadcast(smpi_global->start_stop_cond);
}
+ while (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
+ SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
+ }
SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
do {
SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
do {
@@
-92,17
+95,25
@@
int smpi_sender(int argc, char **argv)
action = SIMIX_action_communicate(shost, dhost, "communication", request->datatype->size * request->count, -1.0);
SIMIX_register_action_to_condition(action, request->cond);
action = SIMIX_action_communicate(shost, dhost, "communication", request->datatype->size * request->count, -1.0);
SIMIX_register_action_to_condition(action, request->cond);
- SIMIX_cond_wait(request->cond, request->mutex);
-
- SIMIX_unregister_action_to_condition(action, request->cond);
- SIMIX_action_destroy(action);
- SIMIX_mutex_unlock(request->mutex);
+ for (
+ state = SIMIX_action_get_state(action);
+ state == SURF_ACTION_READY ||
+ state == SURF_ACTION_RUNNING;
+ state = SIMIX_action_get_state(action)
+ ) {
+ SIMIX_cond_wait(request->cond, request->mutex);
+ }
SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[dindex]);
xbt_fifo_push(smpi_global->received_message_queues[dindex], message);
SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[dindex]);
SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[dindex]);
xbt_fifo_push(smpi_global->received_message_queues[dindex], message);
SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[dindex]);
+ SIMIX_unregister_action_to_condition(action, request->cond);
+ SIMIX_action_destroy(action);
+
+ SIMIX_mutex_unlock(request->mutex);
+
// wake up receiver if necessary
receiver_process = smpi_global->receiver_processes[dindex];
if (SIMIX_process_is_suspended(receiver_process)) {
// wake up receiver if necessary
receiver_process = smpi_global->receiver_processes[dindex];
if (SIMIX_process_is_suspended(receiver_process)) {