@@ -149,7 +149,7 @@ jobs:
149149 continue-on-error : true
150150
151151 github :
152- name : Github
152+ name : ${{ matrix.nvhpc && format('NVHPC {0} ({1})', matrix.nvhpc, matrix.target) || format(' Github ({0}, {1}, {2}, intel={3})', matrix.os, matrix.mpi, matrix.debug, matrix.intel) }}
153153 needs : [lint-gate, file-changes, rebuild-cache]
154154 if : >-
155155 !cancelled() &&
@@ -162,8 +162,10 @@ jobs:
162162 os : ['ubuntu', 'macos']
163163 mpi : ['mpi']
164164 precision : ['']
165- debug : ['debug ', 'no-debug']
165+ debug : ['reldebug ', 'no-debug']
166166 intel : [true, false]
167+ nvhpc : ['']
168+ target : ['']
167169 exclude :
168170 - os : macos
169171 intel : true
@@ -175,11 +177,62 @@ jobs:
175177 debug : no-debug
176178 intel : false
177179
180+ # NVHPC compiler matrix: cpu (build+test), gpu (build-only, acc then omp)
181+ # Every release from 23.11 through 26.3 (current)
182+ - { nvhpc: '23.11', target: cpu }
183+ - { nvhpc: '23.11', target: gpu }
184+ - { nvhpc: '24.1', target: cpu }
185+ - { nvhpc: '24.1', target: gpu }
186+ - { nvhpc: '24.3', target: cpu }
187+ - { nvhpc: '24.3', target: gpu }
188+ - { nvhpc: '24.5', target: cpu }
189+ - { nvhpc: '24.5', target: gpu }
190+ - { nvhpc: '24.7', target: cpu }
191+ - { nvhpc: '24.7', target: gpu }
192+ - { nvhpc: '24.9', target: cpu }
193+ - { nvhpc: '24.9', target: gpu }
194+ - { nvhpc: '24.11', target: cpu }
195+ - { nvhpc: '24.11', target: gpu }
196+ - { nvhpc: '25.1', target: cpu }
197+ - { nvhpc: '25.1', target: gpu }
198+ - { nvhpc: '25.3', target: cpu }
199+ - { nvhpc: '25.3', target: gpu }
200+ - { nvhpc: '25.5', target: cpu }
201+ - { nvhpc: '25.5', target: gpu }
202+ - { nvhpc: '25.7', target: cpu }
203+ - { nvhpc: '25.7', target: gpu }
204+ - { nvhpc: '25.9', target: cpu }
205+ - { nvhpc: '25.9', target: gpu }
206+ - { nvhpc: '25.11', target: cpu }
207+ - { nvhpc: '25.11', target: gpu }
208+ - { nvhpc: '26.1', target: cpu }
209+ - { nvhpc: '26.1', target: gpu }
210+ - { nvhpc: '26.3', target: cpu }
211+ - { nvhpc: '26.3', target: gpu }
212+
178213 fail-fast : false
179214 continue-on-error : true
180- runs-on : ${{ matrix.os }}-latest
215+ runs-on : ${{ matrix.nvhpc && 'ubuntu-22.04' || format('{0}-latest', matrix.os) }}
216+ container :
217+ image : ${{ matrix.nvhpc && format('nvcr.io/nvidia/nvhpc:{0}-devel-cuda_multi-ubuntu22.04', matrix.nvhpc) || '' }}
218+ options : ${{ matrix.nvhpc && '--security-opt seccomp=unconfined' || '' }}
219+ env :
220+ CC : ${{ matrix.nvhpc && 'nvc' || '' }}
221+ CXX : ${{ matrix.nvhpc && 'nvc++' || '' }}
222+ FC : ${{ matrix.nvhpc && 'nvfortran' || '' }}
223+ OMPI_ALLOW_RUN_AS_ROOT : ${{ matrix.nvhpc && '1' || '' }}
224+ OMPI_ALLOW_RUN_AS_ROOT_CONFIRM : ${{ matrix.nvhpc && '1' || '' }}
225+ PMIX_MCA_gds : ${{ matrix.nvhpc && 'hash' || '' }}
226+ OMPI_MCA_hwloc_base_binding_policy : ${{ matrix.nvhpc && 'none' || '' }}
227+ FFLAGS : ${{ matrix.nvhpc && '-tp=px -Kieee -noswitcherror' || '' }}
228+ CFLAGS : ${{ matrix.nvhpc && '-tp=px' || '' }}
229+ CXXFLAGS : ${{ matrix.nvhpc && '-tp=px' || '' }}
181230
182231 steps :
232+ - name : Git safe directory
233+ if : matrix.nvhpc
234+ run : git config --global --add safe.directory /__w/MFC/MFC
235+
183236 - name : Clone
184237 uses : actions/checkout@v4
185238
@@ -222,7 +275,7 @@ jobs:
222275 fi
223276
224277 - name : Setup MacOS
225- if : matrix.os == 'macos'
278+ if : matrix.os == 'macos' && !matrix.nvhpc
226279 run : |
227280 brew update
228281 brew upgrade || true
@@ -231,7 +284,7 @@ jobs:
231284 echo "BOOST_INCLUDE=/opt/homebrew/include/" >> $GITHUB_ENV
232285
233286 - name : Setup Ubuntu
234- if : matrix.os == 'ubuntu' && matrix.intel == false
287+ if : matrix.os == 'ubuntu' && matrix.intel == false && !matrix.nvhpc
235288 run : |
236289 sudo apt update -y
237290 sudo apt install -y cmake gcc g++ python3 python3-dev hdf5-tools \
@@ -245,30 +298,79 @@ jobs:
245298 sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
246299 sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
247300 sudo apt-get update
248- sudo apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-mpi intel-oneapi-mpi-devel
301+ sudo apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp intel-oneapi- mpi intel-oneapi-mpi-devel
249302 # Export only new/changed env vars from setvars.sh.
250303 # `printenv >> $GITHUB_ENV` dumps all vars including shell internals
251304 # with special characters that corrupt GITHUB_ENV parsing.
252305 printenv | sort > /tmp/env_before
253306 source /opt/intel/oneapi/setvars.sh
254307 printenv | sort > /tmp/env_after
255308 diff /tmp/env_before /tmp/env_after | grep '^>' | sed 's/^> //' >> $GITHUB_ENV
256-
309+ echo "FC=ifx" >> $GITHUB_ENV
310+ echo "CC=icx" >> $GITHUB_ENV
311+ echo "CXX=icpx" >> $GITHUB_ENV
312+ echo "MPIFC=mpiifx" >> $GITHUB_ENV
313+ echo "MPICC=mpiicx" >> $GITHUB_ENV
314+ echo "MPICXX=mpiicpx" >> $GITHUB_ENV
315+
316+ # --- NVHPC container setup ---
317+ - name : Setup NVHPC
318+ if : matrix.nvhpc
319+ run : |
320+ apt-get update -y
321+ apt-get install -y cmake python3 python3-venv python3-pip \
322+ libfftw3-dev libhdf5-dev hdf5-tools git
323+ # Set up NVHPC HPC-X MPI runtime paths
324+ HPCX_DIR=$(dirname "$(find /opt/nvidia/hpc_sdk -path "*/hpcx/hpcx-*/ompi/bin/mpirun" | head -1)")/../..
325+ MPI_LIB=$(mpifort --showme:link | grep -oP '(?<=-L)\S+' | head -1)
326+ echo "LD_LIBRARY_PATH=${MPI_LIB}:${HPCX_DIR}/ucx/lib:${HPCX_DIR}/ucc/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
327+ # Container MPI fixes: PMIx shared-memory, hwloc binding
328+ echo "PMIX_MCA_gds=hash" >> $GITHUB_ENV
329+ echo "OMPI_MCA_hwloc_base_binding_policy=none" >> $GITHUB_ENV
330+ echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV
331+ # Debug: confirm compiler flags are set
332+ echo "=== NVHPC Environment ==="
333+ echo "FFLAGS=$FFLAGS"
334+ echo "CFLAGS=$CFLAGS"
335+ echo "CXXFLAGS=$CXXFLAGS"
336+ nvfortran --version
337+ cat /proc/cpuinfo | grep "model name" | head -1
338+
339+ # --- Standard build + test ---
257340 - name : Build
341+ if : ' !matrix.nvhpc'
258342 run : |
259343 /bin/bash mfc.sh test -v --dry-run -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} $PRECISION $TEST_ALL
260344 env :
261345 TEST_ALL : ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
262346 PRECISION : ${{ matrix.precision != '' && format('--{0}', matrix.precision) || '' }}
263347
264348 - name : Test
349+ if : ' !matrix.nvhpc'
265350 run : |
266351 /bin/bash mfc.sh test -v --max-attempts 3 -j $(nproc) $ONLY_CHANGES $TEST_ALL $TEST_PCT
267352 env :
268353 TEST_ALL : ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
269- TEST_PCT : ${{ matrix.debug == 'debug ' && '-% 20' || '' }}
354+ TEST_PCT : ${{ matrix.debug == 'reldebug ' && '-% 20' || '' }}
270355 ONLY_CHANGES : ${{ github.event_name == 'pull_request' && '--only-changes' || '' }}
271356
357+ # --- NVHPC build + test ---
358+ - name : Build (NVHPC)
359+ if : matrix.nvhpc && matrix.target == 'cpu'
360+ run : /bin/bash mfc.sh test -v --dry-run -j $(nproc) --test-all
361+
362+ - name : Build (NVHPC GPU)
363+ if : matrix.nvhpc && matrix.target == 'gpu'
364+ run : |
365+ /bin/bash mfc.sh test -v --dry-run -j 2 --test-all --gpu acc
366+ /bin/bash mfc.sh test -v --dry-run -j 2 --test-all --gpu mp
367+
368+ - name : Test (NVHPC)
369+ if : matrix.nvhpc && matrix.target == 'cpu'
370+ run : |
371+ ulimit -s unlimited || ulimit -s 65536 || true
372+ /bin/bash mfc.sh test -v --max-attempts 3 -j $(nproc) --test-all
373+
272374 self :
273375 name : " ${{ matrix.cluster_name }} (${{ matrix.device }}${{ matrix.interface != 'none' && format('-{0}', matrix.interface) || '' }}${{ matrix.shard != '' && format(' [{0}]', matrix.shard) || '' }})"
274376 needs : [lint-gate, file-changes, rebuild-cache]
0 commit comments