Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Typos, cosmetics and RDV protocol.
authorpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Apr 2010 09:22:24 +0000 (09:22 +0000)
committerpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Apr 2010 09:22:24 +0000 (09:22 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7583 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/simix/smx_network.c
src/smpi/private.h
src/smpi/smpi_base.c

index 0fa2c51..941dcce 100644 (file)
@@ -347,12 +347,19 @@ void SIMIX_network_copy_buffer_callback(smx_comm_t comm, size_t buff_size) {
  */
 void SIMIX_network_copy_data(smx_comm_t comm)
 {
+  size_t buff_size = comm->src_buff_size;
+
+  DEBUG6("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
+      comm,
+      comm->src_proc->smx_host->name, comm->src_buff,
+      comm->dst_proc->smx_host->name, comm->dst_buff,
+      buff_size);
+
   /* If there is no data to be copy then return */
   if(!comm->src_buff || !comm->dst_buff)
     return;
   
   /* Copy at most dst_buff_size bytes of the message to receiver's buffer */
-  size_t buff_size = comm->src_buff_size;
   if (comm->dst_buff_size)
     buff_size = MIN(buff_size,*(comm->dst_buff_size));
   
@@ -362,11 +369,6 @@ void SIMIX_network_copy_data(smx_comm_t comm)
 
   if(buff_size == 0)
     return;
-  DEBUG6("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
-      comm,
-      comm->src_proc->smx_host->name, comm->src_buff,
-      comm->dst_proc->smx_host->name, comm->dst_buff,
-      buff_size);
   (*SIMIX_network_copy_data_callback)(comm, buff_size);
 
   /* pimple to display the message sizes */
index 8b61ea7..942e9c7 100644 (file)
@@ -64,7 +64,7 @@ int smpi_comm_rank(MPI_Comm comm);
 MPI_Request smpi_mpi_isend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
 MPI_Request smpi_mpi_irecv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
 void smpi_mpi_recv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status);
-void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
+void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
 void smpi_mpi_sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status);
 int smpi_mpi_test(MPI_Request* request, MPI_Status* status);
 int smpi_mpi_testany(int count, MPI_Request requests[], int* index, MPI_Status* status);
index 7296b10..065bf7c 100644 (file)
@@ -13,6 +13,8 @@ XBT_LOG_EXTERNAL_CATEGORY(smpi_receiver);
 XBT_LOG_EXTERNAL_CATEGORY(smpi_sender);
 XBT_LOG_EXTERNAL_CATEGORY(smpi_util);
 
+#define EAGER_LIMIT 65536
+
 void smpi_process_init(int* argc, char*** argv) {
   int index;
   smpi_process_data_t data;
@@ -40,13 +42,18 @@ void smpi_process_destroy(void) {
 /* MPI Low level calls */
 MPI_Request smpi_mpi_isend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
   MPI_Request request;
+  size_t size = smpi_datatype_size(datatype) * count;
 
+  if (size > EAGER_LIMIT) {
+       /* Warning: this (zero-length synchronous) call will come back here with size == 0 */
+       smpi_mpi_send (NULL, 0, MPI_BYTE, dst, tag, comm);
+  }
   request = xbt_new(s_smpi_mpi_request_t, 1);
   request->comm = comm;
   request->src = smpi_comm_rank(comm);
   request->dst = dst;
   request->tag = tag;
-  request->size = smpi_datatype_size(datatype) * count;
+  request->size = size;
   request->complete = 0;
   request->data = request;
   smpi_process_post_send(comm, request);
@@ -56,13 +63,18 @@ MPI_Request smpi_mpi_isend(void* buf, int count, MPI_Datatype datatype, int dst,
 
 MPI_Request smpi_mpi_irecv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) {
   MPI_Request request;
+  size_t size = smpi_datatype_size(datatype) * count;
 
+  if (size > EAGER_LIMIT) {
+       /* Warning: this (zero-length synchronous) call will come back here with size == 0 */
+       smpi_mpi_recv (NULL, 0, MPI_BYTE, src, tag, comm, MPI_STATUS_IGNORE);
+  }
   request = xbt_new(s_smpi_mpi_request_t, 1);
   request->comm = comm;
   request->src = src;
   request->dst = smpi_comm_rank(comm);
   request->tag = tag;
-  request->size = smpi_datatype_size(datatype) * count;
+  request->size = size;
   request->complete = 0;
   request->data = MPI_REQUEST_NULL;
   smpi_process_post_recv(request);
@@ -77,10 +89,10 @@ void smpi_mpi_recv(void* buf, int count, MPI_Datatype datatype, int src, int tag
   smpi_mpi_wait(&request, status);
 }
 
-void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) {
+void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
   MPI_Request request;
 
-  request = smpi_mpi_isend(buf, count, datatype, src, tag, comm);
+  request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
   smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
 }