ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Adding CMake Presets

Open MarcelKoch opened this issue 1 year ago • 7 comments

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.

MarcelKoch avatar Jan 19 '24 14:01 MarcelKoch

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

upsj avatar Jan 19 '24 15:01 upsj

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.

MarcelKoch avatar Jan 19 '24 15:01 MarcelKoch

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

upsj avatar Jan 19 '24 15:01 upsj

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

greole avatar Jan 21 '24 07:01 greole

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

pratikvn avatar Jan 22 '24 13:01 pratikvn

@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)

upsj avatar Jan 22 '24 13:01 upsj

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.

MarcelKoch avatar Jan 22 '24 13:01 MarcelKoch