From 09b2c14984af8fb8161346d5b5fdf225a959bfb1 Mon Sep 17 00:00:00 2001 From: Emilien Bauer Date: Thu, 5 Oct 2023 14:43:50 +0100 Subject: [PATCH] Comment shell scripts. --- fast/openmp.sh | 22 ++++++++++++++++++++++ fast/single_thread.sh | 16 ++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/fast/openmp.sh b/fast/openmp.sh index 960b35a830..0b3dc229d9 100755 --- a/fast/openmp.sh +++ b/fast/openmp.sh @@ -1,30 +1,52 @@ #!/bin/bash +# Simple script to run multithreaded benchmarks locally, +# for simple sanity checks. + +# Use OpenMP export DEVITO_LANGUAGE=openmp +# Use the cray compiler, if available. export DEVITO_ARCH=cray +# Enable debug logging. export DEVITO_LOGGING=DEBUG +# Disable (tile size) autotuning for iteration speed. +# I enable it sometimes; NB enabling it requires that no explicit tile size +# is specified in the Operator constructor args. unset DEVITO_AUTOTUNING +# Bind threads to physical cores export OMP_PLACES=cores export OMP_PROC_BIND=true +# Just extract the reported runtime from the whole output of the passed command get_runtime() { $@ |& grep 'Operator.*ran' | rev | cut -d ' ' -f2 | rev } +# Iterate over benchmarks and cases, print simple CSV data to stdout +# Copy-pastes nicely in Google Sheets echo bench_name,so,threads,Devito,xDSL for bench in "wave2d_b.py -d 2048 2048 --nt 512" "wave3d_b.py -d 512 512 512 --nt 512" "diffusion_3D_wBCs.py -d 512 512 512 --nt 512" "diffusion_2D_wBCs.py -d 2048 2048 --nt 512" do + # Get the benchmark file for printing bench_name=$(echo $bench | cut -d ' ' -f1) + # Iterate over measured space orders for so in 2 4 8 do + # Iterate over measured thread numbers for threads in 1 2 4 8 16 32 do + # Set the thread number to use export OMP_NUM_THREADS=$threads + + # To uncomment to check what's going on without capturing the output. # echo OMP_NUM_THREADS=$threads # python $bench -so $so --devito 1 + + # Get the runtimes devito_time=$(get_runtime python $bench -so $so --devito 1) xdsl_time=$(get_runtime python $bench -so $so --xdsl 1) + # print CSV line echo $bench_name,$so,$threads,$devito_time,$xdsl_time done done diff --git a/fast/single_thread.sh b/fast/single_thread.sh index 263b5be104..03260295e7 100755 --- a/fast/single_thread.sh +++ b/fast/single_thread.sh @@ -1,22 +1,38 @@ #!/bin/bash +# Simple script to run single threaded benchmarks locally, +# for simple sanity checks. + +# Don't use OpenMP unset DEVITO_LANGUAGE +# Use the cray compiler, if available. export DEVITO_ARCH=cray +# Enable debug logging. export DEVITO_LOGGING=DEBUG +# Enable (tile size) autotuning +# NB enabling it requires that no explicit tile size +# is specified in the Operator constructor args. export DEVITO_AUTOTUNING=aggressive +# Just extract the reported runtime from the whole output of the passed command get_runtime() { $@ |& grep 'Operator.*ran' | rev | cut -d ' ' -f2 | rev } +# Iterate over benchmarks and cases, print simple CSV data to stdout +# Copy-pastes nicely in Google Sheets echo bench_name,so,Devito,xDSL for bench in "wave2d_b.py -d 2048 2048 --nt 512" "wave3d_b.py -d 512 512 512 --nt 512" "diffusion_3D_wBCs.py -d 512 512 512 --nt 512" "diffusion_2D_wBCs.py -d 2048 2048 --nt 512" do + # Get the benchmark file for printing bench_name=$(echo $bench | cut -d ' ' -f1) + # Iterate over measured space orders for so in 2 4 8 do + # Get the runtimes devito_time=$(get_runtime python $bench -so $so --devito 1) xdsl_time=$(get_runtime python $bench -so $so --xdsl 1) + # print CSV line echo $bench_name,$so,$devito_time,$xdsl_time done done