Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -6,6 +6,16 @@ project(ThreadsafeScorers C CXX)
|
||||
find_package(Geant4 REQUIRED ui_all vis_all)
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
option(USE_TIMEMORY "Enable timemory if not built at Geant4 level" OFF)
|
||||
set(timemory_COMPONENTS "headers;caliper;papi;gotcha;gperftools-cpu;vector"
|
||||
CACHE STRING "timemory components")
|
||||
set(timemory_FIND_COMPONENTS_INTERFACE ${PROJECT_NAME}-timemory)
|
||||
|
||||
if(USE_TIMEMORY AND NOT TARGET geant4-timemory)
|
||||
find_package(timemory 3.0 REQUIRED COMPONENTS ${timemory_COMPONENTS})
|
||||
set(timemory_LIBRARIES ${PROJECT_NAME}-timemory)
|
||||
endif()
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
${Geant4_INCLUDE_DIR})
|
||||
|
||||
@@ -19,7 +29,7 @@ add_executable(${name} ${name}.cc ${headers}
|
||||
${sources}
|
||||
${macros})
|
||||
|
||||
target_link_libraries(${name} ${Geant4_LIBRARIES})
|
||||
target_link_libraries(${name} ${Geant4_LIBRARIES} ${timemory_LIBRARIES})
|
||||
|
||||
# For IDEs - specifically Xcode
|
||||
source_group("macros" FILES ${macros})
|
||||
|
||||
@@ -14,6 +14,14 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
22/11/2019 Jonathan Madsen (ThreadsafeScorers-V10-05-01)
|
||||
- Updated CMakeLists.txt to support enabling timemory even without
|
||||
support at the Geant4 level
|
||||
|
||||
19/11/2019 Gabriele Cosmo (ThreadsafeScorers-V10-05-00)
|
||||
- Fixed compilation warning on Windows for calling TIMEMORY_AUTO_TIMER
|
||||
with no arguments in TSPrimaryGeneratorAction::GeneratePrimaries().
|
||||
|
||||
13/11/2018 Jonathan Madsen (ThreadsafeScorers-V10-04-06)
|
||||
- Fixed shadowing warnings in G4atomic.hh header (recommit of ThreadsafeScorers-V10-04-03)
|
||||
|
||||
@@ -29,7 +37,7 @@ track of all tags.
|
||||
- Added scorers with G4StatAnalysis and G4ConvergenceTester
|
||||
- Improved scheme for using TiMemory to time how long the
|
||||
scoring takes w.r.t. storage container and PS
|
||||
|
||||
|
||||
15/6/2018 Gabriele Cosmo (ThreadsafeScorers-V10-04-03)
|
||||
- Fixed shadowing warnings in G4atomic.hh header.
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ TSPrimaryGeneratorAction::~TSPrimaryGeneratorAction()
|
||||
|
||||
void TSPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
TIMEMORY_AUTO_TIMER();
|
||||
TIMEMORY_AUTO_TIMER("");
|
||||
static TSDetectorConstruction* detector
|
||||
= TSDetectorConstruction::Instance();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -89,6 +89,15 @@ void message(RunManager* runmanager)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TIMEMORY_INIT(argc, argv);
|
||||
|
||||
#if defined(GEANT4_USE_TIMEMORY)
|
||||
// override environment settings
|
||||
tim::settings::json_output() = true;
|
||||
tim::settings::dart_output() = true;
|
||||
tim::settings::dart_type() = "peak_rss";
|
||||
tim::settings::dart_count() = 1;
|
||||
#endif
|
||||
|
||||
// Detect interactive mode (if no arguments) and define UI session
|
||||
//
|
||||
@@ -138,36 +147,6 @@ int main(int argc, char** argv)
|
||||
delete ui;
|
||||
}
|
||||
|
||||
#ifdef GEANT4_USE_TIMEMORY
|
||||
G4cout << "\nOutputting TiMemory results...\n" << G4endl;
|
||||
tim::manager* manager = tim::manager::instance();
|
||||
# if defined(G4MULTITHREADED)
|
||||
// TiMemory by default will report master + workers
|
||||
manager->set_get_num_threads_func(
|
||||
[=]() { return runmanager->GetNumberOfThreads(); });
|
||||
# endif
|
||||
manager->write_report(std::cout, true);
|
||||
std::string fname = argv[0];
|
||||
std::string rfname = fname + ".txt";
|
||||
std::string sfname = fname + ".json";
|
||||
manager->write_report(rfname);
|
||||
manager->write_serialization(sfname);
|
||||
if(std::system(nullptr))
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "timemory-plotter -f " << sfname << " -t \"ThreadSafe Scorers\" "
|
||||
<< "-o plots -e --timing-fields cpu wall sys";
|
||||
int ret = std::system(ss.str().c_str());
|
||||
if(ret != 0)
|
||||
{
|
||||
G4ExceptionDescription desc;
|
||||
desc << "Error generating plots with command: '"
|
||||
<< ss.str() << "'";
|
||||
G4Exception("ThreadsafeScorers::main", "0001", JustWarning, desc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
|
||||
Reference in New Issue
Block a user