Multithreading mode - installation

Hi, im new with Geant4 and with C++ so I decided to start my learning and installation of Geant4 following some videos of YouTube (video tutorial 10 - MULTITHREADING MODE Physics Matter channel) and came across with some problems executing the command ./sim.cc run.mac after I made the installation of MultiThreading mode and made the compilation and the executable sim.cc with no problem.

Basically the problem is that when I run the Geant4 with the command ./sim.cc run.mac its runs at first instance but it doesn’t runs the entire simulation, as you can see at the end of my terminal text.

THE FOLLOWING TEXT CORRESPOND TO MY TERMINAL TEXT

geochronos@geochronos-decay:~$ . Software/geant4/geant4-v11.1.2-mt-install/share/Geant4/geant4make/geant4make.sh
geochronos@geochronos-decay:~$ cd PhysicsMatter/MultithreadingMode10/build/
geochronos@geochronos-decay:~/PhysicsMatter/MultithreadingMode10/build$ cmake …
– Configuring done
– Generating done
– Build files have been written to: /home/geochronos/PhysicsMatter/MultithreadingMode10/build
geochronos@geochronos-decay:~/PhysicsMatter/MultithreadingMode10/build$ make
Consolidate compiler generated dependencies of target sim
[ 12%] Building CXX object CMakeFiles/sim.dir/detector.cc.o
[ 25%] Linking CXX executable sim
geochronos@geochronos-decay:~/PhysicsMatter/MultithreadingMode10/build$ ls
CMakeCache.txt CMakeFiles cmake_install.cmake det.mac Makefile run.mac scandet.mac sim vis.mac
geochronos@geochronos-decay:~/PhysicsMatter/MultithreadingMode10/build$ ./sim run.mac


Geant4 version Name: geant4-11-01-patch-02 [MT] (15-June-2023)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


G4ParticleGun::geantino
was defined in terms of KineticEnergy: 1GeV
is now defined in terms Momentum: 100GeV/c
Visualization Manager instantiating with verbosity “warnings (3)”…
Visualization Manager initialising…
Registering graphics systems…

You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
RayTracerX (RayTracerX)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)

Registering model factories…

You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume

Registered models:
None

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

Registered filters:
None

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
“/vis/list” to see available colours.

Additional Info
_Geant4 Version:_geant4-v11.1.2
_Operating System:_Ubuntu 22.04
_Compiler/Version:_GNU 11.4.0
_CMake Version:_CMake Version 3.22.1

Without seeing the code, it’s a bit difficult to know what the expected behaviour/output is, so you might be best asking the tutorial author.

Are you able to build and run the Geant4 basic examples, such as exampleB1?

Yes, im able to build and run the exampleB1 with the multithreading mode and modify the run1.mac and run2.mac and run it again without problem.

Here are the .cc and .hh files that have been modify to build and run using the MultiThreading mode in the tutorial, i could share the entire .cc and .hh of this project, but i don’t know which its more relevant than others to share first.

action.cc (466 Bytes)
action.hh (344 Bytes)

and this is my sim.cc

#include

#include “G4RunManagerFactory.hh”
#include “G4UImanager.hh”
#include “G4VisManager.hh”
#include “G4VisExecutive.hh”
#include “G4UIExecutive.hh”
#include “G4MTRunManager.hh”

#include “construction.hh”
#include “Physics.hh”
#include “action.hh”

int main(int argc, char** argv)
{
#ifndef G4MULTITHREADED
G4MTRunManager *runManager= new G4MTRunManager(); //MULTITHREADE MODE
#else
G4RunManager *runManager= new G4RunManager(); //SINGLETHREADE MODE

#endif

runManager->SetUserInitialization(new MyDetectorConstruction);
runManager->SetUserInitialization(new MyPhysicsList);
runManager->SetUserInitialization(new MyActionInitialization);
	
G4UIExecutive *ui = 0;

if(argc == 1)
{
 	ui = new G4UIExecutive(argc, argv);
 }

G4VisManager *visManager= new G4VisExecutive();
visManager->Initialize();

G4UImanager *UImanager= G4UImanager::GetUIpointer();

if(ui)
{
	
	UImanager->ApplyCommand("/control/execute vis.mac");
	ui->SessionStart();	
}
else
{
	G4String command = "/control/execute";
	G4String filename = argv[1];
	UImanager->ApplyCommand(command+filename);
}
return 0;

};

and this is my sim.cc

/run/numberOfThreads 4
/run/initialize
/gun/momentumAmp 10 GeV
/run/beamOn 100

I think it’s probably best to contact the author of the tutorial directly, especially if there is expected output. Otherwise, I’d suggest starting from the official Geant4 examples which we’re in a better position to support/advise on and which show the recommended use of the interfaces.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.