#!/bin/bash
# This script installs thp memscale
###SHELLPACK preamble thpmemscale-bench 0

###SHELLPACK parseargBegin
###SHELLPACK parseargInstall
###SHELLPACK parseargParam	--max-threads	THPMEMSCALE_MAX_THREADS
###SHELLPACK parseargParam	--memory	THPMEMSCALE_MEMORY

###SHELLPACK parseargEnd

###SHELLPACK check_install_required thpmemscale-${VERSION}

###SHELLPACK monitor_hooks

cd $SHELLPACK_SOURCES/thpmemscale-${VERSION}-installed || die Failed to cd to thp memscale directory
# -C 0 -m 0 -c <cores> -b <memory>
###SHELLPACK threads_stride_begin 1 $THPMEMSCALE_MAX_THREADS
	monitor_pre_hook $LOGDIR_RESULTS $NR_THREADS
	( ./thp_memscale -C 0 -m 0 -c $NR_THREADS -b $THPMEMSCALE_MEMORY \
		2>&1 | tee -a $LOGDIR_RESULTS/thpmemscale-$NR_THREADS ) \
			|| die Failed to run thp memscale
	monitor_post_hook $LOGDIR_RESULTS $NR_THREADS
###SHELLPACK threads_stride_end

exit $SHELLPACK_SUCCESS
