Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
enhance shared tests to validate comms are skipped
authorAugustin Degomme <adegomme@gmail.com>
Thu, 28 Nov 2019 09:28:39 +0000 (10:28 +0100)
committerAugustin Degomme <adegomme@gmail.com>
Thu, 28 Nov 2019 09:32:33 +0000 (10:32 +0100)
src/smpi/internals/smpi_global.cpp
src/smpi/mpi/smpi_datatype.cpp
teshsuite/smpi/macro-shared/macro-shared.c
teshsuite/smpi/macro-shared/macro-shared.tesh

index 59e5c6a..5325b9d 100644 (file)
@@ -180,7 +180,7 @@ void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, v
   if(smpi_is_shared(buff, src_private_blocks, &src_offset)) {
     src_private_blocks = shift_and_frame_private_blocks(src_private_blocks, src_offset, buff_size);
     if (src_private_blocks.size()==1 && (src_private_blocks[0].second - src_private_blocks[0].first)==buff_size){//simple shared malloc ... return.
-      XBT_DEBUG("Sender %p is shared. Let's ignore it.", buff);
+      XBT_VERB("Sender is shared. Let's ignore it.");
       smpi_cleanup_comm_after_copy(comm, buff);
       return;
     }
@@ -192,7 +192,7 @@ void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, v
   if (smpi_is_shared((char*)comm->dst_buff_, dst_private_blocks, &dst_offset)) {
     dst_private_blocks = shift_and_frame_private_blocks(dst_private_blocks, dst_offset, buff_size);
     if (src_private_blocks.size()==1 && (src_private_blocks[0].second - src_private_blocks[0].first)==buff_size){//simple shared malloc ... return.
-      XBT_DEBUG("Receiver %p is shared. Let's ignore it.", (char*)comm->dst_buff_);
+      XBT_VERB("Receiver is shared. Let's ignore it.");
       smpi_cleanup_comm_after_copy(comm, buff);
       return;
     }
index 074c158..b82b801 100644 (file)
@@ -284,11 +284,13 @@ int Datatype::copy(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
   if(smpi_is_shared(sendbuf,private_blocks,&offset)
        && (private_blocks.size()==1
        && (private_blocks[0].second - private_blocks[0].first)==(unsigned long)(sendcount * sendtype->get_extent()))){
+    XBT_VERB("sendbuf is shared. Ignoring copies");
     return 0;
   }
   if(smpi_is_shared(recvbuf,private_blocks,&offset)
        && (private_blocks.size()==1
        && (private_blocks[0].second - private_blocks[0].first)==(unsigned long)(recvcount * recvtype->get_extent()))){
+    XBT_VERB("recvbuf is shared. Ignoring copies");
     return 0;
   }
 
index 7ce48e7..6e739ad 100644 (file)
@@ -54,6 +54,17 @@ int main(int argc, char *argv[])
 
   printf("[%d] After change, the value in the shared buffer is: %" PRIu64"\n", rank, *buf);
 
+  //try to send/receive shared data, to check if we skip the copies correctly.
+  if(rank==0)
+    MPI_Send(buf, 1, MPI_AINT, 1, 100, MPI_COMM_WORLD);
+  else if (rank ==1)
+    MPI_Recv(buf, 1, MPI_AINT, 0, 100, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+    
+  //same thing with an MPI_IN_PLACE collective (no)
+  if (rank == 0)
+    MPI_Scatter(buf, 1, MPI_AINT, MPI_IN_PLACE, -1, MPI_DATATYPE_NULL, 0, MPI_COMM_WORLD);
+  else
+    MPI_Scatter(NULL, -1, MPI_DATATYPE_NULL, buf, 1, MPI_AINT, 0, MPI_COMM_WORLD);
   SMPI_SHARED_FREE(buf);
 
   MPI_Finalize();
index 6eb375a..38b20ab 100644 (file)
@@ -1,7 +1,12 @@
 p Test compute
 ! output sort
 ! timeout 5
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/macro-shared --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/macro-shared --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --log=smpi_kernel.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n"
+> (maestro@) You did not set the power of the host running the simulation.  The timings will certainly not be accurate.  Use the option "--cfg=smpi/host-speed:<flops>" to set its value.  Check https://simgrid.org/doc/latest/Configuring_SimGrid.html#automatic-benchmarking-of-smpi-code for more information.
+> (maestro@) Receiver is shared. Let's ignore it.
+> (maestro@) Receiver is shared. Let's ignore it.
+> (maestro@) Receiver is shared. Let's ignore it.
+> (maestro@) Receiver is shared. Let's ignore it.
 > [0] After change, the value in the shared buffer is: 16053117601147974045
 > [0] The value in the shared buffer is: 4
 > [1] After change, the value in the shared buffer is: 16053117601147974045