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
* added support for optimized collectives:
[simgrid.git]
/
src
/
smpi
/
smpi_sender.c
diff --git
a/src/smpi/smpi_sender.c
b/src/smpi/smpi_sender.c
index
f8f9aa9
..
129caab
100644
(file)
--- a/
src/smpi/smpi_sender.c
+++ b/
src/smpi/smpi_sender.c
@@
-3,8
+3,9
@@
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_sender, smpi,
"Logging specific to SMPI (sender)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_sender, smpi,
"Logging specific to SMPI (sender)");
-int smpi_sender(int argc, char *
*argv
)
+int smpi_sender(int argc, char *
argv[]
)
{
{
+ smpi_process_data_t mydata = SIMIX_process_get_data(SIMIX_process_self());
smx_process_t self;
smx_host_t shost;
smx_process_t self;
smx_host_t shost;
@@
-12,8
+13,6
@@
int smpi_sender(int argc, char **argv)
xbt_fifo_t request_queue;
xbt_fifo_t request_queue;
- int running_hosts_count;
-
smpi_mpi_request_t request;
smx_host_t dhost;
smpi_mpi_request_t request;
smx_host_t dhost;
@@
-26,25
+25,17
@@
int smpi_sender(int argc, char **argv)
int dindex;
int dindex;
- smx_process_t receiver_process;
-
self = SIMIX_process_self();
shost = SIMIX_host_self();
self = SIMIX_process_self();
shost = SIMIX_host_self();
- index = smpi_host_index();
-
- request_queue = smpi_global->pending_send_request_queues[index];
-
- smpi_global->sender_processes[index] = self;
+ index = mydata->index;
- do {
+ request_queue = mydata->pending_send_request_queue;
+ while (1) {
request = xbt_fifo_shift(request_queue);
request = xbt_fifo_shift(request_queue);
- if (NULL == request) {
- SIMIX_process_suspend(self);
- } else {
-
+ if (NULL != request) {
message = xbt_mallocator_get(smpi_global->message_mallocator);
SIMIX_mutex_lock(request->mutex);
message = xbt_mallocator_get(smpi_global->message_mallocator);
SIMIX_mutex_lock(request->mutex);
@@
-58,7
+49,9
@@
int smpi_sender(int argc, char **argv)
request->datatype->size * request->count);
dindex = request->comm->rank_to_index_map[request->dst];
request->datatype->size * request->count);
dindex = request->comm->rank_to_index_map[request->dst];
- dhost = smpi_global->hosts[dindex];
+ smpi_process_data_t remote_process =
+ SIMIX_process_get_data(smpi_global->main_processes[dindex]);
+ dhost = SIMIX_process_get_host(smpi_global->main_processes[dindex]);
message->forward = (request->forward - 1) / 2;
request->forward = request->forward / 2;
message->forward = (request->forward - 1) / 2;
request->forward = request->forward / 2;
@@
-68,6
+61,10
@@
int smpi_sender(int argc, char **argv)
(request->dst + message->forward + 1) % request->comm->size;
xbt_fifo_push(request_queue, request);
} else {
(request->dst + message->forward + 1) % request->comm->size;
xbt_fifo_push(request_queue, request);
} else {
+//#define DEBUG_MATCH
+#ifdef DEBUG_MATCH
+ printf("**SENDER: request %p completed :=1\n",request);
+#endif
request->completed = 1;
}
request->completed = 1;
}
@@
-86,7
+83,7
@@
int smpi_sender(int argc, char **argv)
SIMIX_cond_wait(request->cond, request->mutex);
}
SIMIX_cond_wait(request->cond, request->mutex);
}
- xbt_fifo_push(
smpi_global->received_message_queues[dindex]
, message);
+ xbt_fifo_push(
remote_process->received_message_queue
, message);
SIMIX_unregister_action_to_condition(action, request->cond);
SIMIX_action_destroy(action);
SIMIX_unregister_action_to_condition(action, request->cond);
SIMIX_action_destroy(action);
@@
-94,16
+91,15
@@
int smpi_sender(int argc, char **argv)
SIMIX_mutex_unlock(request->mutex);
// wake up receiver if necessary
SIMIX_mutex_unlock(request->mutex);
// wake up receiver if necessary
- receiver_process = smpi_global->receiver_processes[dindex];
- if (SIMIX_process_is_suspended(receiver_process)) {
- SIMIX_process_resume(receiver_process);
- }
+ SIMIX_process_resume(remote_process->receiver);
+ } else if (mydata->finalize > 0) { /* main wants me to die and nothing to do */
+ mydata->finalize--;
+ SIMIX_cond_signal(mydata->cond);
+ return 0;
+ } else {
+ SIMIX_process_suspend(self);
}
}
-
- running_hosts_count = smpi_global->running_hosts_count;
-
- } while (0 < running_hosts_count);
-
+ }
return 0;
}
return 0;
}