Commit 87136c83 authored by Philippe SWARTVAGHER's avatar Philippe SWARTVAGHER
Browse files

Do not count per-thread duration computations in global duration

parent 11bb0fa4
......@@ -158,16 +158,18 @@ static double memset_run_kernel(enum bench_type bench_type)
per_thread_perfs = memset_perfs_per_thread_no_comm;
}
puk_tick_t* thread_start_times = malloc(nb_threads * sizeof(puk_tick_t));
puk_tick_t* thread_end_times = malloc(nb_threads * sizeof(puk_tick_t));
PUK_GET_TICK(start_time);
#pragma omp parallel for
for (int i = 0; i < nb_threads; i++)
{
puk_tick_t thread_start_time, thread_end_time;
#if defined(HAVE_DECL__MM_STREAM_SI32)
if (use_non_temporal)
{
PUK_GET_TICK(thread_start_time);
PUK_GET_TICK(thread_start_times[i]);
for (int j = 1; j <= NB_ITER; j++)
{
int value = scalar * j;
......@@ -176,31 +178,34 @@ static double memset_run_kernel(enum bench_type bench_type)
_mm_stream_si32(a[i]+k, value);
}
}
PUK_GET_TICK(thread_end_time);
PUK_GET_TICK(thread_end_times[i]);
}
else
#endif
{
PUK_GET_TICK(thread_start_time);
PUK_GET_TICK(thread_start_times[i]);
for (int j = 1; j <= NB_ITER; j++)
{
memset(a[i], scalar*j, array_size*sizeof(MEMSET_TYPE));
}
PUK_GET_TICK(thread_end_time);
PUK_GET_TICK(thread_end_times[i]);
}
}
PUK_GET_TICK(end_time);
if (params.per_thread_perf)
if (params.per_thread_perf && (bench_type == WITH_COMM || bench_type == WITHOUT_COMM))
{
for (int i = 0; i < nb_threads; i++)
{
double thread_duration = PUK_TIMING_DELAY(thread_start_time, thread_end_time);
if (bench_type == WITH_COMM || bench_type == WITHOUT_COMM)
{
per_thread_perfs[i*3] = MIN(per_thread_perfs[i*3], thread_duration);
per_thread_perfs[i*3+1] += thread_duration;
per_thread_perfs[i*3+2] = MAX(per_thread_perfs[i*3+2], thread_duration);
}
double thread_duration = PUK_TIMING_DELAY(thread_start_times[i], thread_end_times[i]);
per_thread_perfs[i*3] = MIN(per_thread_perfs[i*3], thread_duration);
per_thread_perfs[i*3+1] += thread_duration;
per_thread_perfs[i*3+2] = MAX(per_thread_perfs[i*3+2], thread_duration);
}
}
PUK_GET_TICK(end_time);
free(thread_start_times);
free(thread_end_times);
return PUK_TIMING_DELAY(start_time, end_time);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment