Commit e5a4853a authored by Alexandru Dura's avatar Alexandru Dura

Set a chunk size, such that dynamic case runs in decent time.

parent 313783d6
......@@ -17,16 +17,20 @@
#ifndef NOWAIT
#define NOWAIT
#define NOWAIT_STR "wait"
#else
#define NOWAIT_STR "nowait"
#endif
#define N_RUNS 100
#define VEC_SIZE 50000000
#define CHUNK_SIZE 10000
#define NOINLINE __attribute__((noinline))
void NOINLINE initialize(double *d, int n, double val) {
#pragma omp for NOWAIT \
schedule(SCHEDULE)
schedule(SCHEDULE, CHUNK_SIZE)
for (int i = 0; i < n; ++i) {
d[i] = val;
}
......@@ -35,7 +39,7 @@ void NOINLINE initialize(double *d, int n, double val) {
double NOINLINE sqsum(const double *d, int n) {
double sum = 0.0;
#pragma omp for NOWAIT \
schedule(SCHEDULE)
schedule(SCHEDULE, CHUNK_SIZE)
for (int i = 0; i < n; ++i) {
double tmp = d[i] * d[i];
sum += tmp;
......@@ -78,7 +82,7 @@ int main(int argc, char **argv) {
n_threads = 1;
#endif
printf ("%d," XSTR(SCHEDULE) "," XSTR(NOWAIT) ",%f,%f\n", n_threads, reported_time, r);
printf ("%d," XSTR(SCHEDULE) "," NOWAIT_STR ",%f,%f\n", n_threads, reported_time, r);
return 0;
}
......@@ -17,12 +17,15 @@
#define N_RUNS 100
#define VEC_SIZE 50000000
// define chunk size, it is essential for the dynamic case,
// since there is so little to compute per iteration
#define CHUNK_SIZE 100000
#define NOINLINE __attribute__((noinline))
void NOINLINE initialize(double *d, int n, double val) {
#pragma omp parallel for \
schedule(SCHEDULE)
schedule(SCHEDULE, CHUNK_SIZE)
for (int i = 0; i < n; ++i) {
d[i] = val;
}
......@@ -32,7 +35,7 @@ double NOINLINE sqsum(const double *d, int n) {
double sum = 0.0;
#pragma omp parallel for \
reduction(+:sum) \
schedule(SCHEDULE)
schedule(SCHEDULE, CHUNK_SIZE)
for (int i = 0; i < n; ++i) {
sum += d[i] * d[i];
}
......
Markdown is supported
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