From de4392d990a2b9f19b9aa535b1a81155aac8b0d1 Mon Sep 17 00:00:00 2001 From: jvinyals Date: Wed, 28 Sep 2022 18:34:23 +0200 Subject: [PATCH 1/9] Makes .gitignore more generig Signed-off-by: jvinyals --- .gitignore | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5ba1d85..9e264ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ pils pils_regions -talp_overhead*.out -talp_overhead*.png -output_*.out +*.out +*.png .RData .Rhistory -- GitLab From 95e74280f0c3173ce087f1a9ad7b6d836f822eca Mon Sep 17 00:00:00 2001 From: jvinyals Date: Wed, 28 Sep 2022 18:36:53 +0200 Subject: [PATCH 2/9] Fixes gen_chart.r typos Signed-off-by: jvinyals --- gen_chart.r | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen_chart.r b/gen_chart.r index 989f67e..83da3f7 100644 --- a/gen_chart.r +++ b/gen_chart.r @@ -7,10 +7,10 @@ library(tidyr) # Parse arguments args = commandArgs(trailingOnly=TRUE) if (length(args)==0) { - stop("At least one argument must be supplied (input file).n", call.=FALSE) + stop("At least one argument must be supplied (input file).", call.=FALSE) } else if (length(args)==1) { # default output file - args[2] = paste(tools::file_path_sans_ext(args[1]), ".png") + args[2] = paste(tools::file_path_sans_ext(args[1]), ".png", sep='') } data <- read.table(args[1], sep=',', header=T) -- GitLab From 851a960889f4ca7c01d84cdb8e8b510101b5d9fb Mon Sep 17 00:00:00 2001 From: jvinyals Date: Wed, 28 Sep 2022 18:37:49 +0200 Subject: [PATCH 3/9] Changes the Y axis to % overhead It also changes the size of the image from 768x768 to 512x512. Signed-off-by: jvinyals --- gen_chart.r | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gen_chart.r b/gen_chart.r index 83da3f7..df78c99 100644 --- a/gen_chart.r +++ b/gen_chart.r @@ -22,12 +22,14 @@ dg <- data %>% dg <- dg %>% pivot_wider( names_from=Flavor, values_from=c(time, stdev), names_glue = "{Flavor}_{.value}") -dev <- png(args[2], width=786, height=786) - -ggplot(dg) + - geom_line(aes(x=MPI_calls_per_ms, y=talp_time-vanilla_time, color="w/o Regions")) + - geom_line(aes(x=MPI_calls_per_ms, y=talp_regions_time-vanilla_time, color="w/ Regions")) + - xlab('# MPI calls per ms') + ylab('Time difference in s') + ggtitle('TALP overhead') + +dev <- png(args[2], width=512, height=512) + +ggplot(dg,aes(x=MPI_calls_per_ms)) + + geom_line(aes(y=100*(talp_time/vanilla_time-1), color="w/o Regions")) + + geom_point(aes(y=100*(talp_time/vanilla_time-1), color="w/o Regions")) + + geom_line(aes(y=100*(talp_regions_time/vanilla_time-1), color="w/ Regions")) + + geom_point(aes(y=100*(talp_regions_time/vanilla_time-1), color="w/ Regions")) + + xlab('# MPI calls per ms') + ylab('% overhead') + ggtitle('TALP overhead') + scale_x_continuous(trans="log2") + theme(text = element_text(size=20)) dev.off() -- GitLab From acb769b354b249cccb7a81f664a01ea3bc676fe7 Mon Sep 17 00:00:00 2001 From: JOAN VINYALS YLLA CATALA Date: Thu, 29 Sep 2022 11:09:56 +0200 Subject: [PATCH 4/9] Renames the color legend lables. It renames the color labels to TALP and TALP + Regions. It also includes the csv file name to the title. Signed-off-by: JOAN VINYALS YLLA CATALA --- gen_chart.r | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gen_chart.r b/gen_chart.r index df78c99..43481fd 100644 --- a/gen_chart.r +++ b/gen_chart.r @@ -25,11 +25,11 @@ dg <- dg %>% dev <- png(args[2], width=512, height=512) ggplot(dg,aes(x=MPI_calls_per_ms)) + - geom_line(aes(y=100*(talp_time/vanilla_time-1), color="w/o Regions")) + - geom_point(aes(y=100*(talp_time/vanilla_time-1), color="w/o Regions")) + - geom_line(aes(y=100*(talp_regions_time/vanilla_time-1), color="w/ Regions")) + - geom_point(aes(y=100*(talp_regions_time/vanilla_time-1), color="w/ Regions")) + - xlab('# MPI calls per ms') + ylab('% overhead') + ggtitle('TALP overhead') + + geom_line(aes(y=100*(talp_time/vanilla_time-1), color="TALP")) + + geom_point(aes(y=100*(talp_time/vanilla_time-1), color="TALP")) + + geom_line(aes(y=100*(talp_regions_time/vanilla_time-1), color="TALP + Regions")) + + geom_point(aes(y=100*(talp_regions_time/vanilla_time-1), color="TALP + Regions")) + + xlab('# MPI calls per ms') + ylab('% overhead') + ggtitle(paste('TALP overhead', args[1])) + scale_x_continuous(trans="log2") + theme(text = element_text(size=20)) dev.off() -- GitLab From e233001c066b544614a707b856a8bc91a49248ba Mon Sep 17 00:00:00 2001 From: JOAN VINYALS YLLA CATALA Date: Thu, 29 Sep 2022 11:12:51 +0200 Subject: [PATCH 5/9] Adds an echo of the DLB_HOME in the job.sh Includes information about the installation of DLB used for better clarity, in the job output. Signed-off-by: JOAN VINYALS YLLA CATALA --- job.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/job.sh b/job.sh index 9037ea8..0ed444d 100755 --- a/job.sh +++ b/job.sh @@ -14,6 +14,8 @@ expected_test_duration=10000000 # 10 s output="talp_overhead.out" reps=5 +echo "DLB_HOME:${DLB_HOME}" + echo "Flavor,MPI_calls_per_ms,Time" > $output for flavor in "${flavors[@]}" ; do -- GitLab From 050952519830d028e3e49fcc506a491b05ac738a Mon Sep 17 00:00:00 2001 From: JOAN VINYALS YLLA CATALA Date: Thu, 29 Sep 2022 15:53:31 +0200 Subject: [PATCH 6/9] Adds to pils the report of total MPI calls Signed-off-by: JOAN VINYALS YLLA CATALA --- pils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pils.c b/pils.c index cb9c490..2a8bffe 100644 --- a/pils.c +++ b/pils.c @@ -264,8 +264,12 @@ int main(int argc, char* argv[]) { // Application elapsed time t_end = usecs(); - app_time = (t_end-t_start)/1000000.0; - if (mpi_rank == 0) printf("\nApplication time = %f \n", app_time); + app_time = (t_end-t_start); + if (mpi_rank == 0) { + int num_mpi_calls = loops * 2 /* number of MPI calls per iteration */; + printf("\n# MPI Calls = %d \n", num_mpi_calls); + printf("\nApplication time = %.4f \n", app_time); + } MPI_Finalize(); -- GitLab From 5a44dc5bb096119f01444b2b6c18c8efb1f75e69 Mon Sep 17 00:00:00 2001 From: JOAN VINYALS YLLA CATALA Date: Thu, 29 Sep 2022 15:54:40 +0200 Subject: [PATCH 7/9] Creates the R script to compute the overhead It creates the file calc_regression.r that computes the overhead of two versions of pills with relation to the vanilla version. This two versions are: executions of pils with TALP; and executions of pils with TALP and TALP regions. This script also creates a plot that shows the linear regression. It also adapts the job.sh to automatically report overhead of two installations of DLB: dlb/git; and dlb/testing. Signed-off-by: JOAN VINYALS YLLA CATALA --- calc_regression.r | 44 ++++++++++++++++++++++ job.sh | 93 +++++++++++++++++++++++++++++------------------ 2 files changed, 101 insertions(+), 36 deletions(-) create mode 100644 calc_regression.r diff --git a/calc_regression.r b/calc_regression.r new file mode 100644 index 0000000..6a73ce1 --- /dev/null +++ b/calc_regression.r @@ -0,0 +1,44 @@ +#!/usr/bin/env R + +library(dplyr) +library(ggplot2) +library(ggpubr) +library(tidyr) + +# Parse arguments +args = commandArgs(trailingOnly=TRUE) +if (length(args)==0) { + stop("At least one argument must be supplied (input file).", call.=FALSE) +} else if (length(args)==1) { + # default output file + args[2] = paste(tools::file_path_sans_ext(args[1]), ".png", sep='') +} + +data <- read.table(args[1], sep=',', header=T) + +overhead <- c() +flavors <- c("vanilla", "talp", "talp_regions") +for (flav in flavors) { + fit <- data %>% filter(Flavor == flav) %>% lm(Time ~ MPI_calls, data = .) + c <- fit$coefficients[1] + m <- fit$coefficients[2] + overhead[flav] <- m +} + +vanilla <- overhead[["vanilla"]] +talp <- overhead[["talp"]] +talp_regions <- overhead[["talp_regions"]] + +print(paste("overhead", "TALP", ":", talp - vanilla)) +print(paste("overhead", "TALP + Regions", ":", talp_regions - vanilla)) + +dev <- png(args[2], width=512, height=512) + +data %>% ggplot(aes(x=MPI_calls, y=Time, color=Flavor)) + + geom_point() + + geom_smooth(method="lm") + + stat_regline_equation(label.x=0, aes(label = ..eq.label..)) + + stat_regline_equation(label.x=10000000, aes(label = ..rr.label..)) + + labs(x='MPI calls', y='Time (us)', title=paste('TALP overhead', args[1])) + +dev.off() diff --git a/job.sh b/job.sh index 0ed444d..3196fdc 100755 --- a/job.sh +++ b/job.sh @@ -4,46 +4,67 @@ #SBATCH --error=output_%j.out #SBATCH --ntasks=48 #SBATCH --cpus-per-task=1 -#SBATCH --time=06:00:00 +#SBATCH --time=24:00:00 ##SBATCH --qos=debug #SBATCH --exclusive flavors=( vanilla talp talp_regions ) task_durations=( 1 5 10 20 40 50 100 200 400 500 1000 2000 ) # in us expected_test_duration=10000000 # 10 s -output="talp_overhead.out" -reps=5 - -echo "DLB_HOME:${DLB_HOME}" - -echo "Flavor,MPI_calls_per_ms,Time" > $output - -for flavor in "${flavors[@]}" ; do - case "$flavor" in - vanilla) - bin="./pils" - unset preload - unset DLB_ARGS - ;; - talp) - bin="./pils" - preload="env LD_PRELOAD=$DLB_HOME/lib/libdlb_mpi.so" - export DLB_ARGS="--talp --quiet" - ;; - talp_regions) - bin="./pils_regions" - preload="env LD_PRELOAD=$DLB_HOME/lib/libdlb_mpi.so" - export DLB_ARGS="--talp --quiet" - ;; - esac - for task_duration in "${task_durations[@]}" ; do - # Compute number of iterations - iters="$(( expected_test_duration / task_duration ))" - mpi_calls_per_ms="$(( 2000 / task_duration ))" - for (( i=0; i> "$output" - done - done +reps=30 + +echo "version,talp,talp_regions" | tee --append talp_overhead.out + +for version in "git" "testing"; do + + module load "dlb/${version}" + make clean all + echo "DLB_HOME:${DLB_HOME}" + + csvfile="talp_${version}_overhead.out" + echo "Flavor,MPI_calls,Time" | tee $csvfile # Write headers and trucate file + + for flavor in "${flavors[@]}" ; do + case "$flavor" in + vanilla) + bin="./pils" + unset preload + unset DLB_ARGS + ;; + talp) + bin="./pils" + preload="env LD_PRELOAD=$DLB_HOME/lib/libdlb_mpi.so" + export DLB_ARGS="--talp --quiet" + ;; + talp_regions) + bin="./pils_regions" + preload="env LD_PRELOAD=$DLB_HOME/lib/libdlb_mpi.so" + export DLB_ARGS="--talp --quiet" + ;; + esac + for task_duration in "${task_durations[@]}" ; do + # Compute number of iterations + iters="$(( expected_test_duration / task_duration ))" + mpi_calls_per_ms="$(( 2000 / task_duration ))" + for (( i=0; i "${output}"; + + time="$(awk '/Application time/ {print $4}' ${output})" + mpi_calls="$(awk '/# MPI Calls/ {print $5}' ${output})" + + echo "$flavor,$mpi_calls,$time" | tee --append "$csvfile" # Append entry to csv file + + rm -f ${output} + + done + done + done + + module load R + Rscript calc_regression.r "${csvfile}" | tee "${csvfile%.*}.r.out" + talp=$(awk '/overhead TALP :/ { print $5 }' "${csvfile%.*}.r.out" | tr -d '"') + talp_regions=$(awk '/overhead TALP \+ Regions :/ { print $7 }' "${csvfile%.*}.r.out" | tr -d '"') + echo "${version},${talp},${talp_regions}" | tee --append talp_overhead.out + module unload R done -- GitLab From 1e9d8a1daff8690f8bc838d442bfc21fe1e311b4 Mon Sep 17 00:00:00 2001 From: JOAN VINYALS YLLA CATALA Date: Fri, 30 Sep 2022 12:22:03 +0200 Subject: [PATCH 8/9] Renamed the overhead computation R script Signed-off-by: JOAN VINYALS YLLA CATALA --- calc_regression.r => compute_overhead.r | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename calc_regression.r => compute_overhead.r (100%) diff --git a/calc_regression.r b/compute_overhead.r similarity index 100% rename from calc_regression.r rename to compute_overhead.r -- GitLab From 013b9bb71b217e015c716f384e519a2bc0c6b0a1 Mon Sep 17 00:00:00 2001 From: JOAN VINYALS YLLA CATALA Date: Fri, 30 Sep 2022 12:22:15 +0200 Subject: [PATCH 9/9] Creates a new R script to compare the versions Signed-off-by: JOAN VINYALS YLLA CATALA --- compare_overhead.r | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 compare_overhead.r diff --git a/compare_overhead.r b/compare_overhead.r new file mode 100644 index 0000000..10092ba --- /dev/null +++ b/compare_overhead.r @@ -0,0 +1,29 @@ +#!/usr/bin/env R + +library(dplyr) +library(ggplot2) +library(reshape2) + +# Parse arguments +args = commandArgs(trailingOnly=TRUE) +if (length(args)==0) { + stop("At least one argument must be supplied (input file).", call.=FALSE) +} else if (length(args)==1) { + # default output file + args[2] = paste(tools::file_path_sans_ext(args[1]), ".png", sep='') +} + +data <- read.table("talp_overhead.out", sep=',', header=T) + +data <- data %>% melt(id.vars="version", variable.name="config") + +dev <- png(args[2], width=512, height=512) + +ggplot(data, aes(x=config, fill=version, y=value)) + + geom_col(position="dodge") + + labs( + title="overhead comparison (git vs testing) @ MN4", + x="Configuration", + y="Overhaed in Time (us) / MPI Call") + +dev.off() -- GitLab