Commit 279d3fca authored by Jan Eitzinger's avatar Jan Eitzinger
Browse files

Pull out likwid intrumentation from benchmark functions.

parent 072bda51
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -26,7 +26,6 @@
*/
#include <timing.h>
#include <likwid-marker.h>
double copy(
double * restrict a,
......@@ -37,14 +36,9 @@ double copy(
double S, E;
S = getTimeStamp();
#pragma omp parallel
{
LIKWID_MARKER_START("COPY");
#pragma omp for
for (int i=0; i<N; i++) {
a[i] = b[i];
}
LIKWID_MARKER_STOP("COPY");
#pragma omp parallel for schedule(static)
for (int i=0; i<N; i++) {
a[i] = b[i];
}
E = getTimeStamp();
......
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -26,7 +26,6 @@
*/
#include <timing.h>
#include <likwid-marker.h>
double init(
double * restrict a,
......@@ -37,14 +36,9 @@ double init(
double S, E;
S = getTimeStamp();
#pragma omp parallel
{
LIKWID_MARKER_START("INIT");
#pragma omp for schedule(static)
for (int i=0; i<N; i++) {
a[i] = scalar;
}
LIKWID_MARKER_STOP("INIT");
#pragma omp parallel for schedule(static)
for (int i=0; i<N; i++) {
a[i] = scalar;
}
E = getTimeStamp();
......
......@@ -52,6 +52,13 @@
#define ABS(a) ((a) >= 0 ? (a) : -(a))
#endif
#define LIKWID_PROFILE(tag,call) \
_Pragma ("omp parallel") \
{LIKWID_MARKER_START("tag");} \
times[tag][k] = call; \
_Pragma ("omp parallel") \
{LIKWID_MARKER_STOP("tag");}
typedef enum benchmark {
INIT = 0,
SUM,
......@@ -169,16 +176,16 @@ int main (int argc, char** argv)
scalar = 3.0;
for ( int k=0; k < NTIMES; k++) {
times[INIT][k] = init(b, scalar, N);
LIKWID_PROFILE(INIT,init(b, scalar, N));
tmp = a[10];
times[SUM][k] = sum(a, N);
LIKWID_PROFILE(SUM,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);
times[DAXPY][k] = daxpy(a, b, scalar, N);
times[STRIAD][k] = striad(a, b, c, d, N);
times[SDAXPY][k] = sdaxpy(a, b, c, N);
LIKWID_PROFILE(COPY,copy(c, a, N));
LIKWID_PROFILE(UPDATE,update(a, scalar, N));
LIKWID_PROFILE(TRIAD,triad(a, b, c, scalar, N));
LIKWID_PROFILE(DAXPY,daxpy(a, b, scalar, N));
LIKWID_PROFILE(STRIAD,striad(a, b, c, d, N));
LIKWID_PROFILE(SDAXPY,sdaxpy(a, b, c, N));
}
for (int j=0; j<NUMBENCH; j++) {
......
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -26,7 +26,6 @@
*/
#include <timing.h>
#include <likwid-marker.h>
double sdaxpy(
double * restrict a,
......@@ -38,14 +37,9 @@ double sdaxpy(
double S, E;
S = getTimeStamp();
#pragma omp parallel
{
LIKWID_MARKER_START("SDAXPY");
#pragma omp for schedule(static)
for (int i=0; i<N; i++) {
a[i] = a[i] + b[i] * c[i];
}
LIKWID_MARKER_STOP("SDAXPY");
#pragma omp parallel for schedule(static)
for (int i=0; i<N; i++) {
a[i] = a[i] + b[i] * c[i];
}
E = getTimeStamp();
......
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -26,7 +26,6 @@
*/
#include <timing.h>
#include <likwid-marker.h>
double striad(
double * restrict a,
......@@ -39,14 +38,9 @@ double striad(
double S, E;
S = getTimeStamp();
#pragma omp parallel
{
LIKWID_MARKER_START("STRIAD");
#pragma omp for schedule(static)
for (int i=0; i<N; i++) {
a[i] = b[i] + d[i] * c[i];
}
LIKWID_MARKER_STOP("STRIAD");
#pragma omp parallel for schedule(static)
for (int i=0; i<N; i++) {
a[i] = b[i] + d[i] * c[i];
}
E = getTimeStamp();
......
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -26,7 +26,6 @@
*/
#include <timing.h>
#include <likwid-marker.h>
double sum(
double * restrict a,
......@@ -37,14 +36,9 @@ double sum(
double sum = 0.0;
S = getTimeStamp();
#pragma omp parallel
{
LIKWID_MARKER_START("SUM");
#pragma omp for reduction(+:sum) schedule(static)
for (int i=0; i<N; i++) {
sum += a[i];
}
LIKWID_MARKER_STOP("SUM");
#pragma omp parallel for reduction(+:sum) schedule(static)
for (int i=0; i<N; i++) {
sum += a[i];
}
E = getTimeStamp();
......
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -26,7 +26,6 @@
*/
#include <timing.h>
#include <likwid-marker.h>
double triad(
double * restrict a,
......@@ -39,14 +38,9 @@ double triad(
double S, E;
S = getTimeStamp();
#pragma omp parallel
{
LIKWID_MARKER_START("TRIAD");
#pragma omp for schedule(static)
for (int i=0; i<N; i++) {
a[i] = b[i] + scalar * c[i];
}
LIKWID_MARKER_STOP("TRIAD");
#pragma omp parallel for schedule(static)
for (int i=0; i<N; i++) {
a[i] = b[i] + scalar * c[i];
}
E = getTimeStamp();
......
......@@ -2,7 +2,7 @@
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -26,7 +26,6 @@
*/
#include <timing.h>
#include <likwid-marker.h>
double update(
double * restrict a,
......@@ -37,14 +36,9 @@ double update(
double S, E;
S = getTimeStamp();
#pragma omp parallel
{
LIKWID_MARKER_START("UPDATE");
#pragma omp for schedule(static)
for (int i=0; i<N; i++) {
a[i] = a[i] * scalar;
}
LIKWID_MARKER_STOP("UPDATE");
#pragma omp parallel for schedule(static)
for (int i=0; i<N; i++) {
a[i] = a[i] * scalar;
}
E = getTimeStamp();
......
......@@ -38,8 +38,8 @@
#include <likwid-marker.h>
#define SIZE 40000000ull
#define NTIMES 10
#define SIZE 120000000ull
#define NTIMES 5
#define ARRAY_ALIGNMENT 64
#define HLINE "----------------------------------------------------------------------------\n"
......
......@@ -25,6 +25,7 @@
* =======================================================================================
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
......@@ -36,8 +37,8 @@
#include <omp.h>
#endif
#define SIZE 40000000ull
#define NTIMES 10
#define SIZE 120000000ull
#define NTIMES 5
#define ARRAY_ALIGNMENT 64
#define HLINE "----------------------------------------------------------------------------\n"
......
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