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

Refactoring: Moved the collective Generator to collective

parent bf4a0fe6
Branches
No related tags found
1 merge request!4Devel tj
#! /usr/bin/python3
from scripts.Infrastructure.ErrorGenerator import ErrorGenerator
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, get_collective_template
class InvalidRankErrorColl(ErrorGenerator):
invalid_ranks = ["-1", "size", "MPI_PROC_NULL"]
functions_to_use = ["mpi_reduce", "mpi_bcast"]
def __init__(self):
pass
def get_num_errors(self):
return len(self.invalid_ranks) * len(self.functions_to_use)
# the number of errors to produce in the extended mode (all possible combinations)
def get_num_errors_extended(self):
return len(self.invalid_ranks) * len(self.functions_to_use)
def get_feature(self):
return ["COLL"]
def generate(self, i):
rank_to_use = self.invalid_ranks[i // len(self.functions_to_use)]
func_to_use = self.functions_to_use[i % len(self.functions_to_use)]
tm = get_collective_template(func_to_use, seperate=False)
arg_to_replace = "root"
tm.set_description("InvalidParam-Rank-"+func_to_use, "Invalid Rank: %s" % rank_to_use)
tm.get_block("MPICALL").get_operation(kind='all', index=0).set_arg(arg_to_replace, rank_to_use)
tm.get_block("MPICALL").get_operation(kind='all', index=0).set_has_error()
return tm
......@@ -35,33 +35,3 @@ class InvalidRankErrorP2P(ErrorGenerator):
return tm
class InvalidRankErrorColl(ErrorGenerator):
invalid_ranks = ["-1", "size", "MPI_PROC_NULL"]
functions_to_use = ["mpi_reduce", "mpi_bcast"]
def __init__(self):
pass
def get_num_errors(self):
return len(self.invalid_ranks) * len(self.functions_to_use)
# the number of errors to produce in the extended mode (all possible combinations)
def get_num_errors_extended(self):
return len(self.invalid_ranks) * len(self.functions_to_use)
def get_feature(self):
return ["COLL"]
def generate(self, i):
rank_to_use = self.invalid_ranks[i // len(self.functions_to_use)]
func_to_use = self.functions_to_use[i % len(self.functions_to_use)]
tm = get_collective_template(func_to_use, seperate=False)
arg_to_replace = "root"
tm.set_description("InvalidParam-Rank-"+func_to_use, "Invalid Rank: %s" % rank_to_use)
tm.get_block("MPICALL").get_operation(kind='all', index=0).set_arg(arg_to_replace, rank_to_use)
tm.get_block("MPICALL").get_operation(kind='all', 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