Disabling G4BackTrace

Geant Version: 11-00-beta-01
Operating system: Ubuntu 20.04.2

Hi there,

I’m interested in disabling G4Backtrace, as I assume there is some performance overhead associated with it, or at the very least I would like to benchmark to see what the effects of turning it off are. In G4Backtrace.hh I see there are three options given to disable G4Backtrace:

//  In order to turn off handling for one or more signals, one can do:
//
//    G4BackTrace::DefaultSignals() = std::set<int>{};
//    G4BackTrace::DefaultSignals() = std::set<int>{ SIGSEGV };
//
//  and so on, *before* creating the run-manager. After the run-manager
//  has been created, one should disable the signals:
//
//    G4BackTrace::Disable(G4BackTrace::DefaultSignals());
//
//  Additionally, at runtime, the environment variable "G4BACKTRACE" can
//  be set to select a specific set of signals or none, e.g. in bash:
//
//    export G4BACKTRACE="SIGQUIT,SIGSEGV"
//    export G4BACKTRACE="none"

I have tried all three of these options, yet when my Geant program begins running it prints:

          ################################
          !!! G4Backtrace is activated !!!
          ################################

Has anyone succesfully deactivated G4Backtrace? Or is this just a matter of this message being printed even though G4Backtrace isn’t handling any signals?

Thank you for any advice,

Joseph DeCunha

Hi @JDecunha, if you’ve used the options to deactivate G4Backtrace, then as you suspect the message is just being printed even though no signals will be handled.

The other option available is to completely disable G4Backtrace in Geant4 (in the G4run library) by configuring/building Geant4 with the GEANT4_BUILD_BUILTIN_BACKTRACE CMake option set to OFF. That’s a complete recompile though, so slightly more involved so perhaps only try that if your results with the DefaultSignals/Disable C++ code need further investigation.

We’d welcome any results/feedback on this option/functionality as it was made “ON” by default in the beta, so can be changed/updated for the December release!

1 Like

Thanks so much for the fast reply!