eagles-project/mam4xx

Compilation issues due to `-Werror` flag in `tests/CMakeLists.txt`

Closed this issue · 9 comments

While working on the current (Jan 10, 23) main branch my builds have been failing with a handful of errors of the flavor:

error: 'static void Kokkos::OpenMP::partition_master(const F&, int, int)' is deprecated [-Werror=deprecated-declarations]

This appears to be coming from the target_compile_options(mam4_<test>_unit_tests PRIVATE -Werror) lines in tests/CMakeLists.txt because my current workaround is to comment these lines out, and my builds succeed.

I'll note that it appears the intent is for these -Werror flags to be scoped only to the tests/ directory and below, but it's affecting my entire build for whatever reason.

This is when I've been working on either Pete's RHEL workstation (gcc 10.1.0/cmake 3.21.1), and I've also hit it when working from my intel mac with gcc 12.? and cmake somewhere around 3.25 (don't currently have access).

I think maybe we need to disable this particular warning (-Wno-deprecated-declarations), since it seems like it could be an issue within Kokkos.

I wonder if tracking the number of build warnings as a quality metric might be a better way of preventing them from accumulating, rather than expressing them as hard errors. What do you think about this idea, @overfelt ?

We can track the number of warnings as a metric but in my experience it becomes a monotonically increasing function of not much use. I would rather see -Wall -Werror with a rather long list of exceptions that we can assume will never be fixed but at least we have know just what warnings are are ignoring.

Fair enough. @mjs271, let's try to add the flag I mentioned to ignore this warning. In the future, if you see warnings like this, feel free to disable them with a -Wno-xyz flag.

I can't reproduce this even with gcc 12.1 but will keep trying. Note that the warning is controlled through the Kokkos flag:
Kokkos_ENABLE_DEPRECATION_WARNINGS
which is ON in our configuration scripts.

Maybe we should just flip that switch, then. This would be a change to Haero, right? Would you mind putting together a tiny PR to disable that option in Haero, @overfelt ?

OK, the latest haero and mam4xx should fix these compiler warnings. The latest haero removes deprecated code from the Kokkos compile and the latest mam4xx removes the use of deprecated functions there. @mjs271 , could you update and see if this works? Since I was never able to get these warnings, I'm not sure if I fixed it.

Thanks, @overfelt !

@mjs271 , can you confirm this issue is fixed and close if so?

It looks like it is!