Commit 228a62c4 authored by Augustin Degomme's avatar Augustin Degomme

enhance shared tests to validate comms are skipped

parent 55160521
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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();
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment