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

string generation from instructions instead of blocks

parent c8369980
Branches
No related tags found
1 merge request!14Infrastructure: Remove Instructionblock
...@@ -114,9 +114,23 @@ class TemplateManager: ...@@ -114,9 +114,23 @@ class TemplateManager:
Converts the TemplateManager to a string, replacing placeholders. Converts the TemplateManager to a string, replacing placeholders.
""" """
version = self.get_version() version = self.get_version()
block_string = "" code_string = ""
for block in self._blocks: current_rank = 'all'
block_string += str(block) + "\n" for inst in self._instructions:
if inst.get_ranks_executing != current_rank:
if current_rank != 'all':
code_string = code_string + "}\n" # end previous if
current_rank = inst.get_ranks_executing()
if current_rank == 'not0':
code_string = code_string + "if (rank!=0){\n"
elif current_rank != 'all':
code_string = code_string + "if (rank==%D){\n" % current_rank
code_string += str(inst) + "\n"
# end for inst
if current_rank != 'all':
code_string = code_string + "}\n" # end previous if
init_string = "" init_string = ""
if self._has_init: if self._has_init:
...@@ -135,7 +149,7 @@ class TemplateManager: ...@@ -135,7 +149,7 @@ class TemplateManager:
.replace("@{mpi_finalize}@", finalize_string) .replace("@{mpi_finalize}@", finalize_string)
.replace("@{desc}@", self._descr_full) .replace("@{desc}@", self._descr_full)
.replace("@{version}@", version) .replace("@{version}@", version)
.replace("@{test_code}@", block_string)) .replace("@{test_code}@", code_string))
def register_instruction(self, inst: Instruction | typing.List[Instruction]): def register_instruction(self, inst: Instruction | typing.List[Instruction]):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment