Skip to content
Snippets Groups Projects
Commit 736a10b8 authored by Jammer, Tim's avatar Jammer, Tim
Browse files

added case for invalid and missmatching comms with the predefined communicators

parent 3c6f5d37
No related branches found
No related tags found
1 merge request!5more work on infrastructure III
#! /usr/bin/python3
from scripts.Infrastructure.ErrorGenerator import ErrorGenerator, CorrectTestcase
from scripts.Infrastructure.InstructionBlock import InstructionBlock
from scripts.Infrastructure.MPICallFactory import MPICallFactory, CorrectMPICallFactory
from scripts.Infrastructure.CorrectParameter import CorrectParameterFactory, get_matching_recv
from scripts.Infrastructure.Template import TemplateManager
from scripts.Infrastructure.TemplateFactory import get_send_recv_template
from itertools import chain
sendrecv_funcs = ["mpi_sendrecv", "mpi_sendrecv_replace"]
# TODO implement more missmatching comms
# and missmatching comm when sender and receiver use different comms
class InvalidCommErrorP2P(ErrorGenerator):
invalid_comm = ["MPI_COMM_NULL", "NULL"]
missmatching_comms = ["MPI_COMM_SELF"]
comms_to_check = invalid_comm + missmatching_comms
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
recv_funcs = ["mpi_recv", "mpi_irecv", "mpi_recv_init", "mpi_precv_init"] + sendrecv_funcs
def __init__(self):
pass
def get_num_errors(self):
# send + receive = only check the first two functions
return len(self.comms_to_check) * 2
# the number of errors to produce in the extended mode (all possible combinations)
def get_num_errors_extended(self):
return len(self.comms_to_check) * len(self.functions_to_check)
def get_feature(self):
return ["P2P"]
def generate(self, i):
comm_to_use = self.comms_to_check[i % len(self.comms_to_check)]
send_func = self.functions_to_check[i // len(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"
if recv_func in sendrecv_funcs:
send_func = recv_func
if i % len(self.functions_to_check) >= len(self.functions_to_check) - len(sendrecv_funcs):
# check the send part of sendrecv
check_receive = False
tm = get_send_recv_template(send_func, recv_func)
error_string = "ParamMatching"
if comm_to_use in self.invalid_comm:
error_string = "InvalidParam"
if check_receive:
if comm_to_use in self.missmatching_comms and recv_func=="mpi_irecv":
# combination repeated
raise CorrectTestcase
tm.set_description(error_string + "-Comm-" + recv_func, "Invalid Rank: %s" % comm_to_use)
else:
tm.set_description(error_string + "-Comm-" + send_func, "Invalid Rank: %s" % comm_to_use)
if check_receive:
tm.get_block("MPICALL").get_operation(kind=0, index=0).set_arg("comm", comm_to_use)
tm.get_block("MPICALL").get_operation(kind=0, index=0).set_has_error()
if comm_to_use in self.missmatching_comms:
# missmatch is between both
tm.get_block("MPICALL").get_operation(kind=1, index=0).set_has_error()
else:
tm.get_block("MPICALL").get_operation(kind=1, index=0).set_arg("comm", comm_to_use)
tm.get_block("MPICALL").get_operation(kind=1, index=0).set_has_error()
if comm_to_use in self.missmatching_comms:
# missmatch is between both
tm.get_block("MPICALL").get_operation(kind=0, index=0).set_has_error()
return tm
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment