Skip to content

Commit 907181d

Browse files
authored
Separate out CI testing workflows (#475)
* Separate out test suite workflows and use consistent naming * Add missing commit hashes for actions * Drop debug job; formatting * Bump version for setup-oneapi * Bump Intel compiler versions
1 parent b643c36 commit 907181d

6 files changed

Lines changed: 175 additions & 145 deletions

.github/workflows/JOSS_paper_pdf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
id-token: write # We trust the deploy action with write permissions
6565
steps:
6666
- name: Upload draft PDF
67-
uses: actions/upload-artifact@v4
67+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6
6868
with:
6969
name: paper
7070
path: paper/paper.pdf

.github/workflows/build_docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ jobs:
4747
sudo apt-get install -y graphviz
4848
4949
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
50-
- name: Checkout code
50+
- name: Checkout FTorch repository
5151
with:
52-
persist-credentials: false
53-
uses: actions/checkout@v4
52+
persist-credentials: true
53+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5454

5555
- name: Setup Python
5656
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6

.github/workflows/test_suite_ubuntu.yml renamed to .github/workflows/test_suite_ubuntu_cpu_gnu.yml

Lines changed: 19 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Workflow to run the FTorch test suite using jobs for Intel and GNU compilers
2-
# Any changes need to be reflected in both GNU and Intel jobs
3-
name: Test suite (Ubuntu CPU)
1+
# Workflow to run the FTorch test suite using jobs for GNU compiler
2+
name: Test suite (Ubuntu CPU GNU)
43

54
# Controls when the workflow will run
65
on:
@@ -11,17 +10,21 @@ on:
1110
# Triggers the workflow on pushes to open pull requests with code changes
1211
pull_request:
1312
paths:
14-
- '.github/workflows/test_suite_ubuntu.yml'
13+
# This workflow
14+
- '.github/workflows/test_suite_ubuntu_cpu_gnu.yml'
15+
# Source files
1516
- '**.c'
1617
- '**.cpp'
1718
- '**.fypp'
1819
- '**.f90'
1920
- '**.F90'
20-
- '**.pf'
2121
- '**.py'
22-
- '**.sh'
22+
# Unit tests
23+
- '**.pf'
24+
# Build system
2325
- '**CMakeLists.txt'
2426
- '**requirements.txt'
27+
# Data
2528
- '**data/*'
2629

2730
# Allows you to run this workflow manually from the Actions tab
@@ -37,9 +40,9 @@ permissions: {}
3740

3841
# Workflow run - one or more jobs that can run sequentially or in parallel
3942
jobs:
40-
# Dynamically build matrix for GNU job
41-
setup-gnu-matrix:
42-
name: setup GNU matrix
43+
# Dynamically build matrix for GNU job
44+
setup-matrix:
45+
name: setup matrix
4346
runs-on: ubuntu-latest
4447

4548
# Terminate the job if it runs for more than 5 minutes
@@ -83,14 +86,14 @@ jobs:
8386
MATRIX_JSON=$(echo "$MATRIX_JSON" | jq -c .)
8487
echo "matrix=${MATRIX_JSON}" >> $GITHUB_OUTPUT
8588
86-
GNU:
87-
name: GNU test suite
88-
needs: setup-gnu-matrix
89+
test-suite:
90+
name: test suite
91+
needs: setup-matrix
8992
# The type of runner that the job will run on
9093
runs-on: ubuntu-latest
9194
strategy:
9295
fail-fast: false
93-
matrix: ${{ fromJSON(needs.setup-gnu-matrix.outputs.matrix) }}
96+
matrix: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }}
9497

9598
# Terminate the job if it runs for more than 15 minutes
9699
timeout-minutes: 15
@@ -103,17 +106,12 @@ jobs:
103106
persist-credentials: true
104107
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
105108

106-
- name: setup-fortran
109+
- name: Setup Fortran
107110
uses: fortran-lang/setup-fortran@d2ba6ea44297a24407def2f6e117954d844a5368 # v1
108111
with:
109112
compiler: ${{ matrix.toolchain.compiler }}
110113
version: ${{ matrix.toolchain.version }}
111114

112-
- name: check-compilers-env
113-
run: ${FC}
114-
env:
115-
FC: ${{ steps.setup-fortran.outputs.fc }}
116-
117115
- name: Setup Python
118116
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
119117
with:
@@ -161,10 +159,10 @@ jobs:
161159
-DCMAKE_Fortran_COMPILER=gfortran \
162160
-DCMAKE_C_COMPILER=gcc \
163161
-DCMAKE_CXX_COMPILER=g++ \
164-
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
162+
-DCMAKE_INSTALL_PREFIX="${BUILD_DIR}" \
165163
-DCMAKE_BUILD_TESTS=TRUE \
166164
-DCMAKE_PREFIX_PATH="${PFUNIT_DIR};${Torch_DIR}" \
167-
-DCMAKE_Fortran_FLAGS="-std=$FORTRAN_STANDARD"
165+
-DCMAKE_Fortran_FLAGS="-std=${FORTRAN_STANDARD}"
168166
cmake --build .
169167
cmake --install .
170168
@@ -219,111 +217,3 @@ jobs:
219217
. ftorch/bin/activate
220218
cd build
221219
ctest --verbose --tests-regex example
222-
223-
Intel:
224-
name: Intel test suite
225-
# Trigger intel build only if push to main, or called manually via dispatch.
226-
if: |
227-
(github.ref == 'refs/heads/main' && github.event_name == 'push')
228-
|| github.event_name == 'workflow_dispatch'
229-
|| (github.event_name == 'pull_request' && contains(github.event.pull_request.changed_files, '.github/workflows/test_suite_ubuntu.yml'))
230-
# The type of runner that the job will run on
231-
runs-on: ubuntu-latest
232-
233-
# Terminate the job if it runs for more than 15 minutes
234-
timeout-minutes: 15
235-
236-
strategy:
237-
fail-fast: false
238-
matrix:
239-
toolchain: [intel-ifx, intel-ifort]
240-
include:
241-
- toolchain: intel-ifx
242-
FC: ifx
243-
MPIFC: mpiifx
244-
- toolchain: intel-ifort
245-
FC: ifort
246-
MPIFC: mpiifort
247-
248-
# Steps represent a sequence of tasks that will be executed as part of the job
249-
steps:
250-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
251-
- name: Checkout code
252-
with:
253-
persist-credentials: false
254-
uses: actions/checkout@v4
255-
256-
- name: Setup Python
257-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
258-
with:
259-
python-version: '3.13' # Use 3.13 as no PyTorch wheels for 3.14 yet.
260-
261-
- name: Install PyTorch
262-
run: |
263-
python -m pip install --upgrade pip
264-
python -m venv ftorch
265-
. ftorch/bin/activate
266-
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
267-
268-
- name: Install Intel tools
269-
uses: rscohn2/setup-oneapi@8affb2b9c36a17ffc190a96fd27ba5ad9b4b5447 # v0
270-
with:
271-
components: |
272-
icx@2023.2.1
273-
ifx@2023.2.1
274-
impi@2021.14.0
275-
276-
- name: Setup Intel oneAPI environment
277-
run: |
278-
source /opt/intel/oneapi/setvars.sh
279-
printenv >> $GITHUB_ENV
280-
281-
- name: Install pFUnit
282-
run: |
283-
# TODO: Avoid version pinning (needed because version appears in install path)
284-
git clone -b v4.12.0 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
285-
mkdir pFUnit/build
286-
cd pFUnit/build
287-
cmake .. \
288-
-DCMAKE_C_COMPILER=icx \
289-
-DCMAKE_CXX_COMPILER=icpx \
290-
-DCMAKE_Fortran_COMPILER=${{ matrix.FC }} \
291-
-DMPI_Fortran_COMPILER=${{ matrix.MPIFC }}
292-
make -j 4 install
293-
294-
- name: Build and install FTorch
295-
run: |
296-
. ftorch/bin/activate
297-
VN=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))")
298-
export Torch_DIR=${VIRTUAL_ENV}/lib/python${VN}/site-packages
299-
export BUILD_DIR=$(pwd)/build
300-
# NOTE: The pFUnit version (pinned during installation above) is used in the install path.
301-
export PFUNIT_DIR=$(pwd)/pFUnit/build/installed/PFUNIT-4.12
302-
mkdir ${BUILD_DIR}
303-
cd ${BUILD_DIR}
304-
305-
cmake .. \
306-
-DPython_EXECUTABLE="$(which python)" \
307-
-DCMAKE_BUILD_TYPE=Release \
308-
-DCMAKE_C_COMPILER=icx \
309-
-DCMAKE_CXX_COMPILER=icpx \
310-
-DCMAKE_Fortran_COMPILER=${{ matrix.FC }} \
311-
-DMPI_Fortran_COMPILER=${{ matrix.MPIFC }} \
312-
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
313-
-DCMAKE_BUILD_TESTS=TRUE \
314-
-DCMAKE_PREFIX_PATH="${PFUNIT_DIR};${Torch_DIR}" \
315-
-DCMAKE_Fortran_FLAGS="-stand f08"
316-
cmake --build .
317-
cmake --install .
318-
319-
- name: Run unit tests
320-
run: |
321-
. ftorch/bin/activate
322-
cd build
323-
ctest --verbose --tests-regex unit
324-
325-
- name: Run integration tests
326-
run: |
327-
. ftorch/bin/activate
328-
cd build
329-
ctest --verbose --tests-regex example
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Workflow to run the FTorch test suite using jobs for Intel compiler
2+
name: Test suite (Ubuntu CPU Intel)
3+
4+
# Controls when the workflow will run
5+
on:
6+
# Triggers the workflow on pushes to the "main" branch, i.e., PR merges
7+
push:
8+
branches: [ "main" ]
9+
10+
# Triggers the workflow on pushes to open pull requests with changes to this workflow
11+
pull_request:
12+
paths:
13+
- '.github/workflows/test_suite_ubuntu_cpu_intel.yml'
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
# Cancel jobs running if new commits are pushed
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
21+
cancel-in-progress: true
22+
23+
# Write permissions are not required
24+
permissions: {}
25+
26+
# Workflow run - one or more jobs that can run sequentially or in parallel
27+
jobs:
28+
test-suite:
29+
name: test suite
30+
# The type of runner that the job will run on
31+
runs-on: ubuntu-latest
32+
33+
# Terminate the job if it runs for more than 15 minutes
34+
timeout-minutes: 15
35+
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
toolchain: [intel-ifx, intel-ifort]
40+
include:
41+
- toolchain: intel-ifx
42+
FC: ifx
43+
MPIFC: mpiifx
44+
- toolchain: intel-ifort
45+
FC: ifort
46+
MPIFC: mpiifort
47+
version: [2024.1.0]
48+
std: [f08]
49+
50+
# Steps represent a sequence of tasks that will be executed as part of the job
51+
steps:
52+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
53+
- name: Checkout FTorch repository
54+
with:
55+
persist-credentials: true
56+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
57+
58+
- name: Setup Python
59+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
60+
with:
61+
python-version: '3.13' # Use 3.13 as no PyTorch wheels for 3.14 yet.
62+
63+
- name: Install PyTorch
64+
run: |
65+
python -m pip install --upgrade pip
66+
python -m venv ftorch
67+
. ftorch/bin/activate
68+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
69+
70+
- name: Install Intel tools
71+
uses: rscohn2/setup-oneapi@2ad0cf6b74bc2426bdcee825cf88f9db719dd727 # v0.1.0
72+
with:
73+
components: |
74+
icx@${{ matrix.version }}
75+
ifx@${{ matrix.version }}
76+
impi@2021.12.0
77+
78+
- name: Setup Intel oneAPI environment
79+
run: |
80+
source /opt/intel/oneapi/setvars.sh
81+
printenv >> ${GITHUB_ENV}
82+
83+
- name: Install pFUnit
84+
run: |
85+
# TODO: Avoid version pinning (needed because version appears in install path)
86+
git clone -b v4.12.0 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
87+
mkdir pFUnit/build
88+
cd pFUnit/build
89+
cmake .. \
90+
-DCMAKE_C_COMPILER=icx \
91+
-DCMAKE_CXX_COMPILER=icpx \
92+
-DCMAKE_Fortran_COMPILER=${{ matrix.FC }} \
93+
-DMPI_Fortran_COMPILER=${{ matrix.MPIFC }}
94+
make -j 4 install
95+
96+
- name: Build and install FTorch
97+
env:
98+
FORTRAN_STANDARD: ${{ matrix.std }}
99+
run: |
100+
. ftorch/bin/activate
101+
VN=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))")
102+
export Torch_DIR=${VIRTUAL_ENV}/lib/python${VN}/site-packages
103+
export BUILD_DIR=$(pwd)/build
104+
# NOTE: The pFUnit version (pinned during installation above) is used in the install path.
105+
export PFUNIT_DIR=$(pwd)/pFUnit/build/installed/PFUNIT-4.12
106+
mkdir ${BUILD_DIR}
107+
cd ${BUILD_DIR}
108+
109+
cmake .. \
110+
-DPython_EXECUTABLE="$(which python)" \
111+
-DCMAKE_BUILD_TYPE=Release \
112+
-DCMAKE_C_COMPILER=icx \
113+
-DCMAKE_CXX_COMPILER=icpx \
114+
-DCMAKE_Fortran_COMPILER="${{ matrix.FC }}" \
115+
-DMPI_Fortran_COMPILER="${{ matrix.MPIFC }}" \
116+
-DCMAKE_INSTALL_PREFIX="${BUILD_DIR}" \
117+
-DCMAKE_BUILD_TESTS=TRUE \
118+
-DCMAKE_PREFIX_PATH="${PFUNIT_DIR};${Torch_DIR}" \
119+
-DCMAKE_Fortran_FLAGS="-std=${FORTRAN_STANDARD}"
120+
cmake --build .
121+
cmake --install .
122+
123+
- name: Run unit tests
124+
run: |
125+
. ftorch/bin/activate
126+
cd build
127+
ctest --verbose --tests-regex unit
128+
129+
- name: Run integration tests
130+
run: |
131+
. ftorch/bin/activate
132+
cd build
133+
ctest --verbose --tests-regex example

0 commit comments

Comments
 (0)