diff -Nur MFCG.orig/Makefile MFCG/Makefile --- MFCG.orig/Makefile 2025-07-31 14:05:35.400907372 +0200 +++ MFCG/Makefile 2025-07-31 13:54:51.241425520 +0200 @@ -11,12 +11,12 @@ FLAGS_S = -std=c++0x -Wall -Winline -Wshadow -W -O3 -qopenmp-stubs -xHOST -pg endif -INCLUDES =-Iinclude -LDFLAGS = -LIBS = +INCLUDES =-Iinclude $(LIKWID_INC) +LDFLAGS = $(LIKWID_LIB) +LIBS = -llikwid #EXTRA_FLAGS := -CXXFLAGS = $(FLAGS) $(EXTRA_FLAGS) +CXXFLAGS = -DLIKWID_PERFMON $(FLAGS) $(EXTRA_FLAGS) CXXFLAGS_S = $(FLAGS_S) $(EXTRA_FLAGS) all: perf perf-serial diff -Nur MFCG.orig/src/Grid.cpp MFCG/src/Grid.cpp --- MFCG.orig/src/Grid.cpp 2025-07-31 14:05:35.124111300 +0200 +++ MFCG/src/Grid.cpp 2025-07-31 12:26:38.527982296 +0200 @@ -3,6 +3,7 @@ #include +#include // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////// Class Member Functions ///////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -257,7 +258,11 @@ int shift = halo?0:HALO; -#pragma omp parallel for + +#pragma omp parallel +{ + LIKWID_MARKER_START("axpby"); +#pragma omp for for(int yIndex=shift; yIndexnumGrids_y(true)-shift; ++yIndex) { #pragma omp simd @@ -266,6 +271,8 @@ (*res)(yIndex,xIndex) = (a*(*x)(yIndex,xIndex)) + (b*(*y)(yIndex,xIndex)); } } + LIKWID_MARKER_STOP("axpby"); +} STOP_TIMER(AXPBY); } @@ -306,7 +313,10 @@ int shift = halo?0:HALO; double l2_sq = 0; -#pragma omp parallel for reduction(+:l2_sq) +#pragma omp parallel +{ + //LIKWID_MARKER_START("dotProduct"); +#pragma omp for reduction(+:l2_sq) for(int yIndex=shift; yIndexnumGrids_y(true)-shift; ++yIndex) { #pragma omp simd reduction(+:l2_sq) @@ -315,7 +325,8 @@ l2_sq += (*x)(yIndex,xIndex)*(*y)(yIndex,xIndex); } } - + //LIKWID_MARKER_STOP("dotProduct"); +} STOP_TIMER(DOT_PRODUCT); return l2_sq; } diff -Nur MFCG.orig/src/PDE.cpp MFCG/src/PDE.cpp --- MFCG.orig/src/PDE.cpp 2025-07-31 14:05:35.304498410 +0200 +++ MFCG/src/PDE.cpp 2025-07-31 12:23:53.964004166 +0200 @@ -2,6 +2,7 @@ #include #include #include +#include //default boundary function as in ex01 double defaultBoundary(int i, int j, double h_x, double h_y) @@ -97,7 +98,7 @@ void PDE::applyStencil(Grid* res, Grid* u) { START_TIMER(APPLY_STENCIL); - + #if DEBUG assert((res->numGrids_y(true)==grids_y) && (res->numGrids_x(true)==grids_x)); assert((u->numGrids_y(true)==grids_y) && (u->numGrids_x(true)==grids_x)); @@ -109,7 +110,9 @@ const double w_y = 1.0/(h_y*h_y); const double w_c = 2.0*w_x + 2.0*w_y; -#pragma omp parallel for +#pragma omp parallel +{ +#pragma omp for for ( int j=1; j0; --j) { int jj = j-tid; @@ -195,6 +201,7 @@ } #pragma omp barrier } + LIKWID_MARKER_STOP("precon-backward"); //backward substitution end } diff -Nur MFCG.orig/src/perf.cpp MFCG/src/perf.cpp --- MFCG.orig/src/perf.cpp 2025-07-31 14:05:35.348015393 +0200 +++ MFCG/src/perf.cpp 2025-07-31 12:36:51.642220802 +0200 @@ -3,7 +3,7 @@ #include "Solver.h" #include "test_macros.h" #include - +#include double uSineFunc(int i, int j, double h_x, double h_y) { return sin(M_PI*i*h_x)*sin(M_PI*j*h_y); @@ -47,9 +47,14 @@ fprintf(stderr, "Dimensions for x and y must be greater than zero\n"); return 0; } - + LIKWID_MARKER_INIT; + LIKWID_MARKER_REGISTER("PCG"); #pragma omp parallel { + LIKWID_MARKER_REGISTER("axpby"); + + LIKWID_MARKER_REGISTER("precon-forward"); + LIKWID_MARKER_REGISTER("precon-backward"); #pragma omp single { numThreads = omp_get_num_threads(); @@ -92,4 +97,6 @@ TESTS_END; PRINT_TIME_SUMMARY; + +LIKWID_MARKER_CLOSE; } diff -Nur MFCG.orig/src/Solver.cpp MFCG/src/Solver.cpp --- MFCG.orig/src/Solver.cpp 2025-07-31 14:05:35.092939190 +0200 +++ MFCG/src/Solver.cpp 2025-07-31 12:22:19.267223886 +0200 @@ -1,5 +1,6 @@ #include "Solver.h" #include "Grid.h" +#include SolverClass::SolverClass(PDE *pde_, Grid *x_, Grid *b_):pde(pde_),x(x_),b(b_) { @@ -27,6 +28,7 @@ // PCG loop begin START_TIMER(PCG); + LIKWID_MARKER_START("PCG"); while( (itertol*tol) ) { pde->applyStencil(v,p); @@ -48,6 +50,7 @@ #endif ++iter; } + LIKWID_MARKER_STOP("PCG"); STOP_TIMER(PCG); // PCG loop end