From 4812daab74a8a0de97d186a42f996f625a5e04fc Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 16:56:30 +0200 Subject: [PATCH 01/36] Add flake --- flake.nix | 34 ++++++++++++++++++++++++++++++++++ shell.nix | 15 --------------- 2 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a10d62e --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "bench6"; + nixConfig.bash-prompt = "\[nix-develop\]$ "; + + inputs.jungle.url = "jungle"; + + outputs = { self, jungle }: + let pkgs = jungle.packages.x86_64-linux.hut; in + { + packages.x86_64-linux.default = pkgs.stdenv.mkDerivation rec { + pname = "bench6"; + version = "local"; + + src = self.outPath; + + buildInputs = with pkgs; [ + cmake + bsc.clangOmpss2 + bsc.nanos6 + bsc.nodes + bsc.mpi + bsc.tampi + ]; + + enableParallelBuilding = false; + cmakeFlags = [ + "-DCMAKE_C_COMPILER=clang" + "-DCMAKE_CXX_COMPILER=clang++" + ]; + hardeningDisable = [ "all" ]; + dontStrip = true; + }; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index c04b746..0000000 --- a/shell.nix +++ /dev/null @@ -1,15 +0,0 @@ -let - pkgs = import (builtins.fetchTarball - "https://pm.bsc.es/gitlab/rarias/bscpkgs/-/archive/master/bscpkgs-master.tar.gz"); - - rWrapper = pkgs.rWrapper.override { - packages = with pkgs.rPackages; [ tidyverse rjson jsonlite egg viridis ]; - }; -in - pkgs.mkShell { - nativeBuildInputs = [ - pkgs.bsc.clangOmpss2 - pkgs.bsc.nanos6 - rWrapper - ]; - } -- GitLab From ed28fa8a52d175d930f134fe0e93295e02fe1795 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 16:57:26 +0200 Subject: [PATCH 02/36] Add TAMPI cmake module --- cmake/FindTampi.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cmake/FindTampi.cmake diff --git a/cmake/FindTampi.cmake b/cmake/FindTampi.cmake new file mode 100644 index 0000000..6bcc84b --- /dev/null +++ b/cmake/FindTampi.cmake @@ -0,0 +1,22 @@ +include(GNUInstallDirs) + +find_library(TAMPI_LIBRARY NAMES tampi-c) +find_path(TAMPI_INCLUDE_DIR TAMPI.h) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Tampi DEFAULT_MSG + TAMPI_LIBRARY TAMPI_INCLUDE_DIR) + +if(NOT TAMPI_FOUND) + return() +endif() + +if(TARGET Tampi::tampi-c) + return() +endif() + +add_library(Tampi::tampi-c SHARED IMPORTED) +set_target_properties(Tampi::tampi-c PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TAMPI_INCLUDE_DIR}" + IMPORTED_LOCATION ${TAMPI_LIBRARY}) -- GitLab From 08549bddbb911302faa7f9b383ee106ba0fa7915 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 16:58:18 +0200 Subject: [PATCH 03/36] Fix heat MPI benchmarks --- src/heat/mpi/CMakeLists.txt | 13 +++++++++- src/heat/mpi/main.c | 31 ++++++++++++----------- src/heat/mpi/solver_itampi_ompss2_tasks.c | 12 +++++++++ src/heat/mpi/solver_mpi.c | 6 +++++ src/heat/mpi/solver_mpi_nbuffer.c | 6 +++++ src/heat/mpi/solver_mpi_ompss2_forkjoin.c | 6 +++++ src/heat/mpi/solver_mpi_ompss2_tasks.c | 6 +++++ src/heat/mpi/utils.h | 1 + 8 files changed, 65 insertions(+), 16 deletions(-) diff --git a/src/heat/mpi/CMakeLists.txt b/src/heat/mpi/CMakeLists.txt index bf9ac14..3682f4b 100644 --- a/src/heat/mpi/CMakeLists.txt +++ b/src/heat/mpi/CMakeLists.txt @@ -10,7 +10,8 @@ endmacro() macro(mk_heat_mpi_nanos6 NAME SOURCE) mk_heat_mpi(${NAME} ${SOURCE}) - target_link_libraries(${NAME} PRIVATE Nanos6::wrapper) + target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6") + target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") endmacro() macro(mk_heat_mpi_nodes NAME SOURCE) @@ -18,6 +19,12 @@ macro(mk_heat_mpi_nodes NAME SOURCE) target_link_libraries(${NAME} PRIVATE Nodes::wrapper) endmacro() +macro(mk_heat_tampi_nanos6 NAME SOURCE) + mk_heat_mpi_nanos6(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE Tampi::tampi-c) +endmacro() + + # ------------------------------------------------------------------- add_library(heat_mpi_common STATIC main.c utils.c) @@ -35,3 +42,7 @@ if(NODES_FOUND) mk_heat_mpi_nodes(b6_heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c) mk_heat_mpi_nodes(b6_heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c) endif() + +if(NANOS6_FOUND AND TAMPI_FOUND) + mk_heat_tampi_nanos6(b6_heat_itampi_nanos6_tasks solver_itampi_ompss2_tasks.c) +endif() diff --git a/src/heat/mpi/main.c b/src/heat/mpi/main.c index e073740..718615f 100644 --- a/src/heat/mpi/main.c +++ b/src/heat/mpi/main.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -19,16 +20,7 @@ void generateImage(const HeatConfiguration *conf, int64_t rows, int64_t cols, in int main(int argc, char **argv) { -#if defined(TAMPI) - // TAMPI+OmpSs-2 variants - const int required = MPI_TASK_MULTIPLE; -#elif defined(_OMPSS_2) - // MPI+OmpSs-2 variants - const int required = MPI_THREAD_SERIALIZED; -#else - // MPI-only variants - const int required = MPI_THREAD_SINGLE; -#endif + const int required = mpi_level(); int provided; MPI_Init_thread(&argc, &argv, required, &provided); @@ -76,8 +68,10 @@ int main(int argc, char **argv) if (!rank) { int64_t totalElements = conf.rows*conf.cols; + //double time_element = (end-start)/(totalElements*conf.timesteps); double throughput = (totalElements*conf.timesteps)/(end-start); - throughput = throughput/1000000.0; + //throughput = throughput/1000000.0; + double residual = NAN; #ifdef _OMPSS_2 int threads = nanos6_get_num_cpus(); @@ -85,10 +79,17 @@ int main(int argc, char **argv) int threads = 1; #endif - fprintf(stdout, "rows, %ld, cols, %ld, rows/rank, %ld, total, %ld, total/rank, %ld, rbs, %d, " - "cbs, %d, ranks, %d, threads, %d, timesteps, %d, time, %f, Mupdates/s, %f\n", - conf.rows, conf.cols, conf.rows/nranks, totalElements, totalElements/nranks, - conf.rbs, conf.cbs, nranks, threads, conf.timesteps, end-start, throughput); + fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s %8s\n", + "throughput", "time", "error", + "rows", "cols", + "rbs", "cbs", "threads", + "steps"); + fprintf(stdout, "%14e %14e %14e %8ld %8ld %8d %8d %8d %8d\n", + throughput, end-start, residual, + conf.rows, conf.cols, + conf.rbs, conf.cbs, threads, + conf.convergenceTimesteps); + } if (conf.generateImage) { diff --git a/src/heat/mpi/solver_itampi_ompss2_tasks.c b/src/heat/mpi/solver_itampi_ompss2_tasks.c index 7620a58..720587f 100644 --- a/src/heat/mpi/solver_itampi_ompss2_tasks.c +++ b/src/heat/mpi/solver_itampi_ompss2_tasks.c @@ -4,6 +4,17 @@ #include "utils.h" #include "common/heat.h" +const char * +summary(void) +{ + return "Parallel version using MPI + OmpSs-2 tasks + Non-blocking TAMPI"; +} + +int +mpi_level(void) +{ + return MPI_TASK_MULTIPLE; +} static inline void send(const double *data, int nelems, int dst, int tag) { @@ -55,6 +66,7 @@ static inline void gaussSeidelSolver(int64_t rows, int64_t cols, int rbs, int cb double solve(HeatConfiguration *conf, int64_t rows, int64_t cols, int timesteps, void *extraData) { + (void) extraData; double (*matrix)[cols] = (double (*)[cols]) conf->matrix; const int rbs = conf->rbs; const int cbs = conf->cbs; diff --git a/src/heat/mpi/solver_mpi.c b/src/heat/mpi/solver_mpi.c index 42f6932..12ac822 100644 --- a/src/heat/mpi/solver_mpi.c +++ b/src/heat/mpi/solver_mpi.c @@ -3,6 +3,12 @@ #include "utils.h" #include "common/heat.h" +int +mpi_level(void) +{ + return MPI_THREAD_SINGLE; +} + const char * summary(void) { diff --git a/src/heat/mpi/solver_mpi_nbuffer.c b/src/heat/mpi/solver_mpi_nbuffer.c index 52a1d78..41b92f7 100644 --- a/src/heat/mpi/solver_mpi_nbuffer.c +++ b/src/heat/mpi/solver_mpi_nbuffer.c @@ -8,6 +8,12 @@ typedef struct { MPI_Request recv; } HaloRequests; +int +mpi_level(void) +{ + return MPI_THREAD_SINGLE; +} + const char * summary(void) { diff --git a/src/heat/mpi/solver_mpi_ompss2_forkjoin.c b/src/heat/mpi/solver_mpi_ompss2_forkjoin.c index 72f7e35..1e9503f 100644 --- a/src/heat/mpi/solver_mpi_ompss2_forkjoin.c +++ b/src/heat/mpi/solver_mpi_ompss2_forkjoin.c @@ -3,6 +3,12 @@ #include "utils.h" #include "common/heat.h" +int +mpi_level(void) +{ + return MPI_THREAD_SERIALIZED; +} + const char * summary(void) { diff --git a/src/heat/mpi/solver_mpi_ompss2_tasks.c b/src/heat/mpi/solver_mpi_ompss2_tasks.c index c60cb60..43adf97 100644 --- a/src/heat/mpi/solver_mpi_ompss2_tasks.c +++ b/src/heat/mpi/solver_mpi_ompss2_tasks.c @@ -5,6 +5,12 @@ static int serial; +int +mpi_level(void) +{ + return MPI_THREAD_SERIALIZED; +} + const char * summary(void) { diff --git a/src/heat/mpi/utils.h b/src/heat/mpi/utils.h index ecfc088..15d3e74 100644 --- a/src/heat/mpi/utils.h +++ b/src/heat/mpi/utils.h @@ -17,5 +17,6 @@ typedef struct { void broadcastConfiguration(HeatConfiguration *configuration); void initializeWindows(HeatConfiguration *configuration, int64_t rows, int64_t cols, MPIRMAInfo *info); void finalizeWindows(MPIRMAInfo *info); +int mpi_level(void); #endif // MPI_UTILS_H -- GitLab From 07538f96ff2397b3102d423d3ec4a076cd2ce56b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 16:59:04 +0200 Subject: [PATCH 04/36] Use popen() in the runner --- src/tools/runner.c | 108 ++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/src/tools/runner.c b/src/tools/runner.c index 685da3d..9bc75b8 100644 --- a/src/tools/runner.c +++ b/src/tools/runner.c @@ -27,69 +27,57 @@ struct sampling { static int do_run(char *argv[], double *ptime) { - /* Gather binary path */ - char path[PATH_MAX]; - sprintf(path, "%s/%s", BENCH6_BIN, argv[0]); + int ret = 0; + FILE *p = popen(argv[0], "r"); - if (access(path, R_OK | X_OK) != 0) { - err("cannot find benchmark %s:", path); + if (p == NULL) { + err("popen failed:"); return -1; } - int pipefd[2]; - if (pipe(pipefd) != 0) { - err("pipe failed:"); - return -1; + char line[4096]; + if (fgets(line, 4096, p) == NULL) { + err("missing stdout line"); + ret = -1; + goto bad_close; } - /* Fork */ - pid_t p = fork(); + char *nl = strchr(line, '\n'); + if (nl != NULL) + *nl = '\0'; - if (p < 0) { - err("fork failed:"); - return -1; - } + /* Clean status line */ + fprintf(stderr, " \r"); + fprintf(stderr, "%s\n", line); - /* In children execute benchmark */ - if (p == 0) { - close(pipefd[0]); - dup2(pipefd[1], 1); - close(2); - if (execve(path, argv, NULL) != 0) { - err("execve failed:"); - return -1; - } - /* Not reached */ - } else { - close(pipefd[1]); - char line[4096]; - FILE *f = fdopen(pipefd[0], "r"); - if (f == NULL) { - err("fdopen failed:"); - return -1; - } + double time; + sscanf(line, "%le", &time); + //printf("got %e\n", time); + *ptime = time; - if (fgets(line, 4096, f) == NULL) { - err("missing stdout line"); - return -1; - } + /* Drain the rest of the stdout */ + while (fgets(line, 4096, p) != NULL) { + fprintf(stderr, "%s", line); + } - char *nl = strchr(line, '\n'); - if (nl != NULL) - *nl = '\0'; +bad_close: + pclose(p); - double time; - sscanf(line, "%le", &time); - //printf("got %e\n", time); - *ptime = time; - - /* Drain the rest of the stdout */ - while (fgets(line, 4096, f) != NULL) { } - fclose(f); - close(pipefd[0]); - } + return ret; +} - return 0; +static int +cmp_double(const void *pa, const void *pb) +{ + double a = *(const double *) pa; + double b = *(const double *) pb; + + if (a < b) + return -1; + else if (a > b) + return 1; + else + return 0; } static void @@ -99,6 +87,13 @@ stats(struct sampling *s) return; double n = s->n; + //double last = s->samples[s->n - 1]; + + /* Sort samples to take the median */ + qsort(s->samples, s->n, sizeof(double), cmp_double); + + double median = s->samples[s->n / 2]; + double sum = 0.0; for (int i = 0; i < s->n; i++) sum += s->samples[i]; @@ -112,11 +107,12 @@ stats(struct sampling *s) double var = sumsqr / n; double stdev = sqrt(var); + double rstdev = 100.0 * stdev / mean; double se = stdev / sqrt(n); - double rse = se * 1.96 / mean; + double rse = 100.0 * se * 1.96 / mean; - fprintf(stderr, "\rn=%d last=%e mean=%e stdev=%e se=%e rse=%e", - s->n, s->last, mean, stdev, se, rse); + fprintf(stderr, "n=%03d median=%.3e mean=%.3e SD=%.3e RSD=%.2f%% RSE=%.2f%% \r", + s->n, median, mean, stdev, rstdev, rse); s->rse = rse; } @@ -129,7 +125,7 @@ should_continue(struct sampling *s) if (s->n < s->nmin) return 1; - if (s->rse * 100.0 > 1.0 /* % */) + if (s->rse > 1.0 /* % */) return 1; return 0; @@ -180,6 +176,8 @@ sample(char *argv[]) add_sample(&s, time); } + fprintf(stderr, "\n"); + free(s.samples); return 0; -- GitLab From 677a8f957851eb69ef1d1fc90b17de122e5beab0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 16:59:49 +0200 Subject: [PATCH 05/36] Turn on SIMD by default --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e53e51c..1a2a981 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ if (NOT HAVE_CLOCK_GETTIME) endif() endif() -set(USE_SIMD OFF CACHE BOOL "Define SIMD and build with -fopenmp-simd") +set(USE_SIMD ON CACHE BOOL "Define SIMD and build with -fopenmp-simd") if(USE_SIMD) add_definitions(-DSIMD) add_compile_options(-fopenmp-simd) @@ -72,6 +72,7 @@ endif() find_package(MPI) find_package(Nanos6) find_package(Nodes) +find_package(Tampi) set_property(GLOBAL PROPERTY bench6_list "") -- GitLab From 3dd39af3420f22991f04414038d74f36f2551881 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:15:54 +0200 Subject: [PATCH 06/36] Add plot scripts --- plot/convergence.py | 21 +++++++++++++++++++++ plot/readywave-cmp-ovni.R | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 plot/convergence.py create mode 100644 plot/readywave-cmp-ovni.R diff --git a/plot/convergence.py b/plot/convergence.py new file mode 100644 index 0000000..68c3917 --- /dev/null +++ b/plot/convergence.py @@ -0,0 +1,21 @@ +import pandas as pd +import sys +import matplotlib.pyplot as plt + +#df = pd.read_csv("convergence.csv", delimiter=" ") +df_gs = pd.read_csv("gs.csv", delimiter=" ") +df_sor = pd.read_csv("sor.csv", delimiter=" ") + +fig, axes = plt.subplots() + +#df.plot(ax=axes, x="time", y="error", label="Current") +df_sor.plot(ax=axes, x="time", y="error", label="SOR", color="red") +df_gs.plot( ax=axes, x="time", y="error", label="GS", color="blue") + +plt.grid(True) +plt.title("Heat 2D steady state Gauss-Seidel vs Succesive-Over-Relaxation") +plt.ylabel("Absolute error (K)") +plt.xlabel("Time (s)") +plt.yscale("log") +plt.savefig("err.png") + diff --git a/plot/readywave-cmp-ovni.R b/plot/readywave-cmp-ovni.R new file mode 100644 index 0000000..202fb2b --- /dev/null +++ b/plot/readywave-cmp-ovni.R @@ -0,0 +1,27 @@ +library(ggplot2) +library(dplyr, warn.conflicts = FALSE) +library(scales) +library(jsonlite) +library(readr) + +# Load the arguments (argv) +args = commandArgs(trailingOnly=TRUE) + +input_file = "data/readywave-instr.csv" + +df = read_delim(input_file, delim=",", show_col_types = FALSE) %>% + mutate(instr = as.factor(instr)) + +dpi = 150 +h = 2 +w = 7 + +# --------------------------------------------------------------------- + +p = ggplot(df, aes(time_ms, fill=instr)) + + geom_histogram(color="white", bins=50) + + #theme_bw() + + labs(x = "Time (ms)", title="bench6.readywave -r 100 -t 5000 -w 10") + # TODO: Add ntasks and taskwork to labels + +ggsave(sprintf("%s.png", input_file), plot=p, width=w, height=h, dpi=dpi) -- GitLab From 2e71ddb838c18385a19a90a8b610a46686172805 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:18:42 +0200 Subject: [PATCH 07/36] Initialize only one wall --- src/heat/common/misc.c | 86 +++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/src/heat/common/misc.c b/src/heat/common/misc.c index 922892b..6b52fa3 100644 --- a/src/heat/common/misc.c +++ b/src/heat/common/misc.c @@ -370,50 +370,58 @@ void printConfiguration(const HeatConfiguration *conf) void initializeMatrix(const HeatConfiguration *conf, double *matrix, int64_t rows, int64_t cols, int64_t rowOffset) { - const int totalRows = conf->rows+2; + //const int totalRows = conf->rows+2; // Set all elements to zero memset(matrix, 0, rows*cols*sizeof(double)); - for (int i = 0; i < conf->numHeatSources; i++) { - const HeatSource *src = &(conf->heatSources[i]); - - // Initialize top row - if (rowOffset == 0) { - for (int c = 0; c < cols; ++c) { - double dist = sqrt(pow((double)c/(double)cols-src->col, 2) + pow(src->row, 2)); - if (dist <= src->range) { - matrix[c] += (src->range-dist)/src->range*src->temperature; - } - } - } - - // Initialize bottom row - if (rowOffset+rows == totalRows) { - for (int c = 0; c < cols; ++c) { - double dist = sqrt(pow((double)c/(double)cols-src->col, 2) + pow(1-src->row, 2)); - if (dist <= src->range) { - matrix[(rows-1)*cols+c] += (src->range-dist)/src->range*src->temperature; - } - } - } - - // Initialize left column - for (int r = 1; r < rows-1; ++r) { - double dist = sqrt(pow(src->col, 2) + pow((double)(rowOffset+r)/(double)totalRows-src->row, 2)); - if (dist <= src->range) { - matrix[r*cols] += (src->range-dist)/src->range*src->temperature; - } - } - - // Initialize right column - for (int r = 1; r < rows-1; ++r) { - double dist = sqrt(pow(1-src->col, 2) + pow((double)(rowOffset+r)/(double)totalRows-src->row, 2)); - if (dist <= src->range) { - matrix[r*cols+cols-1] += (src->range-dist)/src->range*src->temperature; - } - } + /* Set the left side to 1.0 */ + for (int i = 0; i < rows; i++) { + matrix[i*cols] = 1.0; } + + (void)(conf); + (void)(rowOffset); + +// for (int i = 0; i < conf->numHeatSources; i++) { +// const HeatSource *src = &(conf->heatSources[i]); +// +// // Initialize top row +// if (rowOffset == 0) { +// for (int c = 0; c < cols; ++c) { +// double dist = sqrt(pow((double)c/(double)cols-src->col, 2) + pow(src->row, 2)); +// if (dist <= src->range) { +// matrix[c] += (src->range-dist)/src->range*src->temperature; +// } +// } +// } +// +// // Initialize bottom row +// if (rowOffset+rows == totalRows) { +// for (int c = 0; c < cols; ++c) { +// double dist = sqrt(pow((double)c/(double)cols-src->col, 2) + pow(1-src->row, 2)); +// if (dist <= src->range) { +// matrix[(rows-1)*cols+c] += (src->range-dist)/src->range*src->temperature; +// } +// } +// } +// +// // Initialize left column +// for (int r = 1; r < rows-1; ++r) { +// double dist = sqrt(pow(src->col, 2) + pow((double)(rowOffset+r)/(double)totalRows-src->row, 2)); +// if (dist <= src->range) { +// matrix[r*cols] += (src->range-dist)/src->range*src->temperature; +// } +// } +// +// // Initialize right column +// for (int r = 1; r < rows-1; ++r) { +// double dist = sqrt(pow(1-src->col, 2) + pow((double)(rowOffset+r)/(double)totalRows-src->row, 2)); +// if (dist <= src->range) { +// matrix[r*cols+cols-1] += (src->range-dist)/src->range*src->temperature; +// } +// } +// } } double getTime(void) -- GitLab From 7ae09d777543075ddda9cac9eb98cbef2531dc02 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:19:47 +0200 Subject: [PATCH 08/36] Add relax parameter for SOR --- src/heat/common/heat.h | 7 +++++-- src/heat/common/misc.c | 10 +++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/heat/common/heat.h b/src/heat/common/heat.h index 5e5af35..1a2f5ac 100644 --- a/src/heat/common/heat.h +++ b/src/heat/common/heat.h @@ -4,9 +4,11 @@ #include #include #include +#include -#define IGNORE_RESIDUAL ((double) -1.0) -#define DEFAULT_DELTA ((double) 0.00005) +#define IGNORE_RESIDUAL (NAN) +#define DEFAULT_DELTA ((double) 0.05) +#define DEFAULT_RELAX 1.9766 #define DEFAULT_BS 1024 #define ROUND(a, b) ((((a) + (b) - 1) / (b)) * (b)) @@ -22,6 +24,7 @@ typedef struct { int timesteps; int convergenceTimesteps; double delta; + double relax; int64_t rows; int64_t cols; int rbs; diff --git a/src/heat/common/misc.c b/src/heat/common/misc.c index 6b52fa3..c439a13 100644 --- a/src/heat/common/misc.c +++ b/src/heat/common/misc.c @@ -120,6 +120,7 @@ static void printUsage(int argc, char **argv) fprintf(stdout, " -C, --cbs=BS use BS as the number of columns of each block (overrides -b option)\n"); fprintf(stdout, " -w, --wins=WINS use WINS as the number of MPI RMA windows for each halo row\n"); fprintf(stdout, " -d, --delta=DELTA use DELTA as the residual threshold (default: %f)\n", DEFAULT_DELTA); + fprintf(stdout, " -x, --relax=X use X as the relaxation value (default: %f)\n", DEFAULT_RELAX); fprintf(stdout, " -f, --sources-file=NAME get the heat sources from the NAME configuration file\n"); fprintf(stdout, " -W, --no-warmup do not perform warmup timestep (warmup enabled by default)\n"); fprintf(stdout, " -o, --output=NAME save the computed matrix to the PPM file named NAME.ppm and disable warmup (disabled by default)\n"); @@ -132,6 +133,7 @@ static void setDefaultConfiguration(HeatConfiguration *conf) conf->timesteps = 1; conf->convergenceTimesteps = -1; conf->delta = DEFAULT_DELTA; + conf->relax = DEFAULT_RELAX; conf->rows = DEFAULT_BS * 8; conf->cols = DEFAULT_BS * 8; conf->rbs = DEFAULT_BS; @@ -159,6 +161,7 @@ static void readParameters(int argc, char **argv, HeatConfiguration *conf) {"cbs", required_argument, 0, 'C'}, {"wins", required_argument, 0, 'w'}, {"delta", required_argument, 0, 'd'}, + {"relax", required_argument, 0, 'x'}, {"sources-file", required_argument, 0, 'f'}, {"output", required_argument, 0, 'o'}, {"no-warmup", no_argument, 0, 'W'}, @@ -171,7 +174,7 @@ static void readParameters(int argc, char **argv, HeatConfiguration *conf) int bs = DEFAULT_BS; int rbs = 0, cbs = 0; - while ((c = getopt_long(argc, argv, "ho:f:s:r:c:t:b:R:C:d:w:Wv", long_options, &index)) != -1) { + while ((c = getopt_long(argc, argv, "ho:f:s:r:c:t:b:R:C:d:x:w:Wv", long_options, &index)) != -1) { switch (c) { case 'h': printUsage(argc, argv); @@ -235,6 +238,10 @@ static void readParameters(int argc, char **argv, HeatConfiguration *conf) conf->delta = atof(optarg); assert(conf->delta > 0.0); break; + case 'x': + conf->relax = atof(optarg); + assert(conf->relax > 0.0); + break; case '?': exit(1); default: @@ -356,6 +363,7 @@ void printConfiguration(const HeatConfiguration *conf) fprintf(stderr, "Block size : %d x %d\n", conf->rbs, conf->cbs); fprintf(stderr, "Timesteps : %d\n", conf->timesteps); fprintf(stderr, "Delta : %f\n", conf->delta); + fprintf(stderr, "Relax : %f\n", conf->relax); fprintf(stderr, "Num. heat sources : %d\n", conf->numHeatSources); for (int i = 0; i < conf->numHeatSources; i++) { -- GitLab From 31b373792a6e7ba84ec5b3af4171c3170756f671 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:20:15 +0200 Subject: [PATCH 09/36] Add SOR solver --- src/heat/common/heat.h | 2 +- src/heat/common/kernel.c | 73 +++++++++++++++++++++++++++++++++++----- 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/src/heat/common/heat.h b/src/heat/common/heat.h index 1a2f5ac..696b28c 100644 --- a/src/heat/common/heat.h +++ b/src/heat/common/heat.h @@ -53,6 +53,6 @@ double getTime(void); const char *summary(void); double solve(HeatConfiguration *conf, int64_t rows, int64_t cols, int timesteps, void *extraData); void computeBlock(const int64_t rows, const int64_t cols, const int rstart, const int rend, const int cstart, const int cend, double M[rows][cols]); -double computeBlockResidual(const int64_t rows, const int64_t cols, const int rstart, const int rend, const int cstart, const int cend, double M[rows][cols]); +void computeBlockResidual(const int64_t rows, const int64_t cols, const int rstart, const int rend, const int cstart, const int cend, double M[rows][cols], double relax, double *residual, double *max_elem); #endif // HEAT_H diff --git a/src/heat/common/kernel.c b/src/heat/common/kernel.c index da6582f..aadc896 100644 --- a/src/heat/common/kernel.c +++ b/src/heat/common/kernel.c @@ -1,4 +1,5 @@ #include +#include #include "common/heat.h" #ifndef SIMD @@ -19,6 +20,7 @@ void computeBlock(const int64_t rows, const int64_t cols, const int cstart, const int cend, double M[rows][cols]) { + (void) cend; // Assuming square blocks const int bs = rend-rstart+1; for (int k = 0; k < bs; ++k) { @@ -40,19 +42,74 @@ void computeBlock(const int64_t rows, const int64_t cols, } #endif -double computeBlockResidual(const int64_t rows, const int64_t cols, + +#if 1 + +void computeBlockResidual(const int64_t rows, const int64_t cols, const int rstart, const int rend, const int cstart, const int cend, - double M[rows][cols]) + double M[rows][cols], double relax, + double *residual, double *max_elem) { - double sum = 0.0; + //double relax = 1.95; for (int r = rstart; r <= rend; ++r) { for (int c = cstart; c <= cend; ++c) { - const double value = 0.25*(M[r-1][c] + M[r+1][c] + M[r][c-1] + M[r][c+1]); - const double diff = value - M[r][c]; - sum += diff*diff; - M[r][c] = value; + double old = M[r][c]; + double fdiff = 0.25*(M[r-1][c] + M[r+1][c] + M[r][c-1] + M[r][c+1]); + double new = (1 - relax) * old + relax * fdiff; + double diff = new - old; + /* Use the largest absolute error as residual */ + *residual = fmax(*residual, fabs(diff)); + *max_elem = fmax(*max_elem, fabs(new)); + //fprintf(stderr, "residual = %e in (%4d, %4d)\n", residual, r, c); + M[r][c] = new; } } - return sum; } + +#else + +/* Red-black parallelization */ +void computeBlockResidual(const int64_t rows, const int64_t cols, + const int rstart, const int rend, + const int cstart, const int cend, + double M[rows][cols], double relax, + double * restrict residual, double * restrict max_elem) +{ + (void)(residual); + (void)(max_elem); + + const double A = 1 - relax; + const double B = 0.25 * relax; + + //double relax = 1.95; + for (int r = rstart; r <= rend; r += 2) { + #pragma clang loop vectorize(enable) + for (int c = cstart; c <= cend; c += 2) { + double old = M[r][c]; + double new = A * old + B * (M[r-1][c] + M[r+1][c] + M[r][c-1] + M[r][c+1]); + //double diff = new - old; + /* Use the largest absolute error as residual */ + //*residual = fmax(*residual, fabs(diff)); + //*max_elem = fmax(*max_elem, fabs(new)); + //fprintf(stderr, "residual = %e in (%4d, %4d)\n", residual, r, c); + M[r][c] = new; + } + } + + for (int r = rstart+1; r <= rend; r += 2) { + #pragma clang loop vectorize(enable) + for (int c = cstart+1; c <= cend; c += 2) { + double old = M[r][c]; + double new = A * old + B * (M[r-1][c] + M[r+1][c] + M[r][c-1] + M[r][c+1]); + //double diff = new - old; + /* Use the largest absolute error as residual */ + //*residual = fmax(*residual, fabs(diff)); + //*max_elem = fmax(*max_elem, fabs(new)); + //fprintf(stderr, "residual = %e in (%4d, %4d)\n", residual, r, c); + M[r][c] = new; + } + } +} + +#endif -- GitLab From 7bf7e638fc79d3b8164e51320bfa5a0d0a55a61f Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:20:47 +0200 Subject: [PATCH 10/36] Use -fompss-2 flag for Nanos6 --- src/heat/smp/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/heat/smp/CMakeLists.txt b/src/heat/smp/CMakeLists.txt index 4763b2f..17b1f73 100644 --- a/src/heat/smp/CMakeLists.txt +++ b/src/heat/smp/CMakeLists.txt @@ -6,7 +6,8 @@ endmacro() macro(mk_heat_nanos6 NAME SOURCE) mk_heat_smp(${NAME} ${SOURCE}) - target_link_libraries(${NAME} PRIVATE Nanos6::wrapper) + target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6") + target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") endmacro() macro(mk_heat_nodes NAME SOURCE) -- GitLab From 1adc92f2f8ade11c688e835b189c947ee7a5bc28 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:21:17 +0200 Subject: [PATCH 11/36] Update reported line --- src/heat/smp/main.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/heat/smp/main.c b/src/heat/smp/main.c index a5c3577..ff7acdb 100644 --- a/src/heat/smp/main.c +++ b/src/heat/smp/main.c @@ -25,26 +25,21 @@ int main(int argc, char **argv) double start = getTime(); double residual = solve(&conf, rows, cols, conf.timesteps, NULL); double end = getTime(); + double delta_time = end - start; - int64_t totalElements = conf.rows*conf.cols; - double throughput = (totalElements*conf.timesteps)/(end-start); + long niter = conf.convergenceTimesteps; + long iter_elem = conf.rows * conf.cols; + long total_elem = iter_elem * niter; + double throughput = total_elem / delta_time; -#ifdef _OMPSS_2 - int threads = sysconf(_SC_NPROCESSORS_ONLN); -#else - int threads = 1; -#endif - - fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s %8s\n", - "time", "updates/s", "error", + fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s\n", + "time", "updates/s", "rel. error", "rows", "cols", - "rbs", "cbs", "threads", - "steps"); - fprintf(stdout, "%14e %14e %14e %8ld %8ld %8d %8d %8d %8d\n", - end-start, throughput, residual, + "rbs", "cbs", "iters"); + fprintf(stdout, "%14e %14e %14e %8ld %8ld %8d %8d %8ld\n", + delta_time, throughput, residual, conf.rows, conf.cols, - conf.rbs, conf.cbs, threads, - conf.convergenceTimesteps); + conf.rbs, conf.cbs, niter); if (conf.generateImage) writeImage(conf.imageFileName, conf.matrix, rows, cols); -- GitLab From b49ee58a62004362ec31b1c184dcd6bbcaf7bf50 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:21:50 +0200 Subject: [PATCH 12/36] Set iterations done --- src/heat/smp/solver_ompss2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/heat/smp/solver_ompss2.c b/src/heat/smp/solver_ompss2.c index 36b009e..8b4ad9c 100644 --- a/src/heat/smp/solver_ompss2.c +++ b/src/heat/smp/solver_ompss2.c @@ -34,6 +34,7 @@ double solve(HeatConfiguration *conf, int64_t rows, int64_t cols, int timesteps, gaussSeidelSolver(rows, cols, rbs, cbs, nrb, ncb, matrix, representatives); } #pragma oss taskwait + conf->convergenceTimesteps = timesteps; return IGNORE_RESIDUAL; } -- GitLab From ec68ebaa8a7bb7796b3d6caefd244fbe35c3a142 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 17:22:23 +0200 Subject: [PATCH 13/36] Use relative error as tolerance --- src/heat/README.md | 9 +++++ src/heat/results | 8 +++++ src/heat/smp/solver_ompss2_residual.c | 50 +++++++++++++++++++++++---- 3 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 src/heat/README.md create mode 100644 src/heat/results diff --git a/src/heat/README.md b/src/heat/README.md new file mode 100644 index 0000000..0d642a0 --- /dev/null +++ b/src/heat/README.md @@ -0,0 +1,9 @@ +The heat benchmark solves the steady heat equation in a regular grid of NxM +elements using an iterative solver. + +The solver is either the Gauss-Seidel or Successive-over-relaxation with a wiven +relaxation parameter (--relax). + +In every iteration the relative error of the solution is computed by using the +infinite norm until the tolerance limit is reached. + diff --git a/src/heat/results b/src/heat/results new file mode 100644 index 0000000..019865e --- /dev/null +++ b/src/heat/results @@ -0,0 +1,8 @@ +In MareNostrum 4: +24cores -s_16384_-t_500_-b_1024 3906.56 +24cores -s_16384_-t_500_-b_2048 3890.20 +24cores -s_16384_-t_500_-b_128 3752.77 + +48cores -s_16384_-t_500_-b_1024 4843.91 +48cores -s_16384_-t_500_-b_128 4367.97 +48cores -s_16384_-t_500_-b_2048 4275.91 diff --git a/src/heat/smp/solver_ompss2_residual.c b/src/heat/smp/solver_ompss2_residual.c index 03baa7f..17d59b3 100644 --- a/src/heat/smp/solver_ompss2_residual.c +++ b/src/heat/smp/solver_ompss2_residual.c @@ -1,4 +1,5 @@ #include +#include #include "common/heat.h" @@ -9,41 +10,74 @@ summary(void) "residual"; } -static inline void gaussSeidelSolver(int64_t rows, int64_t cols, int rbs, int cbs, int nrb, int ncb, double M[rows][cols], char reps[nrb][ncb], double *residual) +static inline void gaussSeidelSolver(int64_t rows, int64_t cols, int rbs, int cbs, int nrb, int ncb, double M[rows][cols], char reps[nrb][ncb], double *residual, double *max_elem, double relax) { for (int R = 1; R < nrb-1; ++R) { for (int C = 1; C < ncb-1; ++C) { #pragma oss task label("block computation") \ in(reps[R-1][C]) in(reps[R+1][C]) \ in(reps[R][C-1]) in(reps[R][C+1]) \ - inout(reps[R][C]) reduction(+: [1]residual) - *residual += computeBlockResidual(rows, cols, (R-1)*rbs+1, R*rbs, (C-1)*cbs+1, C*cbs, M); + inout(reps[R][C]) \ + reduction(max: [1]residual) \ + reduction(max: [1]max_elem) + { + double lresidual = 0.0; + double lmax_elem = 0.0; + + computeBlockResidual(rows, cols, (R-1)*rbs+1, + R*rbs, (C-1)*cbs+1, C*cbs, M, + relax, &lresidual, &lmax_elem); + + *residual = fmax(*residual, lresidual); + *max_elem = fmax(*max_elem, lmax_elem); + } } } } double solve(HeatConfiguration *conf, int64_t rows, int64_t cols, int timesteps, void *extraData) { + FILE *f = fopen("convergence.csv", "w"); + fprintf(f, "iter error time\n"); + (void) extraData; double (*matrix)[cols] = (double (*)[cols]) conf->matrix; const double delta = conf->delta; const int rbs = conf->rbs; const int cbs = conf->cbs; - const int N = 10; + const int N = 4; double results[N]; - for (int i = 0; i < N; ++i) - results[i] = delta; + double max_elem[N]; + double residual[N]; + + for (int i = 0; i < N; ++i) { + results[i] = 666; + max_elem[i] = 666; + residual[i] = 666; + } const int nrb = (rows-2)/rbs+2; const int ncb = (cols-2)/cbs+2; char representatives[nrb][ncb]; + double t0 = getTime(); + int t = 0; while (t < timesteps) { results[t%N] = 0.0f; + max_elem[t%N] = 0.0f; + residual[t%N] = 0.0f; + + gaussSeidelSolver(rows, cols, rbs, cbs, nrb, ncb, matrix, + representatives, &residual[t%N], &max_elem[t%N], conf->relax); - gaussSeidelSolver(rows, cols, rbs, cbs, nrb, ncb, matrix, representatives, &results[t%N]); + #pragma oss task in(residual[t%N], max_elem[t%N]) out(results[t%N]) + { + results[t%N] = residual[t%N] / max_elem[t%N]; + fprintf(f, "%d %e %e\n", t, results[t%N], getTime() - t0); + //fprintf(stderr, "t=%d error=%e\n", t, results[t%N]); + } // Advance to the next timestep ++t; @@ -60,5 +94,7 @@ double solve(HeatConfiguration *conf, int64_t rows, int64_t cols, int timesteps, // Save the number of performed timesteps conf->convergenceTimesteps = t; + fclose(f); + return results[(t-1)%N]; } -- GitLab From 6cee1636b8b422a1fed1ef1877b84ffcd231ad36 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 18:05:19 +0200 Subject: [PATCH 14/36] Set compiler to clang in CMakeLists.txt --- CMakeLists.txt | 7 +++++-- flake.nix | 4 ---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a2a981..36fb051 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.20) +set(CMAKE_C_COMPILER "clang") +set(CMAKE_CXX_COMPILER "clang++") + project(BENCH6 LANGUAGES C CXX) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") @@ -83,9 +86,9 @@ macro(mk_bench NAME) add_executable(${NAME}) get_property(BENCH6_LIST GLOBAL PROPERTY bench6_list) - message(STATUS "Before BENCH6_LIST=${BENCH6_LIST}") + #message(STATUS "Before BENCH6_LIST=${BENCH6_LIST}") list(APPEND BENCH6_LIST ${NAME}) - message(STATUS "After BENCH6_LIST=${BENCH6_LIST}") + #message(STATUS "After BENCH6_LIST=${BENCH6_LIST}") set_property(GLOBAL PROPERTY bench6_list "${BENCH6_LIST}") install(TARGETS ${NAME} RUNTIME DESTINATION bin) diff --git a/flake.nix b/flake.nix index a10d62e..db3b695 100644 --- a/flake.nix +++ b/flake.nix @@ -23,10 +23,6 @@ ]; enableParallelBuilding = false; - cmakeFlags = [ - "-DCMAKE_C_COMPILER=clang" - "-DCMAKE_CXX_COMPILER=clang++" - ]; hardeningDisable = [ "all" ]; dontStrip = true; }; -- GitLab From 4a6c2dc663c42141559b2b1df8c7a168ecc7197a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 18:06:03 +0200 Subject: [PATCH 15/36] Improve runner reporting --- src/tools/runner.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/src/tools/runner.c b/src/tools/runner.c index 9bc75b8..4d827c8 100644 --- a/src/tools/runner.c +++ b/src/tools/runner.c @@ -9,11 +9,7 @@ #include #include -//static void -//usage(void) -//{ -// exit(1); -//} +static char *progname = "b6_runner"; struct sampling { int nmax; @@ -47,7 +43,6 @@ do_run(char *argv[], double *ptime) *nl = '\0'; /* Clean status line */ - fprintf(stderr, " \r"); fprintf(stderr, "%s\n", line); double time; @@ -111,8 +106,8 @@ stats(struct sampling *s) double se = stdev / sqrt(n); double rse = 100.0 * se * 1.96 / mean; - fprintf(stderr, "n=%03d median=%.3e mean=%.3e SD=%.3e RSD=%.2f%% RSE=%.2f%% \r", - s->n, median, mean, stdev, rstdev, rse); + fprintf(stderr, "%s: n=%03d median=%.3e mean=%.3e SD=%.3e RSD=%.2f%% RSE=%.2f%%\n", + progname, s->n, median, mean, stdev, rstdev, rse); s->rse = rse; } @@ -143,20 +138,6 @@ add_sample(struct sampling *s, double time) } } -//static int -//compare_double(const void *a, const void *b) -//{ -// double aa = *(const double *) a; -// double bb = *(const double *) b; -// -// if (aa < bb) -// return -1; -// else if (aa > bb) -// return +1; -// else -// return 0; -//} - static int sample(char *argv[]) { @@ -186,6 +167,7 @@ sample(char *argv[]) int main(int argc, char *argv[]) { + progname_set(progname); (void) argc; if (sample(argv+1) != 0) { -- GitLab From d41a19b37d8299a11181f1c66fea13e1c564900b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 23 Jun 2023 18:06:29 +0200 Subject: [PATCH 16/36] Build kernel with vectorization --- src/heat/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/heat/CMakeLists.txt b/src/heat/CMakeLists.txt index a115a7b..7edf742 100644 --- a/src/heat/CMakeLists.txt +++ b/src/heat/CMakeLists.txt @@ -1,6 +1,12 @@ -add_library(heat_common STATIC common/misc.c common/kernel.c) +add_library(heat_kernel STATIC common/kernel.c) +target_include_directories(heat_kernel PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_options(heat_kernel PRIVATE + -Rpass-analysis=loop-vectorize + -ffast-math) + +add_library(heat_common STATIC common/misc.c) target_include_directories(heat_common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(heat_common PUBLIC m) +target_link_libraries(heat_common PUBLIC m heat_kernel) add_subdirectory(smp) add_subdirectory(mpi) -- GitLab From 32e1199184057273e1f92405d81fb4614be53a05 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 12 Sep 2023 16:12:01 +0200 Subject: [PATCH 17/36] WIP --- cmake/FindNodes.cmake | 44 +++++++++++++++++++++++++++++++------------ src/heat/README.md | 2 +- src/tools/runner.c | 30 ++++++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 14 deletions(-) diff --git a/cmake/FindNodes.cmake b/cmake/FindNodes.cmake index 49ba1aa..13e46cb 100644 --- a/cmake/FindNodes.cmake +++ b/cmake/FindNodes.cmake @@ -1,3 +1,15 @@ +# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) +# SPDX-License-Identifier: GPL-3.0-or-later +# +# Searchs for libnodes and checks if the -fompss-2=libnodes flag is supported in +# the compiler. +# +# Sets the variable NODES_FOUND when libnodes is found and NODES_FLAG_SUPPORTED +# when the -fompss-2=libnodes flag is supported. +# +# The target Nodes::nodes is defined when both checks are passed, and includes a +# rule to add the compile and link time flags. + include(GNUInstallDirs) if(DEFINED ENV{NODES_HOME}) @@ -6,16 +18,30 @@ else() message(STATUS "NODES_HOME not set, refusing to search") endif() -find_library(NODES_LIBRARY NAMES nanos6 PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH) -find_file(NODES_WRAPPER NAMES nanos6-main-wrapper.o PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH) -find_path(NODES_INCLUDE_DIR nanos6.h PATHS "${NODES_HOME}/include" NO_DEFAULT_PATH) +find_library(NODES_LIBRARY NAMES nodes PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH) +find_path(NODES_INCLUDE_DIR nodes.h PATHS "${NODES_HOME}/include" NO_DEFAULT_PATH) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Nodes DEFAULT_MSG - NODES_LIBRARY NODES_INCLUDE_DIR NODES_WRAPPER) + NODES_LIBRARY NODES_INCLUDE_DIR) if(NOT NODES_FOUND) + message(STATUS "Cannot find NODES library") + return() +endif() + +# Also ensure the compiler supports libnodes +include(CheckCCompilerFlag) + +set(NODES_FLAG "-fompss-2=libnodes") +# Also set the linker flags, as otherwise the check will fail due to undefined +# symbols in the final program. +set(CMAKE_REQUIRED_LINK_OPTIONS "${NODES_FLAG}") +check_c_compiler_flag("${NODES_FLAG}" NODES_FLAG_SUPPORTED) + +if(NOT NODES_FLAG_SUPPORTED) + message(STATUS "Compiler doesn't support ${NODES_FLAG} flag") return() endif() @@ -24,12 +50,6 @@ if(NOT TARGET Nodes::nodes) set_target_properties(Nodes::nodes PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${NODES_INCLUDE_DIR}" IMPORTED_LOCATION ${NODES_LIBRARY}) -endif() - -if(NOT TARGET Nodes::wrapper) - add_library(Nodes::wrapper STATIC IMPORTED) - set_target_properties(Nodes::wrapper PROPERTIES - IMPORTED_LOCATION ${NODES_WRAPPER}) - target_compile_options(Nodes::wrapper INTERFACE "-fompss-2") - target_link_libraries(Nodes::wrapper INTERFACE Nodes::nodes) + target_compile_options(Nodes::nodes INTERFACE "${NODES_FLAG}") + target_link_options(Nodes::nodes INTERFACE "${NODES_FLAG}") endif() diff --git a/src/heat/README.md b/src/heat/README.md index 0d642a0..6ddcc67 100644 --- a/src/heat/README.md +++ b/src/heat/README.md @@ -1,7 +1,7 @@ The heat benchmark solves the steady heat equation in a regular grid of NxM elements using an iterative solver. -The solver is either the Gauss-Seidel or Successive-over-relaxation with a wiven +The solver is either the Gauss-Seidel or Successive-over-relaxation with a given relaxation parameter (--relax). In every iteration the relative error of the solution is computed by using the diff --git a/src/tools/runner.c b/src/tools/runner.c index 4d827c8..00167c3 100644 --- a/src/tools/runner.c +++ b/src/tools/runner.c @@ -9,7 +9,7 @@ #include #include -static char *progname = "b6_runner"; +static char *progname = "bench6"; struct sampling { int nmax; @@ -164,6 +164,34 @@ sample(char *argv[]) return 0; } +static void +parse_options(struct options *options, int argc, char *argv[]) +{ + /* Default options */ + options->ndrift_samples = 1; + options->nsamples = 100; + options->verbose = 0; + options->drift_wait = 5; + options->outpath = "ovni/clock-offsets.txt"; + + int opt; + while ((opt = getopt(argc, argv, "hl")) != -1) { + switch (opt) { + case 'l': + list(); + break; + case 'h': + default: /* '?' */ + usage(); + } + } + + if (optind < argc) { + fprintf(stderr, "error: unexpected extra arguments\n"); + exit(EXIT_FAILURE); + } +} + int main(int argc, char *argv[]) { -- GitLab From 5d4b5c88ddf7008a75a4f98b6cfa7b6037fe241f Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 14 Mar 2024 16:25:01 +0100 Subject: [PATCH 18/36] Update flake --- flake.lock | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 22 +++--- 2 files changed, 204 insertions(+), 10 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b9b5434 --- /dev/null +++ b/flake.lock @@ -0,0 +1,192 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "jungle", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696775529, + "narHash": "sha256-TYlE4B0ktPtlJJF9IFxTWrEeq+XKG8Ny0gc2FGEAdj0=", + "owner": "ryantm", + "repo": "agenix", + "rev": "daf42cb35b2dc614d1551e37f96406e4c4a2d3e4", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "bscpkgs": { + "inputs": { + "nixpkgs": [ + "jungle", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700663915, + "narHash": "sha256-2NiVhUgOs26nVqnypx8Er3sjyHD2cApjYV9iYrGY9xE=", + "ref": "refs/heads/master", + "rev": "e148de50d68b3eeafc3389b331cf042075971c4b", + "revCount": 912, + "type": "git", + "url": "https://git.sr.ht/~rodarima/bscpkgs" + }, + "original": { + "type": "git", + "url": "https://git.sr.ht/~rodarima/bscpkgs" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "jungle", + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "jungle", + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682203081, + "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jungle": { + "inputs": { + "agenix": "agenix", + "bscpkgs": "bscpkgs", + "nixpkgs": "nixpkgs", + "nixseparatedebuginfod": "nixseparatedebuginfod" + }, + "locked": { + "lastModified": 1709653941, + "narHash": "sha256-/tvfFXPgT+1lsid7i69ugxp4a1QIxU5gUYkK7qZD+rc=", + "ref": "refs/heads/master", + "rev": "005a67deafa6b2b9400d6d05249cb713e4dc6ef4", + "revCount": 229, + "type": "git", + "url": "https://git.sr.ht/~rodarima/jungle" + }, + "original": { + "type": "git", + "url": "https://git.sr.ht/~rodarima/jungle" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixseparatedebuginfod": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "jungle", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1699185600, + "narHash": "sha256-jxU+5plCvsOJYEdLQTi7sKOOAnndin2sslYOF0Ys66g=", + "owner": "symphorien", + "repo": "nixseparatedebuginfod", + "rev": "232591f5274501b76dbcd83076a57760237fcd64", + "type": "github" + }, + "original": { + "owner": "symphorien", + "repo": "nixseparatedebuginfod", + "type": "github" + } + }, + "root": { + "inputs": { + "jungle": "jungle" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index db3b695..7960e4f 100644 --- a/flake.nix +++ b/flake.nix @@ -2,24 +2,26 @@ description = "bench6"; nixConfig.bash-prompt = "\[nix-develop\]$ "; - inputs.jungle.url = "jungle"; + inputs.jungle.url = "git+https://git.sr.ht/~rodarima/jungle"; - outputs = { self, jungle }: - let pkgs = jungle.packages.x86_64-linux.hut; in - { + outputs = { self, jungle, ... }: + let + targetMachine = jungle.outputs.nixosConfigurations.hut; + pkgs = targetMachine.pkgs; + in { packages.x86_64-linux.default = pkgs.stdenv.mkDerivation rec { pname = "bench6"; - version = "local"; + version = if self ? shortRev then self.shortRev else "dirty"; src = self.outPath; buildInputs = with pkgs; [ cmake - bsc.clangOmpss2 - bsc.nanos6 - bsc.nodes - bsc.mpi - bsc.tampi + clangOmpss2 + nanos6 + nodes + mpi + tampi ]; enableParallelBuilding = false; -- GitLab From 491b65ad9e5f22b50bbf3666f3dbeefd51a8f990 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 9 Apr 2024 17:16:21 +0200 Subject: [PATCH 19/36] WIP: Use jungle from local disk --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 7960e4f..22331b5 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "bench6"; nixConfig.bash-prompt = "\[nix-develop\]$ "; - inputs.jungle.url = "git+https://git.sr.ht/~rodarima/jungle"; + inputs.jungle.url = "path:/home/Computational/rarias/jungle"; outputs = { self, jungle, ... }: let -- GitLab From 42f3d2c83d25c7db5bb2a225ebfeee97d2cfe1c3 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 9 Apr 2024 17:16:27 +0200 Subject: [PATCH 20/36] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'jungle': 'git+https://git.sr.ht/~rodarima/jungle?ref=refs/heads/master&rev=005a67deafa6b2b9400d6d05249cb713e4dc6ef4' (2024-03-05) → 'path:/home/Computational/rarias/jungle?lastModified=1710869393&narHash=sha256-Oi2lgWkYRG1SHImng09H2yQ06VS6nN7s6QPlWSPrTA4%3D' (2024-03-19) • Updated input 'jungle/agenix': 'github:ryantm/agenix/daf42cb35b2dc614d1551e37f96406e4c4a2d3e4' (2023-10-08) → 'github:ryantm/agenix/8cb01a0e717311680e0cbca06a76cbceba6f3ed6' (2024-02-13) • Updated input 'jungle/agenix/darwin': 'github:lnl7/nix-darwin/87b9d090ad39b25b2400029c64825fc2a8868943' (2023-01-09) → 'github:lnl7/nix-darwin/4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d' (2023-11-24) • Updated input 'jungle/agenix/home-manager': 'github:nix-community/home-manager/32d3e39c491e2f91152c84f8ad8b003420eab0a1' (2023-04-22) → 'github:nix-community/home-manager/3bfaacf46133c037bb356193bd2f1765d9dc82c1' (2023-12-20) • Added input 'jungle/agenix/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09) • Updated input 'jungle/bscpkgs': 'git+https://git.sr.ht/~rodarima/bscpkgs?ref=refs/heads/master&rev=e148de50d68b3eeafc3389b331cf042075971c4b' (2023-11-22) → 'git+https://git.sr.ht/~rodarima/bscpkgs?ref=refs/heads/master&rev=fce556cb285071e4cb042ad135dcaaaae303c9a7' (2024-03-14) • Updated input 'jungle/nixpkgs': 'github:NixOS/nixpkgs/e4ad989506ec7d71f7302cc3067abd82730a4beb' (2023-11-19) → 'github:NixOS/nixpkgs/0ad13a6833440b8e238947e47bea7f11071dc2b2' (2024-03-12) • Removed input 'jungle/nixseparatedebuginfod' • Removed input 'jungle/nixseparatedebuginfod/flake-utils' • Removed input 'jungle/nixseparatedebuginfod/flake-utils/systems' • Removed input 'jungle/nixseparatedebuginfod/nixpkgs' --- flake.lock | 93 +++++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 68 deletions(-) diff --git a/flake.lock b/flake.lock index b9b5434..303b093 100644 --- a/flake.lock +++ b/flake.lock @@ -7,14 +7,15 @@ "nixpkgs": [ "jungle", "nixpkgs" - ] + ], + "systems": "systems" }, "locked": { - "lastModified": 1696775529, - "narHash": "sha256-TYlE4B0ktPtlJJF9IFxTWrEeq+XKG8Ny0gc2FGEAdj0=", + "lastModified": 1707830867, + "narHash": "sha256-PAdwm5QqdlwIqGrfzzvzZubM+FXtilekQ/FA0cI49/o=", "owner": "ryantm", "repo": "agenix", - "rev": "daf42cb35b2dc614d1551e37f96406e4c4a2d3e4", + "rev": "8cb01a0e717311680e0cbca06a76cbceba6f3ed6", "type": "github" }, "original": { @@ -31,11 +32,11 @@ ] }, "locked": { - "lastModified": 1700663915, - "narHash": "sha256-2NiVhUgOs26nVqnypx8Er3sjyHD2cApjYV9iYrGY9xE=", + "lastModified": 1710421994, + "narHash": "sha256-GitTgcFYT6OQvbt+QUSwz4WPGR55D4AVo47yXywH0W8=", "ref": "refs/heads/master", - "rev": "e148de50d68b3eeafc3389b331cf042075971c4b", - "revCount": 912, + "rev": "fce556cb285071e4cb042ad135dcaaaae303c9a7", + "revCount": 934, "type": "git", "url": "https://git.sr.ht/~rodarima/bscpkgs" }, @@ -53,11 +54,11 @@ ] }, "locked": { - "lastModified": 1673295039, - "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", "type": "github" }, "original": { @@ -67,24 +68,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -94,11 +77,11 @@ ] }, "locked": { - "lastModified": 1682203081, - "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", "owner": "nix-community", "repo": "home-manager", - "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", "type": "github" }, "original": { @@ -111,30 +94,26 @@ "inputs": { "agenix": "agenix", "bscpkgs": "bscpkgs", - "nixpkgs": "nixpkgs", - "nixseparatedebuginfod": "nixseparatedebuginfod" + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1709653941, - "narHash": "sha256-/tvfFXPgT+1lsid7i69ugxp4a1QIxU5gUYkK7qZD+rc=", - "ref": "refs/heads/master", - "rev": "005a67deafa6b2b9400d6d05249cb713e4dc6ef4", - "revCount": 229, - "type": "git", - "url": "https://git.sr.ht/~rodarima/jungle" + "lastModified": 1710869393, + "narHash": "sha256-Oi2lgWkYRG1SHImng09H2yQ06VS6nN7s6QPlWSPrTA4=", + "path": "/home/Computational/rarias/jungle", + "type": "path" }, "original": { - "type": "git", - "url": "https://git.sr.ht/~rodarima/jungle" + "path": "/home/Computational/rarias/jungle", + "type": "path" } }, "nixpkgs": { "locked": { - "lastModified": 1700390070, - "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", + "lastModified": 1710272261, + "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", + "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", "type": "github" }, "original": { @@ -144,28 +123,6 @@ "type": "github" } }, - "nixseparatedebuginfod": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "jungle", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1699185600, - "narHash": "sha256-jxU+5plCvsOJYEdLQTi7sKOOAnndin2sslYOF0Ys66g=", - "owner": "symphorien", - "repo": "nixseparatedebuginfod", - "rev": "232591f5274501b76dbcd83076a57760237fcd64", - "type": "github" - }, - "original": { - "owner": "symphorien", - "repo": "nixseparatedebuginfod", - "type": "github" - } - }, "root": { "inputs": { "jungle": "jungle" -- GitLab From 08a1dee08a2cca60f8a19622c5c4f411e17f5469 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 15 Apr 2024 15:25:05 +0200 Subject: [PATCH 21/36] Merge heat files into a single directory Gaspi is still pending. --- src/heat/CMakeLists.txt | 89 ++++++++++++++++++- src/heat/common/main.c | 52 ----------- src/heat/{common => }/heat.h | 0 src/heat/{common => }/kernel.c | 2 +- src/heat/{mpi/main.c => main_mpi.c} | 4 +- src/heat/{smp/main.c => main_smp.c} | 2 +- src/heat/{common => }/misc.c | 0 src/heat/mpi/CMakeLists.txt | 48 ---------- src/heat/{Makefile => old.Makefile} | 0 src/heat/smp/CMakeLists.txt | 33 ------- .../{mpi => }/solver_itampi_ompss2_tasks.c | 4 +- src/heat/{mpi => }/solver_mpi.c | 4 +- src/heat/{mpi => }/solver_mpi_nbuffer.c | 4 +- .../{mpi => }/solver_mpi_ompss2_forkjoin.c | 4 +- src/heat/{mpi => }/solver_mpi_ompss2_tasks.c | 4 +- src/heat/{mpi => }/solver_mpirma_nbuffer.c | 4 +- .../{mpi => }/solver_mpirma_ompss2_tasks.c | 4 +- src/heat/{smp => }/solver_ompss2.c | 2 +- src/heat/{smp => }/solver_ompss2_residual.c | 2 +- src/heat/{smp => }/solver_ompss2_taskloop.c | 2 +- src/heat/{smp => }/solver_seq.c | 2 +- .../{mpi => }/solver_tampi_ompss2_tasks.c | 2 +- .../{mpi => }/solver_tampirma_ompss2_tasks.c | 2 +- src/heat/{mpi/utils.c => utils_mpi.c} | 4 +- src/heat/{mpi/utils.h => utils_mpi.h} | 2 +- 25 files changed, 112 insertions(+), 164 deletions(-) delete mode 100644 src/heat/common/main.c rename src/heat/{common => }/heat.h (100%) rename src/heat/{common => }/kernel.c (99%) rename src/heat/{mpi/main.c => main_mpi.c} (98%) rename src/heat/{smp/main.c => main_smp.c} (97%) rename src/heat/{common => }/misc.c (100%) delete mode 100644 src/heat/mpi/CMakeLists.txt rename src/heat/{Makefile => old.Makefile} (100%) delete mode 100644 src/heat/smp/CMakeLists.txt rename src/heat/{mpi => }/solver_itampi_ompss2_tasks.c (98%) rename src/heat/{mpi => }/solver_mpi.c (97%) rename src/heat/{mpi => }/solver_mpi_nbuffer.c (98%) rename src/heat/{mpi => }/solver_mpi_ompss2_forkjoin.c (97%) rename src/heat/{mpi => }/solver_mpi_ompss2_tasks.c (98%) rename src/heat/{mpi => }/solver_mpirma_nbuffer.c (98%) rename src/heat/{mpi => }/solver_mpirma_ompss2_tasks.c (98%) rename src/heat/{smp => }/solver_ompss2.c (97%) rename src/heat/{smp => }/solver_ompss2_residual.c (98%) rename src/heat/{smp => }/solver_ompss2_taskloop.c (97%) rename src/heat/{smp => }/solver_seq.c (96%) rename src/heat/{mpi => }/solver_tampi_ompss2_tasks.c (98%) rename src/heat/{mpi => }/solver_tampirma_ompss2_tasks.c (99%) rename src/heat/{mpi/utils.c => utils_mpi.c} (98%) rename src/heat/{mpi/utils.h => utils_mpi.h} (94%) diff --git a/src/heat/CMakeLists.txt b/src/heat/CMakeLists.txt index 7edf742..4374eb2 100644 --- a/src/heat/CMakeLists.txt +++ b/src/heat/CMakeLists.txt @@ -1,12 +1,93 @@ -add_library(heat_kernel STATIC common/kernel.c) +# --- Common to all --- + +add_library(heat_kernel STATIC kernel.c) target_include_directories(heat_kernel PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_options(heat_kernel PRIVATE -Rpass-analysis=loop-vectorize -ffast-math) -add_library(heat_common STATIC common/misc.c) +add_library(heat_common STATIC misc.c) target_include_directories(heat_common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(heat_common PUBLIC m heat_kernel) -add_subdirectory(smp) -add_subdirectory(mpi) +# --- SMP based --- + +add_library(heat_smp_common STATIC main_smp.c) +target_link_libraries(heat_smp_common PUBLIC heat_common) + +macro(mk_heat_smp NAME SOURCE) + mk_bench(${NAME}) + target_sources(${NAME} PRIVATE ${SOURCE}) + target_link_libraries(${NAME} PRIVATE heat_smp_common) +endmacro() + +# No requisites +mk_heat_smp(heat_seq solver_seq.c) + +if(NANOS6_FOUND) + macro(mk_heat_nanos6 NAME SOURCE) + mk_heat_smp(${NAME} ${SOURCE}) + target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6") + target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") + endmacro() + + mk_heat_nanos6(heat_nanos6 solver_ompss2.c) + mk_heat_nanos6(heat_nanos6_residual solver_ompss2_residual.c) +endif() + +message(STATUS "NODES FOUND = ${NODES_FOUND}") +if(NODES_FOUND) + macro(mk_heat_nodes NAME SOURCE) + mk_heat_smp(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE Nodes::nodes) + endmacro() + + mk_heat_nodes(heat_nodes solver_ompss2.c) + mk_heat_nodes(heat_nodes_residual solver_ompss2_residual.c) +endif() + +# --- MPI based --- + +if(MPI_FOUND) + add_library(heat_mpi_common STATIC main_mpi.c utils_mpi.c) + target_link_libraries(heat_mpi_common PUBLIC heat_common MPI::MPI_C) + + macro(mk_heat_mpi NAME SOURCE) + mk_bench(${NAME}) + target_sources(${NAME} PRIVATE ${SOURCE}) + target_link_libraries(${NAME} PRIVATE heat_mpi_common) + endmacro() + mk_heat_mpi(heat_mpi solver_mpi.c) + mk_heat_mpi(heat_mpi_nbuffer solver_mpi_nbuffer.c) + + if(NANOS6_FOUND) + macro(mk_heat_mpi_nanos6 NAME SOURCE) + mk_heat_mpi(${NAME} ${SOURCE}) + target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6") + target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") + endmacro() + mk_heat_mpi_nanos6(heat_mpi_nanos6_forkjoin solver_mpi_ompss2_forkjoin.c) + mk_heat_mpi_nanos6(heat_mpi_nanos6_tasks solver_mpi_ompss2_tasks.c) + + if(TAMPI_FOUND) + macro(mk_heat_tampi_nanos6 NAME SOURCE) + mk_heat_mpi_nanos6(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE Tampi::tampi-c) + endmacro() + mk_heat_tampi_nanos6(heat_itampi_nanos6_tasks solver_itampi_ompss2_tasks.c) + endif() + endif() + + if(NODES_FOUND) + macro(mk_heat_mpi_nodes NAME SOURCE) + mk_heat_mpi(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE Nodes::nodes) + endmacro() + mk_heat_mpi_nodes(heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c) + mk_heat_mpi_nodes(heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c) + endif() +endif() + +# --- GASPI --- + +# TODO diff --git a/src/heat/common/main.c b/src/heat/common/main.c deleted file mode 100644 index 9ff1a91..0000000 --- a/src/heat/common/main.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include - -#include "common/heat.h" - - -int main(int argc, char **argv) -{ - HeatConfiguration conf; - readConfiguration(argc, argv, &conf); - refineConfiguration(&conf, conf.rbs, conf.cbs); - if (conf.verbose) - printConfiguration(&conf); - - int64_t rows = conf.rows+2; - int64_t cols = conf.cols+2; - - initialize(&conf, rows, cols, 0); - - if (conf.warmup) - solve(&conf, rows, cols, 1, NULL); - - // Solve the problem - double start = getTime(); - double residual = solve(&conf, rows, cols, conf.timesteps, NULL); - double end = getTime(); - - int64_t totalElements = conf.rows*conf.cols; - double throughput = (totalElements*conf.timesteps)/(end-start); - -#ifdef _OMPSS_2 - int threads = sysconf(_SC_NPROCESSORS_ONLN); -#else - int threads = 1; -#endif - - fprintf(stderr,"%8s %8s %8s %8s %8s %8s %14s %14s %14s", - "rows", "cols", "rbs", "cbs", "threads", - "steps", "error", "time", "updates/s\n"); - fprintf(stdout, "%8ld %8ld %8d %8d %8d %8d %14e %14e %14e\n", - conf.rows, conf.cols, - conf.rbs, conf.cbs, threads, - conf.convergenceTimesteps, residual, end-start, throughput); - - if (conf.generateImage) - writeImage(conf.imageFileName, conf.matrix, rows, cols); - - finalize(&conf); - - return 0; -} diff --git a/src/heat/common/heat.h b/src/heat/heat.h similarity index 100% rename from src/heat/common/heat.h rename to src/heat/heat.h diff --git a/src/heat/common/kernel.c b/src/heat/kernel.c similarity index 99% rename from src/heat/common/kernel.c rename to src/heat/kernel.c index aadc896..32d67df 100644 --- a/src/heat/common/kernel.c +++ b/src/heat/kernel.c @@ -1,6 +1,6 @@ #include #include -#include "common/heat.h" +#include "heat.h" #ifndef SIMD void computeBlock(const int64_t rows, const int64_t cols, diff --git a/src/heat/mpi/main.c b/src/heat/main_mpi.c similarity index 98% rename from src/heat/mpi/main.c rename to src/heat/main_mpi.c index 718615f..af980a1 100644 --- a/src/heat/mpi/main.c +++ b/src/heat/main_mpi.c @@ -4,8 +4,8 @@ #include #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" #ifdef TAMPI #include diff --git a/src/heat/smp/main.c b/src/heat/main_smp.c similarity index 97% rename from src/heat/smp/main.c rename to src/heat/main_smp.c index ff7acdb..5d29b7d 100644 --- a/src/heat/smp/main.c +++ b/src/heat/main_smp.c @@ -2,7 +2,7 @@ #include #include -#include "common/heat.h" +#include "heat.h" int main(int argc, char **argv) diff --git a/src/heat/common/misc.c b/src/heat/misc.c similarity index 100% rename from src/heat/common/misc.c rename to src/heat/misc.c diff --git a/src/heat/mpi/CMakeLists.txt b/src/heat/mpi/CMakeLists.txt deleted file mode 100644 index 3682f4b..0000000 --- a/src/heat/mpi/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -if(NOT MPI_FOUND) - return() -endif() - -macro(mk_heat_mpi NAME SOURCE) - mk_bench(${NAME}) - target_sources(${NAME} PRIVATE ${SOURCE}) - target_link_libraries(${NAME} PRIVATE heat_mpi_common) -endmacro() - -macro(mk_heat_mpi_nanos6 NAME SOURCE) - mk_heat_mpi(${NAME} ${SOURCE}) - target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6") - target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") -endmacro() - -macro(mk_heat_mpi_nodes NAME SOURCE) - mk_heat_mpi(${NAME} ${SOURCE}) - target_link_libraries(${NAME} PRIVATE Nodes::wrapper) -endmacro() - -macro(mk_heat_tampi_nanos6 NAME SOURCE) - mk_heat_mpi_nanos6(${NAME} ${SOURCE}) - target_link_libraries(${NAME} PRIVATE Tampi::tampi-c) -endmacro() - - -# ------------------------------------------------------------------- - -add_library(heat_mpi_common STATIC main.c utils.c) -target_link_libraries(heat_mpi_common PUBLIC heat_common MPI::MPI_C) - -mk_heat_mpi(b6_heat_mpi solver_mpi.c) -mk_heat_mpi(b6_heat_mpi_nbuffer solver_mpi_nbuffer.c) - -if(NANOS6_FOUND) - mk_heat_mpi_nanos6(b6_heat_mpi_nanos6_forkjoin solver_mpi_ompss2_forkjoin.c) - mk_heat_mpi_nanos6(b6_heat_mpi_nanos6_tasks solver_mpi_ompss2_tasks.c) -endif() - -if(NODES_FOUND) - mk_heat_mpi_nodes(b6_heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c) - mk_heat_mpi_nodes(b6_heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c) -endif() - -if(NANOS6_FOUND AND TAMPI_FOUND) - mk_heat_tampi_nanos6(b6_heat_itampi_nanos6_tasks solver_itampi_ompss2_tasks.c) -endif() diff --git a/src/heat/Makefile b/src/heat/old.Makefile similarity index 100% rename from src/heat/Makefile rename to src/heat/old.Makefile diff --git a/src/heat/smp/CMakeLists.txt b/src/heat/smp/CMakeLists.txt deleted file mode 100644 index 17b1f73..0000000 --- a/src/heat/smp/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -macro(mk_heat_smp NAME SOURCE) - mk_bench(${NAME}) - target_sources(${NAME} PRIVATE ${SOURCE}) - target_link_libraries(${NAME} PRIVATE heat_smp_common) -endmacro() - -macro(mk_heat_nanos6 NAME SOURCE) - mk_heat_smp(${NAME} ${SOURCE}) - target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6") - target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") -endmacro() - -macro(mk_heat_nodes NAME SOURCE) - mk_heat_smp(${NAME} ${SOURCE}) - target_link_libraries(${NAME} PRIVATE Nodes::wrapper) -endmacro() - -# ------------------------------------------------------------------- - -add_library(heat_smp_common STATIC main.c) -target_link_libraries(heat_smp_common PUBLIC heat_common) - -mk_heat_smp(b6_heat_seq solver_seq.c) - -if(NANOS6_FOUND) - mk_heat_nanos6(b6_heat_nanos6 solver_ompss2.c) - mk_heat_nanos6(b6_heat_nanos6_residual solver_ompss2_residual.c) -endif() - -if(NODES_FOUND) - mk_heat_nodes(b6_heat_nodes solver_ompss2.c) - mk_heat_nodes(b6_heat_nodes_residual solver_ompss2_residual.c) -endif() diff --git a/src/heat/mpi/solver_itampi_ompss2_tasks.c b/src/heat/solver_itampi_ompss2_tasks.c similarity index 98% rename from src/heat/mpi/solver_itampi_ompss2_tasks.c rename to src/heat/solver_itampi_ompss2_tasks.c index 720587f..25966eb 100644 --- a/src/heat/mpi/solver_itampi_ompss2_tasks.c +++ b/src/heat/solver_itampi_ompss2_tasks.c @@ -1,8 +1,8 @@ #include #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" const char * summary(void) diff --git a/src/heat/mpi/solver_mpi.c b/src/heat/solver_mpi.c similarity index 97% rename from src/heat/mpi/solver_mpi.c rename to src/heat/solver_mpi.c index 12ac822..7cfa786 100644 --- a/src/heat/mpi/solver_mpi.c +++ b/src/heat/solver_mpi.c @@ -1,7 +1,7 @@ #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" int mpi_level(void) diff --git a/src/heat/mpi/solver_mpi_nbuffer.c b/src/heat/solver_mpi_nbuffer.c similarity index 98% rename from src/heat/mpi/solver_mpi_nbuffer.c rename to src/heat/solver_mpi_nbuffer.c index 41b92f7..0d76b6c 100644 --- a/src/heat/mpi/solver_mpi_nbuffer.c +++ b/src/heat/solver_mpi_nbuffer.c @@ -1,7 +1,7 @@ #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" typedef struct { MPI_Request send; diff --git a/src/heat/mpi/solver_mpi_ompss2_forkjoin.c b/src/heat/solver_mpi_ompss2_forkjoin.c similarity index 97% rename from src/heat/mpi/solver_mpi_ompss2_forkjoin.c rename to src/heat/solver_mpi_ompss2_forkjoin.c index 1e9503f..d5b2de6 100644 --- a/src/heat/mpi/solver_mpi_ompss2_forkjoin.c +++ b/src/heat/solver_mpi_ompss2_forkjoin.c @@ -1,7 +1,7 @@ #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" int mpi_level(void) diff --git a/src/heat/mpi/solver_mpi_ompss2_tasks.c b/src/heat/solver_mpi_ompss2_tasks.c similarity index 98% rename from src/heat/mpi/solver_mpi_ompss2_tasks.c rename to src/heat/solver_mpi_ompss2_tasks.c index 43adf97..7e6ce91 100644 --- a/src/heat/mpi/solver_mpi_ompss2_tasks.c +++ b/src/heat/solver_mpi_ompss2_tasks.c @@ -1,7 +1,7 @@ #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" static int serial; diff --git a/src/heat/mpi/solver_mpirma_nbuffer.c b/src/heat/solver_mpirma_nbuffer.c similarity index 98% rename from src/heat/mpi/solver_mpirma_nbuffer.c rename to src/heat/solver_mpirma_nbuffer.c index ae9c918..55acc80 100644 --- a/src/heat/mpi/solver_mpirma_nbuffer.c +++ b/src/heat/solver_mpirma_nbuffer.c @@ -3,8 +3,8 @@ #include #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" typedef struct { MPI_Request send; diff --git a/src/heat/mpi/solver_mpirma_ompss2_tasks.c b/src/heat/solver_mpirma_ompss2_tasks.c similarity index 98% rename from src/heat/mpi/solver_mpirma_ompss2_tasks.c rename to src/heat/solver_mpirma_ompss2_tasks.c index 6f25ff4..c438f22 100644 --- a/src/heat/mpi/solver_mpirma_ompss2_tasks.c +++ b/src/heat/solver_mpirma_ompss2_tasks.c @@ -1,7 +1,7 @@ #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" static int serial; diff --git a/src/heat/smp/solver_ompss2.c b/src/heat/solver_ompss2.c similarity index 97% rename from src/heat/smp/solver_ompss2.c rename to src/heat/solver_ompss2.c index 8b4ad9c..92170e7 100644 --- a/src/heat/smp/solver_ompss2.c +++ b/src/heat/solver_ompss2.c @@ -1,4 +1,4 @@ -#include "common/heat.h" +#include "heat.h" const char * summary(void) diff --git a/src/heat/smp/solver_ompss2_residual.c b/src/heat/solver_ompss2_residual.c similarity index 98% rename from src/heat/smp/solver_ompss2_residual.c rename to src/heat/solver_ompss2_residual.c index 17d59b3..2064a3d 100644 --- a/src/heat/smp/solver_ompss2_residual.c +++ b/src/heat/solver_ompss2_residual.c @@ -1,7 +1,7 @@ #include #include -#include "common/heat.h" +#include "heat.h" const char * summary(void) diff --git a/src/heat/smp/solver_ompss2_taskloop.c b/src/heat/solver_ompss2_taskloop.c similarity index 97% rename from src/heat/smp/solver_ompss2_taskloop.c rename to src/heat/solver_ompss2_taskloop.c index 7bf065b..7f14e12 100644 --- a/src/heat/smp/solver_ompss2_taskloop.c +++ b/src/heat/solver_ompss2_taskloop.c @@ -1,4 +1,4 @@ -#include "common/heat.h" +#include "heat.h" const char * summary(void) diff --git a/src/heat/smp/solver_seq.c b/src/heat/solver_seq.c similarity index 96% rename from src/heat/smp/solver_seq.c rename to src/heat/solver_seq.c index 456ac86..9f3ad62 100644 --- a/src/heat/smp/solver_seq.c +++ b/src/heat/solver_seq.c @@ -1,4 +1,4 @@ -#include "common/heat.h" +#include "heat.h" const char * summary(void) diff --git a/src/heat/mpi/solver_tampi_ompss2_tasks.c b/src/heat/solver_tampi_ompss2_tasks.c similarity index 98% rename from src/heat/mpi/solver_tampi_ompss2_tasks.c rename to src/heat/solver_tampi_ompss2_tasks.c index 75c8060..ed421b3 100644 --- a/src/heat/mpi/solver_tampi_ompss2_tasks.c +++ b/src/heat/solver_tampi_ompss2_tasks.c @@ -2,7 +2,7 @@ #include #include "utils.h" -#include "common/heat.h" +#include "heat.h" static inline void send(const double *data, int nelems, int dst, int tag) diff --git a/src/heat/mpi/solver_tampirma_ompss2_tasks.c b/src/heat/solver_tampirma_ompss2_tasks.c similarity index 99% rename from src/heat/mpi/solver_tampirma_ompss2_tasks.c rename to src/heat/solver_tampirma_ompss2_tasks.c index fdcdfac..62331e2 100644 --- a/src/heat/mpi/solver_tampirma_ompss2_tasks.c +++ b/src/heat/solver_tampirma_ompss2_tasks.c @@ -2,7 +2,7 @@ #include #include "utils.h" -#include "common/heat.h" +#include "heat.h" static inline void fence(MPI_Win win) diff --git a/src/heat/mpi/utils.c b/src/heat/utils_mpi.c similarity index 98% rename from src/heat/mpi/utils.c rename to src/heat/utils_mpi.c index ff18643..f23cd7d 100644 --- a/src/heat/mpi/utils.c +++ b/src/heat/utils_mpi.c @@ -4,8 +4,8 @@ #include #include -#include "utils.h" -#include "common/heat.h" +#include "utils_mpi.h" +#include "heat.h" int rank; int nranks; diff --git a/src/heat/mpi/utils.h b/src/heat/utils_mpi.h similarity index 94% rename from src/heat/mpi/utils.h rename to src/heat/utils_mpi.h index 15d3e74..b96d552 100644 --- a/src/heat/mpi/utils.h +++ b/src/heat/utils_mpi.h @@ -3,7 +3,7 @@ #include -#include "common/heat.h" +#include "heat.h" extern int rank; extern int nranks; -- GitLab From 36ead8b16af4561744fec15388a455a5cadcad9a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 15 Apr 2024 15:26:30 +0200 Subject: [PATCH 22/36] Remove unused function from runner --- src/tools/runner.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/tools/runner.c b/src/tools/runner.c index 00167c3..25493f7 100644 --- a/src/tools/runner.c +++ b/src/tools/runner.c @@ -164,34 +164,6 @@ sample(char *argv[]) return 0; } -static void -parse_options(struct options *options, int argc, char *argv[]) -{ - /* Default options */ - options->ndrift_samples = 1; - options->nsamples = 100; - options->verbose = 0; - options->drift_wait = 5; - options->outpath = "ovni/clock-offsets.txt"; - - int opt; - while ((opt = getopt(argc, argv, "hl")) != -1) { - switch (opt) { - case 'l': - list(); - break; - case 'h': - default: /* '?' */ - usage(); - } - } - - if (optind < argc) { - fprintf(stderr, "error: unexpected extra arguments\n"); - exit(EXIT_FAILURE); - } -} - int main(int argc, char *argv[]) { -- GitLab From e424faf91b2cd64f9f60774428e9ee63fa0262ef Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 15 Apr 2024 15:26:56 +0200 Subject: [PATCH 23/36] Fix Nodes detection --- cmake/FindNodes.cmake | 53 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/cmake/FindNodes.cmake b/cmake/FindNodes.cmake index 13e46cb..13e81cf 100644 --- a/cmake/FindNodes.cmake +++ b/cmake/FindNodes.cmake @@ -11,37 +11,48 @@ # rule to add the compile and link time flags. include(GNUInstallDirs) +include(FeatureSummary) -if(DEFINED ENV{NODES_HOME}) - set(NODES_HOME "$ENV{NODES_HOME}") -else() - message(STATUS "NODES_HOME not set, refusing to search") +set(NODES_FLAG "-fompss-2=libnodes") + +set(can_search_nodes TRUE) + +if(NOT DEFINED ENV{NODES_HOME}) + message(STATUS "NODES_HOME not set, refusing to search Nodes") + set(can_search_nodes FALSE) endif() -find_library(NODES_LIBRARY NAMES nodes PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH) -find_path(NODES_INCLUDE_DIR nodes.h PATHS "${NODES_HOME}/include" NO_DEFAULT_PATH) +if(NOT DEFINED ENV{NOSV_HOME}) + message(STATUS "NOSV_HOME not set, refusing to search Nodes") + set(can_search_nodes FALSE) +endif() -include(FindPackageHandleStandardArgs) +if(can_search_nodes) + set(NODES_HOME "$ENV{NODES_HOME}") -find_package_handle_standard_args(Nodes DEFAULT_MSG - NODES_LIBRARY NODES_INCLUDE_DIR) + # Ensure the compiler supports libnodes + include(CheckCCompilerFlag) -if(NOT NODES_FOUND) - message(STATUS "Cannot find NODES library") - return() + # Also set the linker flags, as otherwise the check will fail due to undefined + # symbols in the final program. + set(CMAKE_REQUIRED_LINK_OPTIONS "${NODES_FLAG}") + check_c_compiler_flag("${NODES_FLAG}" NODES_FLAG_SUPPORTED) + + if(NOT NODES_FLAG_SUPPORTED) + message(STATUS "Compiler doesn't support ${NODES_FLAG} flag") + endif() + + find_library(NODES_LIBRARY NAMES nodes PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH) + find_path(NODES_INCLUDE_DIR nodes.h PATHS "${NODES_HOME}/include" NO_DEFAULT_PATH) endif() -# Also ensure the compiler supports libnodes -include(CheckCCompilerFlag) +include(FindPackageHandleStandardArgs) -set(NODES_FLAG "-fompss-2=libnodes") -# Also set the linker flags, as otherwise the check will fail due to undefined -# symbols in the final program. -set(CMAKE_REQUIRED_LINK_OPTIONS "${NODES_FLAG}") -check_c_compiler_flag("${NODES_FLAG}" NODES_FLAG_SUPPORTED) +find_package_handle_standard_args(Nodes DEFAULT_MSG + NODES_HOME NODES_LIBRARY NODES_INCLUDE_DIR NODES_FLAG_SUPPORTED) -if(NOT NODES_FLAG_SUPPORTED) - message(STATUS "Compiler doesn't support ${NODES_FLAG} flag") +if(NOT NODES_FOUND) + message(STATUS "Cannot find NODES library") return() endif() -- GitLab From 767ddc2c875884ba950d6b24d5a6c888f92fc2dc Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 15 Apr 2024 15:28:26 +0200 Subject: [PATCH 24/36] Install benchmarks in libexec --- CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36fb051..b3f15d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,18 +80,11 @@ find_package(Tampi) set_property(GLOBAL PROPERTY bench6_list "") macro(mk_bench NAME) - if(NOT "${NAME}" MATCHES "b6_.*") - message(FATAL_ERROR "benchmark name must begin with b6_: ${NAME}") - endif() add_executable(${NAME}) - get_property(BENCH6_LIST GLOBAL PROPERTY bench6_list) - #message(STATUS "Before BENCH6_LIST=${BENCH6_LIST}") list(APPEND BENCH6_LIST ${NAME}) - #message(STATUS "After BENCH6_LIST=${BENCH6_LIST}") set_property(GLOBAL PROPERTY bench6_list "${BENCH6_LIST}") - - install(TARGETS ${NAME} RUNTIME DESTINATION bin) + install(TARGETS ${NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}") endmacro() add_subdirectory(src) -- GitLab From 580f500966ab1e19185271b5bcb55ca2d5759eda Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 15 Apr 2024 15:28:50 +0200 Subject: [PATCH 25/36] Set bscpkgs to custom patch for now Also add nOS-V dependency --- flake.lock | 31 +++++++++++++++++++------------ flake.nix | 2 ++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 303b093..e1896f1 100644 --- a/flake.lock +++ b/flake.lock @@ -26,19 +26,13 @@ }, "bscpkgs": { "inputs": { - "nixpkgs": [ - "jungle", - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1710421994, - "narHash": "sha256-GitTgcFYT6OQvbt+QUSwz4WPGR55D4AVo47yXywH0W8=", - "ref": "refs/heads/master", - "rev": "fce556cb285071e4cb042ad135dcaaaae303c9a7", - "revCount": 934, - "type": "git", - "url": "https://git.sr.ht/~rodarima/bscpkgs" + "lastModified": 1712926972, + "narHash": "sha256-0dKhCH3cPU8QSc8LLpJypj4FYGVbE5i2iRl6NnDhB6s=", + "path": "/home/Computational/rarias/bscpkgs", + "type": "path" }, "original": { "type": "git", @@ -94,7 +88,7 @@ "inputs": { "agenix": "agenix", "bscpkgs": "bscpkgs", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1710869393, @@ -108,6 +102,19 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1710272261, + "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", + "path": "/nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source", + "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1710272261, "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", diff --git a/flake.nix b/flake.nix index 22331b5..a0047f3 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ nixConfig.bash-prompt = "\[nix-develop\]$ "; inputs.jungle.url = "path:/home/Computational/rarias/jungle"; + inputs.jungle.inputs.bscpkgs.url = "path:/home/Computational/rarias/bscpkgs"; outputs = { self, jungle, ... }: let @@ -20,6 +21,7 @@ clangOmpss2 nanos6 nodes + nosv mpi tampi ]; -- GitLab From a79551d5237b57933da7732268ba2a2a1b6c2467 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 15 Apr 2024 15:40:40 +0200 Subject: [PATCH 26/36] Revert "Install benchmarks in libexec" This reverts commit 767ddc2c875884ba950d6b24d5a6c888f92fc2dc. --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3f15d5..36fb051 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,11 +80,18 @@ find_package(Tampi) set_property(GLOBAL PROPERTY bench6_list "") macro(mk_bench NAME) + if(NOT "${NAME}" MATCHES "b6_.*") + message(FATAL_ERROR "benchmark name must begin with b6_: ${NAME}") + endif() add_executable(${NAME}) + get_property(BENCH6_LIST GLOBAL PROPERTY bench6_list) + #message(STATUS "Before BENCH6_LIST=${BENCH6_LIST}") list(APPEND BENCH6_LIST ${NAME}) + #message(STATUS "After BENCH6_LIST=${BENCH6_LIST}") set_property(GLOBAL PROPERTY bench6_list "${BENCH6_LIST}") - install(TARGETS ${NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}") + + install(TARGETS ${NAME} RUNTIME DESTINATION bin) endmacro() add_subdirectory(src) -- GitLab From 60ebd2fdd069d19950f6c3ecb59ca81109f7b5c0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 15 Apr 2024 15:45:22 +0200 Subject: [PATCH 27/36] Put back the b6_ prefix --- src/heat/CMakeLists.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/heat/CMakeLists.txt b/src/heat/CMakeLists.txt index 4374eb2..2652cc9 100644 --- a/src/heat/CMakeLists.txt +++ b/src/heat/CMakeLists.txt @@ -22,7 +22,7 @@ macro(mk_heat_smp NAME SOURCE) endmacro() # No requisites -mk_heat_smp(heat_seq solver_seq.c) +mk_heat_smp(b6_heat_seq solver_seq.c) if(NANOS6_FOUND) macro(mk_heat_nanos6 NAME SOURCE) @@ -31,8 +31,8 @@ if(NANOS6_FOUND) target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") endmacro() - mk_heat_nanos6(heat_nanos6 solver_ompss2.c) - mk_heat_nanos6(heat_nanos6_residual solver_ompss2_residual.c) + mk_heat_nanos6(b6_heat_nanos6 solver_ompss2.c) + mk_heat_nanos6(b6_heat_nanos6_residual solver_ompss2_residual.c) endif() message(STATUS "NODES FOUND = ${NODES_FOUND}") @@ -42,8 +42,8 @@ if(NODES_FOUND) target_link_libraries(${NAME} PRIVATE Nodes::nodes) endmacro() - mk_heat_nodes(heat_nodes solver_ompss2.c) - mk_heat_nodes(heat_nodes_residual solver_ompss2_residual.c) + mk_heat_nodes(b6_heat_nodes solver_ompss2.c) + mk_heat_nodes(b6_heat_nodes_residual solver_ompss2_residual.c) endif() # --- MPI based --- @@ -57,8 +57,8 @@ if(MPI_FOUND) target_sources(${NAME} PRIVATE ${SOURCE}) target_link_libraries(${NAME} PRIVATE heat_mpi_common) endmacro() - mk_heat_mpi(heat_mpi solver_mpi.c) - mk_heat_mpi(heat_mpi_nbuffer solver_mpi_nbuffer.c) + mk_heat_mpi(b6_heat_mpi solver_mpi.c) + mk_heat_mpi(b6_heat_mpi_nbuffer solver_mpi_nbuffer.c) if(NANOS6_FOUND) macro(mk_heat_mpi_nanos6 NAME SOURCE) @@ -66,15 +66,15 @@ if(MPI_FOUND) target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6") target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6") endmacro() - mk_heat_mpi_nanos6(heat_mpi_nanos6_forkjoin solver_mpi_ompss2_forkjoin.c) - mk_heat_mpi_nanos6(heat_mpi_nanos6_tasks solver_mpi_ompss2_tasks.c) + mk_heat_mpi_nanos6(b6_heat_mpi_nanos6_forkjoin solver_mpi_ompss2_forkjoin.c) + mk_heat_mpi_nanos6(b6_heat_mpi_nanos6_tasks solver_mpi_ompss2_tasks.c) if(TAMPI_FOUND) macro(mk_heat_tampi_nanos6 NAME SOURCE) mk_heat_mpi_nanos6(${NAME} ${SOURCE}) target_link_libraries(${NAME} PRIVATE Tampi::tampi-c) endmacro() - mk_heat_tampi_nanos6(heat_itampi_nanos6_tasks solver_itampi_ompss2_tasks.c) + mk_heat_tampi_nanos6(b6_heat_itampi_nanos6_tasks solver_itampi_ompss2_tasks.c) endif() endif() @@ -83,8 +83,8 @@ if(MPI_FOUND) mk_heat_mpi(${NAME} ${SOURCE}) target_link_libraries(${NAME} PRIVATE Nodes::nodes) endmacro() - mk_heat_mpi_nodes(heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c) - mk_heat_mpi_nodes(heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c) + mk_heat_mpi_nodes(b6_heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c) + mk_heat_mpi_nodes(b6_heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c) endif() endif() -- GitLab From 347e846288fba01f3ae47eb86682d18abb65a765 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 19 Apr 2024 15:18:32 +0200 Subject: [PATCH 28/36] Fix heat output order --- src/heat/main_mpi.c | 4 ++-- src/heat/main_smp.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/heat/main_mpi.c b/src/heat/main_mpi.c index af980a1..7ff91ed 100644 --- a/src/heat/main_mpi.c +++ b/src/heat/main_mpi.c @@ -80,12 +80,12 @@ int main(int argc, char **argv) #endif fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s %8s\n", - "throughput", "time", "error", + "time", "throughput", "error", "rows", "cols", "rbs", "cbs", "threads", "steps"); fprintf(stdout, "%14e %14e %14e %8ld %8ld %8d %8d %8d %8d\n", - throughput, end-start, residual, + end-start, throughput, residual, conf.rows, conf.cols, conf.rbs, conf.cbs, threads, conf.convergenceTimesteps); diff --git a/src/heat/main_smp.c b/src/heat/main_smp.c index 5d29b7d..1b3656d 100644 --- a/src/heat/main_smp.c +++ b/src/heat/main_smp.c @@ -32,10 +32,10 @@ int main(int argc, char **argv) long total_elem = iter_elem * niter; double throughput = total_elem / delta_time; - fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s\n", - "time", "updates/s", "rel. error", - "rows", "cols", - "rbs", "cbs", "iters"); +// fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s\n", +// "time", "updates/s", "rel. error", +// "rows", "cols", +// "rbs", "cbs", "iters"); fprintf(stdout, "%14e %14e %14e %8ld %8ld %8d %8d %8ld\n", delta_time, throughput, residual, conf.rows, conf.cols, -- GitLab From 752e8de5032cf6b7eb2d372c7b8fa8435b688703 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 19 Apr 2024 15:19:40 +0200 Subject: [PATCH 29/36] Compute several statistics --- src/tools/CMakeLists.txt | 6 +- src/tools/config.in.h | 5 +- src/tools/runner.c | 257 ++++++++++++++++++++++++++++++++------- 3 files changed, 220 insertions(+), 48 deletions(-) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 2c6ed35..34bc51c 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -2,6 +2,6 @@ get_property(BENCH6_LIST GLOBAL PROPERTY bench6_list) configure_file(config.in.h config.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_executable(bench6_runner runner.c) -target_link_libraries(bench6_runner PRIVATE m bench6_lib) -install(TARGETS bench6_runner RUNTIME DESTINATION bin) +add_executable(bigote runner.c) +target_link_libraries(bigote PRIVATE m bench6_lib) +install(TARGETS bigote RUNTIME DESTINATION bin) diff --git a/src/tools/config.in.h b/src/tools/config.in.h index 3e51d90..c5cd9d0 100644 --- a/src/tools/config.in.h +++ b/src/tools/config.in.h @@ -4,8 +4,7 @@ #ifndef CONFIG_H #define CONFIG_H -#define BENCH6_PREFIX "@CMAKE_INSTALL_PREFIX@" -#define BENCH6_BIN (BENCH6_PREFIX "/bin") -#define BENCH6_LIST "@BENCH6_LIST@" +/* Where the benchmark binaries are located */ +#define BENCH6_BENCHDIR "@CMAKE_INSTALL_LIBEXECDIR@" #endif /* CONFIG_H */ diff --git a/src/tools/runner.c b/src/tools/runner.c index 25493f7..5a08507 100644 --- a/src/tools/runner.c +++ b/src/tools/runner.c @@ -1,3 +1,4 @@ +#include "bench6.h" #include "common.h" #include "config.h" #include @@ -12,12 +13,17 @@ static char *progname = "bench6"; struct sampling { - int nmax; - int nmin; - int n; + long nmax; + long nmin; + long n; double *samples; - double rse; + double rsem; double last; + double wall; + double min_rsem; + const char *name; + double t0; + double min_time; }; static int @@ -43,7 +49,7 @@ do_run(char *argv[], double *ptime) *nl = '\0'; /* Clean status line */ - fprintf(stderr, "%s\n", line); + //fprintf(stderr, "%s\n", line); double time; sscanf(line, "%le", &time); @@ -52,7 +58,7 @@ do_run(char *argv[], double *ptime) /* Drain the rest of the stdout */ while (fgets(line, 4096, p) != NULL) { - fprintf(stderr, "%s", line); + //fprintf(stderr, "%s", line); } bad_close: @@ -75,41 +81,191 @@ cmp_double(const void *pa, const void *pb) return 0; } +//static void +//resample(double *values, long n, double *out) +//{ +// for (long i = 0; i < n; i++) { +// /* FIXME: Not really uniform */ +// out[i] = values[rand() % n]; +// //printf("out[%ld] = %e\n", i, out[i]); +// } +//} +// +//static double +//mad_bootstrap(double *values, long n) +//{ +// long m = 1000; +// +// double *r = calloc(n, sizeof(double)); +// if (r == NULL) { +// perror("calloc failed"); +// exit(1); +// } +// +// double *absdev = calloc(n, sizeof(double)); +// if (absdev == NULL) { +// perror("calloc failed"); +// exit(1); +// } +// +// double *mad = calloc(m, sizeof(double)); +// if (mad == NULL) { +// perror("calloc failed"); +// exit(1); +// } +// +// for (long sample = 0; sample < m; sample++) { +// resample(values, n, r); +// +// qsort(r, n, sizeof(double), cmp_double); +// double median = r[n / 2]; +// +// for (long i = 0; i < n; i++) { +// absdev[i] = fabs(r[i] - median); +// } +// +// qsort(absdev, n, sizeof(double), cmp_double); +// mad[sample] = absdev[n / 2]; +// //printf("mad[%ld] = %e\n", sample, mad[sample]); +// } +// +// double sum = 0.0; +// for (long i = 0; i < m; i++) +// sum += mad[i]; +// +// double mean = sum / (double) m; +// double sumsqr = 0.0; +// for (long i = 0; i < m; i++) { +// double dev = mad[i] - mean; +// sumsqr += dev * dev; +// } +// +// double var = sumsqr / m; +// double stdev = sqrt(var); +// double sem = stdev / sqrt(m); +// double rsem = 100.0 * sem * 1.96 / mean; +// +// free(mad); +// free(absdev); +// free(r); +// +// return rsem; +//} + static void stats(struct sampling *s) { - if (s->n < 2) + if (s->n < 1) return; - double n = s->n; - //double last = s->samples[s->n - 1]; - - /* Sort samples to take the median */ - qsort(s->samples, s->n, sizeof(double), cmp_double); - - double median = s->samples[s->n / 2]; - - double sum = 0.0; - for (int i = 0; i < s->n; i++) - sum += s->samples[i]; + long outliers = 0; + double last = s->samples[s->n - 1]; + double median = last; + double mean = last; + double var = NAN; + double stdev = NAN; + double rstdev = NAN; + double sem = NAN; + double rsem = NAN; + double mad = NAN; + //double mad_se = NAN; + double q1 = NAN; + double q3 = NAN; + double iqr = NAN; + double pol = NAN; + double smin = s->samples[s->n - 1]; + double smax = s->samples[s->n - 1]; + + /* Need at least two samples */ + if (s->n >= 2) { + /* Sort samples to take the median */ + qsort(s->samples, s->n, sizeof(double), cmp_double); + + double *absdev = calloc(s->n, sizeof(double)); + if (absdev == NULL) { + perror("calloc failed"); + exit(1); + } - double mean = sum / n; - double sumsqr = 0.0; - for (int i = 0; i < s->n; i++) { - double dev = s->samples[i] - mean; - sumsqr += dev * dev; + smin = s->samples[0]; + q1 = s->samples[s->n / 4]; + median = s->samples[s->n / 2]; + q3 = s->samples[(s->n * 3) / 4]; + smax = s->samples[s->n - 1]; + + //qcd = (q3 - q1) / (q3 + q1); + iqr = q3 - q1; + + double sum = 0.0; + for (long i = 0; i < s->n; i++) + sum += s->samples[i]; + + double n = s->n; + mean = sum / n; + double sumsqr = 0.0; + for (long i = 0; i < s->n; i++) { + double x = s->samples[i]; + double dev = x - mean; + sumsqr += dev * dev; + absdev[i] = fabs(s->samples[i] - median); + //printf("absdev[%3ld] = %e\n", i, absdev[i]); + if (x < q1 - 1.5 * iqr || x > q3 + iqr * 1.5) + outliers++; + } + qsort(absdev, s->n, sizeof(double), cmp_double); + mad = absdev[s->n / 2] * 1.4826; + //mad_se = mad_bootstrap(s->samples, s->n); + pol = (double) outliers * 100.0 / n; + + var = sumsqr / n; + stdev = sqrt(var); + rstdev = 100.0 * stdev / mean; + sem = stdev / sqrt(n); + rsem = 100.0 * sem * 1.96 / mean; + s->rsem = rsem; + free(absdev); } - double var = sumsqr / n; - double stdev = sqrt(var); - double rstdev = 100.0 * stdev / mean; - double se = stdev / sqrt(n); - double rse = 100.0 * se * 1.96 / mean; - - fprintf(stderr, "%s: n=%03d median=%.3e mean=%.3e SD=%.3e RSD=%.2f%% RSE=%.2f%%\n", - progname, s->n, median, mean, stdev, rstdev, rse); - - s->rse = rse; + /* Print the header at the beginning only */ + if (s->n == 1) { + //printf("# --- bench6 ---\n"); + //printf("# Min %ld runs, max %ld\n", s->nmin, s->nmax); + //printf("# Cutoff %%RSEM value set to %f\n", s->min_rsem); + //printf("# RUN Number of run\n"); + //printf("# LAST Value of last run\n"); + //printf("# MEDIAN Median of values until now\n"); + //printf("# AVG Mean of values until now\n"); + //printf("# SD Standard deviation\n"); + //printf("# %%RSD Relative standard deviation to the mean\n"); + //printf("# %%RSEM Relative standard error of the mean\n"); + printf("%4s %5s" + " %8s %8s %8s %8s %8s" + " %8s %8s %8s" + " %5s %5s" + " %5s\n", + "RUN", "WALL", + "MIN", "Q1", "MEDIAN", "Q3", "MAX", + "MAD", "IQR", "SD", + "%RSD", "%RSEM", + "%OUTLIERS"); + } +//RUN WALL LAST MEDIAN AVG SD %RSD %RSEM +// 89 125.5 5.085e-03 5.075e-03 5.303e-03 3.500e-03 66.00 7.611 +//RUN WALL LAST MEDIAN AVG SD %RSD %RSEM +// 34 3.0 5.110e-03 5.097e-03 5.121e-03 1.327e-04 2.59 0.87 + printf( + "\r%4ld %5.1f" + " %8.2e %8.2e %8.2e %8.2e %8.2e" + " %8.2e %8.2e %8.2e" + " %5.2f %5.2f" + " %5.1f ", + s->n, s->wall, /* progress */ + smin, q1, median, q3, smax, /* centrality */ + mad, iqr, stdev, /* dispersion */ + rstdev, rsem, /* rel. dispersion */ + pol /* outliers */ + ); + fflush(stdout); } static int @@ -120,21 +276,26 @@ should_continue(struct sampling *s) if (s->n < s->nmin) return 1; - if (s->rse > 1.0 /* % */) + if (s->rsem > s->min_rsem) + return 1; + + double dt = bench6_time() - s->t0; + if (dt < s->min_time) return 1; return 0; } static void -add_sample(struct sampling *s, double time) +add_sample(struct sampling *s, double metric, double walltime) { if (s->n >= s->nmax) { die("overflowing samples"); } else { - s->samples[s->n] = time; + s->samples[s->n] = metric; s->n++; - s->last = time; + s->last = metric; + s->wall += walltime; } } @@ -143,21 +304,28 @@ sample(char *argv[]) { struct sampling s = { 0 }; s.nmax = 4000; - s.nmin = 30; + s.nmin = 50; + s.min_rsem = 0.5; + s.min_time = 60.0; /* At least one minute */ s.samples = calloc(s.nmax, sizeof(double)); s.n = 0; + s.name = argv[0]; + s.t0 = bench6_time(); while (should_continue(&s)) { - double time; - if (do_run(argv, &time) != 0) { + double t0 = bench6_time(); + double metric; + if (do_run(argv, &metric) != 0) { err("failed to run benchmark"); return 1; } + double t1 = bench6_time(); + double walltime = t1 - t0; - add_sample(&s, time); + add_sample(&s, metric, walltime); } - fprintf(stderr, "\n"); + fprintf(stdout, "\n"); free(s.samples); @@ -170,6 +338,11 @@ main(int argc, char *argv[]) progname_set(progname); (void) argc; + //while (argc && argv && strcmp(argv, "--") != 0) { + // argv++; + // argc--; + //} + if (sample(argv+1) != 0) { err("failed to sample the benchmark"); return 1; -- GitLab From d64688bd88fcf89ad33d015eddae24973b185751 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 19 Apr 2024 15:20:58 +0200 Subject: [PATCH 30/36] Remove the runner from the repository It has been moved to an standalone tool at https://github.com/rodarima/bigotes/ --- src/CMakeLists.txt | 1 - src/tools/CMakeLists.txt | 7 - src/tools/config.in.h | 10 -- src/tools/runner.c | 352 --------------------------------------- 4 files changed, 370 deletions(-) delete mode 100644 src/tools/CMakeLists.txt delete mode 100644 src/tools/config.in.h delete mode 100644 src/tools/runner.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b7370b2..2bef695 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,3 @@ add_subdirectory(bench6) add_subdirectory(ompss2) add_subdirectory(heat) -add_subdirectory(tools) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt deleted file mode 100644 index 34bc51c..0000000 --- a/src/tools/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -get_property(BENCH6_LIST GLOBAL PROPERTY bench6_list) -configure_file(config.in.h config.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -add_executable(bigote runner.c) -target_link_libraries(bigote PRIVATE m bench6_lib) -install(TARGETS bigote RUNTIME DESTINATION bin) diff --git a/src/tools/config.in.h b/src/tools/config.in.h deleted file mode 100644 index c5cd9d0..0000000 --- a/src/tools/config.in.h +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) - * SPDX-License-Identifier: GPL-3.0-or-later */ - -#ifndef CONFIG_H -#define CONFIG_H - -/* Where the benchmark binaries are located */ -#define BENCH6_BENCHDIR "@CMAKE_INSTALL_LIBEXECDIR@" - -#endif /* CONFIG_H */ diff --git a/src/tools/runner.c b/src/tools/runner.c deleted file mode 100644 index 5a08507..0000000 --- a/src/tools/runner.c +++ /dev/null @@ -1,352 +0,0 @@ -#include "bench6.h" -#include "common.h" -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#include - -static char *progname = "bench6"; - -struct sampling { - long nmax; - long nmin; - long n; - double *samples; - double rsem; - double last; - double wall; - double min_rsem; - const char *name; - double t0; - double min_time; -}; - -static int -do_run(char *argv[], double *ptime) -{ - int ret = 0; - FILE *p = popen(argv[0], "r"); - - if (p == NULL) { - err("popen failed:"); - return -1; - } - - char line[4096]; - if (fgets(line, 4096, p) == NULL) { - err("missing stdout line"); - ret = -1; - goto bad_close; - } - - char *nl = strchr(line, '\n'); - if (nl != NULL) - *nl = '\0'; - - /* Clean status line */ - //fprintf(stderr, "%s\n", line); - - double time; - sscanf(line, "%le", &time); - //printf("got %e\n", time); - *ptime = time; - - /* Drain the rest of the stdout */ - while (fgets(line, 4096, p) != NULL) { - //fprintf(stderr, "%s", line); - } - -bad_close: - pclose(p); - - return ret; -} - -static int -cmp_double(const void *pa, const void *pb) -{ - double a = *(const double *) pa; - double b = *(const double *) pb; - - if (a < b) - return -1; - else if (a > b) - return 1; - else - return 0; -} - -//static void -//resample(double *values, long n, double *out) -//{ -// for (long i = 0; i < n; i++) { -// /* FIXME: Not really uniform */ -// out[i] = values[rand() % n]; -// //printf("out[%ld] = %e\n", i, out[i]); -// } -//} -// -//static double -//mad_bootstrap(double *values, long n) -//{ -// long m = 1000; -// -// double *r = calloc(n, sizeof(double)); -// if (r == NULL) { -// perror("calloc failed"); -// exit(1); -// } -// -// double *absdev = calloc(n, sizeof(double)); -// if (absdev == NULL) { -// perror("calloc failed"); -// exit(1); -// } -// -// double *mad = calloc(m, sizeof(double)); -// if (mad == NULL) { -// perror("calloc failed"); -// exit(1); -// } -// -// for (long sample = 0; sample < m; sample++) { -// resample(values, n, r); -// -// qsort(r, n, sizeof(double), cmp_double); -// double median = r[n / 2]; -// -// for (long i = 0; i < n; i++) { -// absdev[i] = fabs(r[i] - median); -// } -// -// qsort(absdev, n, sizeof(double), cmp_double); -// mad[sample] = absdev[n / 2]; -// //printf("mad[%ld] = %e\n", sample, mad[sample]); -// } -// -// double sum = 0.0; -// for (long i = 0; i < m; i++) -// sum += mad[i]; -// -// double mean = sum / (double) m; -// double sumsqr = 0.0; -// for (long i = 0; i < m; i++) { -// double dev = mad[i] - mean; -// sumsqr += dev * dev; -// } -// -// double var = sumsqr / m; -// double stdev = sqrt(var); -// double sem = stdev / sqrt(m); -// double rsem = 100.0 * sem * 1.96 / mean; -// -// free(mad); -// free(absdev); -// free(r); -// -// return rsem; -//} - -static void -stats(struct sampling *s) -{ - if (s->n < 1) - return; - - long outliers = 0; - double last = s->samples[s->n - 1]; - double median = last; - double mean = last; - double var = NAN; - double stdev = NAN; - double rstdev = NAN; - double sem = NAN; - double rsem = NAN; - double mad = NAN; - //double mad_se = NAN; - double q1 = NAN; - double q3 = NAN; - double iqr = NAN; - double pol = NAN; - double smin = s->samples[s->n - 1]; - double smax = s->samples[s->n - 1]; - - /* Need at least two samples */ - if (s->n >= 2) { - /* Sort samples to take the median */ - qsort(s->samples, s->n, sizeof(double), cmp_double); - - double *absdev = calloc(s->n, sizeof(double)); - if (absdev == NULL) { - perror("calloc failed"); - exit(1); - } - - smin = s->samples[0]; - q1 = s->samples[s->n / 4]; - median = s->samples[s->n / 2]; - q3 = s->samples[(s->n * 3) / 4]; - smax = s->samples[s->n - 1]; - - //qcd = (q3 - q1) / (q3 + q1); - iqr = q3 - q1; - - double sum = 0.0; - for (long i = 0; i < s->n; i++) - sum += s->samples[i]; - - double n = s->n; - mean = sum / n; - double sumsqr = 0.0; - for (long i = 0; i < s->n; i++) { - double x = s->samples[i]; - double dev = x - mean; - sumsqr += dev * dev; - absdev[i] = fabs(s->samples[i] - median); - //printf("absdev[%3ld] = %e\n", i, absdev[i]); - if (x < q1 - 1.5 * iqr || x > q3 + iqr * 1.5) - outliers++; - } - qsort(absdev, s->n, sizeof(double), cmp_double); - mad = absdev[s->n / 2] * 1.4826; - //mad_se = mad_bootstrap(s->samples, s->n); - pol = (double) outliers * 100.0 / n; - - var = sumsqr / n; - stdev = sqrt(var); - rstdev = 100.0 * stdev / mean; - sem = stdev / sqrt(n); - rsem = 100.0 * sem * 1.96 / mean; - s->rsem = rsem; - free(absdev); - } - - /* Print the header at the beginning only */ - if (s->n == 1) { - //printf("# --- bench6 ---\n"); - //printf("# Min %ld runs, max %ld\n", s->nmin, s->nmax); - //printf("# Cutoff %%RSEM value set to %f\n", s->min_rsem); - //printf("# RUN Number of run\n"); - //printf("# LAST Value of last run\n"); - //printf("# MEDIAN Median of values until now\n"); - //printf("# AVG Mean of values until now\n"); - //printf("# SD Standard deviation\n"); - //printf("# %%RSD Relative standard deviation to the mean\n"); - //printf("# %%RSEM Relative standard error of the mean\n"); - printf("%4s %5s" - " %8s %8s %8s %8s %8s" - " %8s %8s %8s" - " %5s %5s" - " %5s\n", - "RUN", "WALL", - "MIN", "Q1", "MEDIAN", "Q3", "MAX", - "MAD", "IQR", "SD", - "%RSD", "%RSEM", - "%OUTLIERS"); - } -//RUN WALL LAST MEDIAN AVG SD %RSD %RSEM -// 89 125.5 5.085e-03 5.075e-03 5.303e-03 3.500e-03 66.00 7.611 -//RUN WALL LAST MEDIAN AVG SD %RSD %RSEM -// 34 3.0 5.110e-03 5.097e-03 5.121e-03 1.327e-04 2.59 0.87 - printf( - "\r%4ld %5.1f" - " %8.2e %8.2e %8.2e %8.2e %8.2e" - " %8.2e %8.2e %8.2e" - " %5.2f %5.2f" - " %5.1f ", - s->n, s->wall, /* progress */ - smin, q1, median, q3, smax, /* centrality */ - mad, iqr, stdev, /* dispersion */ - rstdev, rsem, /* rel. dispersion */ - pol /* outliers */ - ); - fflush(stdout); -} - -static int -should_continue(struct sampling *s) -{ - stats(s); - - if (s->n < s->nmin) - return 1; - - if (s->rsem > s->min_rsem) - return 1; - - double dt = bench6_time() - s->t0; - if (dt < s->min_time) - return 1; - - return 0; -} - -static void -add_sample(struct sampling *s, double metric, double walltime) -{ - if (s->n >= s->nmax) { - die("overflowing samples"); - } else { - s->samples[s->n] = metric; - s->n++; - s->last = metric; - s->wall += walltime; - } -} - -static int -sample(char *argv[]) -{ - struct sampling s = { 0 }; - s.nmax = 4000; - s.nmin = 50; - s.min_rsem = 0.5; - s.min_time = 60.0; /* At least one minute */ - s.samples = calloc(s.nmax, sizeof(double)); - s.n = 0; - s.name = argv[0]; - s.t0 = bench6_time(); - - while (should_continue(&s)) { - double t0 = bench6_time(); - double metric; - if (do_run(argv, &metric) != 0) { - err("failed to run benchmark"); - return 1; - } - double t1 = bench6_time(); - double walltime = t1 - t0; - - add_sample(&s, metric, walltime); - } - - fprintf(stdout, "\n"); - - free(s.samples); - - return 0; -} - -int -main(int argc, char *argv[]) -{ - progname_set(progname); - (void) argc; - - //while (argc && argv && strcmp(argv, "--") != 0) { - // argv++; - // argc--; - //} - - if (sample(argv+1) != 0) { - err("failed to sample the benchmark"); - return 1; - } - - return 0; -} -- GitLab From 1a76d491e5a4fd823dab548440c41bc2c909990d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 25 Apr 2024 16:50:29 +0200 Subject: [PATCH 31/36] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'jungle': 'path:/home/Computational/rarias/jungle?lastModified=1710869393&narHash=sha256-Oi2lgWkYRG1SHImng09H2yQ06VS6nN7s6QPlWSPrTA4%3D' (2024-03-19) → 'path:/home/Computational/rarias/jungle?lastModified=1714044572&narHash=sha256-9Y9g3o/sZMtLSR4/mYvkxIIvNwPy6xBomzFi8PANZhI%3D' (2024-04-25) • Updated input 'jungle/agenix': 'github:ryantm/agenix/8cb01a0e717311680e0cbca06a76cbceba6f3ed6' (2024-02-13) → 'github:ryantm/agenix/1381a759b205dff7a6818733118d02253340fd5e' (2024-04-02) • Updated input 'jungle/bscpkgs': 'path:/home/Computational/rarias/bscpkgs?lastModified=1712926972&narHash=sha256-0dKhCH3cPU8QSc8LLpJypj4FYGVbE5i2iRl6NnDhB6s%3D' (2024-04-12) → 'path:/home/Computational/rarias/bscpkgs?lastModified=1713974498&narHash=sha256-e%2BII9sPaaiaX7uGcQHSK8I028CDm3yuvu6AVPlJDS6A%3D' (2024-04-24) • Updated input 'jungle/bscpkgs/nixpkgs': 'path:/nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source?lastModified=1710272261&narHash=sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC%2BfhQ%3D&rev=0ad13a6833440b8e238947e47bea7f11071dc2b2' (2024-03-12) → follows 'jungle/nixpkgs' • Updated input 'jungle/nixpkgs': 'github:NixOS/nixpkgs/0ad13a6833440b8e238947e47bea7f11071dc2b2' (2024-03-12) → 'github:NixOS/nixpkgs/6143fc5eeb9c4f00163267708e26191d1e918932' (2024-04-21) --- flake.lock | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/flake.lock b/flake.lock index e1896f1..80670ea 100644 --- a/flake.lock +++ b/flake.lock @@ -11,11 +11,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1707830867, - "narHash": "sha256-PAdwm5QqdlwIqGrfzzvzZubM+FXtilekQ/FA0cI49/o=", + "lastModified": 1712079060, + "narHash": "sha256-/JdiT9t+zzjChc5qQiF+jhrVhRt8figYH29rZO7pFe4=", "owner": "ryantm", "repo": "agenix", - "rev": "8cb01a0e717311680e0cbca06a76cbceba6f3ed6", + "rev": "1381a759b205dff7a6818733118d02253340fd5e", "type": "github" }, "original": { @@ -26,11 +26,14 @@ }, "bscpkgs": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "jungle", + "nixpkgs" + ] }, "locked": { - "lastModified": 1712926972, - "narHash": "sha256-0dKhCH3cPU8QSc8LLpJypj4FYGVbE5i2iRl6NnDhB6s=", + "lastModified": 1713974498, + "narHash": "sha256-e+II9sPaaiaX7uGcQHSK8I028CDm3yuvu6AVPlJDS6A=", "path": "/home/Computational/rarias/bscpkgs", "type": "path" }, @@ -88,11 +91,11 @@ "inputs": { "agenix": "agenix", "bscpkgs": "bscpkgs", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1710869393, - "narHash": "sha256-Oi2lgWkYRG1SHImng09H2yQ06VS6nN7s6QPlWSPrTA4=", + "lastModified": 1714044572, + "narHash": "sha256-9Y9g3o/sZMtLSR4/mYvkxIIvNwPy6xBomzFi8PANZhI=", "path": "/home/Computational/rarias/jungle", "type": "path" }, @@ -103,24 +106,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1710272261, - "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", - "path": "/nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source", - "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1710272261, - "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", + "lastModified": 1713714899, + "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", + "rev": "6143fc5eeb9c4f00163267708e26191d1e918932", "type": "github" }, "original": { -- GitLab From 0ce033ac7d9e42a81a40aabda3ffa883c3cdbf1f Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 25 Apr 2024 16:53:43 +0200 Subject: [PATCH 32/36] Use jungle from repository --- flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index a0047f3..10dde15 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,7 @@ description = "bench6"; nixConfig.bash-prompt = "\[nix-develop\]$ "; - inputs.jungle.url = "path:/home/Computational/rarias/jungle"; - inputs.jungle.inputs.bscpkgs.url = "path:/home/Computational/rarias/bscpkgs"; + inputs.jungle.url = "git+https://git.sr.ht/~rodarima/jungle"; outputs = { self, jungle, ... }: let -- GitLab From 935d4e71aa35374697d59a16afb307571cca28c2 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 25 Apr 2024 16:53:27 +0200 Subject: [PATCH 33/36] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'jungle': 'path:/home/Computational/rarias/jungle?lastModified=1714044572&narHash=sha256-9Y9g3o/sZMtLSR4/mYvkxIIvNwPy6xBomzFi8PANZhI%3D' (2024-04-25) → 'git+https://git.sr.ht/~rodarima/jungle?ref=refs/heads/master&rev=d2adc3a6d3ab6a42cc0a1c99c2ff8681667409e0' (2024-04-25) • Updated input 'jungle/bscpkgs': 'path:/home/Computational/rarias/bscpkgs?lastModified=1713974498&narHash=sha256-e%2BII9sPaaiaX7uGcQHSK8I028CDm3yuvu6AVPlJDS6A%3D' (2024-04-24) → 'git+https://git.sr.ht/~rodarima/bscpkgs?ref=refs/heads/master&rev=de89197a4a7b162db7df9d41c9d07759d87c5709' (2024-04-24) --- flake.lock | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 80670ea..1ac2c1f 100644 --- a/flake.lock +++ b/flake.lock @@ -32,10 +32,13 @@ ] }, "locked": { - "lastModified": 1713974498, - "narHash": "sha256-e+II9sPaaiaX7uGcQHSK8I028CDm3yuvu6AVPlJDS6A=", - "path": "/home/Computational/rarias/bscpkgs", - "type": "path" + "lastModified": 1713974364, + "narHash": "sha256-ilZTVWSaNP1ibhQIIRXE+q9Lj2XOH+F9W3Co4QyY1eU=", + "ref": "refs/heads/master", + "rev": "de89197a4a7b162db7df9d41c9d07759d87c5709", + "revCount": 937, + "type": "git", + "url": "https://git.sr.ht/~rodarima/bscpkgs" }, "original": { "type": "git", @@ -94,14 +97,17 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1714044572, - "narHash": "sha256-9Y9g3o/sZMtLSR4/mYvkxIIvNwPy6xBomzFi8PANZhI=", - "path": "/home/Computational/rarias/jungle", - "type": "path" + "lastModified": 1714044311, + "narHash": "sha256-mEMtClaRZE45THl0Ukdhj5SVQzYSvRCRAdPshSlvkCQ=", + "ref": "refs/heads/master", + "rev": "d2adc3a6d3ab6a42cc0a1c99c2ff8681667409e0", + "revCount": 235, + "type": "git", + "url": "https://git.sr.ht/~rodarima/jungle" }, "original": { - "path": "/home/Computational/rarias/jungle", - "type": "path" + "type": "git", + "url": "https://git.sr.ht/~rodarima/jungle" } }, "nixpkgs": { -- GitLab From e0171bccbdf446c5c0ef7bd81bde715919a25fa0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 25 Apr 2024 17:38:24 +0200 Subject: [PATCH 34/36] Test CI --- .gitlab-ci.yml | 6 ++++++ flake.nix | 36 ++++++++++++++++++++---------------- test/run.sh | 3 +++ 3 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100755 test/run.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..08b786e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,6 @@ +build:ci: + stage: build + tags: + - nix + script: + - nix shell '.#bench6' 'jungle#bigotes' --command sh -c "test/run.sh" diff --git a/flake.nix b/flake.nix index 10dde15..e3112f3 100644 --- a/flake.nix +++ b/flake.nix @@ -9,25 +9,29 @@ targetMachine = jungle.outputs.nixosConfigurations.hut; pkgs = targetMachine.pkgs; in { - packages.x86_64-linux.default = pkgs.stdenv.mkDerivation rec { - pname = "bench6"; - version = if self ? shortRev then self.shortRev else "dirty"; + packages.x86_64-linux = rec { + default = bench6; + bench6 = pkgs.stdenv.mkDerivation rec { + pname = "bench6"; + version = if self ? shortRev then self.shortRev else "dirty"; - src = self.outPath; + src = self.outPath; - buildInputs = with pkgs; [ - cmake - clangOmpss2 - nanos6 - nodes - nosv - mpi - tampi - ]; + buildInputs = with pkgs; [ + bigotes + cmake + clangOmpss2 + nanos6 + nodes + nosv + mpi + tampi + ]; - enableParallelBuilding = false; - hardeningDisable = [ "all" ]; - dontStrip = true; + enableParallelBuilding = false; + hardeningDisable = [ "all" ]; + dontStrip = true; + }; }; }; } diff --git a/test/run.sh b/test/run.sh new file mode 100755 index 0000000..250c342 --- /dev/null +++ b/test/run.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bigotes b6_heat_nanos6 -s 2048 -t 10 -b 64 -- GitLab From e9ba567477b77610ac495e0d9864ce2af1fa4b52 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 25 Apr 2024 17:58:14 +0200 Subject: [PATCH 35/36] WIP: Dump environment --- .gitlab-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08b786e..920a3a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,4 +3,13 @@ build:ci: tags: - nix script: + - env + - rm -rf bench6-master + - git clone --depth=1 https://pm.bsc.es/gitlab/rarias/bench6.git bench6-master + - cd bench6-master + - git rev-parse HEAD + - cd .. + - git rev-parse HEAD - nix shell '.#bench6' 'jungle#bigotes' --command sh -c "test/run.sh" + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' -- GitLab From 3fec7327b6852b8156f0fe21cbfec3ac4d9446ed Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 25 Apr 2024 19:06:57 +0200 Subject: [PATCH 36/36] Add master variant for CI --- flake.nix | 7 +++++++ test/ci.sh | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 test/ci.sh diff --git a/flake.nix b/flake.nix index e3112f3..c5b2672 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,13 @@ hardeningDisable = [ "all" ]; dontStrip = true; }; + + bench6Master = bench6.overrideAttrs (old: { + src = builtins.fetchGit { + url = "https://pm.bsc.es/gitlab/rarias/bench6.git"; + ref = "master"; + }; + }); }; }; } diff --git a/test/ci.sh b/test/ci.sh new file mode 100755 index 0000000..cef80ff --- /dev/null +++ b/test/ci.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e +set -x + +# Allow impure evaluation so we fetch the latest commit from the repo +bench6_ref=$(nix build --print-out-paths --impure ".#bench6Master") +bench6_cur=$(nix build --print-out-paths ".#bench6") + +# Add bigotes to the path +bigotes=$(nix build --print-out-paths 'jungle#bigotes') +export PATH="$bigotes/bin:$PATH" + +bigotes "${bench6_ref}/bin/b6_heat_nanos6" -s 2048 -t 10 -b 64 +bigotes "${bench6_cur}/bin/b6_heat_nanos6" -s 2048 -t 10 -b 64 -- GitLab