Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Pick up GeoModel v6 or v7 #3736

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ option(ACTS_FORCE_ASSERTIONS "Force assertions regardless of build type" OFF)
option(ACTS_USE_SYSTEM_LIBS "Use system libraries by default" OFF)
# plugins related options
option(ACTS_USE_SYSTEM_ACTSVG "Use the ActSVG system library" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_GEOMODEL "Use a system-provided GeoModel installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_DETRAY "Use a system-provided detray installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS})
Expand Down Expand Up @@ -229,7 +228,6 @@ set(_acts_actsvg_version 0.4.50)
set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.21)
set(_acts_edm4hep_version 0.7)
set(_acts_geomodel_version 6.3.0)
set(_acts_eigen3_version 3.4.0)
set(_acts_podio_version 1.0.1) # will try this first
set(_acts_podio_fallback_version 0.16) # if not found, will try this one
Expand Down Expand Up @@ -374,8 +372,20 @@ if(ACTS_BUILD_PLUGIN_JSON)
endif()
endif()
if(ACTS_BUILD_PLUGIN_GEOMODEL)
find_package(GeoModelCore ${_acts_geomodel_version} REQUIRED CONFIG)
find_package(GeoModelIO ${_acts_geomodel_version} REQUIRED CONFIG)
foreach(_gm_ver 7.0.0;6.3.0)
message(STATUS "Trying to find GeoModel version ${_gm_ver}")
find_package(GeoModelCore ${_gm_ver} CONFIG)
find_package(GeoModelIO ${_gm_ver} CONFIG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, did the version range formalism not work then? I was hoping that this could've been written just as something like:

find_package(GeoModelCore 6.3...7.99)

I'd really like to avoid such custom for-loops if at all possible... 🤔

Copy link
Member Author

@paulgessinger paulgessinger Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so the range formalism (for some reason) only allows ranges within a single MAJOR version it seems. The range version feature is also seemingly orthogonal to the compatibility check the package can do, which apparently still applies somehow?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very disappointing. If we can't write a possibly quite wide range, then what's the point of this feature even? 😕

I do wonder that once we have an entire for-loop in our code to make all this happen, is the version check actually worth it? Then again, I was never really fond of such version checks to begin with... 🤔

Copy link
Contributor

@andiwand andiwand Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit I also hack the versions from time to time, so also not a big fan of it. Alternatively we could search without version constrain and then check the version manually afterwards

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that if you supply a range, both ends of the range have to be deemed compatible by the target version, i.e. you can't span a range over MAJOR versions, which is indeed disappointing.

I really do want to have a version check, but indeed it might be better to manually check the version after finding without a constraint. I think this only makes a difference if multiple versions are found and CMake would otherwise pick a compatible version out of the available ones.

if(GeoModelCore_FOUND AND GeoModelIO_FOUND)
break()
endif()
endforeach()
if(NOT GeoModelCore_FOUND)
message(
FATAL_ERROR
"GeoModel not found. Please install GeoModel or set ACTS_BUILD_PLUGIN_GEOMODEL to OFF."
)
endif()
endif()
if(ACTS_BUILD_PLUGIN_TGEO)
find_package(
Expand Down
91 changes: 44 additions & 47 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ following commands will clone the repository, configure, and build the core
library:

```console
$ git clone https://github.com/acts-project/acts <source>
$ cmake -B <build> -S <source>
$ cmake --build <build>
git clone https://github.com/acts-project/acts <source>
cmake -B <build> -S <source>
cmake --build <build>
```

For a full list of dependencies, including specific versions, see the
Expand All @@ -23,27 +23,27 @@ section.

The following dependencies are required to build the ACTS core library:

- A C++17 compatible compiler (recent versions of either gcc and clang should work)
- [CMake](https://cmake.org) >= 3.14
- [Boost](https://www.boost.org) >= 1.71 with `filesystem`, `program_options`, and `unit_test_framework`
- [Eigen](https://eigen.tuxfamily.org) >= 3.3.7
- A C++17 compatible compiler (recent versions of either gcc and clang should work)
- [CMake](https://cmake.org) >= 3.14
- [Boost](https://www.boost.org) >= 1.71 with `filesystem`, `program_options`, and `unit_test_framework`
- [Eigen](https://eigen.tuxfamily.org) >= 3.3.7

The following dependencies are optional and are needed to build additional
components:

- [CUDA](https://developer.nvidia.com/cuda-zone) for the CUDA plugin and the Exa.TrkX plugin and its examples
- [DD4hep](http://dd4hep.cern.ch) >= 1.11 for the DD4hep plugin and some examples
- [Doxygen](http://doxygen.org) >= 1.8.15 for the documentation
- [Geant4](https://geant4.org/) for some examples
- [HepMC](https://gitlab.cern.ch/hepmc/HepMC3) >= 3.2.1 for some examples
- [Intel Threading Building Blocks](https://github.com/oneapi-src/oneTBB) >= 2020.1 for the examples
- [ONNX Runtime](https://onnxruntime.ai/) >= 1.12.0 for the ONNX plugin, the Exa.TrkX plugin and some examples
- [Pythia8](https://pythia.org) for some examples
- [ROOT](https://root.cern.ch) >= 6.20 for the TGeo plugin and the examples
- [Sphinx](https://www.sphinx-doc.org) >= 2.0 with [Breathe](https://breathe.readthedocs.io/en/latest/), [Exhale](https://exhale.readthedocs.io/en/latest/), and [recommonmark](https://recommonmark.readthedocs.io/en/latest/index.html) extensions for the documentation
- [cugraph](https://github.com/rapidsai/cugraph) for the Exa.TrkX plugin
- [libtorch](https://pytorch.org/cppdocs/installing.html) for the Exa.TrkX plugin
- [Pybind11](https://github.com/pybind/pybind11) for the Python bindings of the examples
- [CUDA](https://developer.nvidia.com/cuda-zone) for the CUDA plugin and the Exa.TrkX plugin and its examples
- [DD4hep](http://dd4hep.cern.ch) >= 1.11 for the DD4hep plugin and some examples
- [Doxygen](http://doxygen.org) >= 1.8.15 for the documentation
- [Geant4](https://geant4.org/) for some examples
- [HepMC](https://gitlab.cern.ch/hepmc/HepMC3) >= 3.2.1 for some examples
- [Intel Threading Building Blocks](https://github.com/oneapi-src/oneTBB) >= 2020.1 for the examples
- [ONNX Runtime](https://onnxruntime.ai/) >= 1.12.0 for the ONNX plugin, the Exa.TrkX plugin and some examples
- [Pythia8](https://pythia.org) for some examples
- [ROOT](https://root.cern.ch) >= 6.20 for the TGeo plugin and the examples
- [Sphinx](https://www.sphinx-doc.org) >= 2.0 with [Breathe](https://breathe.readthedocs.io/en/latest/), [Exhale](https://exhale.readthedocs.io/en/latest/), and [recommonmark](https://recommonmark.readthedocs.io/en/latest/index.html) extensions for the documentation
- [cugraph](https://github.com/rapidsai/cugraph) for the Exa.TrkX plugin
- [libtorch](https://pytorch.org/cppdocs/installing.html) for the Exa.TrkX plugin
- [Pybind11](https://github.com/pybind/pybind11) for the Python bindings of the examples

There are some additional dependencies that are automatically provided as part of
the build system.
Expand All @@ -69,27 +69,27 @@ runs the configuration and searches for the dependencies. The `<build>`
directory is automatically created.

```console
$ cmake -B <build> -S <source>
cmake -B <build> -S <source>
```

The build can be configured via various options that are listed in detail in the
[Build options](#build-options) section. Options are set on the command line.
The previous command could be e.g. modified to

```console
$ cmake -B <build> -S <source> -DACTS_BUILD_UNITTESTS=on -DACTS_BUILD_FATRAS=on
cmake -B <build> -S <source> -DACTS_BUILD_UNITTESTS=on -DACTS_BUILD_FATRAS=on
```

After the configuration succeeded, the software is build. This is also done with cmake via the following command

```console
$ cmake --build <build>
cmake --build <build>
```

This automatically calls the configure build tool, e.g. Make or Ninja. To build only a specific target, the target names has to be separated from the CMake options by `--`, i.e.

```console
$ cmake --build <build> -- ActsFatras # to build the Fatras library
cmake --build <build> -- ActsFatras # to build the Fatras library
```

The build commands are the same regardless of where you are building the
Expand All @@ -103,19 +103,19 @@ e.g. CERNs lxplus login machines, the dependencies can be easily satisfied
via a LCG releases available through CVMFS. A setup script is provided to activate a compatible releases that can be used as follows:

```console
$ cd <source>
$ source CI/setup_cvmfs_lcg.sh
cd <source>
source CI/setup_cvmfs_lcg.sh
```

After sourcing the setup script, you can build ACTS as described above. The
following commands will build ACTS in the `<source>/build` directory with the
Fatras component.

```console
$ cd <source>
$ source CI/setup_cvmfs_lcg.sh
$ cmake -B build -S . -DACTS_BUILD_FATRAS=on
$ cmake --build build
cd <source>
source CI/setup_cvmfs_lcg.sh
cmake -B build -S . -DACTS_BUILD_FATRAS=on
cmake --build build
```

### In a container
Expand Down Expand Up @@ -144,13 +144,13 @@ available tags, e.g. for the `ubuntu2004` image, you can use the following
command:

```console
$ docker search --list-tags ghcr.io/acts-project/ubuntu2404
docker search --list-tags ghcr.io/acts-project/ubuntu2404
```

The following command then downloads a stable tag of the `ubuntu2404` image:

```console
$ docker pull ghcr.io/acts-project/ubuntu2404:51
docker pull ghcr.io/acts-project/ubuntu2404:51
```

This should print the image id as part of the output. You can also find out the
Expand All @@ -163,7 +163,7 @@ following command will make the source directory available as `/acts` in the
container and start an interactive `bash` shell

```console
$ docker run --volume=<source>:/acts:ro --interactive --tty <image> /bin/bash
docker run --volume=<source>:/acts:ro --interactive --tty <image> /bin/bash
```

where `<image>` is the image id that was previously mentioned. If you are using the Ubuntu-based image you are already good to go. For the images based on LCG releases, you can now activate the LCG release in the container shell by sourcing a setup script:
Expand Down Expand Up @@ -191,6 +191,7 @@ install ACTS' dependencies; see the [building with Spack](misc/spack) page for
more information.

(build_docs)=

## Building the documentation

The documentation uses [Doxygen][doxygen] to extract the source code
Expand All @@ -201,8 +202,8 @@ need to have [Doxygen][doxygen] version `1.9.5` or newer installed.
package manager `pip`:

```console
$ cd <source>
$ pip install -r docs/requirements.txt
cd <source>
pip install -r docs/requirements.txt
```

:::{tip}
Expand All @@ -211,8 +212,8 @@ environment](https://realpython.com/python-virtual-environments-a-primer/) for
this purpose! For example, run

```console
$ python -m venv docvenv
$ source docvenv/bin/activate
python -m venv docvenv
source docvenv/bin/activate
```

to create a local virtual environment, and then run the `pip` command above.
Expand All @@ -221,13 +222,13 @@ to create a local virtual environment, and then run the `pip` command above.
To activate the documentation build targets, the `ACTS_BUILD_DOCS` option has to be set

```console
$ cmake -B <build> -S <source> -DACTS_BUILD_DOCS=on
cmake -B <build> -S <source> -DACTS_BUILD_DOCS=on
```

Then the documentation can be build with this target

```console
$ cmake --build <build> --target docs
cmake --build <build> --target docs
```

The default option includes the Doxygen, Sphinx, and the Breathe extension,
Expand All @@ -239,16 +240,14 @@ of errors you will need to manually pull in symbols to be documented.
[doxygen]: https://doxygen.nl/
[sphinx]: https://www.sphinx-doc.org
[breathe]: https://breathe.readthedocs.io
[exhale]: https://exhale.readthedocs.io
[rtd_acts]: https://acts.readthedocs.io

## Build options

CMake options can be set by adding `-D<OPTION>=<VALUE>` to the configuration
command. The following command would e.g. enable the unit tests

```console
$ cmake -B <build> -S <source> -DACTS_BUILD_UNITTESTS=ON
cmake -B <build> -S <source> -DACTS_BUILD_UNITTESTS=ON
```

Multiple options can be given. `cmake` caches the options so that only changed
Expand All @@ -264,7 +263,6 @@ components.
| ACTS_FORCE_ASSERTIONS | Force assertions regardless of build<br>type<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_LIBS | Use system libraries by default<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_ACTSVG | Use the ActSVG system library<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_USE_SYSTEM_GEOMODEL | Use a system-provided GeoModel<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_USE_SYSTEM_COVFIE | Use a system-provided covfie<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_USE_SYSTEM_DETRAY | Use a system-provided detray<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_USE_SYSTEM_TRACCC | Use a system-provided traccc<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
Expand Down Expand Up @@ -350,7 +348,7 @@ documentation](https://cmake.org/documentation/).
The build is also affected by some environment variables. They can be set by prepending them to the configuration call:

```console
$ DD4hep_DIR=<path/to/dd4hep> cmake -B <build> -S <source>
DD4hep_DIR=<path/to/dd4hep> cmake -B <build> -S <source>
```

The following environment variables might be useful.
Expand All @@ -367,8 +365,8 @@ ACTS comes packaged with a detector modeled using DD4hep that can be used to tes
It is available via the git submodule feature by performing the following steps ([`git lfs`](https://git-lfs.com/) need to be installed on your machine):

```console
$ git submodule init
$ git submodule update
git submodule init
git submodule update
```

To use it, you will then need to build ACTS with the `ACTS_BUILD_ODD` option and then point either `LD_LIBRARY_PATH` on Linux or
Expand All @@ -381,7 +379,6 @@ oddMaterialDeco = acts.IMaterialDecorator.fromFile("PATH_TO_Acts/thirdparty/Open
detector, trackingGeometry, decorators = getOpenDataDetector(oddMaterialDeco)
```


## Using ACTS

When using ACTS in your own CMake-based project, you need to include the
Expand Down
Loading