Import Geant4 11.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2025-06-26 09:17:29 +02:00
parent 20a218bbe1
commit a499fb82e9
1941 changed files with 203285 additions and 95593 deletions
-5
View File
@@ -15,9 +15,4 @@ different techniques for achieving event parallelism with Geant4.
and so on.
<br><br>
- \link Examples_tbb Examples TBB \endlink demonstrate how to
interface a simple application with the Intel Threading Building Blocks
library (TBB), and organise MT event-level parallelism as TBB tasks.
<br><br>
*/
@@ -14,10 +14,4 @@ else()
message(STATUS "G4 Examples: MPI not installed --> MPI examples disabled")
endif()
find_package(TBB QUIET)
if(TBB_FOUND)
add_subdirectory(TBB)
else()
message(STATUS "G4 Examples: TBB not installed --> TBB example disabled")
endif()
+5
View File
@@ -5,6 +5,11 @@ which **must** added in reverse chronological order (newest at the top). It must
be used as a substitute for writing good git commit messages!
## 2025-03-30 Ben Morgan (exparallel-V11-03-00)
- Retire obsolete and untested TBB example.
- Functionality fully provided by tasking run manager with TBB support with no
user code changes required.
## 2024-05-30 Ben Morgan (exparallel-V11-02-00)
- Remove obsolete and untested TopC example
+12 -15
View File
@@ -1,22 +1,19 @@
# - CmakeLists.txt for MPI examples
# This file should be used when configuring Geant4 with GEANT4_BUILD_EXAMPLES=ON
# Do not use in other cases
# To compile G4mpi as a standalone package, first compile the source subdir
# and then examples, see included README files
cmake_minimum_required(VERSION 3.16...3.27)
project(G4mpi)
cmake_minimum_required(VERSION 3.16...3.27)
# - Require both MPI and Geant4.
# Only MPI component required is CXX (ability to use C++ with C API).
find_package(MPI REQUIRED CXX)
find_package(Geant4 REQUIRED ui_all vis_all)
# - The G4mpi library used by all the examples
add_subdirectory(source)
set(G4mpi_DIR "${PROJECT_BINARY_DIR}/source")
add_subdirectory(examples)
add_dependencies(exMPI01 G4mpi)
if(TARGET exMPI02) #If ROOT not found, this does not exists
add_dependencies(exMPI02 G4mpi)
endif()
add_dependencies(exMPI03 G4mpi)
add_custom_target(MPI DEPENDS G4mpi exMPI01 exMPI02 exMPI03)
# - The example applications themselves
add_subdirectory(exMPI01)
add_subdirectory(exMPI02)
add_subdirectory(exMPI03)
add_subdirectory(exMPI04)
+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-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.
## 2025-02-18 Chris Brady, Filippo Falezza, Ben Morgan (MPI-V11-03-00)
- Move MPI from deprecated C++ interface to C interface (MPI 3+)
- Changes from privately supplied patch, and through [GitHub PR #81](https://github.com/Geant4/geant4/pull/81/)
## 2023-03-11 Ben Morgan (MPI-V11-02-00)
- Move CTests definitions to tests/ctests_examples
+3 -3
View File
@@ -27,9 +27,9 @@ 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
* OpenMPI 5.0.2 and 4.1.4
* ~~MPICH 3.2~~
* ~~Intel MPI 5.0.1~~
### CMake
@@ -0,0 +1,34 @@
#----------------------------------------------------------------------------
# Create a new project level to avoid name clashes with other exMPI0N
project(exMPI01)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, use our local headers, and link it to the Geant4 libraries
#
add_executable(exMPI01 exMPI01.cc ${sources} ${headers})
target_include_directories(exMPI01 PRIVATE include)
target_link_libraries(exMPI01 PRIVATE ${Geant4_LIBRARIES} G4mpi::G4mpi)
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build exMPI01. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(exMPI01_SCRIPTS
run.mac
vis.mac
)
foreach(_script ${exMPI01_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
@@ -0,0 +1,42 @@
#----------------------------------------------------------------------------
# Create a new project level to avoid name clashes with other exMPI0N
project(exMPI02)
# Find ROOT and return if we don't have it to prvent building this project
find_package(ROOT QUIET COMPONENTS Hist RIO)
if(NOT ROOT_FOUND)
message(STATUS "ROOT not found, disabling exMPI02 build")
return()
endif()
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(exMPI02 exMPI02.cc ${sources} ${headers})
target_include_directories(exMPI02 PRIVATE include)
target_link_libraries(exMPI02 PRIVATE ${Geant4_LIBRARIES} G4mpi::G4mpi ROOT::Hist ROOT::RIO)
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build exMPI02. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(exMPI02_SCRIPTS
run.mac
vis.mac
)
foreach(_script ${exMPI02_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
@@ -55,7 +55,7 @@ void RunAction::EndOfRunAction(const G4Run*)
G4int rank = G4MPImanager::GetManager()->GetRank();
char str[64];
sprintf(str, "dose-rank%03d.root", rank);
snprintf(str, 64, "dose-rank%03d.root", rank);
G4String fname(str);
Analysis* myana = Analysis::GetAnalysis();
@@ -0,0 +1,35 @@
#----------------------------------------------------------------------------
# Create a new project level to avoid name clashes with other exMPI0N
project(exMPI03)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(exMPI03 exMPI03.cc ${sources} ${headers})
target_include_directories(exMPI03 PRIVATE include)
target_link_libraries(exMPI03 ${Geant4_LIBRARIES} G4mpi::G4mpi)
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build exMPI03. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(exMPI03_SCRIPTS
run.mac
vis.mac
)
foreach(_script ${exMPI03_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
@@ -32,7 +32,7 @@ void RunMerger::Pack()
{
// Very imporant, here fMyRun is const!
// Register a user-data in the user Run class with MPI merger
InputUserData(const_cast<int*>(&(fMyRun->fDummyCounter)), MPI::INT, 1);
InputUserData(const_cast<int*>(&(fMyRun->fDummyCounter)), MPI_INT, 1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,6 +40,6 @@ G4Run* RunMerger::UnPack()
{
// Create a dummy user-Run, used to contain data received via MPI
Run* aDummyRun = new Run;
OutputUserData(&(aDummyRun->fDummyCounter), MPI::INT, 1);
OutputUserData(&(aDummyRun->fDummyCounter), MPI_INT, 1);
return aDummyRun;
}
@@ -0,0 +1,35 @@
#----------------------------------------------------------------------------
# Create a new project level to avoid name clashes with other exMPI0N
project(exMPI04)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(exMPI04 exMPI04.cc ${sources} ${headers})
target_include_directories(exMPI04 PRIVATE include)
target_link_libraries(exMPI04 PRIVATE ${Geant4_LIBRARIES} G4mpi::G4mpi)
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build exMPI04. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(exMPI04_SCRIPTS
run.mac
vis.mac
)
foreach(_script ${exMPI04_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
@@ -32,7 +32,7 @@ void RunMerger::Pack()
{
// Very imporant, here fMyRun is const!
// Register a user-data in the user Run class with MPI merger
InputUserData(const_cast<int*>(&(fMyRun->fDummyCounter)), MPI::INT, 1);
InputUserData(const_cast<int*>(&(fMyRun->fDummyCounter)), MPI_INT, 1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,6 +40,6 @@ G4Run* RunMerger::UnPack()
{
// Create a dummy user-Run, used to contain data received via MPI
Run* aDummyRun = new Run;
OutputUserData(&(aDummyRun->fDummyCounter), MPI::INT, 1);
OutputUserData(&(aDummyRun->fDummyCounter), MPI_INT, 1);
return aDummyRun;
}
@@ -1,8 +0,0 @@
# - CmakeLists.txt for MPI examples
cmake_minimum_required(VERSION 3.16...3.27)
add_subdirectory(exMPI01)
add_subdirectory(exMPI02)
add_subdirectory(exMPI03)
add_subdirectory(exMPI04)
@@ -1,75 +0,0 @@
# - CmakeLists.txt for building an application
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.27)
project(exMPI01)
#----------------------------------------------------------------------------
# check MPI package...
find_package(MPI REQUIRED)
# modify these variables if needed
#set(CMAKE_CXX_COMPILER mpicxx)
#set(CMAKE_CXX_COMPILER mpiicpc)
#set(CMAKE_CXX_INCLUDE_PATH )
#------------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 REQUIRED ui_all vis_all)
else()
find_package(Geant4 REQUIRED)
endif()
find_package(G4mpi REQUIRED)
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include)
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR}
${G4mpi_INCLUDE_DIR})
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(exMPI01 exMPI01.cc ${sources} ${headers})
target_link_libraries(exMPI01 ${G4mpi_LIBRARIES} ${Geant4_LIBRARIES})
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build exMPI01. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(exMPI01_SCRIPTS
run.mac
vis.mac
)
foreach(_script ${exMPI01_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS exMPI01 RUNTIME DESTINATION bin)

Some files were not shown because too many files have changed in this diff Show More