-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9896eb2
Showing
136 changed files
with
12,405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
build | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# .readthedocs.yml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF | ||
formats: | ||
|
||
# Optionally set the version of Python and requirements required to build your docs | ||
python: | ||
version: 3.7 | ||
install: | ||
- requirements: docs/requires.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#---------------------------------------------------------------------------- | ||
# Setup the project | ||
cmake_minimum_required(VERSION 3.3 FATAL_ERROR) | ||
project(TestEm3) | ||
|
||
#---------------------------------------------------------------------------- | ||
# Find Geant4 and set G4 libraries, include directories, etc... | ||
# | ||
find_package(Geant4 REQUIRED) | ||
message (STATUS "Geant4_INCLUDE_DIRS = ${Geant4_INCLUDE_DIRS}") | ||
message (STATUS "Geant4_LIBRARIES = ${Geant4_LIBRARIES}") | ||
message (STATUS "Geant4_CXX_FLAGS = ${Geant4_CXX_FLAGS}") | ||
message (STATUS "Geant4_BUILD_TYPE = ${Geant4_BUILD_TYPE}") | ||
message (STATUS "Geant4_static_FOUND = ${Geant4_static_FOUND}") | ||
|
||
# set the same configuration that was used to build G4 | ||
set (CMAKE_CXX_FLAGS "${Geant4_CXX_FLAGS}") | ||
#set (CMAKE_CXX_FLAGS "-g -O0 -fno-inline -std=c++11") | ||
set (CMAKE_BUILD_TYPE "${Geant4_BUILD_TYPE}") | ||
|
||
message(STATUS "${CMAKE_CXX_FLAGS}") | ||
|
||
set (BUILD_SHARED_LIBS ON) | ||
set (BUILD_STATIC_LIBS OFF) | ||
if (Geant4_static_FOUND) | ||
set (BUILD_SHARED_LIBS OFF) | ||
set (BUILD_STATIC_LIBS ON) | ||
endif () | ||
|
||
|
||
# set the directory where the libraries will be placed | ||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | ||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | ||
|
||
|
||
#---------------------------------------------------------------------------- | ||
# CUDA | ||
option (G4HepEm_CUDA_BUILD "BUILD with CUDA support" OFF) | ||
if (G4HepEm_CUDA_BUILD) | ||
find_package (CUDA 6.0 REQUIRED) | ||
if (CUDA_FOUND) | ||
add_definitions (-DG4HepEm_CUDA_BUILD) | ||
message (STATUS "Found CUDA at ${CUDA_TOOLKIT_ROOT_DIR} (${CUDA_VERSION_STRING})") | ||
include_directories (AFTER SYSTEM ${CUDA_INCLUDE_DIRS}) | ||
# message (STATUS "CUDA INCLUDE DIRECTORY = ${CUDA_INCLUDE_DIRS}") | ||
# message (STATUS "CUDA LIBRARIES = ${CUDA_LIBRARIES}") | ||
# message (STATUS "CUDA CUBLAS LIBRARIES = ${CUDA_CUBLAS_LIBRARIES}") | ||
# message (STATUS "CUDA cudart static LIBRARY = ${CUDA_cudart_static_LIBRARY}") | ||
# message (STATUS "CUDA cusolver LIBRARY = ${CUDA_cusolver_LIBRARY}") | ||
# message (STATUS " ") | ||
###### | ||
enable_language(CUDA) | ||
# set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} | ||
# -Xcompiler -fPIC -Xcudafe | ||
# --diag_suppress=boolean_controlling_expr_is_constant | ||
# --disable-warnings | ||
# -lineinfo" | ||
# ) | ||
else (CUDA_FOUND) | ||
message(FATAL_ERROR "REQUIRED CUDA LIBRARIES WERE NOT FOUND") | ||
endif (CUDA_FOUND) | ||
endif (G4HepEm_CUDA_BUILD) | ||
|
||
|
||
#---------------------------------------------------------------------------- | ||
# Build G4HepEm libraries | ||
add_subdirectory (G4HEPEM) | ||
|
||
|
||
|
||
#---------------------------------------------------------------------------- | ||
# Build the example applications | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
|
||
add_subdirectory (G4HepEmData) | ||
add_subdirectory (G4HepEmInit) | ||
add_subdirectory (G4HepEmRun) | ||
|
||
|
||
include_directories ( | ||
${CMAKE_SOURCE_DIR}/G4HepEm/include | ||
${G4HEPEMDATA_INC_DIR} | ||
${G4HEPEMINIT_INC_DIR} | ||
${G4HEPEMRUN_INC_DIR} | ||
) | ||
|
||
message (STATUS "??? ${G4HEPEMINIT_INC_DIR}") | ||
|
||
file ( GLOB G4HEPEM_headers ${CMAKE_SOURCE_DIR}/G4HepEm/include/*.hh) | ||
file ( GLOB G4HEPEM_sources ${CMAKE_SOURCE_DIR}/G4HepEm/src/*.cc) | ||
if (BUILD_STATIC_LIBS) | ||
add_library (g4HepEm STATIC ${G4HEPEM_sources}) | ||
else () | ||
add_library (g4HepEm SHARED ${G4HEPEM_sources}) | ||
endif () | ||
|
||
set_target_properties(g4HepEm PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS}) | ||
target_link_libraries(g4HepEm g4HepEmData g4HepEmInit g4HepEmRun) # ${Geant4_LIBRARIES}) | ||
|
||
## ---------------------------------------------------------------------------- | ||
## Install G4HepEm libraries and headers | ||
install (FILES ${G4HEPEM_headers} DESTINATION includes) | ||
install (TARGETS g4HepEm DESTINATION lib) | ||
|
||
## ---------------------------------------------------------------------------- | ||
## Create and install G4HepEm CMake Config file | ||
## | ||
configure_file (${CMAKE_SOURCE_DIR}/cmake/G4HepEmConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/cmake/G4HepEmConfig.cmake @ONLY) | ||
|
||
install (FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/cmake/G4HepEmConfig.cmake | ||
DESTINATION lib/cmake/G4HepEm | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
|
||
set (G4HEPEMDATA_INC_DIR ${CMAKE_SOURCE_DIR}/G4HepEm/G4HepEmData/include PARENT_SCOPE) | ||
|
||
include_directories (${CMAKE_SOURCE_DIR}/G4HepEm/G4HepEmData/include) | ||
file ( GLOB G4HEPEMDATA_headers ${CMAKE_SOURCE_DIR}/G4HepEm/G4HepEmData/include/*.hh) | ||
file ( GLOB G4HEPEMDATA_CXX_sources ${CMAKE_SOURCE_DIR}/G4HepEm/G4HepEmData/src/*.cc) | ||
|
||
# | ||
# CUDA | ||
|
||
if (G4HepEm_CUDA_BUILD) | ||
file (GLOB G4HEPEMDATA_CUDA_sources ${CMAKE_SOURCE_DIR}/G4HepEm/G4HepEmData/src/*.cu) | ||
# add possible CUDA headers | ||
# list (APPEND G4HEPEMDATA_headers ) | ||
# | ||
if (BUILD_STATIC_LIBS) | ||
cuda_add_library (g4HepEmData STATIC ${G4HEPEMDATA_CXX_sources} ${G4HEPEMDATA_CUDA_sources}) | ||
else (BUILD_STATIC_LIBS) | ||
cuda_add_library (g4HepEmData SHARED ${G4HEPEMDATA_CXX_sources} ${G4HEPEMDATA_CUDA_sources}) | ||
endif (BUILD_STATIC_LIBS) | ||
set_property(TARGET g4HepEmData PROPERTY CUDA_SEPARABLE_COMPILATION ON) | ||
target_link_libraries(g4HepEmData ${CUDA_LIBRARIES}) | ||
else (G4HepEm_CUDA_BUILD) | ||
if (BUILD_STATIC_LIBS) | ||
add_library (g4HepEmData STATIC ${G4HEPEMDATA_CXX_sources}) | ||
else (BUILD_STATIC_LIBS) | ||
add_library (g4HepEmData SHARED ${G4HEPEMDATA_CXX_sources}) | ||
endif (BUILD_STATIC_LIBS) | ||
set_target_properties(g4HepEmData PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS}) | ||
endif (G4HepEm_CUDA_BUILD) | ||
|
||
|
||
## ---------------------------------------------------------------------------- | ||
## Install G4HepEm libraries and headers | ||
install (FILES ${G4HEPEMDATA_headers} DESTINATION includes) | ||
install (TARGETS g4HepEmData DESTINATION lib) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef G4HepEmCuUtils_HH | ||
#define G4HepEmCuUtils_HH | ||
|
||
#ifdef G4HepEm_CUDA_BUILD | ||
|
||
#include <cuda_runtime.h> | ||
#include <cstdio> | ||
|
||
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); } | ||
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true){ | ||
if (code != cudaSuccess) { | ||
fprintf(stderr,"GPUassert: %s %s %d\n", | ||
cudaGetErrorString(code), file, line); | ||
if (abort) exit(code); | ||
} | ||
} | ||
|
||
#endif // G4HepEm_CUDA_BUILD | ||
|
||
#endif // G4HepEmCuUtils_HH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
|
||
#ifndef G4HepEmData_HH | ||
#define G4HepEmData_HH | ||
|
||
|
||
struct G4HepEmMatCutData; | ||
struct G4HepEmMaterialData; | ||
struct G4HepEmElementData; | ||
|
||
struct G4HepEmElectronData; | ||
|
||
#ifdef G4HepEm_CUDA_BUILD | ||
struct G4HepEmElectronDataOnDevice; | ||
#endif // G4HepEm_CUDA_BUILD | ||
|
||
struct G4HepEmSBTableData; | ||
|
||
/** | ||
* @file G4HepEmData.hh | ||
* @struct G4HepEmData | ||
* @author M. Novak | ||
* @date 2020 | ||
* | ||
* @brief The top level, global data structure i.e. collection of global data | ||
* structures used by all physics interactions covered by `G4HepEm`. | ||
* | ||
* There supposed to be a single instance of this data structure constructed and | ||
* stored by the Master ::G4HepEmRunManager: constructed in the InitializeGlobal() | ||
* method of G4HepEmRunManager called from its Initialise() method in case of the | ||
* master run-manager and only at once. | ||
* Worker G4HepEmRunManager -s will have their pointer set to this master | ||
* G4HepEmRunManager G4HepEmData member object. | ||
* | ||
* Members of this data structure, represented by their pointers, are created | ||
* individualy by invoking the dedicated intialisation methods one-by-one. | ||
* | ||
* In case of CUDA build, the members, suffixed by `_gpu`, points do device memory | ||
* locations where the corresponding data structures are located (after copying | ||
* them). All the corresponding members can be (deep) copied from the host to | ||
* device by calling the G4HepEmData::CopyG4HepEmDataToGPU function. This will invoke | ||
* the dedicated copy methods provided by the individual data structures. | ||
* | ||
* The dynamically allocated memory, represented by all the members of this | ||
* collection (including device side memeory as well in case of CUDA build), can | ||
* be cleaned by calling the `FreeG4HepEmData()` function. This is done, in the | ||
* G4HepEmRunManager::Clean() method. | ||
*/ | ||
|
||
struct G4HepEmData { | ||
/** Global G4HepEmMatCutData i.e. material and scondary production threshold related data.*/ | ||
struct G4HepEmMatCutData* fTheMatCutData = nullptr; | ||
/** Global material and scondary production threshold related data.*/ | ||
struct G4HepEmMaterialData* fTheMaterialData = nullptr; | ||
struct G4HepEmElementData* fTheElementData = nullptr; | ||
|
||
struct G4HepEmElectronData* fTheElectronData = nullptr; | ||
struct G4HepEmElectronData* fThePositronData = nullptr; | ||
|
||
struct G4HepEmSBTableData* fTheSBTableData = nullptr; | ||
|
||
|
||
#ifdef G4HepEm_CUDA_BUILD | ||
struct G4HepEmMatCutData* fTheMatCutData_gpu = nullptr; | ||
struct G4HepEmMaterialData* fTheMaterialData_gpu = nullptr; | ||
struct G4HepEmElementData* fTheElementData_gpu = nullptr; | ||
|
||
struct G4HepEmElectronDataOnDevice* fTheElectronData_gpu = nullptr; | ||
struct G4HepEmElectronDataOnDevice* fThePositronData_gpu = nullptr; | ||
#endif // G4HepEm_CUDA_BUILD | ||
|
||
}; | ||
|
||
/** Function that ...*/ | ||
void InitG4HepEmData (struct G4HepEmData* theHepEmData); | ||
|
||
/** Function that ...*/ | ||
void FreeG4HepEmData (struct G4HepEmData* theHepEmData); | ||
|
||
|
||
#ifdef G4HepEm_CUDA_BUILD | ||
/** Function that ...*/ | ||
void CopyG4HepEmDataToGPU(struct G4HepEmData* onCPU); | ||
|
||
/** Function that ...*/ | ||
void FreeG4HepEmDataOnGPU(struct G4HepEmData* onCPU); | ||
#endif // G4HepEm_CUDA_BUILD | ||
|
||
|
||
#endif // G4HepEmData_HH |
Oops, something went wrong.