Skip to content
Snippets Groups Projects

P2P

Open
Jammer, Timrequested to merge
p2p into main
2 files
+ 90
90
Compare changes
  • Side-by-side
  • Inline

Files

@@ -175,6 +175,95 @@ def get_invalid_param_p2p_case(param, value, check_receive, send_func, recv_func
return tm
def replace_wait(wait_call, tm, wait_func_to_use):
assert wait_func_to_use in ["mpi_wait", "mpi_test", "mpi_waitall", "mpi_testall", "mpi_waitany", "mpi_testany",
"mpi_waitsome", "mpi_testsome"]
if wait_func_to_use == "mpi_wait":
return # nothing to do
if wait_func_to_use == "mpi_test":
flag_name = tm.add_stack_variable("int")
test_call = MPICallFactory.mpi_test(wait_call.get_arg("request"), "&" + flag_name, wait_call.get_arg("status"))
test_call.set_rank_executing(wait_call.get_rank_executing())
test_call.set_identifier(wait_call.get_identifier())
tm.insert_instruction(Instruction("while (!" + flag_name + "){", rank=wait_call.get_rank_executing()),
after_instruction=wait_call)
tm.insert_instruction(test_call, after_instruction=wait_call) # insertion before the improbe call
tm.insert_instruction(Instruction("}", rank=wait_call.get_rank_executing()), before_instruction="FREE",
before_first_of_list=True) # end while
tm.remove_instruction(wait_call)
return
if wait_func_to_use == "mpi_waitall":
test_call = MPICallFactory.mpi_waitall("1", wait_call.get_arg("request"), "&" + wait_call.get_arg("status"))
test_call.set_rank_executing(wait_call.get_rank_executing())
test_call.set_identifier(wait_call.get_identifier())
tm.insert_instruction(test_call, after_instruction=wait_call) # insertion before the improbe call
tm.remove_instruction(wait_call)
return
if wait_func_to_use == "mpi_testall":
flag_name = tm.add_stack_variable("int")
test_call = MPICallFactory.mpi_testall("1", wait_call.get_arg("request"), "&" + flag_name,
wait_call.get_arg("status"))
test_call.set_rank_executing(wait_call.get_rank_executing())
test_call.set_identifier(wait_call.get_identifier())
tm.insert_instruction(Instruction("while (!" + flag_name + "){", rank=wait_call.get_rank_executing()),
after_instruction=wait_call)
tm.insert_instruction(test_call, after_instruction=wait_call) # insertion before the improbe call
tm.insert_instruction(Instruction("}", rank=wait_call.get_rank_executing()), before_instruction="FREE",
before_first_of_list=True) # end while
tm.remove_instruction(wait_call)
return
if wait_func_to_use == "mpi_waitany":
idx_name = tm.add_stack_variable("int")
test_call = MPICallFactory.mpi_waitany("1", wait_call.get_arg("request"), "&" + idx_name,
"&" + wait_call.get_arg("status"))
test_call.set_rank_executing(wait_call.get_rank_executing())
test_call.set_identifier(wait_call.get_identifier())
tm.insert_instruction(test_call, after_instruction=wait_call) # insertion before the improbe call
tm.remove_instruction(wait_call)
return
if wait_func_to_use == "mpi_testany":
flag_name = tm.add_stack_variable("int")
idx_name = tm.add_stack_variable("int")
test_call = MPICallFactory.mpi_testany("1", wait_call.get_arg("request"), "&" + idx_name, "&" + flag_name,
wait_call.get_arg("status"))
test_call.set_rank_executing(wait_call.get_rank_executing())
test_call.set_identifier(wait_call.get_identifier())
tm.insert_instruction(Instruction("while (!" + flag_name + "){", rank=wait_call.get_rank_executing()),
after_instruction=wait_call)
tm.insert_instruction(test_call, after_instruction=wait_call) # insertion before the improbe call
tm.insert_instruction(Instruction("}", rank=wait_call.get_rank_executing()), before_instruction="FREE",
before_first_of_list=True) # end while
tm.remove_instruction(wait_call)
return
if wait_func_to_use == "mpi_waitsome":
idx_name = tm.add_stack_variable("int")
idx_array = tm.add_stack_variable("int")
test_call = MPICallFactory.mpi_waitsome("1", wait_call.get_arg("request"), "&" + idx_name,
"&" + idx_array, "&" + wait_call.get_arg("status"))
test_call.set_rank_executing(wait_call.get_rank_executing())
test_call.set_identifier(wait_call.get_identifier())
tm.insert_instruction(test_call, after_instruction=wait_call) # insertion before the improbe call
tm.remove_instruction(wait_call)
return
if wait_func_to_use == "mpi_testsome":
flag_name = tm.add_stack_variable("int")
idx_name = tm.add_stack_variable("int")
idx_array = tm.add_stack_variable("int")
test_call = MPICallFactory.mpi_testsome("1", wait_call.get_arg("request"), "&" + idx_name, "&" + idx_array,
"&" + flag_name,
wait_call.get_arg("status"))
test_call.set_rank_executing(wait_call.get_rank_executing())
test_call.set_identifier(wait_call.get_identifier())
tm.insert_instruction(Instruction("while (!" + flag_name + "){", rank=wait_call.get_rank_executing()),
after_instruction=wait_call)
tm.insert_instruction(test_call, after_instruction=wait_call) # insertion before the improbe call
tm.insert_instruction(Instruction("}", rank=wait_call.get_rank_executing()), before_instruction="FREE",
before_first_of_list=True) # end while
tm.remove_instruction(wait_call)
return
assert False and "Not implemented"
def get_collective_template(collective_func, seperate=True):
"""
Contructs a default template for the given mpi collecive
Loading