Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace run_cmd with run_shell_cmd in custom easyblock for numpy (numpy.py) #3199

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions easybuild/easyblocks/n/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import change_dir, mkdir, read_file, remove_dir
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 import LooseVersion


Expand Down Expand Up @@ -209,7 +209,7 @@ def get_libs_for_mkl(varname):
if LooseVersion(self.version) < LooseVersion('1.21'):
# check configuration (for debugging purposes)
cmd = "%s setup.py config" % self.python_cmd
run_cmd(cmd, log_all=True, simple=True)
run_shell_cmd(cmd)

if LooseVersion(self.version) >= LooseVersion('1.26'):
# control BLAS/LAPACK library being used
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_step(self):
mkdir(pylibdir, parents=True)
pythonpath = "export PYTHONPATH=%s &&" % os.pathsep.join(abs_pylibdirs + ['$PYTHONPATH'])
cmd = self.compose_install_command(tmpdir, extrapath=pythonpath)
run_cmd(cmd, log_all=True, simple=True, verbose=False)
run_shell_cmd(cmd)

try:
pwd = os.getcwd()
Expand All @@ -283,20 +283,20 @@ def test_step(self):
'-s "import numpy; x = numpy.random.random((%(size)d, %(size)d))"' % {'size': size},
'"numpy.dot(x, x.T)"',
])
(out, ec) = run_cmd(cmd, simple=False)
self.log.debug("Test output: %s" % out)
res = run_shell_cmd(cmd)
self.log.debug("Test output: %s" % res.output)

# fetch result
time_msec = None
msec_re = re.compile(r"\d+ loops, best of \d+: (?P<time>[0-9.]+) msec per loop")
res = msec_re.search(out)
if res:
time_msec = float(res.group('time'))
msec = msec_re.search(res.output)
if msec:
time_msec = float(msec.group('time'))
else:
sec_re = re.compile(r"\d+ loops, best of \d+: (?P<time>[0-9.]+) sec per loop")
res = sec_re.search(out)
if res:
time_msec = 1000 * float(res.group('time'))
sec = sec_re.search(res.output)
if sec:
time_msec = 1000 * float(sec.group('time'))
elif self.dry_run:
# use fake value during dry run
time_msec = 123
Expand Down
Loading