Message: A tip on the mac file of GPS when use MT(Multi Threads) Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Note A tip on the mac file of GPS when use MT(Multi Threads)  

Forum: Multithreading
Date: 16 Sep, 2014
From: <junhui.works@gmail.com>

Part 1.
How the problem raised .

I have built Geant4 scrips which can be run smoothly without MT. Also, they run normally when I used MT and the mac file of run1.mac[1].
However, I can't run them successfully when I used MT and a GPS mac file[2], the error message is [3].

Part2.
Solution(Thanks to Andrea, adotti@slac.stanford.edu and Andrew, andrew.green@hep.manchester.ac.uk).

The solution is rather simple : just move these two lines on the top of GPS mac file, as [4].
/run/initialize
/run/numberOfThreads 2

Be aware, one has to move both two lines, only move the line of "/run/initialize" doesn't work.

Part3.
Behind the solution(The explanation from Andrew)

" I found the problem with your macro; it is a simple fix and requires only moving some commands around. The GPS messenger will not be built - and therefore all commands starting /gps/ will not work - until the run manager has been initialised. In your case, the simplest way to to this is to move the /run/initialize command to somewhere before you start doing GPS things. I also moved the /run/numberOfThreads 2 command to before the /run/initialize command, because the number of threads must be known before the run manager can initialise. After doing that, everything works okay."




Thanks a lot for the diagnose of Andrea and Andrew !


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[1] run1.mac
/run/verbose 1
/run/initialize
/run/numberOfThreads 2
/run/beamOn 1000



[2] My mac file

/gps/particle neutron
/gps/pos/type Beam
# the incident surface is in the x-y plane
/gps/pos/rot1 1 0 0
/gps/pos/rot2 0 1 0
#
# the beam spot is centered at the origin and is
# of 1d gaussian shape with a 3mm central plateau
/gps/pos/shape Circle
/gps/pos/centre 0. 0. -5. cm
/gps/pos/radius 5. mm # chosen 1.0mm before.
/gps/pos/sigma_r .2 mm # chosen 0.1mm before.
#
# the beam is travelling along the x-axis with 5 degrees dispersion
/gps/ang/rot1 0 1 0
/gps/ang/rot2 1 0 0
/gps/ang/type beam1d
/gps/ang/sigma_r 0.1 deg # 0.3 deg


#/gps/pos/shape Circle
#/gps/pos/centre 0. 0. -5. cm
#/gps/pos/radius 0.5 cm
#/gps/ang/type beam1d

/gps/ene/type User
/gps/hist/type energy

.... (many gps points omitted here)

/gps/hist/point 0.598 38034.00
/gps/hist/point 0.6 37542.00



# commands below are independent of gps
#
#/analysis/filename test18
#/analysis/maxeng 15 MeV
#/analysis/mineng 0 MeV
#/analysis/maxpos 5 cm
#/analysis/minpos -5 cm
#/event/printModulo 10
#/control/execute display.mac
/run/verbose 1
/run/initialize
/run/numberOfThreads 2
/run/beamOn 1000




[3] Error message when running my Mac file.


*************************************************************
 Geant4 version Name: geant4-10-00-patch-02 [MT] (13-June-2014)
  << in Multi-threaded mode >>
                      Copyright : Geant4 Collaboration
                      Reference : NIM A 506 (2003), 250-303
                            WWW : http://cern.ch/geant4
*************************************************************

Using Root
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...

You have successfully registered the following graphics systems.
Current available graphics systems are:
  ASCIITree (ATree)
  DAWNFILE (DAWNFILE)
  G4HepRep (HepRepXML)
  G4HepRepFile (HepRepFile)
  OpenGLImmediateX (OGLI, OGLIX)
  OpenGLStoredX (OGL, OGLS, OGLSX)
  RayTracer (RayTracer)
  VRML1FILE (VRML1FILE)
  VRML2FILE (VRML2FILE)
  gMocrenFile (gMocrenFile)

Registering model factories...

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

Registered filter factories:
  chargeFilter
  particleFilter
  originVolumeFilter
  attributeFilter

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.
Available colours:
  black, blue, brown, cyan, gray, green, grey, magenta, red, white, yellow

***** COMMAND NOT FOUND </gps/particle neutron> *****

***** Batch is interrupted!! *****
Graphics systems deleted.
Visualization Manager deleting...



[4] The successful running mac file

/run/initialize
/run/numberOfThreads 2
/gps/particle neutron
/gps/pos/type Beam
# the incident surface is in the x-y plane
/gps/pos/rot1 1 0 0
/gps/pos/rot2 0 1 0
#
# the beam spot is centered at the origin and is
# of 1d gaussian shape with a 3mm central plateau
/gps/pos/shape Circle
/gps/pos/centre 0. 0. -5. cm
/gps/pos/radius 5. mm # chosen 1.0mm before.
/gps/pos/sigma_r .2 mm # chosen 0.1mm before.
#
# the beam is travelling along the x-axis with 5 degrees dispersion
/gps/ang/rot1 0 1 0
/gps/ang/rot2 1 0 0
/gps/ang/type beam1d
/gps/ang/sigma_r 0.1 deg # 0.3 deg


#/gps/pos/shape Circle
#/gps/pos/centre 0. 0. -5. cm
#/gps/pos/radius 0.5 cm
#/gps/ang/type beam1d

/gps/ene/type User
/gps/hist/type energy

.... (many gps points omitted here)


/gps/hist/point 0.598 38034.00
/gps/hist/point 0.6 37542.00



# commands below are independent of gps
#
#/analysis/filename test18
#/analysis/maxeng 15 MeV
#/analysis/mineng 0 MeV
#/analysis/maxpos 5 cm
#/analysis/minpos -5 cm
#/event/printModulo 10
#/control/execute display.mac
/run/verbose 1
/run/beamOn 1000

 Add Message Add Message
to: "A tip on the mac file of GPS when use MT(Multi Threads) "

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews