// FIXME: request queues should be moved to host data...
xbt_fifo_t *pending_send_request_queues;
- xbt_fifo_t *pending_recv_request_queues;
xbt_fifo_t *received_message_queues;
smx_process_t *sender_processes;
int index;
smx_mutex_t mutex;
smx_cond_t cond;
+
smx_process_t main;
smx_process_t sender;
smx_process_t receiver;
+
+ xbt_fifo_t pending_recv_request_queue;
} s_smpi_host_data_t;
typedef struct smpi_host_data_t *smpi_host_data_t;
hdata->index = i;
hdata->mutex = SIMIX_mutex_init();
hdata->cond = SIMIX_cond_init();
+
+ hdata->pending_recv_request_queue = xbt_fifo_new();
+
hdata->main = SIMIX_process_self();
hdata->sender = SIMIX_process_create("smpi_sender",
smpi_sender, hdata,
void smpi_process_finalize()
{
int i;
+ smpi_host_data_t hdata = SIMIX_host_get_data(SIMIX_host_self());
i = --smpi_global->running_hosts_count;
SIMIX_mutex_destroy(smpi_host_mutex());
SIMIX_cond_destroy(smpi_host_cond());
+ xbt_fifo_free(hdata->pending_recv_request_queue);
if (0 >= i) {
int smpi_mpi_irecv(smpi_mpi_request_t request)
{
int retval = MPI_SUCCESS;
- int index = smpi_host_index();
+ smpi_host_data_t hdata = SIMIX_host_get_data(SIMIX_host_self());
if (NULL == request) {
retval = MPI_ERR_INTERN;
} else {
- xbt_fifo_push(smpi_global->pending_recv_request_queues[index], request);
+ xbt_fifo_push(hdata->pending_recv_request_queue, request);
- 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[hdata->index])) {
+ SIMIX_process_resume(smpi_global->receiver_processes[hdata->index]);
}
}
// queues
smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size);
- smpi_global->pending_recv_request_queues = xbt_new(xbt_fifo_t, size);
smpi_global->received_message_queues = xbt_new(xbt_fifo_t, size);
// sender/receiver processes
for (i = 0; i < size; i++) {
smpi_global->pending_send_request_queues[i] = xbt_fifo_new();
- smpi_global->pending_recv_request_queues[i] = xbt_fifo_new();
smpi_global->received_message_queues[i] = xbt_fifo_new();
}
for (i = 0; i < size; i++) {
xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
- xbt_fifo_free(smpi_global->pending_recv_request_queues[i]);
xbt_fifo_free(smpi_global->received_message_queues[i]);
}
xbt_free(smpi_global->pending_send_request_queues);
- xbt_free(smpi_global->pending_recv_request_queues);
xbt_free(smpi_global->received_message_queues);
xbt_free(smpi_global);
self = SIMIX_process_self();
- request_queue = smpi_global->pending_recv_request_queues[index];
+ request_queue = mydata->pending_recv_request_queue;
message_queue = smpi_global->received_message_queues[index];
smpi_global->receiver_processes[index] = self;