Bug #3417
Application CPU time is not correct for OpenMP support
Status: | Closed | Start date: | 10/22/2020 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 2.0.0 | |||
Duration: |
Description
In case of multi-threading the CPU time is not computed correctly.
For OpenMP, the time needs to be computed using the omp_get_wtime()
function, an example is given in the@GObservations::likelihood::eval() method:
Similar code needs to be implemented in @GApplication::celapse(void) and in GApplication::init_members()
.
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen over 4 years ago
// Timing measurement
#if defined(G_EVAL_TIMING)
#ifdef _OPENMP
double t_start = omp_get_wtime();
#else
clock_t t_start = clock();
#endif
#endif
...
// Timing measurement
#if defined(G_EVAL_TIMING)
#ifdef _OPENMP
double t_elapse = omp_get_wtime()-t_start;
#else
double t_elapse = (double)(clock() - t_start) / (double)CLOCKS_PER_SEC;
#endif
std::cout << "GObservations::optimizer::eval: CPU usage = "
<< t_elapse << " sec" << std::endl;
#endif
#2 Updated by Knödlseder Jürgen over 4 years ago
- Status changed from New to Feedback
- Assigned To set to Knödlseder Jürgen
- % Done changed from 0 to 90
I implemented the change and merged the code into devel
. It remains to be seen on a system that actually uses OpenMP whether the CPU time is not computed corrected. I therefore keep the issue status on Feedback.
#3 Updated by Knödlseder Jürgen about 4 years ago
- Status changed from Feedback to Closed
- % Done changed from 90 to 100
The times are now correct.