Skip to content
Snippets Groups Projects

P2P

Open
Jammer, Timrequested to merge
p2p into main
1 file
+ 34
36
Compare changes
  • Side-by-side
  • Inline
+ 34
36
@@ -19,35 +19,36 @@ class MessageRaceErrorAnyTag(ErrorGenerator):
tm = TemplateManager()
tm.set_description("MsgRace-ANY_TAG", "order of messages is indeterministic, may lead to a deadlock")
b = InstructionBlock("alloc")
b.register_instruction(CorrectParameterFactory().get_buffer_alloc())
tm.register_instruction_block(b)
tm.register_instruction(CorrectParameterFactory().get_buffer_alloc())
b = InstructionBlock("MPICALL")
# send part
b.register_instruction("for(int i =0; i < 10; ++i) {", kind=1)
b.register_instruction("buf[0]=i;", kind=1)
tm.register_instruction("for(int i =0; i < 10; ++i) {", rank_to_execute=1)
tm.register_instruction("buf[0]=i;", rank_to_execute=1)
send_call = CorrectMPICallFactory().mpi_send()
send_call.set_arg("tag", "i")
b.register_instruction(send_call, kind=1)
b.register_instruction("}", kind=1)
tm.register_instruction(send_call, rank_to_execute=1)
tm.register_instruction("}", rank_to_execute=1)
# the final msg after the loop
send_call = CorrectMPICallFactory().mpi_send()
tm.register_instruction(send_call, rank_to_execute=1)
# recv part
b.register_instruction("for(int i =0; i < 10; ++i) {", kind=0)
tm.register_instruction("for(int i =0; i < 10; ++i) {", rank_to_execute=0)
recv_call = CorrectMPICallFactory().mpi_recv()
recv_call.set_arg("tag", "MPI_ANY_TAG")
b.register_instruction(recv_call, kind=0)
b.register_instruction("if(buf[0]!=i){", kind=0)
additional_recv = CorrectMPICallFactory().mpi_recv()
additional_recv.set_has_error() # additional recv leads to deadlock
b.register_instruction(additional_recv, kind=0)
b.register_instruction(" }", kind=0) # end if
b.register_instruction("}", kind=0) # end for
recv_call.set_rank_executing(0)
tm.register_instruction(recv_call)
tm.register_instruction_block(b)
tm.register_instruction("if(buf[0]!=i){", rank_to_execute=0)
additional_recv = CorrectMPICallFactory().mpi_recv()
additional_recv.set_has_error() # additional recv may lead to deadlock
tm.register_instruction(additional_recv,rank_to_execute=0)
tm.register_instruction(" }", rank_to_execute=0) # end if
tm.register_instruction("}", rank_to_execute=0) # end for
b = InstructionBlock("free")
b.register_instruction(CorrectParameterFactory().get_buffer_free())
tm.register_instruction_block(b)
tm.register_instruction(CorrectParameterFactory().get_buffer_free())
yield tm
@@ -65,32 +66,29 @@ class MessageRaceErrorAnysource(ErrorGenerator):
tm = TemplateManager(min_ranks=3)
tm.set_description("MsgRace-ANY_SOURCE", "order of messages is indeterministic, may lead to a deadlock")
b = InstructionBlock("alloc")
b.register_instruction(CorrectParameterFactory().get_buffer_alloc())
tm.register_instruction_block(b)
tm.register_instruction(CorrectParameterFactory().get_buffer_alloc())
b = InstructionBlock("MPICALL")
# send part
b.register_instruction("buf[0]=rank;", kind='not0')
tm.register_instruction("buf[0]=rank;", rank_to_execute='not0')
send_call = CorrectMPICallFactory().mpi_send()
tm.register_instruction(send_call, rank_to_execute='not0')
# rank 1 sends an additional msg
send_call = CorrectMPICallFactory().mpi_send()
b.register_instruction(send_call, kind='not0')
tm.register_instruction(send_call, rank_to_execute=1)
# recv part
b.register_instruction("for(int i =1; i < nprocs; ++i) {", kind=0)
tm.register_instruction("for(int i =1; i < nprocs; ++i) {", rank_to_execute=0)
recv_call = CorrectMPICallFactory().mpi_recv()
recv_call.set_arg("source", "MPI_ANY_SOURCE")
b.register_instruction(recv_call, kind=0)
b.register_instruction("if(buf[0]!=i){", kind=0)
tm.register_instruction(recv_call, rank_to_execute=0)
tm.register_instruction("if(buf[0]!=i){", rank_to_execute=0)
additional_recv = CorrectMPICallFactory().mpi_recv()
additional_recv.set_has_error() # additional recv leads to deadlock
b.register_instruction(additional_recv, kind=0)
b.register_instruction(" }", kind=0) # end if
b.register_instruction("}", kind=0) # end for
tm.register_instruction(additional_recv, rank_to_execute=0)
tm.register_instruction(" }", rank_to_execute=0) # end if
tm.register_instruction("}", rank_to_execute=0) # end for
tm.register_instruction_block(b)
tm.register_instruction(CorrectParameterFactory().get_buffer_free())
b = InstructionBlock("free")
b.register_instruction(CorrectParameterFactory().get_buffer_free())
tm.register_instruction_block(b)
yield tm
Loading