#!/bin/bash # # Integration Infiniband test using villas-node. # # @author Dennis Potter # @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC # @license GNU General Public License (version 3) # # VILLASnode # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ################################################################################## ###################################### # SETTINGS ########################### ###################################### # ${NUM_VALUES}, ${RATE_SAMPLES}, and ${IB_MODES} may be a list. NUM_VALUES=(8) RATE_SAMPLES=(10) TIME_TO_RUN=5 IB_MODES=("RC") ###################################### ###################################### ###################################### # Check if user is superuser. SU is used for namespace if [[ "$EUID" -ne 0 ]]; then echo "Please run as root" exit 99 fi # Check whether cpuset cset command is availble if [[ ! $(command -v cset) ]]; then echo "Cset is not availble for root. Please install it: https://github.com/lpechacek/cpuset" exit 99 fi # Check if Infiniband card is present if [[ ! $(lspci | grep Infiniband) ]]; then echo "Did not find any Infiniband cards in system" exit 99 fi # Create list of configs and check whether they are valid OIFS=$IFS; IFS=$'\n'; CONFIG_FILES=($(ls configs | sed -e "s/.conf//")); IFS=$OIFS; NODETYPES=() if [[ ! $1 ]]; then echo "Please define for which node-type to run the script" exit 1 elif [[ $1 == all ]]; then echo "Benchmarking the following nodes:" for NODETYPE in "${CONFIG_FILES[@]}" do echo ${NODETYPE} NODETYPES+=(${NODETYPE}) done else FOUND=0 for NODETYPE in "${CONFIG_FILES[@]}" do if [[ $1 == ${NODETYPE} ]]; then NODETYPES=$1 FOUND=1 break fi done if [[ ${FOUND} == 0 ]]; then echo "Please define a valid node-type for which a config file is present in ./configs!" exit 1 fi fi ###################################### # SET PATHS ########################## ###################################### # Set paths SCRIPT=$(realpath $0) SCRIPTPATH=$(dirname ${SCRIPT}) source ${SCRIPTPATH}/../../tools/villas-helper.sh # Declare location of config files CONFIG=$(mktemp /tmp/nodetype-benchmark-config-XXXX.conf) CONFIG_TARGET=$(mktemp /tmp/nodetype-benchmark-config-target-XXXX.conf) CONFIG_SOURCE=$(mktemp /tmp/nodetype-benchmark-config-source-XXXX.conf) # Initialize counter COUNT=0 ###################################### # START OF LOOPS THROUGH CONFIGS ##### ###################################### echo ${CONFIG_FILES[0]} echo ${CONFIG_FILES[1]} for NODETYPE in "${NODETYPES[@]}" do ###################################### # CREATE PATH CONFIG FILES ########### ###################################### # Set target and source config file, which is the same for both runs cat > ${CONFIG_SOURCE} < ${CONFIG_TARGET} < ${CONFIG_TARGET} < ${CONFIG} <> ${CONFIG} cat >> ${CONFIG} <