diff --git a/.gitignore b/.gitignore index 5ba1d85b29705c76ee2d5057c4fa57905d93d3bd..9e264ae41bf202c51297a5ee0a7de8c88076caa2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ pils pils_regions -talp_overhead*.out -talp_overhead*.png -output_*.out +*.out +*.png .RData .Rhistory diff --git a/compare_overhead.r b/compare_overhead.r new file mode 100644 index 0000000000000000000000000000000000000000..10092bac47f20651a93760632696a6ea3512f806 --- /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() diff --git a/compute_overhead.r b/compute_overhead.r new file mode 100644 index 0000000000000000000000000000000000000000..6a73ce1860cabcbbe68f1b52eb857d7228a1c752 --- /dev/null +++ b/compute_overhead.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/gen_chart.r b/gen_chart.r index 989f67e33f6a977e6fbd27bed65ec0e85df9bf20..43481fd9fd4cc121e2cc8c0932ff16e973fa7cd0 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) @@ -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) +dev <- png(args[2], width=512, height=512) -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') + +ggplot(dg,aes(x=MPI_calls_per_ms)) + + 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() diff --git a/job.sh b/job.sh index 9037ea8f6533dce85fdc62e636e6dc81c9788abb..3196fdc89f67f303b91328994dbd990b0806f26b 100755 --- a/job.sh +++ b/job.sh @@ -4,44 +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 "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 diff --git a/pils.c b/pils.c index cb9c490fe0edf63c0379c58dec2bc9ad1b06510c..2a8bffe5780763edadf7d572cd70639409040915 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();