Skip to content
Snippets Groups Projects

RMA Test Cases

Open Simon Schwitanski requested to merge rma into main
+ 29
3
@@ -7,7 +7,6 @@ from scripts.Infrastructure.Instruction import Instruction
@@ -7,7 +7,6 @@ from scripts.Infrastructure.Instruction import Instruction
from scripts.Infrastructure.MPICall import MPICall
from scripts.Infrastructure.MPICall import MPICall
from scripts.Infrastructure.CorrectParameter import CorrectParameterFactory
from scripts.Infrastructure.CorrectParameter import CorrectParameterFactory
template = """// @{generatedby}@
template = """// @{generatedby}@
/* ///////////////////////// The MPI Bug Bench ////////////////////////
/* ///////////////////////// The MPI Bug Bench ////////////////////////
@@ -92,7 +91,8 @@ class TemplateManager:
@@ -92,7 +91,8 @@ class TemplateManager:
- replace_instruction(self, new_instruction=Instruction, identifier: str = None, idx: int | typing.List[int] = None): Replaces an instruction in the template with a new one.
- replace_instruction(self, new_instruction=Instruction, identifier: str = None, idx: int | typing.List[int] = None): Replaces an instruction in the template with a new one.
"""
"""
def __init__(self, min_ranks: int = 2, thread_level: str = None, has_finalize: bool = True, has_init: bool = True):
def __init__(self, min_ranks: int = 2, thread_level: str = None, has_finalize: bool = True, has_init: bool = True,
 
allow_reorder: bool = True):
"""
"""
Initialize the TemplateManager
Initialize the TemplateManager
@@ -101,6 +101,7 @@ class TemplateManager:
@@ -101,6 +101,7 @@ class TemplateManager:
thread_level : the MPI Thread Level to use (None means use MPI_Init instead of Init_Thread)
thread_level : the MPI Thread Level to use (None means use MPI_Init instead of Init_Thread)
has_finalize (bool) : if call to MPI Finalize should be included
has_finalize (bool) : if call to MPI Finalize should be included
has_init (bool) : if call to MPI Init should be included
has_init (bool) : if call to MPI Init should be included
 
allow_reorder (bool): allow reordering of instructions of different ranks for better redability
"""
"""
self._descr_full = ""
self._descr_full = ""
self._descr_short = ""
self._descr_short = ""
@@ -110,6 +111,7 @@ class TemplateManager:
@@ -110,6 +111,7 @@ class TemplateManager:
self._has_finalize = has_finalize
self._has_finalize = has_finalize
self._has_init = has_init
self._has_init = has_init
self._stack_variables = {}
self._stack_variables = {}
 
self._allow_reorder = allow_reorder
def __str__(self):
def __str__(self):
"""
"""
@@ -118,7 +120,31 @@ class TemplateManager:
@@ -118,7 +120,31 @@ class TemplateManager:
version = self.get_version()
version = self.get_version()
code_string = ""
code_string = ""
current_rank = 'all'
current_rank = 'all'
for inst in self._instructions:
 
instr_copy = []
 
if self._allow_reorder:
 
# "bucket-sort" the instructions to group those from different ranks together
 
buckets = [[] for _ in range(self._min_ranks)]
 
used_buckets = False
 
for instr in self._instructions:
 
rank = instr.get_rank_executing()
 
if rank != 'all' and rank != 'not0':
 
used_buckets = True
 
buckets[rank].append(instr)
 
else:
 
# can not reorder beyond this point
 
if used_buckets:
 
for bucket in buckets:
 
instr_copy = instr_copy + bucket
 
# empty buckets
 
buckets = [[] for _ in range(self._min_ranks)]
 
used_buckets = False
 
instr_copy.append(instr) # current inst
 
else:
 
# no re-ordering
 
instr_copy = self._instructions.copy()
 
 
for inst in instr_copy:
if inst.get_rank_executing() != current_rank:
if inst.get_rank_executing() != current_rank:
if current_rank != 'all':
if current_rank != 'all':
code_string = code_string + "}\n"
code_string = code_string + "}\n"
Loading