Skip to content

Commit

Permalink
Add intel oneapi windows build to CI CMake (#3836)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Nov 10, 2023
1 parent e0d095e commit 66786fa
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 98 deletions.
114 changes: 78 additions & 36 deletions .github/workflows/intel-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,69 +13,111 @@ permissions:
contents: read

jobs:
Intel_build_and_test:
name: "Intel ${{ inputs.build_mode }}"
# Linux (Ubuntu) w/ gcc + CMake
#
Intel_oneapi_linux:
name: "ubuntu-oneapi ${{ inputs.build_mode }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: add oneAPI to apt
shell: bash
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository -y "deb https://apt.repos.intel.com/oneapi all main"
# Only CMake need ninja-build, but we just install it unilaterally
# libssl, etc. are needed for the ros3 VFD
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt-get install ninja-build doxygen graphviz
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
sudo apt update
sudo apt-get install ninja-build doxygen graphviz
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
- name: install oneAPI dpcpp and fortran compiler
shell: bash
run: |
sudo apt update
sudo apt install -y intel-oneapi-compiler-dpcpp-cpp
sudo apt install -y intel-oneapi-compiler-fortran
- name: install oneAPI MKL library
shell: bash
run: |
sudo apt install -y intel-oneapi-mkl-devel
- name: add oneAPI to env
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: intel
version: '2023.2'

- name: CMake Configure with icx
- name: CMake Configure with oneapi
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
source /opt/intel/oneapi/setvars.sh
export PATH=$PATH:/opt/intel/oneapi/compiler/2023.2.1/linux/bin
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \
cmake -C ${{ github.workspace }}/config/cmake/cacheinit.cmake -G Ninja \
-DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \
-DCMAKE_TOOLCHAIN_FILE=config/toolchain/intel.cmake \
-DMKL_ROOT="/opt/intel/oneapi/mkl/latest" \
-DTBB_ROOT="/opt/intel/oneapi/tbb/latest" \
-DLIBAEC_USE_LOCALCONTENT=OFF \
-DZLIB_USE_LOCALCONTENT=OFF \
-DHDF5_BUILD_FORTRAN=OFF \
$GITHUB_WORKSPACE
# BUILD
- name: CMake Build
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
source /opt/intel/oneapi/setvars.sh
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
working-directory: ${{ runner.workspace }}/build

# RUN TESTS
- name: CMake Run Tests
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
source /opt/intel/oneapi/setvars.sh
export SYCL_DEVICE_FILTER=opencl.cpu
ctest . --parallel 2 -C ${{ inputs.build_mode }} -V
working-directory: ${{ runner.workspace }}/build

Intel_oneapi_windows:
name: "windows-oneapi ${{ inputs.build_mode }}"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Install Dependencies (Windows)
run: choco install ninja

- name: add oneAPI to env
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: intel
version: '2023.2'

- name: CMake Configure with oneapi
shell: pwsh
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
mkdir "${{ runner.workspace }}/build"
Set-Location -Path "${{ runner.workspace }}\\build"
cmake -C ${{ github.workspace }}/config/cmake/cacheinit.cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} -DHDF5_BUILD_FORTRAN=ON -DLIBAEC_USE_LOCALCONTENT=OFF -DZLIB_USE_LOCALCONTENT=OFF ${{ github.workspace }}
# BUILD
- name: CMake Build
shell: pwsh
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
working-directory: ${{ runner.workspace }}/build

# RUN TESTS
- name: CMake Run Tests
shell: pwsh
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E tfloatsattrs
working-directory: ${{ runner.workspace }}/build
60 changes: 60 additions & 0 deletions .github/workflows/main-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,63 @@ jobs:
#
# INSTALL (note that this runs even when we don't run the tests)
#

#
# The GitHub runners are inadequate for running parallel HDF5 tests,
# so we catch most issues in daily testing. What we have here is just
# a compile check to make sure nothing obvious is broken.
# A workflow that builds the library
# Parallel Linux (Ubuntu) w/ gcc + Autotools
#
CMake_build_parallel:
name: "Parallel GCC-${{ inputs.build_mode }}-TS=${{ inputs.thread_safety }}"
# Don't run the action if the commit message says to skip CI
if: "!contains(github.event.head_commit.message, 'skip-ci')"

# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# SETUP
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt-get install ninja-build doxygen graphviz
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
sudo apt install gcc-12 g++-12 gfortran-12
sudo apt install libaec0 libaec-dev
sudo apt install openmpi-bin openmpi-common mpi-default-dev
echo "CC=mpicc" >> $GITHUB_ENV
echo "FC=mpif90" >> $GITHUB_ENV
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Get Sources
uses: actions/checkout@v4

# CMAKE CONFIGURE
- name: CMake Configure
run: |
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
CC=mpicc cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \
-DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \
-DBUILD_SHARED_LIBS=ON \
-DHDF5_ENABLE_ALL_WARNINGS=ON \
-DHDF5_ENABLE_PARALLEL:BOOL=ON \
-DHDF5_BUILD_CPP_LIB:BOOL=OFF \
-DHDF5_BUILD_FORTRAN=ON \
-DHDF5_BUILD_JAVA=OFF \
-DLIBAEC_USE_LOCALCONTENT=OFF \
-DZLIB_USE_LOCALCONTENT=OFF \
-DHDF5_ENABLE_MIRROR_VFD:BOOL=OFF \
-DHDF5_ENABLE_DIRECT_VFD:BOOL=OFF \
-DHDF5_ENABLE_ROS3_VFD:BOOL=OFF \
$GITHUB_WORKSPACE
shell: bash

# BUILD
- name: CMake Build
run: cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
working-directory: ${{ runner.workspace }}/build
80 changes: 75 additions & 5 deletions config/cmake-presets/hidden-presets.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,28 @@
"ci-GNUC"
]
},
{
"name": "ci-x64-Debug-Intel",
"description": "Intel for x64 (Debug)",
"hidden": true,
"inherits": [
"ci-base",
"ci-x64",
"ci-Debug",
"ci-Intel"
]
},
{
"name": "ci-x64-Release-Intel",
"description": "Intel for x64 (Release)",
"hidden": true,
"inherits": [
"ci-base",
"ci-x64",
"ci-Release",
"ci-Intel"
]
},
{
"name": "ci-x64-Debug-MSVC-asan",
"description": "x64-Debug-MSVC with /fsanitize=address",
Expand Down Expand Up @@ -265,15 +287,17 @@
"hidden": true,
"inherits": [
"ci-base"
]
],
"configuration": "Debug"
},
{
"name": "ci-x64-Release-MSVC",
"configurePreset": "ci-x64-Release-MSVC",
"hidden": true,
"inherits": [
"ci-base"
]
],
"configuration": "RelWithDebInfo"
},
{
"name": "ci-x64-Debug-Clang",
Expand Down Expand Up @@ -307,6 +331,24 @@
"ci-base"
]
},
{
"name": "ci-x64-Debug-Intel",
"configurePreset": "ci-x64-Debug-Intel",
"hidden": true,
"inherits": [
"ci-base"
],
"configuration": "Debug"
},
{
"name": "ci-x64-Release-Intel",
"configurePreset": "ci-x64-Release-Intel",
"hidden": true,
"inherits": [
"ci-base"
],
"configuration": "RelWithDebInfo"
},
{
"name": "ci-x64-Debug-MSVC-asan",
"configurePreset": "ci-x64-Debug-MSVC-asan",
Expand Down Expand Up @@ -370,15 +412,17 @@
"hidden": true,
"inherits": [
"ci-base"
]
],
"configuration": "Debug"
},
{
"name": "ci-x64-Release-MSVC",
"configurePreset": "ci-x64-Release-MSVC",
"hidden": true,
"inherits": [
"ci-base"
]
],
"configuration": "RelWithDebInfo"
},
{
"name": "ci-x64-Debug-Clang",
Expand Down Expand Up @@ -412,6 +456,22 @@
"ci-base"
]
},
{
"name": "ci-x64-Debug-Intel",
"configurePreset": "ci-x64-Debug-Intel",
"hidden": true,
"inherits": [
"ci-base"
]
},
{
"name": "ci-x64-Release-Intel",
"configurePreset": "ci-x64-Release-Intel",
"hidden": true,
"inherits": [
"ci-base"
]
},
{
"name": "ci-x64-Debug-MSVC-asan",
"configurePreset": "ci-x64-Debug-MSVC-asan",
Expand Down Expand Up @@ -467,7 +527,8 @@
"inherits": "ci-base",
"generators": [
"ZIP"
]
],
"configurations": ["Release"]
},
{
"name": "ci-x64-Release-Clang",
Expand All @@ -486,6 +547,15 @@
"generators": [
"TGZ"
]
},
{
"name": "ci-x64-Release-Intel",
"configurePreset": "ci-x64-Release-Intel",
"hidden": true,
"inherits": "ci-base",
"generators": [
"TGZ"
]
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions fortran/examples/ph5example.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PROGRAM DATASET
CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name

CHARACTER(LEN=100) :: filename ! File name
INTEGER :: fnamelen ! File name length
INTEGER :: fnamelen ! File name length
INTEGER(HID_T) :: file_id ! File identifier
INTEGER(HID_T) :: dset_id ! Dataset identifier
INTEGER(HID_T) :: filespace ! Dataspace identifier in file
Expand Down Expand Up @@ -76,9 +76,9 @@ PROGRAM DATASET
CALL get_environment_variable("HDF5_PARAPREFIX", filename)
fnamelen = LEN_TRIM(filename)
if ( fnamelen == 0 ) then
filename = default_fname
filename = default_fname
else
filename = filename(1:fnamelen) // "/" // default_fname
filename = filename(1:fnamelen) // "/" // default_fname
endif
print *, "Using filename = ", filename

Expand Down
Loading

0 comments on commit 66786fa

Please sign in to comment.