Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
-238
View File
@@ -1,238 +0,0 @@
/// @file "parallel/MPI/.README.txt"
/// @brief Examples MPI README
/*! \page Examples_MPI Category : parallel/MPI
About the interface
===================
G4MPI is a native interface with MPI libraries. The directory contains
a Geant4 UI library and a couple of parallelized examples.
Using this interface, users applications can be parallelized with
different MPI compliant libraries, such as OpenMPI, MPICH2 and so on.
System Requirements:
--------------------
### MPI Library
The MPI interface can work with MPI-compliant libraries,
such as Open MPI, MPICH, Intel MPI etc.
For example, the information about Open MPI can be obtained from
http://www.open-mpi.org/
MPI support:
------------
G4mpi has been tested with the following MPI flavors:
* OpenMPI 1.8.1
* MPICH 3.2
* Intel MPI 5.0.1
### CMake
CMake is used to build <a href="./group__extended__parallel__MPI__libG4mpi.html"> G4MPI </a> library, that co-works with Geant4 build system.
### Optional (for exMPI02)
ROOT for histogramming/analysis
How to build G4MPI
==================
To build G4MPI library, use CMake on Geant4 library installed with CMake build.
Follow these commands,
> mkdir build
> cd build
> cmake -DGeant4_DIR=<your Geant4 install path>/lib[64]/Geant4-V.m.n \
-DCMAKE_INSTALL_PREFIX=<where-G4mpi-lib-will-be-installed> \
<g4source>/examples/extended/parallel/MPI/source
> make
> make install
The cmake step will try to guess where MPI is installed, mpi executables should
be in PATH. You can specify CXX and CC environment variables to your specific
mpi wrappers if needed.
The library and header files will be installed on the installation directory
specified in CMAKE_INSTALL_PREFIX
a CMake configuration file will also be installed
(see examples on how to compile an application using G4mpi)
How to use
==========
How to make parallel applications
---------------------------------
An example of a main program:
\verbatim
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
int main(int argc,char** argv)
{
// At first, G4MPImanager/G4MPIsession should be created.
G4MPImanager* g4MPI= new G4MPImanager(argc,argv);
// MPI session (G4MPIsession) instead of G4UIterminal
G4MPIsession* session= g4MPI-> GetMPIsession();
// user application setting
G4RunManager* runManager= new G4RunManager();
....
// After user application setting, just start a MPI session.
MPIsession treats both interactive and batch modes.
session-> SessionStart();
// Finally, terminate the program
delete g4MPI;
delete runManager;
}
```
\endverbatim
How to compile
---------------
Using cmake, assuming G4mpi library is installed in path _g4mpi-path_ and
Geant4 is installed in _g4-path_:
> mkdir build
> cd build
> cmake -DGeant4_DIR=<g4-path>/lib[64]/Geant4-V.m.n \
-DG4mpi_DIR=<g4mpi-path>/lib[64]/G4mpi-V.m.n \
<source>
> make
Check provided examples: under examples/extended/parallel/MPI/examples for an
example of CMakeLists.txt file to be used.
### Notes about session shell
LAM/MPI users can use "G4tcsh" as an interactive session shell.
For other users (Open MPI/MPICH2), plesae use G4csh (default).
In case of OpenMPI, *LD_LIBRARY_PATH* for OpenMPI runtime libraries
should be set at run time. Alternatively, you can add this path
to the dynamic linker configuration using `ldconfig`.
(needs sys-admin authorization)
MPI runtime Environment
-----------------------
1. Make hosts/cluster configuration of your MPI environment.
2. Launch MPI runtime environment, typically executing
`lamboot` (LAM) / `mpdboot` (MPICH2) / `mpd` (Intel).
How to run
----------
For example,
> mpiexec -n # <your application>
<p>Replace mpicxx with your MPI compiler wrapper if you need to specify which one to use.</p>
Instead, `mpirun` command is more convenient for LAM users.
MPI G4UI commands
-----------------
G4UI commands handling the G4MPI interface are placed in /mpi/.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Command directory path : /mpi/
Guidance :
MPI control commands
Sub-directories :
Commands :
verbose * Set verbose level.
status * Show mpi status.
execute * Execute a macro file. (=/control/execute)
beamOn * Start a parallel run w/ thread.
.beamOn * Start a parallel run w/o thread.
masterWeight * Set weight for master node.
showSeeds * Show seeds of MPI nodes.
setMasterSeed * Set a master seed for the seed generator.
setSeed * Set a seed for a specified node.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Notes:
While "/run/beamOn" and "/mpi/beamOn" commands invoke beam-on in background,
so you can input UI commands even while event processing. Note that drawing
tracks in OpenGL with these commands causes a crash. Please use /mpi/.beamOn
command instead.
The original "/control/execute" and "/run/beamOn" are overwritten
with "/mpi/execute" and "/mpi/beamOn" commands respectively,
that are customized for the MPI interface.
Examples
========
There are a couple of examples for Geant4 MPI applications.
For using ROOT libraries (exMPI02)
- *ROOTSYS* : root path of the ROOT package
\link exMPI01 exMPI01 \endlink
A simple application.
**Configuration:**
- Geometry : chamber / calorimeter
- Primary : particle gun (200 MeV electron as default)
- Physics List : FTFP_BERT
**Features:**
- Particles are transported in a geometry without any scoring.
- Learn how to parallelized your G4 session.
\link exMPI02 exMPI02 (ROOT application) \endlink
An example of dosimetry in a water phantom.
Note: due to limited MT support in ROOT, in this example
MT is disabled, but the code is migrated to MT, ready
for MT when ROOT will support MT.
For an example of MT+MPI take a look at exMPI03
**Configuration:**
- Geometry : water phantom
- Primary : broad beam (200 MeV proton)
- Physics List : FTFP_BERT
- Analysis : ROOT histogramming
**Features:**
- Score dose distribution in a water phantom.
- Learn how to parallelized your applications.
- Create a ROOT file containing histograms/trees in each node.
\link exMPI03 exMPI03 (merging of histograms via MPI) \endlink
This example is the same as exMPI02 with the following
differences:
- It uses g4tools instead of ROOT for histogramming
- It shows how to merge, using g4tools, histograms via MPI
so that the entire statistics is accumulated in a single output file
- It also shows how to merge G4Run objects from different ranks and
how to merge scorers
- MT is enabled.
\link exMPI04 exMPI04 (merging of ntuples via MPI) \endlink
This example is the same as exMPI03 with added ntuple.
- It uses g4tools for histogramming and ntuples.
- It shows how to merge, using g4tools, ntuples via MPI in sequential mode,
so that the entire statistics is accumulated in a single output file.
- If MT is enabled, the ntuples are merged from threads to
files per ranks.
- Combined MT + MPI merging is not yet supported.
- Merging ntuples is actually supported only with Root output format.
*/
+8
View File
@@ -4,6 +4,14 @@ See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
## 2025-07-25 I. Hrivnacova (MPI-V11-03-03)
- Fixed doxygen pages tags
## 2025-07-24 I. Hrivnacova (MPI-V11-03-02)
- Migration of existing README.md to Doxygen:
- Added Doxygen keywords to README.md files
- Removed .README.txt files
## 2025-03-28 Ben Morgan (MPI-V11-03-01)
- Modernize and simplify library and example build scripts to build G4mpi library
and examples of its use in one project.
+14 -9
View File
@@ -1,3 +1,5 @@
\page Examples_MPI Category : parallel/MPI
Geant4 MPI Interface
====================
@@ -33,7 +35,8 @@ G4mpi has been tested with the following MPI flavors:
### CMake
CMake is used to build G4MPI library, that co-works with Geant4 build system.
CMake is used to build <a href="./group__extended__parallel__MPI__libG4mpi.html"> G4MPI </a>library,
that co-works with Geant4 build system.
### Optional (for exMPI02)
@@ -181,8 +184,9 @@ For using ROOT libraries (exMPI02)
- *ROOTSYS* : root path of the ROOT package
exMPI01
-------
\ref exMPI01
------------
A simple application.
**Configuration:**
@@ -195,8 +199,9 @@ A simple application.
- Particles are transported in a geometry without any scoring.
- Learn how to parallelized your G4 session.
exMPI02 (ROOT application)
--------------------------
\ref exMPI02 (ROOT application)
-------------------------------
An example of dosimetry in a water phantom.
Note: due to limited MT support in ROOT, in this example
MT is disabled, but the code is migrated to MT, ready
@@ -214,8 +219,8 @@ Note: due to limited MT support in ROOT, in this example
- Learn how to parallelized your applications.
- Create a ROOT file containing histograms/trees in each node.
exMPI03 (merging of histograms via MPI)
---------------------------------------
\ref exMPI03 (merging of histograms via MPI)
--------------------------------------------
This example is the same as exMPI02 with the following
differences:
- It uses Geant4 analysis instead of ROOT for histogramming
@@ -228,8 +233,8 @@ differences:
- dose-merged.root - merged histograms
- dose-rank0,1,2 - histograms data collected on rank 0, 1,2 before merge
exMPI04 (merging of ntuples via MPI)
---------------------------------------
\ref exMPI04 (merging of ntuples via MPI)
-----------------------------------------
This example is the same as exMPI03 with added ntuple.
- It uses Geant4 analysis for histogramming and ntuples.
- It shows how to merge, using g4tools, ntuples via MPI in sequential mode,
@@ -1,51 +0,0 @@
/// @file "MPI/examples/exMPI01/.README.txt"
/// @brief Example exMPI01 README
/*! \page exMPI01 Example : exMPI01
Description
===========
A simple application
### Configuration:
- Geometry : chamber / calorimeter
- Primary : particle gun (200 MeV electron as default)
- Physics List : FTFP_BERT
The environment variable *G4LEDATA* for low energy EM data is required.
### Features:
- Particles are transported in a geometry without any scoring.
- Learn how to parallelized your G4 session.
- - -
How to build
============
Use CMake on Geant4 library installed with CMake build.
This example requires G4mpi library to be installed
(see examples/extended/parallel/MPI/source/REDME.md)
Follow these commands,
> mkdir build
> cd build
> cmake -DG4mpi_DIR=<where-G4mpi-wasintalled>/lib[64]/G4mpi -DCMAKE_CXX_COMPILER=mpicxx \
-DGeant4_DIR=<your Geant4 install path>/lib[64]/Geant4-V.m.n <path-to-source>
(V.m.n is the version of Geant4, eg. Geant4-9.6.0)
> make
> make install
Replace mpicxx with your MPI-compiler wrapper.
How to run
----------
> mpiexec -n # ./exMPI01 [run.mac]
*/
@@ -1,3 +1,5 @@
\page ExampleexMPI01 Example : exMPI01
MPI/Examples : exMPI01
======================
@@ -22,9 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
/// @file exMPI01.cc
//
/// @brief A MPI example code
/// \file exMPI01.cc
/// \brief Main program of the MPI/exMPI01 example
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.hh
/// @brief Define action initialization
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
///
/// Define action initialization
#ifndef ACTION_INITIALIZATION_H
#define ACTION_INITIALIZATION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.hh
/// @brief Define geometry
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
///
/// Define geometry
#ifndef DETECTOR_CONSTRUCTION_H
#define DETECTOR_CONSTRUCTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Materials.hh
/// @brief Define materials
/// \file Materials.hh
/// \brief Definition of the Materials class
///
/// Define materials
#ifndef MATERIALS_H
#define MATERIALS_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file PrimaryGeneratorAction.hh
/// @brief Define primary generator action
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
///
/// Define primary generator action
#ifndef PRIMARY_GENERATOR_ACTION_H
#define PRIMARY_GENERATOR_ACTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.cc
/// @brief Define action initialization
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
///
/// Define action initialization
#include "ActionInitialization.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.cc
/// @brief Define geometry
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
///
/// Define geometry
#include "DetectorConstruction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Materials.cc
/// @brief Define materials
/// \file Materials.cc
/// \brief Implementation of the Materials class
///
/// Define materials
#include "Materials.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file PrimaryGeneratorAction.cc
/// @brief Define primary generator action
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
///
/// Define primary generator action
#include "PrimaryGeneratorAction.hh"
@@ -1,55 +0,0 @@
/// @file "MPI/examples/exMPI02/.README.txt"
/// @brief Example exMPI02 README
/*! \page exMPI02 Example : exMPI02
Description
===========
An example of dosimetry in a water phantom.
### Configuration:
- Geometry : water phantom
- Primary : broad beam (200 MeV proton)
- Physics List : FTFP_BERT
- Analysis : ROOT histogramming
The environment variables, *G4LEDATA*, *G4LEVELGAMMADATA* and *G4SAIDXSDATA*
are required for data files.
The enviromnet variable, *ROOTSYS*, is set to the root path of the ROOT package.
### Features:
- Score dose distribution in a water phantom.
- Learn how to paralleized your applications.
- Create a ROOT file containing histograms/trees in each node.
Each slave node generate a ROOT file, whose file name is different
from each other.
- - -
How to build
============
Use CMake on Geant4 library installed with CMake build.
This example requires G4mpi library to be installed
(see examples/extended/parallel/MPI/source/REDME.md)
Follow these commands,
> mkdir build
> cd build
> cmake -DG4mpi_DIR=<where-G4mpi-wasintalled>/lib[64]/G4mpi -DCMAKE_CXX_COMPILER=mpicxx \
-DGeant4_DIR=<your Geant4 install path>/lib[64]/Geant4-V.m.n <path-to-source>
(V.m.n is the version of Geant4, eg. Geant4-9.6.0)
> make
> make install
Replace mpicxx with your MPI-compiler wrapper.
How to run
----------
> mpiexec -n # ./exMPI02 [run.mac]
*/
@@ -1,3 +1,5 @@
\page ExampleexMPI02 Example : exMPI02
MPI/Examples : exMPI02
======================
@@ -22,9 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
/// @file exMPI02.cc
//
/// @brief A MPI example code
/// \file exMPI02.cc
/// \brief Main program of the MPI/exMPI02 example
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.hh
/// @brief Define action initialization
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
///
/// Define action initialization
#ifndef ACTION_INITIALIZATION_H
#define ACTION_INITIALIZATION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Analysis.hh
/// @brief Define histograms
/// \file Analysis.hh
/// \brief Definition of the Analysis class
///
/// Define histograms
#ifndef ANALYSIS_MANAGER_H
#define ANALYSIS_MANAGER_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.hh
/// @brief Define geometry
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
///
/// Define geometry
#ifndef DETECTOR_CONSTRUCTION_H
#define DETECTOR_CONSTRUCTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file EventAction.hh
/// @brief Describe event actions
/// \file EventAction.hh
/// \brief Definition of the EventAction class
///
/// Describe event actions
#ifndef EVENT_ACTION_H
#define EVENT_ACTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file MedicalBeam.hh
/// @brief Define beam profile as primary generator
/// \file MedicalBeam.hh
/// \brief Definition of the MedicalBeam class
///
/// Define beam profile as primary generator
#ifndef MEDICAL_BEAM_H
#define MEDICAL_BEAM_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunAction.hh
/// @brief Describe run actions
/// \file RunAction.hh
/// \brief Definition of the RunAction class
///
/// Describe run actions
#ifndef RUN_ACTION_H
#define RUN_ACTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelParam.hh
/// @brief Define voxel parameterization
/// \file VoxelParam.hh
/// \brief Definition of the VoxelParam class
///
/// Define voxel parameterization
#ifndef VOXEL_PARAM_H
#define VOXEL_PARAM_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelSD.hh
/// @brief Define detector sensitivity on voxels
/// \file VoxelSD.hh
/// \brief Definition of the VoxelSD class
///
/// Define detector sensitivity on voxels
#ifndef VOXEL_SD_H
#define VOXEL_SD_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.cc
/// @brief Define action initialization
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
///
/// Define action initialization
#include "ActionInitialization.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Analysis.cc
/// @brief Define histograms
/// \file Analysis.cc
/// \brief Implementation of the Analysis class
///
/// Define histograms
#include "Analysis.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.hh
/// @brief Define geometry
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
///
/// Define geometry
#include "DetectorConstruction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file EventAction.cc
/// @brief Describe event actions
/// \file EventAction.cc
/// \brief Implementation of the EventAction class
///
/// Describe event actions
#include "EventAction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file MedicalBeam.cc
/// @brief Define beam profile as primary generator
/// \file MedicalBeam.cc
/// \brief Implementation of the CLHEP::MedicalBeam class
///
/// Define beam profile as primary generator
#include "MedicalBeam.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunAction.cc
/// @brief Describe run actions
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
///
/// Describe run actions
#include "RunAction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelParam.cc
/// @brief Define voxel parameterization
/// \file VoxelParam.cc
/// \brief Implementation of the VoxelParam class
///
/// Define voxel parameterization
#include "VoxelParam.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelSD.cc
/// @brief Define detector sensitivity on voxels
/// \file VoxelSD.cc
/// \brief Implementation of the VoxelSD class
///
/// Define detector sensitivity on voxels
// #include "G4MPImanager.hh"
#include "VoxelSD.hh"
@@ -1,64 +0,0 @@
/// @file "MPI/examples/exMPI03/.README.txt"
/// @brief Example exMPI03 README
/*! \page exMPI03 Example : exMPI03
Description
===========
An example of dosimetry in a water phantom.
The example has same geometry and physics as exMPI02, only the analysis part
is diffenrent.
### Configuration:
- Geometry : water phantom
- Primary : broad beam (200 MeV proton)
- Physics List : FTFP_BERT
- Analysis : g4tools histogramming
The environment variables, *G4LEDATA*, *G4LEVELGAMMADATA* and *G4SAIDXSDATA*
are required for data files.
### Features:
- Score dose distribution in a water phantom.
- Learn how to paralleized your applications.
- Create a ROOT file containing histograms/trees in each node.
Each slave node generate a ROOT file, whose file name is different
from each other.
- MT is enabled.
- One of each object supported by g4tools is instantiated: 1D, 2D and 3D
histograms and 1D and 2D profiles.
- Histograms and profiles are merged first among threads of the same
MPI-rank and then across MPI-ranks. See RunActionMaster class for
an example on how to use the mergers.
- G4Run object and scorers (command line ones) are also merged via
MPI.
- Output: several root files are created: dose-rank*.root thread-merged
histograms for each rank; dose-merged.root, merged across threads and
across ranks.
How to build
============
Use CMake on Geant4 library installed with CMake build.
This example requires G4mpi library to be installed
(see examples/extended/parallel/MPI/source/REDME.md)
Follow these commands,
> mkdir build
> cd build
> cmake -DG4mpi_DIR=<where-G4mpi-wasintalled>/lib[64]/G4mpi -DCMAKE_CXX_COMPILER=mpicxx \
-DGeant4_DIR=<your Geant4 install path>/lib[64]/Geant4-V.m.n <path-to-source>
(V.m.n is the version of Geant4, eg. Geant4-9.6.0)
> make
> make install
Replace mpicxx with your MPI-compiler wrapper.
How to run
----------
> mpiexec -n # ./exMPI03 [run.mac]
*/
@@ -1,3 +1,5 @@
\page ExampleexMPI03 Example : exMPI03
MPI/Examples : exMPI03
======================
@@ -22,9 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
/// @file exMPI03.cc
//
/// @brief A MPI example code
/// \file exMPI03.cc
/// \brief Main program of the MPI/exMPI03 example
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.hh
/// @brief Define action initialization
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
///
/// Define action initialization
#ifndef ACTION_INITIALIZATION_H
#define ACTION_INITIALIZATION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Analysis.hh
/// @brief Define histograms
/// \file Analysis.hh
/// \brief Definition of the Analysis class
///
/// Define histograms
#ifndef ANALYSIS_MANAGER_H
#define ANALYSIS_MANAGER_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.hh
/// @brief Define geometry
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
///
/// Define geometry
#ifndef DETECTOR_CONSTRUCTION_H
#define DETECTOR_CONSTRUCTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file EventAction.hh
/// @brief Describe event actions
/// \file EventAction.hh
/// \brief Definition of the EventAction class
///
/// Describe event actions
#ifndef EVENT_ACTION_H
#define EVENT_ACTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file MedicalBeam.hh
/// @brief Define beam profile as primary generator
/// \file MedicalBeam.hh
/// \brief Definition of the MedicalBeam class
///
/// Define beam profile as primary generator
#ifndef MEDICAL_BEAM_H
#define MEDICAL_BEAM_H
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file Run.hh
/// \brief Definition of the Run class
#ifndef RUN_HH
#define RUN_HH
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunAction.hh
/// @brief Describe run actions
/// \file RunAction.hh
/// \brief Definition of the RunAction class
///
/// Describe run actions
#ifndef RUN_ACTION_H
#define RUN_ACTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunActionMaster.hh
/// @brief Describe run actions
/// \file RunActionMaster.hh
/// \brief Definition of the RunActionMaster class
///
/// Describe run actions
#ifndef RUN_ACTIONMASTER_H
#define RUN_ACTIONMASTER_H
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunMerger.hh
/// \brief Definition of the RunMerger class
#ifndef MPIRUNMERGER_HH
#define MPIRUNMERGER_HH
#include "Run.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelParam.hh
/// @brief Define voxel parameterization
/// \file VoxelParam.hh
/// \brief Definition of the VoxelParam class
///
/// Define voxel parameterization
#ifndef VOXEL_PARAM_H
#define VOXEL_PARAM_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelSD.hh
/// @brief Define detector sensitivity on voxels
/// \file VoxelSD.hh
/// \brief Definition of the VoxelSD class
///
/// Define detector sensitivity on voxels
#ifndef VOXEL_SD_H
#define VOXEL_SD_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.cc
/// @brief Define action initialization
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
///
/// Define action initialization
#include "ActionInitialization.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Analysis.cc
/// @brief Define histograms
/// \file Analysis.cc
/// \brief Implementation of the Analysis class
///
/// Define histograms
#include "Analysis.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.hh
/// @brief Define geometry
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
///
/// Define geometry
#include "DetectorConstruction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file EventAction.cc
/// @brief Describe event actions
/// \file EventAction.cc
/// \brief Implementation of the EventAction class
///
/// Describe event actions
#include "EventAction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file MedicalBeam.cc
/// @brief Define beam profile as primary generator
/// \file MedicalBeam.cc
/// \brief Implementation of the CLHEP::MedicalBeam class
///
/// Define beam profile as primary generator
#include "MedicalBeam.hh"
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file Run.cc
/// \brief Implementation of the Run class
#include "Run.hh"
#include <atomic>
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunAction.cc
/// @brief Describe run actions
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
///
/// Describe run actions
#include "RunAction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunActionMaster.cc
/// @brief Describe run actions
/// \file RunActionMaster.cc
/// \brief Implementation of the RunActionMaster class
///
/// Describe run actions
#include "RunActionMaster.hh"
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunMerger.cc
/// \brief Implementation of the RunMerger class
#include "RunMerger.hh"
#include "Run.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelParam.cc
/// @brief Define voxel parameterization
/// \file VoxelParam.cc
/// \brief Implementation of the VoxelParam class
///
/// Define voxel parameterization
#include "VoxelParam.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelSD.cc
/// @brief Define detector sensitivity on voxels
/// \file VoxelSD.cc
/// \brief Implementation of the VoxelSD class
///
/// Define detector sensitivity on voxels
// #include "G4MPImanager.hh"
#include "VoxelSD.hh"
@@ -1,63 +0,0 @@
/// @file "MPI/examples/exMPI04/.README.txt"
/// @brief Example exMPI04 README
/*! \page exMPI04 Example : exMPI04
Description
===========
An example of dosimetry in a water phantom.
The example is as exMPI03, but adds output in G4analysis ntuple
and demonstrates ntuple merging.
In difference from merging other data (G4Run, scorers, hitograms),
the ntuple data are not sent to the collecting rank(s) at the
end of run but during event processing. That's why (an) extra rank(s)
have to be reserved for this purpose. The number of extra workers requested
is set in G4MPImanager constructor in main(). While G4MPImanager
can be created with any number of extra workers (< total number),
the ntuple merging is at present supported only for one.
The extra worker is connected to the run action class via G4MPIextraWorker
object which is set to G4MPImanager in main().
The standard calls to G4AnalysisManager (creating ntuple, open, write and
close file) trigger creating all necessary analysis tools object
for merging ntuple data on flight.
MPI ntuple merging can be activated in sequential mode only;
this activation is perfomed by creating the G4MPIntupleMerger
object in the RunActionMaster constructor.
The merger must be created before creating G4AnalysisManager
(= the first call to G4AnalysisManager::Instance())
and deleted only at the end of program.
If multithreading mode is enabled, the ntuples are merged from
threads to files per ranks.
Combined MT + MPI merging is not yet supported.
Merging ntuples is actually supported only with Root output format.
How to build
============
Use CMake on Geant4 library installed with CMake build.
This example requires G4mpi library to be installed
(see examples/extended/parallel/MPI/source/REDME.md)
Follow these commands,
> mkdir build
> cd build
> cmake -DG4mpi_DIR=<where-G4mpi-wasintalled>/lib[64]/G4mpi -DCMAKE_CXX_COMPILER=mpicxx \
-DGeant4_DIR=<your Geant4 install path>/lib[64]/Geant4-V.m.n <path-to-source>
(V.m.n is the version of Geant4, eg. Geant4-9.6.0)
> make
> make install
Replace mpicxx with your MPI-compiler wrapper.
How to run
----------
> mpiexec -n # ./exMPI04 [run.mac]
*/
@@ -1,3 +1,5 @@
\page ExampleexMPI04 Example : exMPI04
MPI/Examples : exMPI04
======================
@@ -22,9 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
/// @file exMPI04.cc
//
/// @brief A MPI example code
/// \file exMPI04.cc
/// \brief Main program of the MPI/exMPI04 example
#include "G4MPIextraWorker.hh"
#include "G4MPImanager.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.hh
/// @brief Define action initialization
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
///
/// Define action initialization
#ifndef ACTION_INITIALIZATION_H
#define ACTION_INITIALIZATION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Analysis.hh
/// @brief Define histograms
/// \file Analysis.hh
/// \brief Definition of the Analysis class
///
/// Define histograms
#ifndef ANALYSIS_MANAGER_H
#define ANALYSIS_MANAGER_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.hh
/// @brief Define geometry
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
///
/// Define geometry
#ifndef DETECTOR_CONSTRUCTION_H
#define DETECTOR_CONSTRUCTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file EventAction.hh
/// @brief Describe event actions
/// \file EventAction.hh
/// \brief Definition of the EventAction class
///
/// Describe event actions
#ifndef EVENT_ACTION_H
#define EVENT_ACTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file MedicalBeam.hh
/// @brief Define beam profile as primary generator
/// \file MedicalBeam.hh
/// \brief Definition of the MedicalBeam class
///
/// Define beam profile as primary generator
#ifndef MEDICAL_BEAM_H
#define MEDICAL_BEAM_H
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file Run.hh
/// \brief Definition of the Run class
#ifndef RUN_HH
#define RUN_HH
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunAction.hh
/// @brief Describe run actions
/// \file RunAction.hh
/// \brief Definition of the RunAction class
///
/// Describe run actions
#ifndef RUN_ACTION_H
#define RUN_ACTION_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunActionMaster.hh
/// @brief Describe run actions
/// \file RunActionMaster.hh
/// \brief Definition of the RunActionMaster class
///
/// Describe run actions
#ifndef RUN_ACTIONMASTER_H
#define RUN_ACTIONMASTER_H
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunMerger.hh
/// \brief Definition of the RunMerger class
#ifndef MPIRUNMERGER_HH
#define MPIRUNMERGER_HH
#include "Run.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelParam.hh
/// @brief Define voxel parameterization
/// \file VoxelParam.hh
/// \brief Definition of the VoxelParam class
///
/// Define voxel parameterization
#ifndef VOXEL_PARAM_H
#define VOXEL_PARAM_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelSD.hh
/// @brief Define detector sensitivity on voxels
/// \file VoxelSD.hh
/// \brief Definition of the VoxelSD class
///
/// Define detector sensitivity on voxels
#ifndef VOXEL_SD_H
#define VOXEL_SD_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file ActionInitialization.cc
/// @brief Define action initialization
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
///
/// Define action initialization
#include "ActionInitialization.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file Analysis.cc
/// @brief Define histograms and ntuples
/// \file Analysis.cc
/// \brief Implementation of the Analysis class
///
/// Define histograms and ntuples
#include "Analysis.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file DetectorConstruction.hh
/// @brief Define geometry
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
///
/// Define geometry
#include "DetectorConstruction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file EventAction.cc
/// @brief Describe event actions
/// \file EventAction.cc
/// \brief Implementation of the EventAction class
///
/// Describe event actions
#include "EventAction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file MedicalBeam.cc
/// @brief Define beam profile as primary generator
/// \file MedicalBeam.cc
/// \brief Implementation of the CLHEP::MedicalBeam class
///
/// Define beam profile as primary generator
#include "MedicalBeam.hh"
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file Run.cc
/// \brief Implementation of the Run class
#include "Run.hh"
#include <atomic>
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunAction.cc
/// @brief Describe run actions
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
///
/// Describe run actions
#include "RunAction.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file RunActionMaster.cc
/// @brief Describe run actions
/// \file RunActionMaster.cc
/// \brief Implementation of the RunActionMaster class
///
/// Describe run actions
#include "RunActionMaster.hh"
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunMerger.cc
/// \brief Implementation of the RunMerger class
#include "RunMerger.hh"
#include "Run.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelParam.cc
/// @brief Define voxel parameterization
/// \file VoxelParam.cc
/// \brief Implementation of the VoxelParam class
///
/// Define voxel parameterization
#include "VoxelParam.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// @file VoxelSD.cc
/// @brief Define detector sensitivity on voxels
/// \file VoxelSD.cc
/// \brief Implementation of the VoxelSD class
///
/// Define detector sensitivity on voxels
// #include "G4MPImanager.hh"
#include "VoxelSD.hh"
@@ -22,7 +22,8 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIextraWorker.hh
/// @brief Extra MPI worker
// The extra MPI worker class defines actions on an extra MPI worker
// which does not perform event processing.
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIhistoMerger.hh
/// @brief Histo merger
// Merge G4analysis histogram objects via MPI
//
// History:
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIntupleMerger.hh
/// @brief Ntuple merger
// Class for configuring G4analysis for merging ntuples via MPI
//
// Author: Ivana Hrivnacova, 21/11/2018 (ivana@ipno.in2p3.fr)
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIrunMerger.hh
/// @brief Run merger
#ifndef G4MPIRUNMERGER_HH_
#define G4MPIRUNMERGER_HH_
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIscorerMerger.hh
/// @brief Scorer merger
#ifndef G4MPISCORERMERGER_HH
#define G4MPISCORERMERGER_HH
#include "G4MPImanager.hh"
@@ -22,8 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Utility functions for MPI G4 interface
/// @file G4MPIutils.hh
/// @brief Utility functions for MPI G4 interface
#ifndef G4MPIUTILS_HH
#define G4MPIUTILS_HH
#include <functional>
@@ -22,10 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4VMPIextraWorker.hh
/// @brief The interface class for an extra MPI worker
// The interface class for an extra MPI worker
//
// Author: Ivana Hrivnacova, 21/11/2018 (ivana@ipno.in2p3.fr)
#ifndef G4MVPIEXTRAWORKER_HH
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4VUserMPIrunMerger.hh
/// @brief A base class for user run merger
#ifndef G4MPIRUNMERGER_HH
#define G4MPIRUNMERGER_HH
#include "G4MPImanager.hh"
@@ -22,7 +22,8 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIextraWorker.cc
/// @brief Extra MPI worker
// The extra MPI worker class defines actions on an extra MPI worker
// which does not perform event processing.
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIhistoMerger.cc
/// @brief Histo merger
// Merge G4analysis histogram objects via MPI
//
// History:
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIntupleMerger.cc
/// @brief Ntuple merger
// Class for configuring G4analysis for merging ntuples via MPI
//
// Author: Ivana Hrivnacova, 21/11/2018 (ivana@ipno.in2p3.fr)
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIscorerMerger.cc
/// @brief Scorer merger
#include "G4MPIscorerMerger.hh"
#include "G4MPIutils.hh"
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4MPIutils.cc
/// @brief Utility functions for MPI G4 interface
#include "G4MPIutils.hh"
#include "globals.hh"
@@ -22,7 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// @file G4VUserMPIrunMerger.cc
/// @brief A base class for user run merger
#include "G4VUserMPIrunMerger.hh"
#include "G4MPImanager.hh"