Problem 2187 - G4cout Error in physics lists with Multithreaded mode
Summary: G4cout Error in physics lists with Multithreaded mode
Status: RESOLVED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: physics_lists (show other problems)
Version: 10.5
Hardware: All All
: P4 minor
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2019-08-15 13:16 CEST by Bohdan
Modified: 2019-08-16 09:40 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Bohdan 2019-08-15 13:16:38 CEST
Hi everyone.

I installed Geant4-10.05 with -DGEANT4_BUILD_MULTITHREADED=ON

It works ok with defined G4MULTITHREADED variable which set G4MTRunManager instead of G4RunManager in examples.

But if I want to swap to sequential mode by writing at the top of the main file:

#undef G4MULTITHREADED

It does not compile and return following error:

CMakeFiles/exampleB4c.dir/exampleB4c.cc.o: In function `(anonymous namespace)::PrintUsage()':
exampleB4c.cc:(.text+0x4): undefined reference to `G4cerr'
CMakeFiles/exampleB4c.dir/exampleB4c.cc.o: In function `TFTFP_BERT<G4VModularPhysicsList>::SetCuts()':
exampleB4c.cc:(.text._ZN10TFTFP_BERTI21G4VModularPhysicsListE7SetCutsEv[_ZN10TFTFP_BERTI21G4VModularPhysicsListE7SetCutsEv]+0xd): undefined reference to `G4cout'
CMakeFiles/exampleB4c.dir/exampleB4c.cc.o: In function `TFTFP_BERT<G4VModularPhysicsList>::TFTFP_BERT(int)':
exampleB4c.cc:(.text._ZN10TFTFP_BERTI21G4VModularPhysicsListEC1Ei[_ZN10TFTFP_BERTI21G4VModularPhysicsListEC1Ei]+0x85): undefined reference to `G4cout'
collect2: error: ld returned 1 exit status
gmake[2]: *** [exampleB4c] Error 1
gmake[1]: *** [CMakeFiles/exampleB4c.dir/all] Error 2
gmake: *** [all] Error 2

Tested on example B4c.

The same I encountered in my program with different physics list: QGSP_BERT.

G4MTRunManager->SetNumberOfThreads(1) is a solution, but it gives additional root output file:
output.root
output_t0.root
And lateral only usable.

OS: Scientific Linux 7
Comment 1 Gabriele Cosmo 2019-08-16 09:39:57 CEST
You cannot modify the setup by hacking the code that way… if you need a sequential installation of Geant4, reinstall Geant4 with GEANT4_MULTITHREADED=OFF, or execute your application forcing it to use a single thread (i.e. use the UI command “/run/numberOfThreads 1”).
Comment 2 Gabriele Cosmo 2019-08-16 09:40:16 CEST
You cannot modify the setup by hacking the code that way… if you need a sequential installation of Geant4, reinstall Geant4 with GEANT4_MULTITHREADED=OFF, or execute your application forcing it to use a single thread (i.e. use the UI command “/run/numberOfThreads 1”).