ginkgo-project / ginkgo

Numerical linear algebra software package
https://ginkgo-project.github.io/
BSD 3-Clause "New" or "Revised" License
384 stars 86 forks source link

Adding CMake Presets #1536

Open MarcelKoch opened 5 months ago

MarcelKoch commented 5 months ago

This PR can be used to discuss the addition of CMake presets. So far, I've added only very basic presets which are compatible with the current workflows.

But these preset can be used to set common standards, especially regarding warnings. ATM, we only enforce the -Wpedantic warnings for our development builds. We could use the presets to define a more rigorous set of warnings.

There might also be other options we might want to set here, this is only a starting point for a discussion.

The workflow using the presets would be as follows:

cd ginkgo
cmake . --presets develop [cmake options...]
cmake --build build-develop

Also, the presets are usually picked up by IDEs.

upsj commented 5 months ago

Another useful feature might be the environment object, with which we can configure path-independent CXX and CUDACXX compiler executable names

MarcelKoch commented 5 months ago

Another useful feature might be the environment object, with which we can configure path-independent CXX and CUDACXX compiler executable names

Are you meaning something like CXX=g++? I think that would make sense if we would extend the presets to be used in our CI, but otherwise I'm not sure of the benefit of that.

upsj commented 5 months ago

I could imagine develop-clang being useful from time to time, especially with its better diagnostics

greole commented 5 months ago

I guess that should also work with cmakes new --workflow option.

pratikvn commented 5 months ago

Can we extend this approach to enable builds for HPC systems ? Frontier, Horeka etc.

upsj commented 5 months ago

@pratikvn I think the issue there is that they depend on loaded modules, and the executable names (gcc etc) are the same otherwise, so the configs may not help and differ that much between different systems.

We could consider adding a '-march=native` preset that also includes other optimizations (mixed precision, maybe jacobi full optimizations)

MarcelKoch commented 5 months ago

I tend to agree that adding supported machines may clutter the file a bit too much. But it is possible to include configurations from other files, so perhaps we could put these configs into a separate file.