Skip to content

Commit 103a793

Browse files
committed
fix some merges
1 parent 7da5cea commit 103a793

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

toolchain/mfc/build.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os, typing, hashlib, dataclasses
22

3-
from .case import Case
43
from .printer import cons
54
from .common import MFCException, system, delete_directory, create_directory, \
65
format_list_to_string
@@ -22,7 +21,7 @@ def compute(self) -> typing.Set:
2221
return r
2322

2423
name: str # Name of the target
25-
flags: typing.List[str] # Extra flags to pass to CMake
24+
flags: typing.List[str] # Extra flags to pass to CMakeMFCTarget
2625
isDependency: bool # Is it a dependency of an MFC target?
2726
isDefault: bool # Should it be built by default? (unspecified -t | --targets)
2827
isRequired: bool # Should it always be built? (no matter what -t | --targets is)
@@ -32,7 +31,7 @@ def compute(self) -> typing.Set:
3231
def __hash__(self) -> int:
3332
return hash(self.name)
3433

35-
def get_slug(self, case: Case) -> str:
34+
def get_slug(self, case: input.MFCInputFile) -> str:
3635
if self.isDependency:
3736
return self.name
3837

@@ -47,7 +46,7 @@ def get_slug(self, case: Case) -> str:
4746
return m.hexdigest()[:10]
4847

4948
# Get path to directory that will store the build files
50-
def get_staging_dirpath(self, case: Case) -> str:
49+
def get_staging_dirpath(self, case: input.MFCInputFile) -> str:
5150
return os.sep.join([os.getcwd(), "build", "staging", self.get_slug(case) ])
5251

5352
# Get the directory that contains the target's CMakeLists.txt
@@ -64,18 +63,18 @@ def get_install_dirpath(self, case: input.MFCInputFile) -> str:
6463
# The install directory is located <root>/build/install/<slug>
6564
return os.sep.join([os.getcwd(), "build", "install", self.get_slug(case)])
6665

67-
def get_install_binpath(self, case: Case) -> str:
66+
def get_install_binpath(self, case: input.MFCInputFile) -> str:
6867
# <root>/install/<slug>/bin/<target>
6968
return os.sep.join([self.get_install_dirpath(case), "bin", self.name])
7069

71-
def is_configured(self, case: Case) -> bool:
70+
def is_configured(self, case: input.MFCInputFile) -> bool:
7271
# We assume that if the CMakeCache.txt file exists, then the target is
7372
# configured. (this isn't perfect, but it's good enough for now)
7473
return os.path.isfile(
7574
os.sep.join([self.get_staging_dirpath(case), "CMakeCache.txt"])
7675
)
7776

78-
def get_configuration_txt(self, case: Case) -> typing.Optional[dict]:
77+
def get_configuration_txt(self, case: input.MFCInputFile) -> typing.Optional[dict]:
7978
if not self.is_configured(case):
8079
return None
8180

@@ -261,8 +260,6 @@ def build(targets = None, case: input.MFCInputFile = None, history: typing.Set[s
261260
targets = [ targets ]
262261
if targets is None:
263262
targets = ARG("targets")
264-
elif isinstance(targets, (MFCTarget, str)):
265-
targets = [targets]
266263

267264
targets = get_targets(list(REQUIRED_TARGETS) + targets)
268265
case = case or input.load(ARG("input"), ARG("--"), {})

toolchain/mfc/test/case.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from ..run import input
88
from ..build import MFCTarget, get_target
99

10-
count = 0
1110
Tend = 0.25
1211
Nt = 50
1312
mydt = 0.0005
@@ -219,7 +218,7 @@ def __str__(self) -> str:
219218

220219
def to_input_file(self) -> input.MFCInputFile:
221220
return input.MFCInputFile(
222-
self.get_filepath(),
221+
os.path.basename(self.get_filepath()),
223222
self.get_dirpath(),
224223
self.get_parameters())
225224

@@ -262,7 +261,7 @@ def get_uuid(self) -> str:
262261
return trace_to_uuid(self.trace)
263262

264263
def to_case(self) -> TestCase:
265-
dictionary = {}
264+
dictionary = self.mods.copy()
266265
if self.path:
267266
dictionary.update(input.load(self.path, self.args, do_print=False).params)
268267

@@ -274,6 +273,7 @@ def to_case(self) -> TestCase:
274273
path = os.path.abspath(path)
275274
if os.path.exists(path):
276275
dictionary[key] = path
276+
break
277277

278278
if self.mods:
279279
dictionary.update(self.mods)

toolchain/mfc/test/test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
136136
start_time = time.time()
137137

138138
tol = case.compute_tolerance()
139+
case.delete_output()
140+
case.create_directory()
141+
139142
cmd = case.run([PRE_PROCESS, SIMULATION], gpus=devices)
140143
out_filepath = os.path.join(case.get_dirpath(), "out_pre_sim.txt")
141144

0 commit comments

Comments
 (0)