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

simplified InvalidBuffer case

parent 5505e4b7
Branches
No related tags found
1 merge request!6More Work on infrastructure IV
......@@ -111,7 +111,6 @@ class GeneratorManager:
cases_generated = 0
for generator in generators_to_use:
print(generator)
for result_error in generator.generate(generate_full_set):
assert isinstance(result_error, TemplateManager)
......
......@@ -9,19 +9,19 @@ from scripts.Infrastructure.TemplateFactory import get_send_recv_template
from itertools import chain
sendrecv_funcs = ["mpi_sendrecv", "mpi_sendrecv_replace"]
class InvalidBufErrorP2P(ErrorGenerator):
invalid_bufs = [CorrectParameterFactory().buf_var_name, "NULL"]
functions_to_check = ["mpi_send",
"mpi_recv", "mpi_irecv",
send_funcs = ["mpi_send",
"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
# chekc sendrecv funcs two times: the send and recv part
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 = ["mpi_sendrecv", "mpi_sendrecv_replace"]
def __init__(self):
pass
......@@ -29,20 +29,9 @@ class InvalidBufErrorP2P(ErrorGenerator):
def get_feature(self):
return ["P2P"]
def generate(self, generate_full_set):
for send_func in self.functions_to_check:
for buf_to_use in self.invalid_bufs:
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"
# TODO
# if i % len(self.functions_to_check) >= len(self.functions_to_check) - len(sendrecv_funcs):
# check the send part of sendrecv
def generate_impl(self, send_func, recv_func, check_receive):
for buf_to_use in self.invalid_bufs:
tm = get_send_recv_template(send_func, recv_func)
if buf_to_use == CorrectParameterFactory().buf_var_name:
......@@ -51,7 +40,6 @@ class InvalidBufErrorP2P(ErrorGenerator):
type = tm.get_block("alloc").get_operation(kind='all', index=1).get_type()
tm.get_block("alloc").replace_operation(
CorrectParameterFactory.dtype[0] + "* " + name + ";", kind='all', index=1)
else:
tm.get_block("alloc").replace_operation(
CorrectParameterFactory.dtype[0] + "* " + CorrectParameterFactory.buf_var_name + ";")
......@@ -76,9 +64,18 @@ class InvalidBufErrorP2P(ErrorGenerator):
tm.get_block("MPICALL").get_operation(kind=1, index=0).set_has_error()
yield tm
# end for buf_to_use
def generate(self, generate_full_set):
for func in self.send_funcs:
yield from self.generate_impl(func, 'mpi_irecv', False)
if not generate_full_set:
return
for func in self.recv_funcs:
yield from self.generate_impl("mpi_send", func, True)
yield from self.generate_impl("mpi_sendrecv", "mpi_sendrecv", True)
yield from self.generate_impl("mpi_sendrecv", "mpi_sendrecv", False)
yield from self.generate_impl("mpi_sendrecv_replace", "mpi_sendrecv_replace", True)
class MessageRaceErrorSendRecv(ErrorGenerator):
......
......@@ -2,8 +2,8 @@
from scripts.Infrastructure.GeneratorManager import GeneratorManager
if __name__ == "__main__":
gm = GeneratorManager("./errors")
#gm = GeneratorManager("./errors/devel")
#gm = GeneratorManager("./errors")
gm = GeneratorManager("./errors/devel")
#gm.generate("../gencodes", try_compile=True, generate_full_set=False) # default
gm.generate("../gencodes", try_compile=True, generate_full_set=True, max_mpi_version="3.1") #all cases that can compile for my local mpi installation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment