Markers for init and copy to investigate deviations

This commit is contained in:
Georg Hager
2019-03-14 13:30:22 +01:00
parent bc717360ec
commit 4e39aab88a
5 changed files with 43 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ TAG ?= GCC
ENABLE_OPENMP ?= false ENABLE_OPENMP ?= false
#Feature options #Feature options
OPTIONS = -DSIZE=40000000ull OPTIONS = -DSIZE=100000000ull
OPTIONS += -DNTIMES=10 OPTIONS += -DNTIMES=10
OPTIONS += -DARRAY_ALIGNMENT=64 OPTIONS += -DARRAY_ALIGNMENT=64
#OPTIONS += -DVERBOSE_AFFINITY #OPTIONS += -DVERBOSE_AFFINITY

View File

@@ -5,8 +5,8 @@ ifeq ($(ENABLE_OPENMP),true)
OPENMP = -qopenmp OPENMP = -qopenmp
endif endif
CFLAGS = -Ofast -xHost -std=c99 -ffreestanding $(OPENMP) CFLAGS = -DLIKWID -DLIKWID_PERFMON -Ofast -xHost -std=c99 -ffreestanding $(OPENMP) $(LIKWID_INC)
LFLAGS = $(OPENMP) LFLAGS = $(OPENMP) $(LIKWID_LIB) -llikwid
DEFINES = -D_GNU_SOURCE DEFINES = -D_GNU_SOURCE
INCLUDES = INCLUDES =
LIBS = LIBS =

View File

@@ -26,6 +26,9 @@
*/ */
#include <timing.h> #include <timing.h>
#ifdef LIKWID
#include <likwid.h>
#endif
double copy( double copy(
double * restrict a, double * restrict a,
@@ -36,10 +39,19 @@ double copy(
double S, E; double S, E;
S = getTimeStamp(); S = getTimeStamp();
#pragma omp parallel for #pragma omp parallel
{
#ifdef LIKWID
LIKWID_MARKER_START("COPY");
#endif
#pragma omp for
for (int i=0; i<N; i++) { for (int i=0; i<N; i++) {
a[i] = b[i]; a[i] = b[i];
} }
#ifdef LIKWID
LIKWID_MARKER_STOP("COPY");
#endif
}
E = getTimeStamp(); E = getTimeStamp();
return E-S; return E-S;

View File

@@ -26,6 +26,9 @@
*/ */
#include <timing.h> #include <timing.h>
#ifdef LIKWID
#include <likwid.h>
#endif
double init( double init(
double * restrict a, double * restrict a,
@@ -36,10 +39,20 @@ double init(
double S, E; double S, E;
S = getTimeStamp(); S = getTimeStamp();
#pragma omp parallel for #pragma omp parallel
{
#ifdef LIKWID
LIKWID_MARKER_START("INIT");
#endif
#pragma omp for
#pragma vector nontemporal
for (int i=0; i<N; i++) { for (int i=0; i<N; i++) {
a[i] = scalar; a[i] = scalar;
} }
#ifdef LIKWID
LIKWID_MARKER_STOP("INIT");
#endif
}
E = getTimeStamp(); E = getTimeStamp();
return E-S; return E-S;

View File

@@ -39,6 +39,10 @@
#include <allocate.h> #include <allocate.h>
#include <affinity.h> #include <affinity.h>
#ifdef LIKWID
#include <likwid.h>
#endif
#define HLINE "----------------------------------------------------------------------------\n" #define HLINE "----------------------------------------------------------------------------\n"
#ifndef MIN #ifndef MIN
@@ -105,6 +109,11 @@ int main (int argc, char** argv)
{"SDaxpy: ", 4, 2} {"SDaxpy: ", 4, 2}
}; };
#ifdef LIKWID
LIKWID_MARKER_INIT;
LIKWID_MARKER_REGISTER("INIT");
#endif
a = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord ); a = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord );
b = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord ); b = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord );
c = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord ); c = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord );
@@ -201,6 +210,10 @@ int main (int argc, char** argv)
check(a, b, c, d, N); check(a, b, c, d, N);
#ifdef LIKWID
LIKWID_MARKER_CLOSE;
#endif
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }