Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
19f93d8
Initial CI jobs
AlynJ Dec 28, 2025
3b962c2
Initial CI jobs
AlynJ Dec 28, 2025
d3185bd
Initial CI jobs
AlynJ Dec 28, 2025
5e21814
Initial CI jobs
AlynJ Dec 28, 2025
39385c2
Intel CI jobs
AlynJ Dec 28, 2025
dc2e984
Intel CI jobs
AlynJ Dec 28, 2025
27ee061
Intel CI jobs + ifx cmake.
AlynJ Dec 28, 2025
f799f8c
Intel CI jobs + ifx cmake.
AlynJ Dec 28, 2025
b8ab7a3
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
6f52d21
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
5cd7a63
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
e1b54bd
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
9e17e67
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
4e67a8d
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
60d43a5
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
39342cc
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
ac600ce
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
ba2d08c
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
782dd51
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
199cd9f
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
8fa4974
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
89ab93a
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
39711ab
Do the h5dwrite/h5dread calls within the readHDF5*/writeHDF5* subrout…
AlynJ Dec 29, 2025
5655a8d
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
e85a032
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
ff25bb6
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
7b05d45
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
70fccf6
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
5662fd8
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
45ee2ee
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
3a900be
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
cc973d0
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
ce4408b
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
1794eb7
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
ae47b1c
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
686e5ab
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
eebe846
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
bab205b
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
3914690
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
360b7c5
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
84b720c
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
88a7169
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
74b9ed6
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
99c6ae4
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
4c027f4
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
ca24b46
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
83ea47d
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
c92e0eb
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
f009a30
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
191e50c
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
9a73f1a
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
1820e0d
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
ed54a37
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
96731c5
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
b9e7d6b
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
7ca1074
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
db0a622
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
f4a3879
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
c3e65ef
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
9c4fd8b
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
c1e7f60
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
5d35a9f
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
95b1fa2
Intel CI jobs + ifx cmake.
AlynJ Dec 29, 2025
9dee7fc
Add further documentation to README.md and comments on the subroutine…
AlynJ Dec 31, 2025
09e9395
Merge develop branch
AlynJ Dec 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,103 @@ jobs:
./build-tests/h5testrunner_mpi
mpirun --allow-run-as-root --oversubscribe \
-np 2 ./build-tests/h5testrunner_mpi


build_serial_HDF5_with_ifx:
runs-on: ubuntu-latest
container:
image: intel/fortran-essentials:latest

steps:
- uses: actions/checkout@v4

- name: Install system dependencies
run: |
apt-get update
apt-get install -y \
cmake make gcc g++ \
libhdf5-dev \
wget \
gpg

- name: Install serial HDF5 1.14.6 with IFX
shell: bash
run: |
wget -O hdf5-1.14.6.tar.gz \
https://sourceforge.net/projects/hdf5.mirror/files/hdf5_1.14.6/hdf5-1.14.6.tar.gz/download
tar -xzf hdf5-1.14.6.tar.gz
mkdir -p build-hdf5-ifx

# configure with ifx
cmake -S ./hdf5-1.14.6 -B build-hdf5-ifx \
-DCMAKE_Fortran_COMPILER=ifx \
-DHDF5_BUILD_FORTRAN=ON \
-DCMAKE_INSTALL_PREFIX=$HOME/hdf5-ifx \
-DCMAKE_Fortran_FLAGS="-fPIE" \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON

cmake --build build-hdf5-ifx -j
cmake --install build-hdf5-ifx

- name: Build and run tests with ifx
shell: bash
run: |
ifx --version

cmake -S ./test/. -B build-tests-ifx \
-DCMAKE_PREFIX_PATH=$HOME/hdf5-ifx \
-DCMAKE_Fortran_COMPILER=ifx
cmake --build build-tests-ifx
./build-tests-ifx/h5testrunner

# hpckit requires more disk space than available on GitHub runner
# build_parallel_HDF5_with_ifx:
# runs-on: ubuntu-latest
# container:
# image: intel/fortran-hpckit:latest

# steps:
# - uses: actions/checkout@v4

# - name: Install system dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y wget cmake make gcc g++ gpg

# - name: Install parallel HDF5 1.14.6 with IFX
# shell: bash
# run: |
# wget -O hdf5-1.14.6.tar.gz \
# https://sourceforge.net/projects/hdf5.mirror/files/hdf5_1.14.6/hdf5-1.14.6.tar.gz/download
# tar -xzf hdf5-1.14.6.tar.gz
# mkdir -p build-hdf5-mpiifx

# cmake -S hdf5-1.14.6 -B build-hdf5-mpiifx \
# -DCMAKE_Fortran_COMPILER=mpiifx \
# -DCMAKE_C_COMPILER=mpiicx \
# -DBUILD_SHARED_LIBS=OFF \
# -DHDF5_BUILD_FORTRAN=ON \
# -DHDF5_ENABLE_PARALLEL=ON \
# -DHDF5_ENABLE_Z_LIB_SUPPORT=OFF \
# -DHDF5_ENABLE_SZIP_SUPPORT=OFF \
# -DCMAKE_INSTALL_PREFIX=$HOME/hdf5-mpiifx \

# cmake --build build-hdf5-mpiifx -j
# cmake --install build-hdf5-mpiifx

# - name: Build and run MPI tests with mpiifx
# shell: bash
# run: |
# mpiifx --version

# cmake -S ./test/. -B build-tests-mpiifx \
# -DCMAKE_Fortran_COMPILER=mpiifx \
# -DCMAKE_PREFIX_PATH=$HOME/hdf5-mpiifx \
# -DMPI_VERSION=ON
# cmake --build build-tests-mpiifx

# ./build-tests-mpiifx/h5testrunner
# ./build-tests-mpiifx/h5testrunner_mpi
# mpirun --allow-run-as-root --oversubscribe \
# -np 2 ./build-tests-mpiifx/h5testrunner_mpi

78 changes: 76 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,50 @@
# HDF5_Fortran_API
A Fortran library which handles the interface to HDF5 library to give simpler I/O proceedures usable within Fortran coding projects

A Fortran library which handles the interface to HDF5 library to give simpler I/O proceedures usable within Fortran coding projects.

The modhdf5.f90 module contains subroutines which interface with the HDF5 library so that you do not need to use it directly in your code. You only need to call upon this module to perform the I/O to the .h5 file.

You can look at examples of how this module is used within the `./tests/testio.f90` code.

__Author:__ Alyn D. N. James

__Version:__ 0.1.0

## How to use

To add this to your Fortran code, add this module .f90 file to the compilation (cmake, make and so on) and load the public subroutines module in your Fortran code via

```Fortran
use modhdf5
```

The .inc files will needed to be in the same directory as the .f90 file, but these will automatically be included during the compilation. (These .inc files are used to reduce the amount of repetative code.)

This module uses macro preprocessors to be compatible with both the serial and parallel HDF5 library. However, to enable the (MPI) parallel HDF5 capabilities in modhdf5, you need to add the -DMPI_modhdf5 flag to the `make` compilation step. This is done within cmake as seen in the `Tests` section below.

## Dependencies

Here is the list of libraries required for the modhdf5 module (with the version it was tested with):
- HDF5 library (1.14.6)
- Fortran 2018+ (gcc 15.1.0 and ifx 2025.3.0)
- MPI (for parallel enabled version) (Openmpi 5.0.8)

For the repository, the following additional packages (with the version it was tested with) are needed:
- cmake (3.22.1)

## Documentation

Within modhdf5, the public subroutines to be used in your code are given at the top of the file. All the global variables are commented, and the inputs and outputs of all of the subroutines are labelled. The subroutines are named to be self-explanatory (some have short doc-strings for clarity).

## Tests

Compile the test runner (within gnu) with
This repository uses the [naturalFRUIT v0.7.4](https://cibinjoseph.github.io/naturalFRUIT/index.html) .f90 code for constructing the test runner for testing the functionality of the code base. Credit goes to the developers for `naturalfruit.f90`.

Please look at the `.github/workflows/ci.yml` to see how modhdf5 has been compiled in different setups.

### Serial Tests

Compile the test runner (within GCC+Openmpi) with

```
cmake ../ -DCMAKE_Fortran_COMPILER=mpif90
Expand All @@ -20,3 +61,36 @@ run the test suite via
```
./h5testrunner
```


### (MPI) Parallel Tests

Compile the test runner (within GCC+Openmpi) with

```
cmake ../ -DCMAKE_Fortran_COMPILER=mpif90 -DMPI_VERSION=ON
```

For conda environment, use

```
cmake ../ -DCMAKE_Fortran_COMPILER=mpif90 -DMPI_VERSION=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
```

run the test suite via

```
mpirun -np 2 ./h5testrunner_mpi
```

## Developer notes

This modhdf5 has been written for HDF5 version 1.x.y. The additional functionality of HDF5 2.x.y has not been included.

modhdf5 uses polymorphic, assumed-rank variable inputs to keep the interface generic. The variable rank and type are resolved within the read/write subroutines to interface with the HDF5 library Fortran APIs. modhdf5 currently sticks to the standard H5 native types available within the HDF5 library. These are:
- H5T_NATIVE_INTEGER
- H5T_NATIVE_REAL
- H5T_NATIVE_DOUBLE
- H5T_FORTRAN_S1 (modhdf5 extends this to a custom n-sized character type to handle aribitary sized character variable.)

It is suggested for users to resolve their data types to conform with these native types and add the Fortran data type it was originally to the `fortran_type` attribute (via `fdtype_name` subroutine input/output) so that other users know its origin.
Loading