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
65on :
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
3942jobs :
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
0 commit comments