|
28 | 28 | be fixed while the number of MPI processes is varied, but this is not required.
|
29 | 29 |
|
30 | 30 | - The process is managed by subclasses of the `MPITestWrapper` base class
|
31 |
| -- Each test file must contain exactly one test function |
| 31 | +- Each test file must contain **exactly one** test function |
32 | 32 | - The test function must be decorated with a subclass of `MPITestWrapper`
|
33 | 33 | - The wrapper will write a modified version of the test file as `runner.py`
|
34 | 34 | to a temporary directory and mpirun it from there; results are collected
|
@@ -99,9 +99,14 @@ class MPITestWrapper:
|
99 | 99 | """
|
100 | 100 |
|
101 | 101 | RUNNER = "runner.py"
|
| 102 | + |
| 103 | + # Formats for output file names to be written by NEST and by the evaluation function. |
| 104 | + # The first placeholder will be filled with the number of processes used. |
| 105 | + # SPIKE and MULTI labels are passed to spike recorder/multimeter, which add "-{Rank}.dat" automatically. |
| 106 | + # For OTHER, the test function needs to provide the Rank explicitly. |
102 | 107 | SPIKE_LABEL = "spike-{}"
|
103 | 108 | MULTI_LABEL = "multi-{}"
|
104 |
| - OTHER_LABEL = "other-{}" |
| 109 | + OTHER_LABEL = "other-{}-{}.dat" |
105 | 110 |
|
106 | 111 | RUNNER_TEMPLATE = textwrap.dedent(
|
107 | 112 | """\
|
@@ -195,13 +200,18 @@ def wrapper(*args, **kwargs):
|
195 | 200 | return wrapper
|
196 | 201 |
|
197 | 202 | def _collect_result_by_label(self, tmpdirpath, label):
|
| 203 | + # Build complete patterns here including the rank part and ending |
| 204 | + if not label.endswith("-{}-{}.dat"): |
| 205 | + assert label.endswith("-{}") |
| 206 | + label += "-{}.dat" |
| 207 | + |
198 | 208 | try:
|
199 |
| - next(tmpdirpath.glob(f"{label.format('*')}.dat")) |
| 209 | + next(tmpdirpath.glob(label.format("*", "*"))) |
200 | 210 | except StopIteration:
|
201 | 211 | return None # no data for this label
|
202 | 212 |
|
203 | 213 | return {
|
204 |
| - n_procs: [pd.read_csv(f, sep="\t", comment="#") for f in tmpdirpath.glob(f"{label.format(n_procs)}-*.dat")] |
| 214 | + n_procs: [pd.read_csv(f, sep="\t", comment="#") for f in tmpdirpath.glob(label.format(n_procs, "*"))] |
205 | 215 | for n_procs in self._procs_lst
|
206 | 216 | }
|
207 | 217 |
|
|
0 commit comments