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

Common: Add flags enum helper class #13778

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

f3sch
Copy link
Collaborator

@f3sch f3sch commented Dec 8, 2024

In a previous iteration this was done via macros, now this became a helper class promoting any enum to a functioning constexpr flags class (very close to std::bitset).
Also enum reflection was added. Where one can print the enum in a 'pretty' way:
image
but also allowing to set bits via their name:

      flags.set("Flag1|TestEnum::Flag2 | Flag4 ");

The class has only one data member, e.g. the underlying type of the enum, so streaming should be straightforward to add if needed.

Copy link
Contributor

github-actions bot commented Dec 8, 2024

REQUEST FOR PRODUCTION RELEASES:
To request your PR to be included in production software, please add the corresponding labels called "async-" to your PR. Add the labels directly (if you have the permissions) or add a comment of the form (note that labels are separated by a ",")

+async-label <label1>, <label2>, !<label3> ...

This will add <label1> and <label2> and removes <label3>.

The following labels are available
async-2023-pbpb-apass4
async-2023-pp-apass4
async-2024-pp-apass1
async-2022-pp-apass7
async-2024-pp-cpass0
async-2024-PbPb-apass1
async-2024-ppRef-apass1

@f3sch f3sch marked this pull request as ready for review December 8, 2024 14:54
@f3sch f3sch requested review from sawenzel and a team as code owners December 8, 2024 14:54
@f3sch f3sch force-pushed the aod/flags branch 2 times, most recently from c82f222 to a59f22f Compare December 9, 2024 20:32
@f3sch f3sch force-pushed the aod/flags branch 3 times, most recently from cefee92 to fb2d69a Compare December 29, 2024 14:29
@AliceO2Group AliceO2Group deleted a comment from alibuild Dec 29, 2024
@f3sch f3sch force-pushed the aod/flags branch 2 times, most recently from 987f4b8 to ce57614 Compare December 29, 2024 19:16
@alibuild
Copy link
Collaborator

alibuild commented Dec 31, 2024

Error while checking build/O2/fullCI for ce57614 at 2025-01-02 10:25:

## sw/BUILD/O2-latest/log
c++: error: unrecognized command-line option '--rtlib=compiler-rt'
c++: error: unrecognized command-line option '--rtlib=compiler-rt'


## sw/BUILD/O2Physics-latest/log
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:


## sw/BUILD/O2-full-system-test-latest/log
Detected critical problem in logfile reco_NOGPU.log
reco_NOGPU.log:[52315:calib-phos-l1phase]: [09:24:59][ERROR] Exception while running: Fatal error. Rethrowing.
[52315:calib-phos-l1phase]: [09:24:59][ERROR] Requested resource does not exist: http://alice-ccdb.cern.ch//PHS/Calib/BadMap/1735809899069/
[52315:calib-phos-l1phase]: [09:24:59][FATAL] Got nullptr from CCDB for path PHS/Calib/BadMap and timestamp 1735809899069
[52315:calib-phos-l1phase]: [09:24:59][ERROR] Exception while running: Fatal error. Rethrowing.
[52315:calib-phos-l1phase]: [09:24:59][FATAL] Unhandled o2::framework::runtime_error reached the top of main of o2-phos-calib-workflow, device shutting down. Reason: Fatal error
[ERROR] Workflow crashed - PID 52315 (calib-phos-l1phase) did not exit correctly however it's not clear why. Exit code forced to 128.


## sw/BUILD/o2checkcode-latest/log
--
========== List of errors found ==========
++ GRERR=0
++ grep -v clang-diagnostic-error error-log.txt
++ grep ' error:'
++ GRERR=1
++ [[ 1 == 0 ]]
++ mkdir -p /sw/INSTALLROOT/db9ba97358b07a46ef326a9ee5fcd2a4a420c448/slc8_x86-64/o2checkcode/1.0-local913/etc/modulefiles
++ cat
--

Full log here.

@f3sch
Copy link
Collaborator Author

f3sch commented Jan 5, 2025

Hi @sawenzel would this be interesting to add? I have a few scenarios in mind where, in the future, managing multiple boolean flags (e.g., for enabling or disabling algorithm features) could become cumbersome. In such cases, a bitset could be a viable alternative. However, I’d like to make it possible to set these features via their names (also because I think it is mind-boggling to remember which number sets which bit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants