#!/usr/bin/env bash # # Integration Infiniband test using villas-node. # # Author: Dennis Potter # SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University # SPDX-License-Identifier: Apache-2.0 set -e # 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") . ${SRCDIR}/tools/villas-helper.sh # 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 # 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} <