Skip to content

Commit

Permalink
replace run_cmd with run_shell_cmd in amber.py
Browse files Browse the repository at this point in the history
  • Loading branch information
branfosj committed Jan 28, 2024
1 parent f1221e2 commit 30ba4ae
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions easybuild/easyblocks/a/amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.modules import get_software_root
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.filetools import remove_dir, which


Expand Down Expand Up @@ -107,7 +107,7 @@ def patch_step(self, *args, **kwargs):
# he or she selects "latest". (Note: "latest" is not
# recommended for this reason and others.)
for _ in range(self.cfg['patchruns']):
run_cmd(cmd, log_all=True)
run_shell_cmd(cmd)
else:
for (tree, patch_level) in zip(['AmberTools', 'Amber'], self.cfg['patchlevels']):
if patch_level == 0:
Expand All @@ -116,7 +116,7 @@ def patch_step(self, *args, **kwargs):
# Run as many times as specified. It is the responsibility
# of the easyconfig author to get this right.
for _ in range(self.cfg['patchruns']):
run_cmd(cmd, log_all=True)
run_shell_cmd(cmd)

super(EB_Amber, self).patch_step(*args, **kwargs)

Expand Down Expand Up @@ -304,18 +304,18 @@ def configuremake_install_step(self):
for flag, testrule in build_targets:
# configure
cmd = "%s ./configure %s" % (self.cfg['preconfigopts'], ' '.join(common_configopts + [flag, comp_str]))
(out, _) = run_cmd(cmd, log_all=True, simple=False)
run_shell_cmd(cmd)

# build in situ using 'make install'
# note: not 'build'
super(EB_Amber, self).install_step()

# test
if self.cfg['runtest']:
run_cmd("make %s" % testrule, log_all=True, simple=False)
run_shell_cmd("make %s" % testrule)

# clean, overruling the normal 'build'
run_cmd("make clean")
run_shell_cmd("make clean")

def install_step(self):
"""Install procedure for Amber."""
Expand All @@ -332,24 +332,24 @@ def install_step(self):
pretestcommands = 'source %s/amber.sh && cd %s' % (self.installdir, self.builddir)

# serial tests
run_cmd("%s && make test.serial" % pretestcommands, log_all=True, simple=True)
run_shell_cmd("%s && make test.serial" % pretestcommands)
if self.with_cuda:
(out, ec) = run_cmd("%s && make test.cuda_serial" % pretestcommands, log_all=True, simple=False)
if ec > 0:
res = run_shell_cmd("%s && make test.cuda_serial" % pretestcommands)
if res.code > 0:
self.log.warning("Check the output of the Amber cuda tests for possible failures")

if self.with_mpi:
# Hard-code parallel tests to use 4 threads
env.setvar("DO_PARALLEL", self.toolchain.mpi_cmd_for('', 4))
(out, ec) = run_cmd("%s && make test.parallel" % pretestcommands, log_all=True, simple=False)
if ec > 0:
res = run_shell_cmd("%s && make test.parallel" % pretestcommands)
if res.code > 0:
self.log.warning("Check the output of the Amber parallel tests for possible failures")

if self.with_mpi and self.with_cuda:
# Hard-code CUDA parallel tests to use 2 threads
env.setvar("DO_PARALLEL", self.toolchain.mpi_cmd_for('', 2))
(out, ec) = run_cmd("%s && make test.cuda_parallel" % pretestcommands, log_all=True, simple=False)
if ec > 0:
res = run_shell_cmd("%s && make test.cuda_parallel" % pretestcommands)
if res.code > 0:
self.log.warning("Check the output of the Amber cuda_parallel tests for possible failures")

def sanity_check_step(self):
Expand Down

0 comments on commit 30ba4ae

Please sign in to comment.