Skip to content

Instantly share code, notes, and snippets.

@paulosevero
Created August 10, 2018 13:42
Show Gist options
  • Select an option

  • Save paulosevero/74c64bdeb77691ff3bba35fbbb912251 to your computer and use it in GitHub Desktop.

Select an option

Save paulosevero/74c64bdeb77691ff3bba35fbbb912251 to your computer and use it in GitHub Desktop.
NAS Parallel Benchmark setup script on Ubuntu 14.04
#!/bin/bash
# compile_bench(bench, nprocs, class)
compile_bench() {
local bench="${1}"
local nprocs="${2}"
local class="${3}"
make "${bench}" NPROCS="${nprocs}" CLASS="${class}"
}
for class in A B C D; do
compile_bench lu 32 "${class}"
compile_bench sp 25 "${class}"
compile_bench sp 36 "${class}"
compile_bench bt 25 "${class}"
compile_bench bt 36 "${class}"
done
#!/bin/bash
# Download and extract NPB
wget http://www.nas.nasa.gov/assets/npb/NPB3.3.1.tar.gz 2>&1
tar xf NPB3.3.1.tar.gz
cd NPB3.3.1
# Setup MPI
cd NPB3.3-MPI/config
cp suite.def.template suite.def
cp make.def.template make.def
sed -i -e 's/f77/mpif77/g' -e 's/cc/mpicc/g' -e 's/-O/-O3 -mcmodel=medium/g' make.def
cd ../..
# Setup OMP
cd NPB3.3-OMP/config
cp suite.def.template suite.def
cp NAS.samples/make.def.gcc_x86 make.def
cd ../..
# Setup Serial
cd NPB3.3-SER/config
cp suite.def.template suite.def
cp NAS.samples/make.def_gcc_x86 make.def
cd ~
# Download, extract and setup NPB-MZ
wget http://www.nas.nasa.gov/assets/npb/NPB3.3.1-MZ.tar.gz 2>&1
tar xf NPB3.3.1-MZ.tar.gz
cp NPB3.3.1/NPB3.3-MPI/config/make.def NPB3.3.1-MZ/NPB3.3-MZ-MPI/config
cp NPB3.3.1-MZ/NPB3.3-MZ-MPI/config/suite.def.template NPB3.3.1-MZ/NPB3.3-MZ-MPI/config/suite.def
cp NPB3.3.1/NPB3.3-OMP/config/make.def NPB3.3.1-MZ/NPB3.3-MZ-OMP/config
cp NPB3.3.1-MZ/NPB3.3-MZ-OMP/config/suite.def.template NPB3.3.1-MZ/NPB3.3-MZ-OMP/config/suite.def
cp NPB3.3.1/NPB3.3-SER/config/make.def NPB3.3.1-MZ/NPB3.3-MZ-SER/config
cp NPB3.3.1-MZ/NPB3.3-MZ-SER/config/suite.def.template NPB3.3.1-MZ/NPB3.3-MZ-SER/config/suite.def
#!/bin/bash
# run_bench(bench, class, nprocs, repetitions)
run_bench() {
local bench="${1}"
local class="${2}"
local nprocs="${3}"
local repetitions="${4}"
local name="${bench}.${class}.${nprocs}"
nohup sar -o "${name}.sa" 5 > /dev/null 2>&1 &
for i in `seq ${repetitions}`; do
echo "Running ${name} (${i}/${repetitions})" | tee -a "${name}.log"
date | tee -a "${name}.log"
mpirun -np "${nprocs}" "${name}" | tee -a "${name}.log"
date | tee -a "${name}.log"
echo | tee -a "${name}.log"
done
killall sar
}
for class in A B C D; do
run_bench lu "${class}" 32 5
run_bench sp "${class}" 25 5
run_bench sp "${class}" 36 5
run_bench bt "${class}" 25 5
run_bench bt "${class}" 36 5
done
#!/bin/bash
# Should be run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y build-essential gfortran openmpi-bin libopenmpi-dev tmux htop git sysstat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment