diff --git a/ChangeLog b/ChangeLog index e058c7c..6ef4396 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ -2014-06-26 Juergen Knoedlseder +2014-07-09 Juergen Knoedlseder * Version 0.8.0 released ======================== Support energy dispersion in ctobssim, ctlike and ctmodel + Correct ctobssim for thread safety Enhance documentation diff --git a/NEWS b/NEWS index 7c72ca8..37037b8 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 00-08-00 Author(s) : Juergen Knoedlseder -26 June 2014 +9 July 2014 1. Introduction @@ -23,7 +23,10 @@ None 4. ctobssim - CTA observation simulation ---------------------------------------- -None +ctobssim was not fully thread save as the models were shared among the +threads which led to concurrent memory access when evaluating the Monte +Carlo cache. The models are now copied within the parallel section, +avoiding concurrent memory access (#1258). ctobssim now also supports the handling of energy dispersion. Energy dispersion can be switched on or off using the hidden edisp parameter. diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 29f353d..ae1c7fb 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -305,6 +305,9 @@ void ctobssim::run(void) wrklog.cout(true); } + // Allocate and initialize copies for multi-threading + GModels models(m_obs.models()); + // Copy configuration from application logger to thread logger wrklog.date(log.date()); wrklog.name(log.name()); @@ -340,10 +343,10 @@ void ctobssim::run(void) int events_before = obs->events()->size(); // Simulate source events - simulate_source(obs, m_obs.models(), m_rans[i], &wrklog); + simulate_source(obs, models, m_rans[i], &wrklog); // Simulate source events - simulate_background(obs, m_obs.models(), m_rans[i], &wrklog); + simulate_background(obs, models, m_rans[i], &wrklog); // Dump simulation results if (logNormal()) {