Skip to content

Commit 99f40d3

Browse files
authored
Merge branch 'main' into compile_commands
2 parents de769ad + 880abe6 commit 99f40d3

Some content is hidden

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

42 files changed

+2751
-2117
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: 'Setup Intel oneAPI Environment'
2+
description: 'Sets up Intel oneAPI C++, Fortran compilers and MPI on Windows or Ubuntu runners.'
3+
4+
inputs:
5+
os:
6+
description: 'Operating system of the runner. Must contain "windows" or "ubuntu".'
7+
required: true
8+
type: string
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: (Windows) Setup VS Build environment
14+
if: contains(inputs.os, 'windows')
15+
uses: seanmiddleditch/gha-setup-vsdevenv@v4
16+
17+
- name: (Windows) Retrieve and Install Intel toolchain
18+
if: contains(inputs.os, 'windows')
19+
shell: pwsh
20+
run: |
21+
$tempDir = "C:\TEMP\intel_install"
22+
New-Item -ItemType Directory -Force -Path $tempDir
23+
cd $tempDir
24+
$installerName = "w_HPCKit_p_2023.0.0.25931_offline.exe" # Consider using inputs.intel_version_windows if added
25+
$installerUrl = "https://registrationcenter-download.intel.com/akdlm/irc_nas/19085/$installerName"
26+
Write-Host "Downloading Intel oneAPI installer..."
27+
curl.exe --output $installerName --url $installerUrl --retry 5 --retry-delay 5 -L # Added -L for potential redirects
28+
Write-Host "Extracting installer..."
29+
Start-Process -FilePath ".\$installerName" -ArgumentList "-s -x -f oneAPI --log extract.log" -Wait -NoNewWindow
30+
Remove-Item ".\$installerName" -Force
31+
Write-Host "Installing oneAPI components..."
32+
# Install C++, Fortran, and MPI development tools silently
33+
Start-Process -FilePath ".\oneAPI\bootstrapper.exe" -ArgumentList "-s --action install --eula=accept --components=""intel.oneapi.win.cpp-compiler:intel.oneapi.win.ifort-compiler:intel.oneapi.win.mpi.devel"" -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=." -Wait -NoNewWindow
34+
Write-Host "Cleaning up extracted files..."
35+
Remove-Item ".\oneAPI" -Force -Recurse
36+
cd ..
37+
Remove-Item $tempDir -Force -Recurse
38+
39+
- name: (Windows) Test that OneAPI is installed
40+
if: contains(inputs.os, 'windows')
41+
shell: pwsh
42+
run: |
43+
$setvarsPath = "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
44+
$compilerVarsPath = "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat"
45+
if (-not (Test-Path -Path $setvarsPath -PathType Leaf)) {
46+
Write-Error "Intel oneAPI setvars.bat not found at $setvarsPath"
47+
exit 1
48+
}
49+
if (-not (Test-Path -Path $compilerVarsPath -PathType Leaf)) {
50+
Write-Warning "Intel oneAPI compiler vars.bat not found at $compilerVarsPath. MPI might still work."
51+
# Depending on requirements, you might want to 'exit 1' here too
52+
}
53+
Write-Host "Intel oneAPI installation paths verified."
54+
55+
- name: (Windows) Load OneAPI environment variables
56+
if: contains(inputs.os, 'windows')
57+
shell: cmd
58+
run: |
59+
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" > NUL
60+
echo "Setting Intel environment variables..."
61+
echo "PATH=%PATH%" >> %GITHUB_ENV%
62+
echo "INCLUDE=%INCLUDE%" >> %GITHUB_ENV%
63+
echo "LIB=%LIB%" >> %GITHUB_ENV%
64+
REM Add any other specific vars if needed, e.g., for MPI
65+
echo "I_MPI_ROOT=%I_MPI_ROOT%" >> %GITHUB_ENV%
66+
echo "FI_PROVIDER_PATH=%FI_PROVIDER_PATH%" >> %GITHUB_ENV%
67+
echo "MPI_BIN=%MPI_BIN%" >> %GITHUB_ENV%
68+
69+
# --- Ubuntu Intel Setup ---
70+
- name: (Ubuntu) Install prerequisites and Intel GPG key
71+
if: contains(inputs.os, 'ubuntu')
72+
shell: bash
73+
run: |
74+
sudo apt-get update -y -qq
75+
sudo apt-get install -y -qq gpg wget ca-certificates curl gpg-agent software-properties-common
76+
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
77+
78+
- name: (Ubuntu) Add Intel oneAPI repository
79+
if: contains(inputs.os, 'ubuntu')
80+
shell: bash
81+
run: |
82+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
83+
sudo apt-get update -y -qq
84+
85+
- name: (Ubuntu) Install Intel oneAPI Compilers using fortran-lang action
86+
if: contains(inputs.os, 'ubuntu')
87+
uses: fortran-lang/setup-fortran@v1
88+
with:
89+
compiler: intel
90+
version: 2024.1.0 # Pinned until issue #1090 is resolved
91+
92+
- name: (Ubuntu) Install Intel oneAPI MPI and build dependencies
93+
if: contains(inputs.os, 'ubuntu')
94+
shell: bash
95+
run: |
96+
# Install MPI devel package and common build tools
97+
# The compilers (icc, ifort) should already be installed by setup-fortran action
98+
sudo apt-get install -y -q intel-oneapi-mpi-devel ninja-build cmake libcurl4-gnutls-dev
99+
100+
- name: (Ubuntu) Source oneAPI environment and add to GITHUB_ENV
101+
if: contains(inputs.os, 'ubuntu')
102+
shell: bash
103+
run: |
104+
# Source the main setvars script to set up the environment for this step
105+
# Use --force as we might be in a non-interactive shell
106+
source /opt/intel/oneapi/setvars.sh --force > /dev/null 2>&1
107+
echo "Sourced setvars.sh. Adding key variables to GITHUB_ENV..."
108+
# Explicitly add key variables to GITHUB_ENV for subsequent steps
109+
echo "PATH=$PATH" >> $GITHUB_ENV
110+
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
111+
echo "LIBRARY_PATH=$LIBRARY_PATH" >> $GITHUB_ENV
112+
echo "CPATH=$CPATH" >> $GITHUB_ENV
113+
echo "CMPLR_ROOT=$CMPLR_ROOT" >> $GITHUB_ENV # Example compiler root
114+
echo "MPI_ROOT=$MPI_ROOT" >> $GITHUB_ENV # MPI root (check actual variable name if needed, e.g., I_MPI_ROOT)
115+
echo "I_MPI_ROOT=$I_MPI_ROOT" >> $GITHUB_ENV # Common variable name for Intel MPI root
116+
echo "FI_PROVIDER_PATH=$FI_PROVIDER_PATH" >> $GITHUB_ENV # Often needed for MPI

.github/workflows/CI.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ jobs:
2828
- {compiler: gcc, version: 12}
2929
- {compiler: gcc, version: 13}
3030
- {compiler: gcc, version: 14}
31+
- {compiler: intel, version: 2025.1}
3132
exclude:
32-
# Not yet supported by setup-fortran
33-
- os: windows-latest
34-
toolchain: {compiler: gcc, version: 14}
33+
- os: macos-13 # No Intel on MacOS anymore since 2024
34+
toolchain: {compiler: intel, version: '2025.1'}
35+
- os: windows-latest # Doesn't pass build and tests yet
36+
toolchain: {compiler: intel, version: '2025.1'}
37+
- os: windows-latest # gcc 14 not available on Windows yet
38+
toolchain: {compiler: gcc, version: 14}
3539
include:
3640
- os: ubuntu-latest
3741
os-arch: linux-x86_64
@@ -49,7 +53,7 @@ jobs:
4953
uses: actions/checkout@v4
5054

5155
- name: Setup Fortran compiler
52-
uses: fortran-lang/[email protected].1
56+
uses: fortran-lang/[email protected].3
5357
id: setup-fortran
5458
with:
5559
compiler: ${{ matrix.toolchain.compiler }}
@@ -61,7 +65,7 @@ jobs:
6165
with:
6266
fpm-version: 'v0.8.0'
6367

64-
# Backport gfortran shared libraries to version 10 folder. This is necessary because the macOS release of fpm
68+
# Backport gfortran shared libraries to version 10 folder. This is necessary because the macOS release of fpm
6569
# 0.10.0 used for bootstrapping has these paths hardcoded in the executable.
6670
- name: MacOS patch libgfortran
6771
if: contains(matrix.os, 'macos') && !contains(matrix.toolchain.version, '10')
@@ -73,7 +77,7 @@ jobs:
7377
mkdir /usr/local/opt/gcc@10/lib/gcc
7478
mkdir /usr/local/opt/gcc@10/lib/gcc/10
7579
mkdir /usr/local/lib/gcc/10
76-
ln -fs /usr/local/opt/gcc@${{ matrix.toolchain.version }}/lib/gcc/${{ matrix.toolchain.version }}/libquadmath.0.dylib /usr/local/opt/gcc@10/lib/gcc/10/libquadmath.0.dylib
80+
ln -fs /usr/local/opt/gcc@${{ matrix.toolchain.version }}/lib/gcc/${{ matrix.toolchain.version }}/libquadmath.0.dylib /usr/local/opt/gcc@10/lib/gcc/10/libquadmath.0.dylib
7781
ln -fs /usr/local/opt/gcc@${{ matrix.toolchain.version }}/lib/gcc/${{ matrix.toolchain.version }}/libgfortran.5.dylib /usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib
7882
ln -fs /usr/local/lib/gcc/${{ matrix.toolchain.version }}/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgcc_s.1.dylib
7983
@@ -96,7 +100,7 @@ jobs:
96100
- name: Build Fortran fpm (bootstrap)
97101
shell: bash
98102
run: |
99-
${{ env.BOOTSTRAP }} build
103+
${{ env.BOOTSTRAP }} build
100104
101105
- name: Run Fortran fpm (bootstrap)
102106
shell: bash
@@ -193,7 +197,7 @@ jobs:
193197
fail-fast: false
194198
matrix:
195199
gcc_v: [11,12,13]
196-
200+
197201
steps:
198202
- uses: actions/checkout@v4
199203

.github/workflows/meta.yml

Lines changed: 68 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ on:
44
# On push, only run if any of the metapackage files has changed
55
push:
66
paths:
7-
- 'src/*meta*.f90'
7+
- 'src/*meta*.f90'
88
- 'src/fpm/*meta*.f90'
99
- 'src/fpm/manifest/*meta*.f90'
1010
- 'src/ci/meta_tests.sh'
1111
- 'src/.github/workflows/meta.yml'
12-
# Always run on PR or release
12+
# Always run on PR or release
1313
pull_request:
1414
release:
1515
types: [published]
1616
# Allow manual triggering
17-
workflow_dispatch:
17+
workflow_dispatch:
1818

1919
env:
2020
CI: "ON" # We can detect this in the build system and other vendors implement it
@@ -44,14 +44,13 @@ jobs:
4444
- os: macos-13
4545
mpi: mpich
4646

47-
4847
steps:
4948
- name: Checkout code
5049
uses: actions/checkout@v4
5150

5251
- name: (Ubuntu/macOS) setup gcc version
5352
if: contains(matrix.os,'ubuntu') || contains(matrix.os,'macos')
54-
run: |
53+
run: |
5554
echo "GCC_V=14" >> $GITHUB_ENV
5655
5756
- name: (Windows) Install MSYS2
@@ -67,24 +66,11 @@ jobs:
6766
unzip
6867
curl
6968
hdf5
70-
71-
- name: (Windows) Setup VS Build environment
72-
if: contains(matrix.os,'windows') && contains(matrix.mpi,'intel')
73-
uses: seanmiddleditch/gha-setup-vsdevenv@master
74-
75-
- name: (Windows) Retrieve Intel toolchain
76-
if: contains(matrix.os,'windows') && contains(matrix.mpi,'intel')
77-
shell: pwsh
78-
working-directory: C:\TEMP
79-
run: |
80-
curl.exe --output webimage.exe --url https://registrationcenter-download.intel.com/akdlm/irc_nas/19085/w_HPCKit_p_2023.0.0.25931_offline.exe --retry 5 --retry-delay 5
81-
Start-Process -FilePath "webimage.exe" -ArgumentList "-s -x -f oneAPI --log extract.log" -Wait
82-
Remove-Item "webimage.exe" -Force
83-
Start-Process -FilePath "oneAPI\bootstrapper.exe" -ArgumentList "-s --action install --eula=accept --components=""intel.oneapi.win.cpp-compiler:intel.oneapi.win.ifort-compiler:intel.oneapi.win.mpi.devel"" -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=." -Wait
84-
Remove-Item "oneAPI" -Force -Recurse
69+
netcdf
70+
netcdf-fortran
8571
8672
- name: (Ubuntu) Install gfortran
87-
if: contains(matrix.os,'ubuntu')
73+
if: contains(matrix.os,'ubuntu')
8874
run: |
8975
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
9076
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
@@ -94,45 +80,76 @@ jobs:
9480
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'openmpi')
9581
run: |
9682
sudo apt-get update
97-
sudo apt install -y -q openmpi-bin libopenmpi-dev hwloc fabric libhdf5-dev libhdf5-fortran-102
83+
sudo apt install -y -q openmpi-bin libopenmpi-dev hwloc fabric libhdf5-dev \
84+
libhdf5-fortran-102 libnetcdf-dev libnetcdff-dev
9885
9986
- name: (Ubuntu) Install MPICH
10087
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'mpich')
10188
run: |
10289
sudo apt-get update
103-
sudo apt install -y -q mpich hwloc fabric libhdf5-dev libhdf5-fortran-102
90+
sudo apt install -y -q mpich hwloc fabric libhdf5-dev libhdf5-fortran-102 \
91+
libnetcdf-dev libnetcdff-dev
10492
105-
- name: (Ubuntu) Retrieve Intel toolchain
106-
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'intel')
107-
timeout-minutes: 1
108-
run: |
109-
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
110-
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
111-
sudo apt-get update
93+
# Intel
11294

113-
- name: (Ubuntu) Install Intel oneAPI
114-
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'intel')
115-
uses: fortran-lang/[email protected]
116-
id: setup-fortran
95+
- name: Setup Intel Environment
96+
if: contains(matrix.mpi, 'intel')
97+
uses: ./.github/actions/setup-intel
11798
with:
118-
compiler: intel
119-
version: 2024.1.0
99+
os: ${{ matrix.os }}
120100

121-
- name: (Ubuntu) finalize oneAPI environment
122-
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'intel')
101+
- name: (Ubuntu) Build and Install HDF5 from source
102+
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'intel')
103+
# Needs checkout if source code isn't available, adjust if needed
104+
# Ensure compilers are available from the previous step's environment setup
105+
shell: bash
123106
run: |
124-
# Install MPI
125-
sudo apt-get install -y -q intel-oneapi-mpi-devel ninja-build cmake
107+
# Source again just in case shell context is lost (shouldn't be, but safer)
126108
source /opt/intel/oneapi/setvars.sh --force
127-
printenv >> $GITHUB_ENV
128-
# To run HDF5 with oneAPI, we need to build it from source. Use CMake to generate pkg-config info
109+
# Download HDF5
129110
curl -O -L https://github.com/HDFGroup/hdf5/archive/refs/tags/snapshot-1.14.tar.gz
130111
tar zxf snapshot-1.14.tar.gz
131112
cd hdf5-snapshot-1.14
113+
# Configure HDF5 with Intel compilers
132114
cmake -B build -DCMAKE_Fortran_COMPILER=ifx -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DHDF5_BUILD_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=/usr
133115
cd build
134-
make -j
116+
make -j $(nproc)
135117
sudo make install
118+
cd ../.. # Go back to workspace directory
119+
rm -rf hdf5-snapshot-1.14 snapshot-1.14.tar.gz # Clean up
120+
121+
- name: (Ubuntu) Build and Install NetCDF-C from source
122+
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'intel')
123+
shell: bash
124+
run: |
125+
source /opt/intel/oneapi/setvars.sh --force
126+
# Download NetCDF-C
127+
curl -L https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.2.tar.gz -o - | tar xz
128+
cd netcdf-c-4.9.2
129+
# Configure NetCDF-C with Intel Compilers, referencing installed HDF5
130+
# Set CC/CXX/FC explicitly in environment for configure script
131+
export CC=icx CXX=icpx FC=ifx
132+
./configure --prefix=/usr --enable-netcdf-4 --with-hdf5=/usr
133+
make -j $(nproc)
134+
sudo make install
135+
cd .. # Go back to workspace directory
136+
rm -rf netcdf-c-4.9.2 # Clean up
137+
138+
- name: (Ubuntu) Build and Install NetCDF-Fortran from source
139+
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'intel')
140+
shell: bash
141+
run: |
142+
source /opt/intel/oneapi/setvars.sh --force
143+
# Download NetCDF-Fortran
144+
curl -L https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar.gz -o - | tar xz
145+
cd netcdf-fortran-4.6.1
146+
# Configure NetCDF-Fortran with Intel Compilers using CMake
147+
cmake -B build -DCMAKE_Fortran_COMPILER=ifx -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCMAKE_INSTALL_PREFIX=/usr
148+
cd build
149+
make -j $(nproc)
150+
sudo make install
151+
cd ../.. # Go back to workspace directory
152+
rm -rf netcdf-fortran-4.6.1 # Clean up
136153
137154
- name: (Windows) Put MSYS2_MinGW64 on PATH
138155
if: contains(matrix.os,'windows') && (!contains(matrix.mpi,'intel'))
@@ -153,26 +170,13 @@ jobs:
153170
# can't use MSMPI_BIN as Actions doesn't update PATH from msmpisetup.exe
154171
run: Test-Path "C:\Program Files\Microsoft MPI\Bin\mpiexec.exe" -PathType leaf
155172

156-
- name: (Windows) test that OneAPI is installed
157-
if: contains(matrix.os,'windows') && contains(matrix.mpi,'intel')
158-
run: |
159-
Test-Path -Path "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" -PathType leaf
160-
Test-Path -Path "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat" -PathType leaf
161-
162173
- name: (Windows) put MSMPI_BIN on PATH (where mpiexec is)
163174
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi')
164175
run: |
165176
echo "C:\Program Files\Microsoft MPI\Bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
166177
echo "/c/Program Files/Microsoft MPI/Bin/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
167178
echo "MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\" | Out-File -FilePath $env:GITHUB_ENV -Append
168179
169-
- name: (Windows) load OneAPI environment variables
170-
if: contains(matrix.os,'windows') && contains(matrix.mpi,'intel')
171-
shell: cmd
172-
run: |
173-
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
174-
"C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat"
175-
176180
- name: (Windows) Install MSYS2 msmpi package
177181
if: contains(matrix.os,'windows') && contains(matrix.mpi,'msmpi')
178182
shell: msys2 {0}
@@ -214,8 +218,14 @@ jobs:
214218
215219
- name: (macOS) Install homebrew HDF5
216220
if: contains(matrix.os,'macos')
217-
run: |
218-
brew install hdf5
221+
run: |
222+
brew install hdf5
223+
224+
- name: (macOS) Install homebrew NetCDF
225+
if: contains(matrix.os,'macos')
226+
run: |
227+
brew install netcdf
228+
brew install netcdf-fortran
219229
220230
# Phase 1: Bootstrap fpm with existing version
221231
- name: Install fpm

0 commit comments

Comments
 (0)