Skip to content

Commit

Permalink
feat: Fortran bindings (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks authored Apr 25, 2024
1 parent 021b808 commit 10d2fdf
Show file tree
Hide file tree
Showing 30 changed files with 787 additions and 56 deletions.
5 changes: 5 additions & 0 deletions .github/install-dependency-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -e
GENERAL_PACKAGE_LIST_LINUX=(
python
gcc
gcc-fortran
clang
make
cmake
Expand Down Expand Up @@ -42,6 +43,7 @@ GENERAL_PACKAGE_LIST_MACOS=(
tree
ninja
meson
gcc # for gfortran
### ROOT dependencies
binutils
libx11
Expand Down Expand Up @@ -128,6 +130,9 @@ case $runner in
brew install $pkg
info_homebrew $pkg
done
### link homebrew's gcc, for gfortran
brew unlink gcc
brew link gcc
;;

*)
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ jobs:
-Dtest_output_dir=$(pwd)/validation_results \
${{ matrix.opts }}
- name: dump build options
run: meson configure iguana_build | cat
run: meson configure iguana_build --no-pager
- run: meson compile
working-directory: iguana_build
- run: meson install
Expand Down Expand Up @@ -331,6 +331,9 @@ jobs:
if: ${{ matrix.id == 'python' }}
- run: iguana-example-01-bank-rows.py test_data.hipo ${{ env.num_events }}
if: ${{ matrix.id == 'python' }}
###### fortran
- run: iguana-example-fortran test_data.hipo ${{ env.num_events }}
if: ${{ matrix.id == 'fortran' }}
### test consumers
- name: consumer test make
if: ${{ matrix.id == 'cpp' }}
Expand Down Expand Up @@ -389,10 +392,10 @@ jobs:
pacman -Syu --noconfirm
pacman -S --noconfirm doxygen graphviz
- name: doxygen
run: doxygen doc/Doxyfile
run: doxygen doc/gen/Doxyfile
- uses: actions/upload-artifact@v4
with:
name: doxygen
name: doc_doxygen
retention-days: 5
path: doc/api/

Expand All @@ -413,7 +416,7 @@ jobs:
- name: download doxygen documentation
uses: actions/download-artifact@v4
with:
name: doxygen
name: doc_doxygen
path: doxygen
- name: download coverage report
uses: actions/download-artifact@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
{ "id": "undefined-sanitizer", "CC": "clang", "CXX": "clang++", "opts": "-Dbuildtype=debug -Drequire_ROOT=true -Db_sanitize=undefined -Db_lundef=false -Db_pie=true" },
{ "id": "leak-sanitizer", "CC": "clang", "CXX": "clang++", "opts": "-Dbuildtype=debug -Drequire_ROOT=true -Db_sanitize=leak -Db_lundef=false -Db_pie=true" },
{ "id": "noROOT", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=false" },
{ "id": "python", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_python=true" }
{ "id": "python", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_python=true" },
{ "id": "fortran", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_fortran=true" }
]
}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ jobs:
"python"
],
"include": [
{ "id": "cpp", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true" },
{ "id": "noROOT", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=false" },
{ "id": "python", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_python=true" }
{ "id": "cpp", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true" },
{ "id": "noROOT", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=false" },
{ "id": "python", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_python=true" },
{ "id": "fortran", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_fortran=true" }
]
}
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/minver.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: MinVer # minimum required-version of dependencies on Linux

on:
pull_request:
push:
branches: [ main ]
tags: [ '*' ]
schedule:
- cron: '15 7 * * 0' # Sundays at 0715Z

Expand All @@ -22,9 +26,10 @@ jobs:
"python"
],
"include": [
{ "id": "cpp", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true" },
{ "id": "noROOT", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=false" },
{ "id": "python", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_python=true" }
{ "id": "cpp", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true" },
{ "id": "noROOT", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=false" },
{ "id": "python", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_python=true" },
{ "id": "fortran", "CC": "gcc", "CXX": "g++", "opts": "-Dbuildtype=release -Drequire_ROOT=true -Dbind_fortran=true" }
]
}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/iguana*/
/.cache

# doxygen artifacts
# documentation artifacts
/doc/api

# data files
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Iguana is not a framework for _reading_ data, rather it is a set of algorithms t
1. [Troubleshooting](doc/troubleshooting.md)
1. [API documentation](https://jeffersonlab.github.io/iguana/doxygen)

#### Language Bindings
1. [Python](/bind/python/README.md)
1. [Fortran](https://jeffersonlab.github.io/iguana/doxygen/group__binding__namespaces.html)

### For Developers
1. [Design Notes](doc/design.md)
1. [Developing a new Algorithm](src/iguana/algorithms/example/README.md)
Expand Down
10 changes: 5 additions & 5 deletions doc/Doxyfile → doc/gen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.

LAYOUT_FILE = doc/DoxygenLayout.xml
LAYOUT_FILE = doc/gen/DoxygenLayout.xml

# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
Expand Down Expand Up @@ -957,7 +957,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = src/ examples/ doc/DoxygenMainpage.md
INPUT = src/ examples/ doc/gen/DoxygenMainpage.md

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -997,7 +997,7 @@ INPUT_FILE_ENCODING =
# provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.

FILE_PATTERNS = *.h iguana-example-*.cc
FILE_PATTERNS = *.h iguana-example-*.cc *Bindings.cc *.f

# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
Expand Down Expand Up @@ -1028,7 +1028,7 @@ EXCLUDE_SYMLINKS = YES
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS =
EXCLUDE_PATTERNS = AlgorithmBindings.cc

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
Expand Down Expand Up @@ -1123,7 +1123,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.

USE_MDFILE_AS_MAINPAGE = doc/DoxygenMainpage.md
USE_MDFILE_AS_MAINPAGE = doc/gen/DoxygenMainpage.md

# The Fortran standard specifies that for fixed formatted Fortran code all
# characters from position 72 are to be considered as comment. A common
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion doc/DoxygenMainpage.md → doc/gen/DoxygenMainpage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
This file is used as a mainpage for the API documentation,
which is generated by `doxygen`. To generate API
documentation locally, run `doxygen doc/Doxyfile`
documentation locally, run `doxygen doc/gen/Doxyfile`
-->

# Iguana API Documentation
Expand Down Expand Up @@ -51,6 +51,7 @@ These functions are unique to each algorithm, so view the algorithm
documentation for details, or browse the full list:

- \ref action "List of all Action Functions"
- \ref binding_namespaces "Fortran Action Functions (C-bindings)"

The action functions have types that correspond to the algorithm types.
Furthermore, some action functions can only be useful if all of the rows of a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ clas12::ZVertexFilter:

# default cuts
- default:
cuts: [ -1.5, 1.3 ]
cuts: [ -15.0, 15.0 ]

# RG-A fall2018 inbending
- runs: [ 4760, 5419 ]
cuts: [ -0.5, 0.5 ]
cuts: [ -5.0, 3.0 ]

# RG-A fall2018 outbending
- runs: [ 5420, 5674 ]
cuts: [ -0.8, 0.7 ]
cuts: [ -8.0, 7.0 ]
6 changes: 3 additions & 3 deletions examples/config/my_z_vertex_cuts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ clas12::ZVertexFilter:

# default cuts
- default:
cuts: [ -15.0, 15.0 ]
cuts: [ -1.5, 1.3 ]

# RG-A fall2018 inbending
- runs: [ 4760, 5419 ]
cuts: [ -5.0, 3.0 ]
cuts: [ -0.5, 0.5 ]

# RG-A fall2018 outbending
- runs: [ 5420, 5674 ]
cuts: [ -8.0, 7.0 ]
cuts: [ -0.8, 0.7 ]
14 changes: 7 additions & 7 deletions examples/iguana-example-03-config-files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main(int argc, char** argv)
if(argc > 1)
configDir = std::string(argv[1]);
else
configDir = iguana::ConfigFileReader::DirName(argv[0]) + "/../etc/iguana/examples";
configDir = iguana::ConfigFileReader::GetConfigInstallationPrefix() + "/examples";
fmt::print("Using top-level configuration directory {}\n", configDir);

// loop over multiple examples how to use configuration files and set options
Expand Down Expand Up @@ -66,8 +66,8 @@ int main(int argc, char** argv)
algo->SetConfigFile(configDir + "/my_z_vertex_cuts.yaml");
algo->SetOption("runnum", 5500);
algo->Start();
assert((algo->GetZcutLower() == -8.0));
assert((algo->GetZcutUpper() == 7.0));
assert((algo->GetZcutLower() == -0.8));
assert((algo->GetZcutUpper() == 0.7));
break;

case 4:
Expand All @@ -76,8 +76,8 @@ int main(int argc, char** argv)
algo->SetConfigDirectory(configDir);
algo->SetConfigFile("my_z_vertex_cuts.yaml");
algo->Start();
assert((algo->GetZcutLower() == -15.0));
assert((algo->GetZcutUpper() == 15.0));
assert((algo->GetZcutLower() == -1.5));
assert((algo->GetZcutUpper() == 1.3));
break;

case 5:
Expand All @@ -87,8 +87,8 @@ int main(int argc, char** argv)
// may use that directory instead of the default, and modify any configuration file within.
algo->SetConfigDirectory(configDir + "/my_config_directory");
algo->Start();
assert((algo->GetZcutLower() == -1.5));
assert((algo->GetZcutUpper() == 1.3));
assert((algo->GetZcutLower() == -15.0));
assert((algo->GetZcutUpper() == 15.0));
break;

case 6:
Expand Down
Loading

0 comments on commit 10d2fdf

Please sign in to comment.