Skip to content

Commit 5ea3d62

Browse files
committed
Fix running w/ --no-mpi & Tests delete p_all,D,...
1 parent 4678ba0 commit 5ea3d62

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

toolchain/mfc/run/engines.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(self) -> None:
5757

5858
def _init(self) -> None:
5959
self.mpibin = mpi_bins.get_binary()
60+
6061
# If using MPI, we don't know yet whether this engine works
6162
self.bKnowWorks = not ARG("mpi")
6263

toolchain/mfc/run/mpi_bins.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from ..state import ARG
55

66
# Note: This file is now only used when running
7-
# in serial mode.
7+
# in -e interactive mode.
88

99
@dataclasses.dataclass
1010
class MPIBinary:
@@ -18,6 +18,17 @@ def gen_params(self) -> typing.List[str]:
1818
raise common.MFCException(f"MPIBinary::gen_params <{self.name}> not implemented.")
1919

2020

21+
class NOMPIBIN(MPIBinary):
22+
def __init__(self):
23+
super().__init__("N/A", "N/A")
24+
25+
def is_present(self) -> bool:
26+
return not ARG("mpi")
27+
28+
def gen_params(self) -> typing.List[str]:
29+
return []
30+
31+
2132
class JSRUN(MPIBinary):
2233
def __init__(self):
2334
super().__init__("IBM's JSRUN", "jsrun")
@@ -83,7 +94,7 @@ def gen_params(self) -> str:
8394

8495

8596
# In descending order of priority (if no override present)
86-
BINARIES: list = [ JSRUN(), SRUN(), MPIRUN(), MPIEXEC() ]
97+
BINARIES: list = [ JSRUN(), SRUN(), MPIRUN(), MPIEXEC(), NOMPIBIN() ]
8798

8899
def get_binary(exclude: typing.List[str] = None) -> MPIBinary:
89100
if exclude is None:

toolchain/mfc/test/case.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ def get_uuid(self) -> str:
124124
def get_dirpath(self):
125125
return os.path.join(common.MFC_TESTDIR, self.get_uuid())
126126

127-
def create_directory(self, filename: str):
127+
def create_directory(self, filename: str, delete=None):
128+
if delete is None:
129+
delete = False
130+
128131
dirpath = self.get_dirpath()
129132

130133
content = f"""\
@@ -135,6 +138,11 @@ def create_directory(self, filename: str):
135138
print(json.dumps({self.gen_json_dict_str()}))
136139
"""
137140

141+
if delete:
142+
common.delete_directory(os.path.join(dirpath, "D"))
143+
common.delete_directory(os.path.join(dirpath, "p_all"))
144+
common.delete_directory(os.path.join(dirpath, "silo_hdf5"))
145+
138146
common.create_directory(dirpath)
139147

140148
common.file_write(f"{dirpath}/{filename}.py", content)

toolchain/mfc/test/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def handle_case(test: TestCase):
133133
else:
134134
tol = 1e-12
135135

136-
test.create_directory("case_pre_sim")
136+
test.create_directory("case_pre_sim", delete=True)
137137
cmd = test.run("case_pre_sim", ["pre_process", "simulation"])
138138

139139
out_filepath = os.path.join(test.get_dirpath(), "out_pre_sim.txt")

0 commit comments

Comments
 (0)