diff --git a/easybuild/easyblocks/h/hpl.py b/easybuild/easyblocks/h/hpl.py index 7dccc70e26..e50d0e4b31 100644 --- a/easybuild/easyblocks/h/hpl.py +++ b/easybuild/easyblocks/h/hpl.py @@ -125,9 +125,6 @@ def test_step(self): srcdir = os.path.join(self.cfg['start_dir'], 'bin', 'UNKNOWN') change_dir(srcdir) - pre_cmd = "" - post_cmd = "" - # xhpl needs atleast 4 processes to run the test suite req_cpus = 4 @@ -137,24 +134,15 @@ def test_step(self): parallel = self.cfg.parallel if not build_option('mpi_tests'): - self.log.info("MPI tests disabled from buildoption. Setting parallel to 1") - parallel = 1 - - if parallel < req_cpus: - self.log.info("Running tests with 1 oversubscribed process") - - pin_str = ','.join(["0"] * req_cpus) - if mpi_fam in [toolchain.INTELMPI]: - pre_cmd = f"I_MPI_PIN_PROCESSOR_LIST=\"{pin_str}\" I_MPI_PIN=on " - elif mpi_fam in [toolchain.OPENMPI]: - post_cmd = f"--cpu-set {pin_str}" - elif mpi_fam in [toolchain.MPICH]: - post_cmd = f"-bind-to user:{pin_str}" - else: - self.report_test_failure("Don't know how to oversubscribe for `%s` MPI family" % mpi_fam) - - cmd = self.toolchain.mpi_cmd_for(f'{post_cmd} ./xhpl', req_cpus) - cmd = f'{pre_cmd} {cmd}' + self.log.warning("MPI tests disabled from buildoption. Skipping tests") + return + + oversubscribe = parallel < req_cpus + + try: + cmd = self.toolchain.mpi_cmd_for(f'./xhpl', req_cpus, oversubscribe=oversubscribe) + except EasyBuildError as err: + self.report_test_failure(f"Could not create MPI command to run xhpl: {err}") res = run_shell_cmd(cmd) out = res.output