Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- version: "4.2.2"
eessi: ESPResSo/4.2.2-foss-2023a
- version: "5.0-dev"
eessi: ESPResSo/8aa60cecd56cdd10ab62042c567552f347374f36-foss-2023b
eessi: ESPResSo/dc87ede3f6c218bb71624460752bc8c26a271c33-foss-2023b
name: ubuntu - ESPResSo ${{ matrix.espresso.version }}
steps:
- name: Setup EESSI
Expand All @@ -37,7 +37,9 @@ jobs:
${{ matrix.espresso.eessi }}
- name: Run testsuite
run: |
export NUM_PROC=$(nproc)
export OMP_PROC_BIND=false OMP_NUM_THREADS=1
module restore pymbe
source venv/bin/activate
make functional_tests -j4
make functional_tests -j${NUM_PROC}
shell: bash
6 changes: 4 additions & 2 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
eessi: ESPResSo/4.2.2-foss-2023a
upload_artifact: true
- version: "5.0-dev"
eessi: ESPResSo/8aa60cecd56cdd10ab62042c567552f347374f36-foss-2023b
eessi: ESPResSo/dc87ede3f6c218bb71624460752bc8c26a271c33-foss-2023b
upload_artifact: false
name: ubuntu - ESPResSo ${{ matrix.espresso.version }}
steps:
Expand All @@ -46,10 +46,12 @@ jobs:
coverage==7.4.4
- name: Run testsuite
run: |
export NUM_PROC=$(nproc)
export OMP_PROC_BIND=false OMP_NUM_THREADS=1
module restore pymbe
source venv/bin/activate
make pylint
make unit_tests -j4 COVERAGE=1
make unit_tests -j${NUM_PROC} COVERAGE=1
make docs
make coverage_xml
shell: bash
Expand Down
65 changes: 0 additions & 65 deletions maintainer/configure_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import os
import sys
import stat
import enum
import argparse
import sysconfig
Expand Down Expand Up @@ -84,67 +83,3 @@ def detect_py_virtual_environment():
if not espressomd_found:
make_pth("espresso", os.path.join(args.espresso_path, "src", "python"))
make_pth("pymbe", os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


def make_venv_set_omp(name, value):
return f"""
_OLD_VIRTUAL_{name}="${name}"
if test -z "${name}"; then
export {name}={value}
fi"""


def make_venv_unset_env(name):
return f""" if [ -n "${{_OLD_VIRTUAL_{name}:-}}" ] ; then
{name}="${{_OLD_VIRTUAL_{name}:-}}"
export {name}
unset _OLD_VIRTUAL_{name}
fi"""


if virtual_env_family == PyVirtualEnv.venv:
venv_activate = os.path.join(os.environ.get("VIRTUAL_ENV"), "bin", "activate")
if os.path.isfile(venv_activate):
original_access_mode = os.stat(venv_activate).st_mode
os.chmod(venv_activate, original_access_mode | stat.S_IWUSR)
try:
with open(venv_activate, "r+") as f:
content = f.read()
token = "\nexport PATH"
assert token in content
content = content.replace(token, f"{token}\n{make_venv_set_omp('OMP_PROC_BIND', 'false')}\n{make_venv_set_omp('OMP_NUM_THREADS', '1')}")
token = "unset _OLD_VIRTUAL_PATH\n fi"
assert token in content
content = content.replace(token, f"{token}\n{make_venv_unset_env('OMP_PROC_BIND')}\n{make_venv_unset_env('OMP_NUM_THREADS')}""")
f.seek(0)
f.truncate()
f.write(content)
except:
raise
finally:
os.chmod(venv_activate, original_access_mode)

elif virtual_env_family == PyVirtualEnv.conda:
try:
import conda.cli.main_env_vars
except ImportError as err:
raise RuntimeError('Cannot set up environment variables in this conda environment; consider executing `conda install conda`') from err
import contextlib
import argparse
import io
parser = argparse.ArgumentParser()
args = argparse.Namespace(json=False)
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
conda.cli.main_env_vars.execute_list(args, parser)
env = {}
for line in buf.getvalue().split("\n"):
if line.strip() not in ["0", ""]:
key, value = line.split("=", 1)
env[key.strip()] = value.strip()
args.vars = []
if "OMP_PROC_BIND" not in env:
args.vars.append("OMP_PROC_BIND = false")
if "OMP_NUM_THREADS" not in env:
args.vars.append("OMP_NUM_THREADS = 1")
conda.cli.main_env_vars.execute_set(args, parser)