git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6334
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
SMPI:
* Cleanup the initialization process
* Improve smpirun to accept -platform and -hostfile arguments
SMPI:
* Cleanup the initialization process
* Improve smpirun to accept -platform and -hostfile arguments
+ * Kill a whole bunch of unneeded synchronization: processes run in
+ exclusive manner within the simulator
Build Chain:
* Do not require doxygen in maintainer mode
Build Chain:
* Do not require doxygen in maintainer mode
// FIXME: request queues should be moved to host data...
xbt_fifo_t *pending_send_request_queues;
// FIXME: request queues should be moved to host data...
xbt_fifo_t *pending_send_request_queues;
- smx_mutex_t *pending_send_request_queues_mutexes;
-
xbt_fifo_t *pending_recv_request_queues;
xbt_fifo_t *pending_recv_request_queues;
- smx_mutex_t *pending_recv_request_queues_mutexes;
-
xbt_fifo_t *received_message_queues;
xbt_fifo_t *received_message_queues;
- smx_mutex_t *received_message_queues_mutexes;
smx_process_t *sender_processes;
smx_process_t *receiver_processes;
smx_process_t *sender_processes;
smx_process_t *receiver_processes;
if (NULL == request) {
retval = MPI_ERR_INTERN;
} else {
if (NULL == request) {
retval = MPI_ERR_INTERN;
} else {
- SIMIX_mutex_lock(smpi_global->pending_send_request_queues_mutexes[index]);
xbt_fifo_push(smpi_global->pending_send_request_queues[index], request);
xbt_fifo_push(smpi_global->pending_send_request_queues[index], request);
- SIMIX_mutex_unlock(smpi_global->pending_send_request_queues_mutexes
- [index]);
if (SIMIX_process_is_suspended(smpi_global->sender_processes[index])) {
SIMIX_process_resume(smpi_global->sender_processes[index]);
if (SIMIX_process_is_suspended(smpi_global->sender_processes[index])) {
SIMIX_process_resume(smpi_global->sender_processes[index]);
if (NULL == request) {
retval = MPI_ERR_INTERN;
} else {
if (NULL == request) {
retval = MPI_ERR_INTERN;
} else {
- SIMIX_mutex_lock(smpi_global->pending_recv_request_queues_mutexes[index]);
xbt_fifo_push(smpi_global->pending_recv_request_queues[index], request);
xbt_fifo_push(smpi_global->pending_recv_request_queues[index], request);
- SIMIX_mutex_unlock(smpi_global->pending_recv_request_queues_mutexes
- [index]);
if (SIMIX_process_is_suspended(smpi_global->receiver_processes[index])) {
SIMIX_process_resume(smpi_global->receiver_processes[index]);
if (SIMIX_process_is_suspended(smpi_global->receiver_processes[index])) {
SIMIX_process_resume(smpi_global->receiver_processes[index]);
// queues
smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size);
// queues
smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size);
- smpi_global->pending_send_request_queues_mutexes =
- xbt_new(smx_mutex_t, size);
smpi_global->pending_recv_request_queues = xbt_new(xbt_fifo_t, size);
smpi_global->pending_recv_request_queues = xbt_new(xbt_fifo_t, size);
- smpi_global->pending_recv_request_queues_mutexes =
- xbt_new(smx_mutex_t, size);
smpi_global->received_message_queues = xbt_new(xbt_fifo_t, size);
smpi_global->received_message_queues = xbt_new(xbt_fifo_t, size);
- smpi_global->received_message_queues_mutexes = xbt_new(smx_mutex_t, size);
// sender/receiver processes
smpi_global->sender_processes = xbt_new(smx_process_t, size);
// sender/receiver processes
smpi_global->sender_processes = xbt_new(smx_process_t, size);
for (i = 0; i < size; i++) {
smpi_global->pending_send_request_queues[i] = xbt_fifo_new();
for (i = 0; i < size; i++) {
smpi_global->pending_send_request_queues[i] = xbt_fifo_new();
- smpi_global->pending_send_request_queues_mutexes[i] = SIMIX_mutex_init();
smpi_global->pending_recv_request_queues[i] = xbt_fifo_new();
smpi_global->pending_recv_request_queues[i] = xbt_fifo_new();
- smpi_global->pending_recv_request_queues_mutexes[i] = SIMIX_mutex_init();
smpi_global->received_message_queues[i] = xbt_fifo_new();
smpi_global->received_message_queues[i] = xbt_fifo_new();
- smpi_global->received_message_queues_mutexes[i] = SIMIX_mutex_init();
}
smpi_global->hosts = SIMIX_host_get_table();
}
smpi_global->hosts = SIMIX_host_get_table();
for (i = 0; i < size; i++) {
xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
for (i = 0; i < size; i++) {
xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
- SIMIX_mutex_destroy(smpi_global->pending_send_request_queues_mutexes[i]);
xbt_fifo_free(smpi_global->pending_recv_request_queues[i]);
xbt_fifo_free(smpi_global->pending_recv_request_queues[i]);
- SIMIX_mutex_destroy(smpi_global->pending_recv_request_queues_mutexes[i]);
xbt_fifo_free(smpi_global->received_message_queues[i]);
xbt_fifo_free(smpi_global->received_message_queues[i]);
- SIMIX_mutex_destroy(smpi_global->received_message_queues_mutexes[i]);
}
xbt_free(smpi_global->pending_send_request_queues);
}
xbt_free(smpi_global->pending_send_request_queues);
- xbt_free(smpi_global->pending_send_request_queues_mutexes);
xbt_free(smpi_global->pending_recv_request_queues);
xbt_free(smpi_global->pending_recv_request_queues);
- xbt_free(smpi_global->pending_recv_request_queues_mutexes);
xbt_free(smpi_global->received_message_queues);
xbt_free(smpi_global->received_message_queues);
- xbt_free(smpi_global->received_message_queues_mutexes);
int index;
xbt_fifo_t request_queue;
int index;
xbt_fifo_t request_queue;
- smx_mutex_t request_queue_mutex;
xbt_fifo_t message_queue;
xbt_fifo_t message_queue;
- smx_mutex_t message_queue_mutex;
index = smpi_host_index();
request_queue = smpi_global->pending_recv_request_queues[index];
index = smpi_host_index();
request_queue = smpi_global->pending_recv_request_queues[index];
- request_queue_mutex =
- smpi_global->pending_recv_request_queues_mutexes[index];
message_queue = smpi_global->received_message_queues[index];
message_queue = smpi_global->received_message_queues[index];
- message_queue_mutex = smpi_global->received_message_queues_mutexes[index];
smpi_global->receiver_processes[index] = self;
smpi_global->receiver_processes[index] = self;
// FIXME: better algorithm, maybe some kind of balanced tree? or a heap?
// FIXME: better algorithm, maybe some kind of balanced tree? or a heap?
- // FIXME: not the best way to request multiple locks...
- SIMIX_mutex_lock(request_queue_mutex);
- SIMIX_mutex_lock(message_queue_mutex);
for (request_item = xbt_fifo_get_first_item(request_queue);
NULL != request_item;
request_item = xbt_fifo_get_next_item(request_item)) {
for (request_item = xbt_fifo_get_first_item(request_queue);
NULL != request_item;
request_item = xbt_fifo_get_next_item(request_item)) {
message = NULL;
stopsearch:
message = NULL;
stopsearch:
- SIMIX_mutex_unlock(message_queue_mutex);
- SIMIX_mutex_unlock(request_queue_mutex);
-
if (NULL == request || NULL == message) {
SIMIX_process_suspend(self);
} else {
if (NULL == request || NULL == message) {
SIMIX_process_suspend(self);
} else {
int index;
xbt_fifo_t request_queue;
int index;
xbt_fifo_t request_queue;
- smx_mutex_t request_queue_mutex;
index = smpi_host_index();
request_queue = smpi_global->pending_send_request_queues[index];
index = smpi_host_index();
request_queue = smpi_global->pending_send_request_queues[index];
- request_queue_mutex =
- smpi_global->pending_send_request_queues_mutexes[index];
smpi_global->sender_processes[index] = self;
do {
smpi_global->sender_processes[index] = self;
do {
- SIMIX_mutex_lock(request_queue_mutex);
request = xbt_fifo_shift(request_queue);
request = xbt_fifo_shift(request_queue);
- SIMIX_mutex_unlock(request_queue_mutex);
if (NULL == request) {
SIMIX_process_suspend(self);
if (NULL == request) {
SIMIX_process_suspend(self);
if (0 < request->forward) {
request->dst =
(request->dst + message->forward + 1) % request->comm->size;
if (0 < request->forward) {
request->dst =
(request->dst + message->forward + 1) % request->comm->size;
- SIMIX_mutex_lock(request_queue_mutex);
xbt_fifo_push(request_queue, request);
xbt_fifo_push(request_queue, request);
- SIMIX_mutex_unlock(request_queue_mutex);
} else {
request->completed = 1;
}
} else {
request->completed = 1;
}
SIMIX_cond_wait(request->cond, request->mutex);
}
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);
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_unregister_action_to_condition(action, request->cond);
SIMIX_action_destroy(action);