Commit 472802158ee83790ec481ce392cdc2234fbfb0ab
1 parent
c754c50d
Add parallelization to ctbin (#1970)
Parallelized computation over different observations.
Showing
1 changed file
with
6 additions
and
2 deletions
src/ctbin/ctbin.cpp
| @@ -236,8 +236,11 @@ void ctbin::run(void) | @@ -236,8 +236,11 @@ void ctbin::run(void) | ||
| 236 | log_header1(TERSE, gammalib::number("Bin observation", m_obs.size())); | 236 | log_header1(TERSE, gammalib::number("Bin observation", m_obs.size())); |
| 237 | 237 | ||
| 238 | // Loop over all unbinned CTA observations in the container | 238 | // Loop over all unbinned CTA observations in the container |
| 239 | - for (GCTAObservation* obs = first_unbinned_observation(); obs != NULL; | ||
| 240 | - obs = next_unbinned_observation()) { | 239 | +// for (GCTAObservation* obs = first_unbinned_observation(); obs != NULL; |
| 240 | +// obs = next_unbinned_observation()) { | ||
| 241 | + #pragma omp parallel for | ||
| 242 | + for (int o=0; o<m_obs.size(); o++) { | ||
| 243 | + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[o]); | ||
| 241 | 244 | ||
| 242 | // Fill the cube | 245 | // Fill the cube |
| 243 | fill_cube(obs); | 246 | fill_cube(obs); |
| @@ -555,6 +558,7 @@ void ctbin::fill_cube(GCTAObservation* obs) | @@ -555,6 +558,7 @@ void ctbin::fill_cube(GCTAObservation* obs) | ||
| 555 | m_livetime += obs->livetime(); | 558 | m_livetime += obs->livetime(); |
| 556 | 559 | ||
| 557 | // Log filling results | 560 | // Log filling results |
| 561 | + log_header3(TERSE, get_obs_header(obs)); | ||
| 558 | log_value(NORMAL, "Events in list", obs->events()->size()); | 562 | log_value(NORMAL, "Events in list", obs->events()->size()); |
| 559 | log_value(NORMAL, "Events in cube", num_in_map); | 563 | log_value(NORMAL, "Events in cube", num_in_map); |
| 560 | log_value(NORMAL, "Events outside RoI", num_outside_roi); | 564 | log_value(NORMAL, "Events outside RoI", num_outside_roi); |