Add markers to all benchmarks. Code review. Add GCC for dependencies.
This commit is contained in:
3
Makefile
3
Makefile
@@ -8,6 +8,7 @@ Q ?= @
|
||||
#DO NOT EDIT BELOW
|
||||
include $(MAKE_DIR)/config.mk
|
||||
include $(MAKE_DIR)/include_$(TAG).mk
|
||||
include $(MAKE_DIR)/include_LIKWID.mk
|
||||
INCLUDES += -I./src/includes
|
||||
|
||||
VPATH = $(SRC_DIR)
|
||||
@@ -30,7 +31,7 @@ asm: $(BUILD_DIR) $(ASM)
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
@echo "===> COMPILE $@"
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
$(Q)$(CC) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
|
||||
$(Q)$(GCC) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
|
||||
|
||||
$(BUILD_DIR)/%.s: %.c
|
||||
@echo "===> GENERATE ASM $@"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Supported: GCC, CLANG, ICC
|
||||
TAG ?= GCC
|
||||
ENABLE_OPENMP ?= false
|
||||
ENABLE_LIKWID ?= false
|
||||
|
||||
#Feature options
|
||||
OPTIONS = -DSIZE=40000000ull
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
CC = clang
|
||||
CC = clang
|
||||
GCC = gcc
|
||||
LINKER = $(CC)
|
||||
|
||||
ifeq ($(ENABLE_OPENMP),true)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
CC = gcc
|
||||
CC = gcc
|
||||
GCC = gcc
|
||||
LINKER = $(CC)
|
||||
|
||||
ifeq ($(ENABLE_OPENMP),true)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
CC = icc
|
||||
CC = icc
|
||||
GCC = gcc
|
||||
LINKER = $(CC)
|
||||
|
||||
ifeq ($(ENABLE_OPENMP),true)
|
||||
|
||||
10
include_LIKWID.mk
Normal file
10
include_LIKWID.mk
Normal file
@@ -0,0 +1,10 @@
|
||||
LIKWID_INC ?= -I/usr/local/include
|
||||
LIKWID_DEFINES ?= -DLIKWID_PERFMON
|
||||
LIKWID_LIB ?= -L/usr/local/lib
|
||||
|
||||
ifeq ($(strip $(ENABLE_LIKWID)),true)
|
||||
INCLUDES += ${LIKWID_INC}
|
||||
DEFINES += ${LIKWID_DEFINES}
|
||||
LIBS += -llikwid
|
||||
LFLAGS += ${LIKWID_LIB}
|
||||
endif
|
||||
@@ -53,7 +53,6 @@ getProcessorID(cpu_set_t* cpu_set)
|
||||
return processorId;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
affinity_getProcessorId()
|
||||
{
|
||||
@@ -85,5 +84,5 @@ affinity_pinProcess(int processorId)
|
||||
CPU_SET(processorId, &cpuset);
|
||||
sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
|
||||
}
|
||||
#endif /*__linux__*/
|
||||
#endif /*_OPENMP*/
|
||||
#endif /*__linux__*/
|
||||
|
||||
12
src/copy.c
12
src/copy.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double copy(
|
||||
double * restrict a,
|
||||
@@ -36,9 +37,14 @@ double copy(
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = b[i];
|
||||
#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");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
12
src/daxpy.c
12
src/daxpy.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double daxpy(
|
||||
double * restrict a,
|
||||
@@ -37,9 +38,14 @@ double daxpy(
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = a[i] + scalar * b[i];
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_START("DAXPY");
|
||||
#pragma omp for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = a[i] + scalar * b[i];
|
||||
}
|
||||
LIKWID_MARKER_STOP("DAXPY");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
44
src/includes/likwid_markers.h
Normal file
44
src/includes/likwid_markers.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* =======================================================================================
|
||||
*
|
||||
* Author: Jan Eitzinger (je), jan.treibig@gmail.com
|
||||
* Copyright (c) 2019 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
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* =======================================================================================
|
||||
*/
|
||||
|
||||
#ifndef LIKWID_MARKERS_H
|
||||
#define LIKWID_MARKERS_H
|
||||
|
||||
#ifdef LIKWID_PERFMON
|
||||
#include <likwid.h>
|
||||
#else
|
||||
#define LIKWID_MARKER_INIT
|
||||
#define LIKWID_MARKER_THREADINIT
|
||||
#define LIKWID_MARKER_SWITCH
|
||||
#define LIKWID_MARKER_REGISTER(regionTag)
|
||||
#define LIKWID_MARKER_START(regionTag)
|
||||
#define LIKWID_MARKER_STOP(regionTag)
|
||||
#define LIKWID_MARKER_CLOSE
|
||||
#define LIKWID_MARKER_GET(regionTag, nevents, events, time, count)
|
||||
#endif
|
||||
|
||||
#endif /*LIKWID_MARKERS_H*/
|
||||
12
src/init.c
12
src/init.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double init(
|
||||
double * restrict a,
|
||||
@@ -36,9 +37,14 @@ double init(
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = scalar;
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_START("INIT");
|
||||
#pragma omp for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = scalar;
|
||||
}
|
||||
LIKWID_MARKER_STOP("INIT");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
19
src/main.c
19
src/main.c
@@ -38,6 +38,7 @@
|
||||
#include <timing.h>
|
||||
#include <allocate.h>
|
||||
#include <affinity.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
#define HLINE "----------------------------------------------------------------------------\n"
|
||||
|
||||
@@ -89,8 +90,8 @@ int main (int argc, char** argv)
|
||||
double E, S;
|
||||
|
||||
double avgtime[NUMBENCH],
|
||||
maxtime[NUMBENCH],
|
||||
mintime[NUMBENCH];
|
||||
maxtime[NUMBENCH],
|
||||
mintime[NUMBENCH];
|
||||
|
||||
double times[NUMBENCH][NTIMES];
|
||||
|
||||
@@ -105,6 +106,19 @@ int main (int argc, char** argv)
|
||||
{"SDaxpy: ", 4, 2}
|
||||
};
|
||||
|
||||
LIKWID_MARKER_INIT;
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_REGISTER("INIT");
|
||||
LIKWID_MARKER_REGISTER("SUM");
|
||||
LIKWID_MARKER_REGISTER("COPY");
|
||||
LIKWID_MARKER_REGISTER("UPDATE");
|
||||
LIKWID_MARKER_REGISTER("TRIAD");
|
||||
LIKWID_MARKER_REGISTER("DAXPY");
|
||||
LIKWID_MARKER_REGISTER("STRIAD");
|
||||
LIKWID_MARKER_REGISTER("SDAXPY");
|
||||
}
|
||||
|
||||
a = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord );
|
||||
b = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord );
|
||||
c = (double*) allocate( ARRAY_ALIGNMENT, N * bytesPerWord );
|
||||
@@ -200,6 +214,7 @@ int main (int argc, char** argv)
|
||||
printf(HLINE);
|
||||
|
||||
check(a, b, c, d, N);
|
||||
LIKWID_MARKER_CLOSE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
12
src/sdaxpy.c
12
src/sdaxpy.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double sdaxpy(
|
||||
double * restrict a,
|
||||
@@ -37,9 +38,14 @@ double sdaxpy(
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = a[i] + b[i] * c[i];
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_START("SDAXPY");
|
||||
#pragma omp for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = a[i] + b[i] * c[i];
|
||||
}
|
||||
LIKWID_MARKER_STOP("SDAXPY");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
12
src/striad.c
12
src/striad.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double striad(
|
||||
double * restrict a,
|
||||
@@ -38,9 +39,14 @@ double striad(
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = b[i] + d[i] * c[i];
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_START("STRIAD");
|
||||
#pragma omp for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = b[i] + d[i] * c[i];
|
||||
}
|
||||
LIKWID_MARKER_STOP("STRIAD");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
12
src/sum.c
12
src/sum.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double sum(
|
||||
double * restrict a,
|
||||
@@ -36,9 +37,14 @@ double sum(
|
||||
double sum = 0.0;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for reduction(+:sum)
|
||||
for (int i=0; i<N; i++) {
|
||||
sum += a[i];
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_START("SUM");
|
||||
#pragma omp for reduction(+:sum)
|
||||
for (int i=0; i<N; i++) {
|
||||
sum += a[i];
|
||||
}
|
||||
LIKWID_MARKER_STOP("SUM");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
@@ -46,4 +46,3 @@ double getTimeStamp_()
|
||||
{
|
||||
return getTimeStamp();
|
||||
}
|
||||
|
||||
|
||||
12
src/triad.c
12
src/triad.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double triad(
|
||||
double * restrict a,
|
||||
@@ -38,9 +39,14 @@ double triad(
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = b[i] + scalar * c[i];
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_START("TRIAD");
|
||||
#pragma omp for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = b[i] + scalar * c[i];
|
||||
}
|
||||
LIKWID_MARKER_STOP("TRIAD");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
12
src/update.c
12
src/update.c
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <timing.h>
|
||||
#include <likwid_markers.h>
|
||||
|
||||
double update(
|
||||
double * restrict a,
|
||||
@@ -36,9 +37,14 @@ double update(
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = a[i] * scalar;
|
||||
#pragma omp parallel
|
||||
{
|
||||
LIKWID_MARKER_START("UPDATE");
|
||||
#pragma omp for
|
||||
for (int i=0; i<N; i++) {
|
||||
a[i] = a[i] * scalar;
|
||||
}
|
||||
LIKWID_MARKER_STOP("UPDATE");
|
||||
}
|
||||
E = getTimeStamp();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user