iccsa-19-vtestbed

Virtual Testbed: Ship Motion Simulation for Personal Workstations
git clone https://git.igankevich.com/iccsa-19-vtestbed.git
Log | Files | Refs

benchmark (1817B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 nprocs=$(nproc)
      6 host=$(hostname)
      7 build_sequential="build-$host-sequential"
      8 build_openmp="build-$host-openmp"
      9 build_opencl="build-$host-opencl"
     10 timeout='1m'
     11 flags=
     12 flags="$flags -Dbuildtype=release -Dcpp_args=-march=native -Dreal_type=float"
     13 flags="$flags -Dwith_profile=true -Dwith_tests=false -Dwith_doc=false"
     14 flags="$flags -Dwith_singularity=false -Dwith_rpm=false -Dwith_scripts=false"
     15 profiles="/tmp/profiles"
     16 ship=1
     17 
     18 mkdir -p "$profiles"
     19 
     20 benchmark_sequential() {
     21 	cd $build_sequential
     22 	echo "Benchmark sequential [1/1]"
     23 	set +e
     24 	env VTB_PROFILE_OUTPUT=$profiles/profile-sequential.log \
     25 		VTB_PROFILE_AUTOSTART=1 \
     26 		VTB_PROFILE_SHIP=$ship \
     27 		timeout $timeout \
     28 		./src/vtestbed/gui/vtestbed-gui
     29 	set -e
     30 	cd -
     31 }
     32 
     33 benchmark_openmp() {
     34 	cd $build_openmp
     35 	for i in $(seq $nprocs)
     36 	do
     37 		echo "Benchmark OpenMP: [$i/$nprocs]"
     38 		set +e
     39 		env VTB_PROFILE_OUTPUT=$profiles/profile-openmp-$i.log \
     40 			VTB_PROFILE_AUTOSTART=1 \
     41 			VTB_PROFILE_SHIP=$ship \
     42 			OMP_NUM_THREADS=$i \
     43 			timeout $timeout \
     44 			./src/vtestbed/gui/vtestbed-gui
     45 		set -e
     46 	done
     47 	cd -
     48 }
     49 
     50 benchmark_opencl() {
     51 	cd $build_opencl
     52 	echo "Benchmark OpenCL [1/1]"
     53 	set +e
     54 	env VTB_PROFILE_OUTPUT=$profiles/profile-opencl.log \
     55 		VTB_PROFILE_AUTOSTART=1 \
     56 		VTB_PROFILE_SHIP=$ship \
     57 		timeout $timeout \
     58 		./src/vtestbed/gui/vtestbed-gui
     59 	set -e
     60 	cd -
     61 }
     62 
     63 build() {
     64 	dir="$1"
     65 	more_flags="$2"
     66 	echo "Build $dir with $more_flags"
     67 	old=$(pwd)
     68 	if test -d "$dir"
     69 	then
     70 		meson configure $flags $more_flags "$dir"
     71 	else
     72 		meson $flags $more_flags . "$dir"
     73 	fi
     74 	cd "$dir"
     75 	ninja
     76 	cd $old
     77 }
     78 
     79 build "$build_sequential" "-Dwith_openmp=false -Dwith_opencl=false"
     80 build "$build_openmp" "-Dwith_openmp=true -Dwith_opencl=false"
     81 build "$build_opencl" "-Dwith_openmp=true -Dwith_opencl=true"
     82 
     83 benchmark_sequential
     84 benchmark_openmp
     85 benchmark_opencl