Skip to content

Commit b126d65

Browse files
authored
Merge pull request #806 from RasmusOrsoe/torch_update
Installation update; expand torch and cuda versions
2 parents af13bfe + 4264301 commit b126d65

59 files changed

Lines changed: 535 additions & 272 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/install/action.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,61 @@ inputs:
1313
extras:
1414
description: "Extras flags for pip installation of graphnet"
1515
required: true
16-
default: "[develop,torch]"
16+
default: "develop"
17+
18+
torch_version:
19+
description: "Version of PyTorch"
20+
required: true
21+
default: "2.6.0"
22+
options: ["2.6.0", "2.5.0", "2.4.0"]
23+
1724
hardware:
1825
description: "The requirements file depends on the hardware, i.e., CPU, GPU, or macOS"
1926
required: true
2027
default: "cpu"
21-
options: ["cpu", "cu118", "cu121", "macos"]
28+
options: ["cpu", "cu118", "cu121", "cu124", "cu126", "macos"]
29+
30+
use_vm:
31+
description: "Should the installation happen in a virtual environment named venv?"
32+
required: true
33+
default: false
34+
options: [true, false]
2235

2336
runs:
2437
using: "composite"
2538
steps:
26-
- name: Infer installation flags
39+
- name: Prepare pip flags
40+
id: flags
41+
run: |
42+
[[ "${{ inputs.editable }}" == "true" ]] && echo "editable_flag=-e" >> $GITHUB_OUTPUT || echo "editable_flag=" >> $GITHUB_OUTPUT
43+
[[ "${{ inputs.user }}" == "true" ]] && echo "user_flag=--user" >> $GITHUB_OUTPUT || echo "user_flag=" >> $GITHUB_OUTPUT
44+
45+
version="${{ inputs.torch_version }}"
46+
IFS='.' read -r major minor _ <<< "$version"
47+
echo "torch_flag=${major}${minor}" >> $GITHUB_OUTPUT
48+
shell: bash
49+
50+
- name: Install dependencies (pip & setuptools)
51+
shell: bash
2752
run: |
28-
PIP_FLAG_EDITABLE=`[[ ${{ inputs.editable }} =~ (T|t)rue ]] && printf "%s\n" "-e " || echo " "`
29-
PIP_FLAG_USER=`[[ ${{ inputs.user }} =~ (T|t)rue ]] && printf "%s\n" "--user " || echo " "`
30-
echo "PIP_FLAGS=${PIP_FLAG_USER}${PIP_FLAG_EDITABLE}" >> $GITHUB_ENV
53+
if [[ "${{ inputs.use_vm }}" == "true" ]]; then source ~/venv/bin/activate; fi
54+
pip install --upgrade 'pip>=20'
55+
pip install --upgrade 'setuptools>=68.2.2'
56+
57+
- name: Print pip and setuptools versions
3158
shell: bash
32-
- name: Install dependencies
3359
run: |
34-
pip install --upgrade pip>=20
35-
pip install wheel setuptools==59.5.0
60+
if [[ "${{ inputs.use_vm }}" == "true" ]]; then source ~/venv/bin/activate; fi
61+
pip --version
62+
pip show setuptools
63+
64+
- name: Install GraphNeT
3665
shell: bash
37-
- name: Install package
3866
run: |
39-
echo requirements/torch_${{ inputs.hardware }}.txt ${{ env.PIP_FLAGS }} .${{ inputs.extras }}
40-
pip install -r requirements/torch_${{ inputs.hardware }}.txt ${{ env.PIP_FLAGS }} .${{ inputs.extras }}
67+
if [[ "${{ inputs.use_vm }}" == "true" ]]; then source ~/venv/bin/activate; fi
68+
69+
echo "Installing graphnet with flags: ${{ steps.flags.outputs.user_flag }} ${{ steps.flags.outputs.editable_flag }}"
70+
pip install ${{ steps.flags.outputs.user_flag }} ${{ steps.flags.outputs.editable_flag }} .[torch-${{ steps.flags.outputs.torch_flag }}-${{ inputs.hardware }},${{ inputs.extras }}] \
71+
-f https://data.pyg.org/whl/torch-${{ inputs.torch_version }}+${{ inputs.hardware }}.html
72+
4173
pip install git+https://github.com/thoglu/jammy_flows.git
42-
shell: bash

.github/workflows/build.yml

Lines changed: 114 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,51 +33,101 @@ jobs:
3333
fi
3434
3535
build-icetray:
36-
name: Unit tests - IceTray
36+
name: Unit tests - IceTray (v1.13.0 - 3.10)
3737
needs: [ check-codeclimate-credentials ]
3838
runs-on: ubuntu-22.04
39+
strategy:
40+
matrix:
41+
torch_version: ['2.7.0']
42+
hardware: ["cpu"]
3943
container:
40-
image: icecube/icetray:icetray-prod-v1.8.1-ubuntu20.04-X64
41-
options: --user root
44+
# GitHub Actions overwrite the docker container entrypoint
45+
# inspect <image> --format '{{.Config.Entrypoint}}'
46+
image: icecube/icetray:icetray-devel-v1.13.0-ubuntu22.04-2025-02-12
47+
4248
steps:
43-
- name: install git
49+
- name: Mimmick Docker Entrypoint
50+
# The entrypoint of the container sets python paths
51+
# Because the entrypoint is skipped by GitHub, we set it here
52+
run: |
53+
echo "I3_SRC=/opt/icetray/share/icetray" >> $GITHUB_ENV
54+
echo "I3_BUILD=/opt/icetray/share/icetray" >> $GITHUB_ENV
55+
echo "I3_TESTDATA=/root/icetray/build/test-data" >> $GITHUB_ENV
56+
echo "I3_PRODDATA=/root/icetray/build/prod-data" >> $GITHUB_ENV
57+
echo "ROOTSYS=/opt/icetray/cernroot" >> $GITHUB_ENV
58+
echo "LD_LIBRARY_PATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:/opt/icetray/lib/tools:$LD_LIBRARY_PATH" >> $GITHUB_ENV
59+
echo "DYLD_LIBRARY_PATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:/opt/icetray/lib/tools:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
60+
echo "PYTHONPATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:$PYTHONPATH" >> $GITHUB_ENV
61+
echo "PATH=/opt/icetray/bin:$PATH" >> $GITHUB_ENV
62+
echo "HDF5_USE_FILE_LOCKING=FALSE" >> $GITHUB_ENV
63+
- name: Verify IceCube is importable
64+
run: python3 -c "import icecube; print('Import Successful')"
65+
- name: Show python version
66+
run: |
67+
python3 --version
68+
pip --version
69+
pip3 list
70+
python3 -c "import icecube; print(icecube.__path__)"
71+
pip show setuptools
72+
73+
- name: Install git
4474
run: |
4575
apt-get --yes install sudo
4676
sudo apt update --fix-missing --yes
4777
sudo apt upgrade --yes
48-
sudo apt-get install --yes git-all
49-
- name: Set environment variables
78+
sudo apt-get install --yes git
79+
80+
- uses: actions/checkout@v4
81+
82+
- name: Create virtual environment
83+
shell: bash
5084
run: |
51-
echo "PATH=/usr/local/icetray/bin:$PATH" >> $GITHUB_ENV
52-
echo "PYTHONPATH=/usr/local/icetray/lib:$PYTHONPATH" >> $GITHUB_ENV
53-
echo "LD_LIBRARY_PATH=/usr/local/icetray/lib:/usr/local/icetray/cernroot/lib:/usr/local/icetray/lib/tools:$LD_LIBRARY_PATH" >> $GITHUB_ENV
54-
- uses: actions/checkout@v3
85+
python3 -m venv ~/venv --upgrade-deps
86+
source ~/venv/bin/activate
87+
pip --version
88+
python --version
89+
pip show setuptools
90+
5591
- name: Print available disk space before graphnet install
5692
run: df -h
57-
- name: Upgrade packages already installed on icecube/icetray
93+
94+
- name: Upgrade packages in virtual environment
95+
shell: bash
5896
run: |
59-
pip install --upgrade astropy # Installed version incompatible with numpy 1.23.0 [https://github.com/astropy/astropy/issues/12534]
60-
pip install --ignore-installed PyYAML # Distutils installed [https://github.com/pypa/pip/issues/5247]
61-
pip install --upgrade psutil # Original version from IceTray Environment incompatible
97+
source ~/venv/bin/activate
98+
pip install --upgrade astropy
99+
pip install --upgrade PyYAML
100+
pip install --upgrade psutil
101+
pip install --upgrade setuptools
102+
pip install --upgrade versioneer
103+
pip show setuptools
104+
pip show versioneer
62105
- name: Install package
63106
uses: ./.github/actions/install
64107
with:
65108
editable: true
109+
use_vm: true
110+
torch_version: ${{ matrix.torch_version }}
111+
hardware: ${{ matrix.hardware }}
66112
- name: Print packages in pip
113+
shell: bash
67114
run: |
115+
source ~/venv/bin/activate
68116
pip show torch
69117
pip show torch-geometric
70118
pip show torch-cluster
71119
pip show torch-sparse
72120
pip show torch-scatter
73121
pip show jammy_flows
74122
- name: Run unit tests and generate coverage report
123+
shell: bash
75124
run: |
125+
source ~/venv/bin/activate
76126
coverage run --source=graphnet -m pytest tests/ --ignore=tests/examples/04_training --ignore=tests/utilities
77127
coverage run -a --source=graphnet -m pytest tests/examples/04_training
78128
coverage run -a --source=graphnet -m pytest tests/utilities
79129
coverage xml -o coverage.xml
80-
130+
coverage report -m
81131
- name: Work around permission issue
82132
run: |
83133
git config --global --add safe.directory /__w/graphnet/graphnet
@@ -89,25 +139,36 @@ jobs:
89139
with:
90140
coverageCommand: coverage report
91141
coverageLocations: coverage.xml:coverage.py
142+
92143

93-
build-matrix:
94-
name: Unit tests - Python versions
144+
build-matrix-examples:
145+
name: Examples - Ubuntu 22.04
95146
runs-on: ubuntu-22.04
96147
strategy:
97148
matrix:
98-
python-version: [3.8, 3.9, '3.10', '3.11']
149+
python-version: ['3.11']
150+
torch_version: ['2.7.0', '2.6.0', '2.5.0']
151+
hardware: ["cpu"]
99152
steps:
100-
- uses: actions/checkout@v3
153+
- uses: actions/checkout@v4
101154
- name: Set up Python ${{ matrix.python-version }}
102155
uses: actions/setup-python@v4
103156
with:
104157
python-version: ${{ matrix.python-version }}
105158
- name: Print available disk space before graphnet install
106159
run: df -h
160+
- name: Show existing environment
161+
run: |
162+
echo "PIP_FLAGS=${PIP_FLAGS}"
163+
python --version
164+
pip --version
165+
pip debug --verbose
107166
- name: Install package
108167
uses: ./.github/actions/install
109168
with:
110169
editable: true
170+
torch_version: ${{ matrix.torch_version }}
171+
hardware: ${{ matrix.hardware }}
111172
- name: Print available disk space after graphnet install
112173
run: df -h
113174
- name: Print packages in pip
@@ -117,32 +178,45 @@ jobs:
117178
pip show torch-cluster
118179
pip show torch-sparse
119180
pip show torch-scatter
181+
pip show dill
120182
pip show numpy
121-
122-
123183
- name: Run unit tests and generate coverage report
124184
run: |
125185
set -o pipefail # To propagate exit code from pytest
126-
coverage run --source=graphnet -m pytest tests/ --ignore=tests/utilities --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/01_icetray/
127-
coverage run -a --source=graphnet -m pytest tests/utilities
128-
coverage report -m
186+
pytest tests/examples --ignore=tests/examples/01_icetray/
129187
- name: Print available disk space after unit tests
130188
run: df -h
131189

132-
build-macos:
133-
name: Unit tests - macOS
134-
runs-on: macos-13
190+
build-macos-examples:
191+
# Runtime on macOS is multiplied with a factor 10 by github. Minimize!
192+
name: Examples - macOS 15
193+
runs-on: macos-15
194+
strategy:
195+
fail-fast: false
196+
matrix:
197+
python-version: ['3.11']
198+
torch_version: ['2.7.0']
199+
hardware: ["cpu"]
200+
135201
steps:
136-
- uses: actions/checkout@v3
137-
- name: Set up Python 3.8
138-
uses: actions/setup-python@v4
202+
- uses: actions/checkout@v4
203+
204+
- name: Set up Python ${{ matrix.python-version }}
205+
uses: actions/setup-python@v5
139206
with:
140-
python-version: 3.8
141-
- name: Install package
207+
python-version: ${{ matrix.python-version }}
208+
209+
- name: Show Python version
210+
run: |
211+
python --version
212+
which python
213+
pip --version
214+
215+
- name: Install dependencies
142216
uses: ./.github/actions/install
143217
with:
144-
editable: true
145-
hardware: "cpu"
218+
torch_version: ${{ matrix.torch_version }}
219+
hardware: ${{ matrix.hardware }}
146220
- name: Print packages in pip
147221
run: |
148222
pip show torch
@@ -153,15 +227,17 @@ jobs:
153227
- name: Run unit tests and generate coverage report
154228
run: |
155229
set -o pipefail # To propagate exit code from pytest
156-
coverage run --source=graphnet -m pytest tests/ --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/ --ignore=tests/utilities
157-
coverage run -a --source=graphnet -m pytest tests/utilities
158-
coverage report -m
230+
pytest tests/examples --ignore=tests/examples/01_icetray/
159231
160232
docs:
161233
name: Documentation Compilation
162234
runs-on: ubuntu-22.04
163235
steps:
164-
- uses: actions/checkout@v3
236+
- uses: actions/checkout@v4
237+
- name: Set up Python 3.10
238+
uses: actions/setup-python@v3
239+
with:
240+
python-version: "3.10"
165241
- name: Install package
166242
uses: ./.github/actions/install
167243
- name: Build documentation

.github/workflows/code-quality.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ jobs:
2222
matrix:
2323
hook: ["black", "flake8", "docformatter", "pydocstyle", "mypy"]
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
26+
- name: Set up Python 3.10
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: "3.10"
2630
- name: Install package
2731
uses: ./.github/actions/install
32+
with:
33+
2834
- name: Run ${{ matrix.hook }}
2935
run: |
36+
pip show ${{ matrix.hook }}
3037
pre-commit run ${{ matrix.hook }} --all-files

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: flake8
1313
language_version: python3
1414
- repo: https://github.com/pycqa/docformatter
15-
rev: v1.7.5
15+
rev: v1.7.7
1616
hooks:
1717
- id: docformatter
1818
language_version: python3

docs/source/installation/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Installation
44
============
55

6-
|graphnet|\ GraphNeT is available for Python 3.8 to Python 3.11.
6+
|graphnet|\ GraphNeT is available for Python 3.9 to Python 3.11.
77

88
.. note::
99
We recommend installing |graphnet|\ GraphNeT in a separate environment, e.g. using a Python virtual environment or Anaconda (see details on installation `here <https://www.anaconda.com/products/individual>`_).

0 commit comments

Comments
 (0)