Skip to content

Commit

Permalink
fix: Remove MG5_aMC directory from PYTHONPATH (#72)
Browse files Browse the repository at this point in the history
* This is apparently needed to avoid conflicts with how MadGraph determines the root_path.
   - c.f. https://bugs.launchpad.net/mg5amcnlo/+bug/2025061
* Add tests/test_root_path.sh to ensure that the root_path is valid.
  • Loading branch information
matthewfeickert authored Jun 28, 2023
1 parent 9a81991 commit 73c8357
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/docker-centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ jobs:
scailfin/madgraph5-amc-nlo-centos:sha-${GITHUB_SHA::8}
"cp -r ${PWD}/tests .; cd tests; bash tests.sh"
- name: Test madevent has valid root_path
run: >-
docker run --rm
-v $PWD:$PWD
scailfin/madgraph5-amc-nlo-centos:sha-${GITHUB_SHA::8}
"cp -r ${PWD}/tests .; cd tests; bash test_root_path.sh"
- name: Check NLO process has dependencies
run: >-
docker run --rm
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/docker-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ jobs:
scailfin/madgraph5-amc-nlo:sha-${GITHUB_SHA::8}
"cp -r ${PWD}/tests .; cd tests; bash tests.sh"
- name: Test madevent has valid root_path
run: >-
docker run --rm
-v $PWD:$PWD
scailfin/madgraph5-amc-nlo:sha-${GITHUB_SHA::8}
"cp -r ${PWD}/tests .; cd tests; bash test_root_path.sh"
- name: Check NLO process has dependencies
run: >-
docker run --rm
Expand Down
2 changes: 1 addition & 1 deletion docker/centos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ COPY --from=builder --chown=moby /usr/local/venv /usr/local/venv/
ENV LC_ALL=en_US.utf8
ENV LANG=en_US.utf8

ENV PYTHONPATH=/usr/local/venv/MG5_aMC:/usr/local/venv/lib:${PYTHONPATH}
ENV PYTHONPATH=/usr/local/venv/lib:${PYTHONPATH}
ENV LD_LIBRARY_PATH=/usr/local/venv/lib:$LD_LIBRARY_PATH
ENV PATH=${HOME}/.local/bin:$PATH
ENV PATH=/usr/local/venv/MG5_aMC/bin:$PATH
Expand Down
4 changes: 2 additions & 2 deletions docker/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN apt-get -qq -y update && \
python -m pip list && \
printf '\nexport PATH=/usr/local/venv/bin:"${PATH}"\n' >> /root/.bashrc

ENV PYTHONPATH=/usr/local/venv/lib:/usr/local/venv/MG5_aMC:$PYTHONPATH
ENV PYTHONPATH=/usr/local/venv/lib:$PYTHONPATH
ENV LD_LIBRARY_PATH=/usr/local/venv/lib:$LD_LIBRARY_PATH

# Install HepMC
Expand Down Expand Up @@ -226,7 +226,7 @@ ENV LANG=C.UTF-8

ENV PATH=${HOME}/.local/bin:/usr/local/venv/bin:"${PATH}"
ENV PATH=/usr/local/venv/MG5_aMC/bin:$PATH
ENV PYTHONPATH=/usr/local/venv/lib:/usr/local/venv/MG5_aMC:$PYTHONPATH
ENV PYTHONPATH=/usr/local/venv/lib:$PYTHONPATH
ENV LD_LIBRARY_PATH=/usr/local/venv/lib:$LD_LIBRARY_PATH

# TODO: Install NLO dependencies independently for greater control
Expand Down
2 changes: 2 additions & 0 deletions tests/bhabha_scattering.mg5
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
generate e+ e- > e+ e-
output bhabha
6 changes: 0 additions & 6 deletions tests/test_import.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
def test_import_madgraph():
import madgraph

assert madgraph


def test_import_lhapdf():
import lhapdf

Expand Down
17 changes: 17 additions & 0 deletions tests/test_root_path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# c.f. https://github.com/scailfin/MadGraph5_aMC-NLO/pull/72

set -e
set -u
set -o pipefail

if [ -d bhabha ]; then
rm -r bhabha
fi

if [ -f py.py ]; then
rm py.py
fi

mg5_aMC bhabha_scattering.mg5
./bhabha/bin/madevent launch -f

0 comments on commit 73c8357

Please sign in to comment.