Skip to content
Snippets Groups Projects

P2P

Open
Jammer, Timrequested to merge
p2p into main
1 file
+ 44
27
Compare changes
  • Side-by-side
  • Inline
+ 44
27
#! /usr/bin/python3
from scripts.Infrastructure.ErrorGenerator import ErrorGenerator
from scripts.Infrastructure.InstructionBlock import InstructionBlock
from scripts.Infrastructure.MPICall import MPICall
from scripts.Infrastructure.MPICallFactory import MPICallFactory, CorrectMPICallFactory
from scripts.Infrastructure.CorrectParameter import CorrectParameterFactory, get_matching_recv
from scripts.Infrastructure.Template import TemplateManager
@@ -25,14 +25,18 @@ class InvalidCommErrorP2P(ErrorGenerator):
comms_to_check = invalid_comm + missmatching_comms + intercomms
mprobe_funcs = ["mpi_mprobe", "mpi_improbe"]
probe_funcs = ["mpi_probe", "mpi_iprobe"]
functions_to_check = ["mpi_send",
"mpi_recv", "mpi_irecv",
"mpi_isend", "mpi_ssend", "mpi_issend", "mpi_rsend", "mpi_irsend", "mpi_bsend", "mpi_ibsend",
"mpi_send_init", "mpi_ssend_init", "mpi_bsend_init", "mpi_rsend_init", "mpi_psend_init",
"mpi_precv_init", "mpi_recv_init"
] + sendrecv_funcs
] + sendrecv_funcs + mprobe_funcs + probe_funcs
recv_funcs = ["mpi_recv", "mpi_irecv", "mpi_recv_init", "mpi_precv_init"] + sendrecv_funcs
recv_funcs = ["mpi_recv", "mpi_irecv", "mpi_recv_init",
"mpi_precv_init"] + sendrecv_funcs + mprobe_funcs + probe_funcs
def __init__(self):
pass
@@ -41,20 +45,25 @@ class InvalidCommErrorP2P(ErrorGenerator):
return ["P2P"]
def generate(self, generate_full_set):
for send_func in self.functions_to_check:
send_func_to_use = send_func
for comm_to_use in self.comms_to_check:
check_receive = False
recv_func = "mpi_irecv"
if send_func in self.recv_funcs:
check_receive = True
recv_func = send_func
send_func = "mpi_send"
send_func_to_use = "mpi_send"
if recv_func in sendrecv_funcs:
send_func = recv_func
send_func_to_use = recv_func
tm = get_send_recv_template(send_func, recv_func)
recv_func_to_use = recv_func
if recv_func in self.mprobe_funcs:
recv_func_to_use = [recv_func, "mpi_mrecv"]
if recv_func in self.probe_funcs:
recv_func_to_use = "mpi_recv"
tm = get_send_recv_template(send_func_to_use, recv_func_to_use)
if comm_to_use in self.missmatching_comms and comm_to_use != "MPI_COMM_SELF":
b = get_communicator(comm_to_use, comm_to_use)
@@ -68,33 +77,40 @@ class InvalidCommErrorP2P(ErrorGenerator):
error_string = "InvalidParam"
if check_receive:
if comm_to_use in self.missmatching_comms and recv_func == "mpi_irecv":
if comm_to_use in self.missmatching_comms + self.intercomms and recv_func == "mpi_irecv":
# combination repeated
continue
tm.set_description(error_string + "-Comm-" + recv_func, "Invalid Rank: %s" % comm_to_use)
tm.set_description(error_string + "-Comm-" + recv_func, error_string+": %s" % comm_to_use)
else:
tm.set_description(error_string + "-Comm-" + send_func, "Invalid Rank: %s" % comm_to_use)
tm.set_description(error_string + "-Comm-" + send_func, error_string+": %s" % comm_to_use)
# TODO enter probe func call
kind = 1
if check_receive:
tm.get_block("MPICALL").get_instruction(kind=0, index=0).set_arg("comm", comm_to_use)
tm.get_block("MPICALL").get_instruction(kind=0, index=0).set_has_error()
if comm_to_use in self.missmatching_comms:
# missmatch is between both
tm.get_block("MPICALL").get_instruction(kind=1, index=0).set_has_error()
else:
tm.get_block("MPICALL").get_instruction(kind=1, index=0).set_arg("comm", comm_to_use)
tm.get_block("MPICALL").get_instruction(kind=1, index=0).set_has_error()
if comm_to_use in self.missmatching_comms:
# missmatch is between both
tm.get_block("MPICALL").get_instruction(kind=0, index=0).set_has_error()
kind = 0
idx = 0
if recv_func == "mpi_improbe":
idx = 1
tm.get_block("MPICALL").get_instruction(kind=kind, index=idx).set_arg("comm", comm_to_use)
tm.get_block("MPICALL").get_instruction(kind=kind, index=idx).set_has_error()
if comm_to_use in self.missmatching_comms + self.intercomms:
# missmatch is between both
tm.get_block("MPICALL").get_instruction(kind=((kind + 1) % 2), index=0).set_has_error()
# an intercomm has only one rank (the other group)
# so all rank values must be set to 0
if comm_to_use in self.intercomms and not comm_to_use == "mpi_intercomm_merge":
# intercomm merge results in an equivalent comm again
if tm.get_block("MPICALL").get_instruction(kind=0, index=0).has_arg("source"):
tm.get_block("MPICALL").get_instruction(kind=0, index=0).set_arg("source", "0")
if tm.get_block("MPICALL").get_instruction(kind=1, index=0).has_arg("source"):
tm.get_block("MPICALL").get_instruction(kind=1, index=0).set_arg("source", "0")
# intercomm merge results in an "equivalent" comm again
for inst in tm.get_block("MPICALL").get_instruction(kind=0, index='all'):
if isinstance(inst, MPICall):
if inst.has_arg("source"):
inst.set_arg("source", "0")
for inst in tm.get_block("MPICALL").get_instruction(kind=1, index='all'):
if isinstance(inst, MPICall):
if inst.has_arg("source"):
inst.set_arg("source", "0")
if comm_to_use in self.missmatching_comms + self.intercomms and comm_to_use != "MPI_COMM_SELF":
b = InstructionBlock("comm_free")
@@ -105,3 +121,4 @@ class InvalidCommErrorP2P(ErrorGenerator):
# end for comm to check
if not generate_full_set:
return
# end for send_func in funcs_to_check
Loading