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

Bump Catch2 version due to GCC11.2 incompatibility #651

Merged
merged 6 commits into from
Apr 8, 2022

Conversation

pgrete
Copy link
Collaborator

@pgrete pgrete commented Feb 22, 2022

PR Summary

I also stumbled across catchorg/Catch2#2178

[ 18%] Building CXX object tst/CMakeFiles/catch2_define.dir/catch2_define.cpp.o
In file included from /usr/include/signal.h:328,
                 from /home/pgrete/src/parthenon/external/Catch2/single_include/catch2/catch.hpp:7955,
                 from /home/pgrete/src/parthenon/tst/catch2_define.cpp:16:
/home/pgrete/src/parthenon/external/Catch2/single_include/catch2/catch.hpp:10735:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
10735 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~
In file included from /usr/include/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /home/pgrete/src/parthenon/external/Catch2/single_include/catch2/catch.hpp:7955,
                 from /home/pgrete/src/parthenon/tst/catch2_define.cpp:16:
/usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
  640 | extern long int sysconf (int __name) __THROW;
      |                 ^~~~~~~
In file included from /home/pgrete/src/parthenon/tst/catch2_define.cpp:16:
/home/pgrete/src/parthenon/external/Catch2/single_include/catch2/catch.hpp:10794:45: error: size of array ‘altStackMem’ is not an integral constant-expression
10794 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~
make[2]: *** [tst/CMakeFiles/catch2_define.dir/build.make:76: tst/CMakeFiles/catch2_define.dir/catch2_define.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1510: tst/CMakeFiles/catch2_define.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Given this was fixed in upstream Catch2, this now includes the latest stable release.

PR Checklist

  • Code passes cpplint
  • New features are documented.
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • CI has been triggered on Darwin for performance regression tests.
  • (@lanl.gov employees) Update copyright on changed files

Still WIP because the discovery now gets confused with Kokkos info output, see first and last tests

$ ctest -N
Test project /home/pgrete/build-test
  Test  #1: Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment variable not set
  Test  #2:   In general, for best performance with OpenMP 4.0 or better set OMP_PROC_BIND=spread and OMP_PLACES=threads
  Test  #3:   For best performance with OpenMP 3.1 set OMP_PROC_BIND=true
  Test  #4:   For unit testing set OMP_PROC_BIND=false
  Test  #5: Adding MeshBlockData objects to a DataCollection
  Test  #6: Just check everything
  Test  #7: Task Object Lifecycle
  Test  #8: Can create a vector-valued face-variable
  Test  #9: Add, Get, and Update are called
  Test #10: reset is called
  Test #11: when hasKey is called
  Test #12: Physical constants
  Test #13: Checking IndexShape indices
  Test #14: Checking IndexShape cell counts
  Test #15: Sorting
  Test #16: par_for loops
  Test #17: nested par_for loops
  Test #18: Overlapping SpaceInstances
  Test #19: Device Object Allocation
  Test #20: Built-in flags are registered
  Test #21: A Metadata flag is allocated
  Test #22: A Metadata struct is created
  Test #23: ParArrayND
  Test #24: ParArrayND with LayoutLeft
  Test #25: ParArray resizing
  Test #26: Time simple stencil operations
  Test #27: Check registry pressure
  Test #28: Check many arrays
  Test #29: Can pull variables from containers based on Metadata
  Test #30: Coarse variable from meshblock_data for cell variable
  Test #31: Get the correct access pattern when using FlatIdx
  Test #32: MeshData works as expected for simple packs
  Test #33: Swarm memory management
  Test #34: Test required/desired checking from inputs
  Test #35: Parthenon Error Checking
  Test #36: Check that integer division, rounded up, works
  Test #37: Check that partitioning a container works
  Test #38: Test Add/Get in Packages_t
  Test #39: Test Associate in StateDescriptor
  Test #40: Test dependency resolution in StateDescriptor
  Test #41: Test SparsePool interface
  Test #42: Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment variable not set
  Test #43:   In general, for best performance with OpenMP 4.0 or better set OMP_PROC_BIND=spread and OMP_PLACES=threads
  Test #44:   For best performance with OpenMP 3.1 set OMP_PROC_BIND=true
  Test #45:   For unit testing set OMP_PROC_BIND=false
  Test #46: Catch2 Container Iterator Performance

@pgrete
Copy link
Collaborator Author

pgrete commented Mar 5, 2022

I now understand what's going on.
From https://github.com/catchorg/Catch2/blob/v2.x/docs/cmake-integration.md#catchcmake-and-catchaddtestscmake

Catch.cmake provides function catch_discover_tests to get tests from a target. This function works by running the resulting executable with --list-test-names-only flag, and then parsing the output to find all existing tests.

Therefore the Kokkos output is incorrectly parsed.
The fix I tried was to add EXTRA_ARGS "--kokkos-disable-warnings" to the discovery to suppress the Kokkos warning during parsing of the test names.
It didn't work as the argument is apparently not passed to the discovery call, see catchorg/Catch2#2382

@pgrete pgrete requested review from brryan and Yurlungur March 8, 2022 10:22
@pgrete pgrete changed the title WIP: Bump Catch2 version due to GCC11.2 incompatibility Bump Catch2 version due to GCC11.2 incompatibility Mar 8, 2022
@pgrete
Copy link
Collaborator Author

pgrete commented Mar 8, 2022

Alright, this is ready for review. I got around all the quirks of the other discovery mechanism by suppressing Kokkos warning during discovery and by manually adding ctest labels (as parsing catch tags as ctest _labels_is currently not supported -- though there's an open PR on Catch2 for that).

@pgrete pgrete merged commit fe59bfe into develop Apr 8, 2022
@pgrete pgrete deleted the pgrete/bump-catch2 branch April 8, 2022 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants