From: markls Date: Thu, 19 Jul 2007 21:04:16 +0000 (+0000) Subject: changed received messages to use own data structure. X-Git-Tag: v3.3~1485 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c5f0619e1d6cb6f4a3a5cc446b7e89f7b111e4fa changed received messages to use own data structure. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3875 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/smpi/include/smpi.h b/src/smpi/include/smpi.h index adcc689621..374382dc3b 100644 --- a/src/smpi/include/smpi.h +++ b/src/smpi/include/smpi.h @@ -84,12 +84,11 @@ extern smpi_mpi_op_t smpi_mpi_sum; // smpi_received_message_t struct smpi_received_message_t { + void *buf; smpi_mpi_communicator_t *comm; int src; int dst; int tag; - void *data; - int fwdthrough; }; typedef struct smpi_received_message_t smpi_received_message_t; diff --git a/src/smpi/src/smpi_base.c b/src/smpi/src/smpi_base.c index 91733c2f1f..49725caab3 100644 --- a/src/smpi/src/smpi_base.c +++ b/src/smpi/src/smpi_base.c @@ -10,6 +10,7 @@ // FIXME: move globals into structure... xbt_mallocator_t smpi_request_mallocator = NULL; +xbt_mallocator_t smpi_message_mallocator = NULL; xbt_fifo_t *smpi_pending_send_requests = NULL; xbt_fifo_t *smpi_pending_recv_requests = NULL; xbt_fifo_t *smpi_received_messages = NULL; @@ -137,8 +138,12 @@ int smpi_sender(int argc, char **argv) SIMIX_cond_wait(request->cond, request->mutex); // copy request to appropriate received queue - scratch = xbt_mallocator_get(smpi_request_mallocator); - memcpy(scratch, request, sizeof smpi_mpi_request_t); + scratch = xbt_mallocator_get(smpi_message_mallocator); + scratch->comm = request->comm; + scratch->src = request->src; + scratch->dst = request->dst; + scratch->tag = request->tag; + scratch->buf = request->buf; drank = smpi_mpi_comm_rank(&smpi_mpi_comm_world, dhost); xbt_fifo_push(smpi_received_messages[drank], scratch); @@ -205,6 +210,7 @@ int smpi_receiver(int argc, char **argv) while (0 < running_hosts) { // FIXME: search for received messages and requests + // use stupid algorithm for now if (NULL == request) { SIMIX_process_suspend(self); @@ -221,7 +227,7 @@ int smpi_receiver(int argc, char **argv) } SIMIX_mutex_unlock(request->mutex); - xbt_mallocator_release(smpi_request_mallocator, message); + xbt_mallocator_release(smpi_message_mallocator, message); } SIMIX_mutex_lock(smpi_running_hosts_mutex); @@ -343,6 +349,7 @@ void smpi_mpi_init() // smpi globals smpi_request_mallocator = xbt_mallocator_new(SMPI_REQUEST_MALLOCATOR_SIZE, smpi_new_request, xbt_free, NULL); + smpi_message_mallocator = xbt_mallocator_new(SMPI_MESSAGE_MALLOCATOR_SIZE, smpi_new_message, xbt_free, NULL); smpi_pending_send_requests = xbt_new(xbt_fifo_t, size); smpi_pending_recv_requests = xbt_new(xbt_fifo_t, size); smpi_received_messages = xbt_new(xbt_fifo_t, size); @@ -408,6 +415,7 @@ void smpi_mpi_finalize() } xbt_mallocator_free(smpi_request_mallocator); + xbt_mallocator_free(smpi_message_mallocator); xbt_free(smpi_pending_send_requests); xbt_free(smpi_pending_recv_requests); xbt_free(smpi_received_messages);