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
Get serious about checking buffer overflows during log construction
[simgrid.git]
/
src
/
smpi
/
smpi_sender.c
diff --git
a/src/smpi/smpi_sender.c
b/src/smpi/smpi_sender.c
index
41ff7a1
..
5715058
100644
(file)
--- a/
src/smpi/smpi_sender.c
+++ b/
src/smpi/smpi_sender.c
@@
-4,11
+4,10
@@
int smpi_sender(int argc, char **argv)
{
smx_process_t self;
smx_host_t shost;
- int
rank
;
+ int
index
;
xbt_fifo_t request_queue;
smx_mutex_t request_queue_mutex;
- int size;
int running_hosts_count;
@@
-16,12
+15,12
@@
int smpi_sender(int argc, char **argv)
smx_host_t dhost;
- char communicat
e[] = "communicate
";
+ char communicat
ion[] = "communication
";
smx_action_t action;
smpi_received_message_t message;
- int d
rank
;
+ int d
index
;
smx_process_t receiver_process;
@@
-35,18
+34,17
@@
int smpi_sender(int argc, char **argv)
}
SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
- rank = smpi_mpi_comm_rank(smpi_mpi_global->mpi_comm_world, shost);
- size = smpi_mpi_comm_size(smpi_mpi_global->mpi_comm_world);
+ index = smpi_host_index();
- request_queue = smpi_global->pending_send_request_queues[
rank
];
- request_queue_mutex = smpi_global->pending_send_request_queues_mutexes[
rank
];
+ request_queue = smpi_global->pending_send_request_queues[
index
];
+ request_queue_mutex = smpi_global->pending_send_request_queues_mutexes[
index
];
- smpi_global->sender_processes[
rank
] = self;
+ smpi_global->sender_processes[
index
] = self;
// 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 * s
ize
) {
+ if (smpi_global->ready_process_count < 3 * s
mpi_global->host_count
) {
SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
} else {
SIMIX_cond_broadcast(smpi_global->start_stop_cond);
@@
-68,22
+66,21
@@
int smpi_sender(int argc, char **argv)
SIMIX_mutex_lock(request->mutex);
message->comm = request->comm;
- message->src = request->src;
- message->dst = request->dst;
+ message->src = smpi_mpi_comm_rank(request->comm);
message->tag = request->tag;
message->buf = xbt_malloc(request->datatype->size * request->count);
memcpy(message->buf, request->buf, request->datatype->size * request->count);
- d
host = request->comm->hosts
[request->dst];
- d
rank = smpi_mpi_comm_rank(smpi_mpi_global->mpi_comm_world, dhost)
;
+ d
index = request->comm->rank_to_index_map
[request->dst];
+ d
host = smpi_global->hosts[dindex]
;
- SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[d
rank
]);
- xbt_fifo_push(smpi_global->received_message_queues[d
rank
], message);
- SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[d
rank
]);
+ SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[d
index
]);
+ xbt_fifo_push(smpi_global->received_message_queues[d
index
], message);
+ SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[d
index
]);
request->completed = 1;
- action = SIMIX_action_communicate(shost, dhost, communicat
e
, request->datatype->size * request->count, -1.0);
+ action = SIMIX_action_communicate(shost, dhost, communicat
ion
, request->datatype->size * request->count, -1.0);
SIMIX_register_action_to_condition(action, request->cond);
SIMIX_cond_wait(request->cond, request->mutex);
@@
-91,10
+88,10
@@
int smpi_sender(int argc, char **argv)
SIMIX_mutex_unlock(request->mutex);
- SIMIX_action_destroy(action);
+
//
SIMIX_action_destroy(action);
// wake up receiver if necessary
- receiver_process = smpi_global->receiver_processes[d
rank
];
+ receiver_process = smpi_global->receiver_processes[d
index
];
if (SIMIX_process_is_suspended(receiver_process)) {
SIMIX_process_resume(receiver_process);
}