Add instrumented single file version.
This commit is contained in:
@@ -53,7 +53,6 @@
|
||||
|
||||
typedef enum benchmark {
|
||||
INIT = 0,
|
||||
SUM,
|
||||
COPY,
|
||||
UPDATE,
|
||||
TRIAD,
|
||||
@@ -70,7 +69,6 @@ typedef struct {
|
||||
} benchmarkType;
|
||||
|
||||
extern double init(double*, double, int);
|
||||
extern double sum(double*, int);
|
||||
extern double copy(double*, double*, int);
|
||||
extern double update(double*, double, int);
|
||||
extern double triad(double*, double*, double*, double, int);
|
||||
@@ -96,7 +94,6 @@ int main (int argc, char** argv)
|
||||
|
||||
benchmarkType benchmarks[NUMBENCH] = {
|
||||
{"Init: ", 1, 0},
|
||||
{"Sum: ", 1, 1},
|
||||
{"Copy: ", 2, 0},
|
||||
{"Update: ", 2, 1},
|
||||
{"Triad: ", 3, 2},
|
||||
@@ -140,9 +137,6 @@ int main (int argc, char** argv)
|
||||
|
||||
for ( int k=0; k < NTIMES; k++) {
|
||||
times[INIT][k] = init(b, scalar, N);
|
||||
tmp = a[10];
|
||||
times[SUM][k] = sum(a, N);
|
||||
a[10] = tmp;
|
||||
times[COPY][k] = copy(c, a, N);
|
||||
times[UPDATE][k] = update(a, scalar, N);
|
||||
times[TRIAD][k] = triad(a, b, c, scalar, N);
|
||||
@@ -290,27 +284,6 @@ double init(
|
||||
return E-S;
|
||||
}
|
||||
|
||||
double sum(
|
||||
double * restrict a,
|
||||
int N
|
||||
)
|
||||
{
|
||||
double S, E;
|
||||
double sum = 0.0;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for reduction(+:sum)
|
||||
for (int i=0; i<N; i++) {
|
||||
sum += a[i];
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
/* make the compiler think this makes actually sense */
|
||||
a[10] = sum;
|
||||
|
||||
return E-S;
|
||||
}
|
||||
|
||||
double copy(
|
||||
double * restrict a,
|
||||
double * restrict b,
|
||||
|
||||
Reference in New Issue
Block a user