I want to measure performance of parallel program implemented using C++(openMP)
Recommended way to measure time using this technology is
double start = omp_get_wtime();
// some code here
double end = omp_get_wtime();
printf_s("Time = %.16g", end - start);
But i get time near 0, despite i wait for program about 8 seconds. All other methods to get execution time return 0.0 Also tried use these code examples
DWORD st = GetTickCount();
time_t time_start = time(NULL);
clock_t start = clock();
auto t1 = Clock::now();
time_t time_finish = time(NULL);
DWORD fn = GetTickCount();
clock_t finish = clock();
auto t2 = Clock::now();
All without success. Program spend running a lot of time. But results always zero. (In debug and release mode) If i debug step-by-step results differs from zero.
Here is my parallel #pragma directive
#pragma omp parallel default(none) private(i) shared(nSum, nTheads, nMaxThreads, nStart, nEnd, data, modulo) {
#pragma omp master
nTheads = omp_get_num_threads();
nMaxThreads = omp_get_max_threads();
#pragma omp for
for (int i = nStart; i < nEnd; ++i)
{
#pragma omp atomic
nSum += (power(data[i], i) * i) % modulo;
}
}
Where is my error? Please help me. I spend a lot of time with this problem.