1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

New benchmark bash script

Replaced the old node-infiniband-benchmark.sh script, which could only run benchmarks for the InfiniBand node-type, by a general script. This script reads configurations from ./configs and executes them in the benchmark environment.

Later, I will add a small README which also contains an image of this environment.
This commit is contained in:
Dennis Potter 2018-10-22 18:33:03 +02:00
parent 32bfe3a0cd
commit 6d2dfee6a3
7 changed files with 412 additions and 230 deletions

View file

@ -0,0 +1,49 @@
source_node = {
type = "infiniband",
rdma_transport_mode = "${IB_MODE}",
in = {
address = "10.0.0.2:1337",
max_wrs = 8192,
cq_size = 8192,
buffer_subtraction = 128
},
out = {
address = "10.0.0.1:1337",
resolution_timeout = 1000,
max_wrs = 4096,
cq_size = 5000,
periodic_signalling = 4500,
send_inline = true,
max_inline_data = 128,
use_fallback = true
}
},
target_node = {
type = "infiniband",
rdma_transport_mode = "${IB_MODE}",
in = {
address = "10.0.0.1:1337",
max_wrs = 8192,
cq_size = 8192,
buffer_subtraction = 128,
signals = {
count = ${NUM_VALUE},
type = "float"
}
}
}

View file

@ -0,0 +1,5 @@
source_node = {
type = "loopback",
queuelen = 8192,
mode = "polling"
}

View file

@ -0,0 +1,21 @@
source_node = {
type = "nanomsg",
out = {
endpoints = [ "tcp://*:12000"]
}
},
target_node = {
type = "nanomsg",
in = {
signals = {
count = ${NUM_VALUE},
type = "float"
},
endpoints = [
"tcp://127.0.0.1:12000"
]
},
}

View file

@ -0,0 +1,34 @@
source_node = {
type = "shmem",
queuelen = 8192,
polling = true,
vectorize = 1,
in = {
signals = {
count = ${NUM_VALUE},
type = "float"
}
name = "/shmem_node",
},
out = {
name = "/shmem_node"
},
}
target_node = {
type = "shmem",
in = {
signals = {
count = ${NUM_VALUE},
type = "float"
}
name = "/shmem_node",
},
out = {
name = "/shmem_node"
}
}

View file

@ -0,0 +1,24 @@
source_node = {
type = "zeromq",
pattern = "pubsub",
ipv6 = false,
out = {
publish = "tcp://127.0.0.1:1235",
filter = "ab184"
}
}
target_node = {
type = "zeromq",
in = {
signals = {
count = ${NUM_VALUE},
type = "float"
},
subscribe = "tcp://127.0.0.1:1235",
filter = "ab184"
}
}

View file

@ -1,230 +0,0 @@
#!/bin/bash
#
# Integration Infiniband test using villas-node.
#
# @author Dennis Potter <dennis@dennispotter.eu>
# @copyright 2018, 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 <http://www.gnu.org/licenses/>.
##################################################################################
# Check if user is superuser. SU is used for namespace
if [[ "$EUID" -ne 0 ]]; then
echo "Please run as root"
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
SCRIPT=$(realpath $0)
SCRIPTPATH=$(dirname ${SCRIPT})
source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh
CONFIG_FILE=$(mktemp /tmp/ib-configuration-XXXX.conf)
CONFIG_FILE_TARGET=$(mktemp /tmp/ib-configuration-target-XXXX.conf)
CONFIG_FILE_SOURCE=$(mktemp /tmp/ib-configuration-source-XXXX.conf)
INPUT_FILE=$(mktemp)
LOG_DIR=benchmarks_$(date +%Y%m%d_%H-%M-%S)
mkdir ${LOG_DIR}
NUM_VALUES=(2 4 8 16 32 64)
RATE_SAMPLES=(10 100 1000 10000 50000)
TIME_TO_RUN=30
# Declare modes
MODES=("RC" "UC" "UD")
# Initialize counter
COUNT=0
# Set target and source config file, which is the same for both runs
cat > ${CONFIG_FILE_TARGET} <<EOF
@include "${CONFIG_FILE//\/tmp\/}"
paths = (
{
in = "ib_node_target",
out = "results_output"
}
)
EOF
cat > ${CONFIG_FILE_SOURCE} <<EOF
@include "${CONFIG_FILE//\/tmp\/}"
paths = (
{
in = "siggen",
out = ("ib_node_source", "results_input")
}
)
EOF
# Run through modes
for MODE in "${MODES[@]}"
do
for NUM_VALUE in "${NUM_VALUES[@]}"
do
for RATE_SAMPLE in "${RATE_SAMPLES[@]}"
do
NUM_SAMPLE=$((${RATE_SAMPLE} * ${TIME_TO_RUN}))
echo "########################################################"
echo "########################################################"
echo "## START ${MODE}"
echo "## NUM_VALUES: ${NUM_VALUE}"
echo "## RATE_SAMPLES: ${RATE_SAMPLE}"
echo "## NUM_SAMPLES: ${NUM_SAMPLE}"
echo "########################################################"
echo "########################################################"
# Set config file with a MODE flag
cat > ${CONFIG_FILE} <<EOF
logging = {
level = 0,
facilities = "ib",
}
http = {
enabled = false,
},
nodes = {
siggen = {
type = "signal",
signal = "mixed",
values = ${NUM_VALUE},
frequency = 3,
rate = ${RATE_SAMPLE},
limit = ${NUM_SAMPLE},
monitor_missed = false,
},
results_input = {
type = "file",
format = "csv",
uri = "${LOG_DIR}/${COUNT}_${MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_input.csv",
buffer_size = 2000000000,
},
results_output = {
type = "file",
format = "csv",
uri = "${LOG_DIR}/${COUNT}_${MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_output.csv",
buffer_size = 2000000000,
},
ib_node_source = {
type = "infiniband",
rdma_port_space = "RDMA_PS_${MODE}",
in = {
address = "10.0.0.2:1337",
max_wrs = 8192,
cq_size = 8192,
poll_mode = "BUSY",
buffer_subtraction = 128,
},
out = {
address = "10.0.0.1:1337",
resolution_timeout = 1000,
max_wrs = 8192,
cq_size = 256,
send_inline = true,
max_inline_data = 60,
use_fallback = true,
}
}
ib_node_target = {
type = "infiniband",
rdma_port_space = "RDMA_PS_${MODE}",
in = {
address = "10.0.0.1:1337",
max_wrs = 8192,
cq_size = 8192,
poll_mode = "BUSY",
buffer_subtraction = 128,
}
}
}
EOF
sleep 1
# Start receiving node
VILLAS_LOG_PREFIX=$(colorize "[Target Node] ") \
villas-node ${CONFIG_FILE_TARGET} &
target_node_proc=$!
# Wait for node to complete init
sleep 2
# Start sending pipe
VILLAS_LOG_PREFIX=$(colorize "[Source Node] ") \
ip netns exec namespace0 villas-node ${CONFIG_FILE_SOURCE} &
source_node_proc=$!
sleep $((${TIME_TO_RUN} + 5))
#sleep 5
# Stop node
kill $target_node_proc
sleep 1
echo "########################################################"
echo "## STOP $MODE"-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}
echo "########################################################"
echo ""
((COUNT++))
sleep 1
done
done
done
# Since this script will be executed as sudo we should chmod the
# log dir 777. Otherwise too many unnecessary 'sudo rm -rf' will be called.
chmod -R 777 ${LOG_DIR}
rm ${CONFIG_FILE} ${CONFIG_FILE_TARGET} ${CONFIG_FILE_SOURCE} ${INPUT_FILE}
exit 0

279
tests/benchmarks/run-benchmark.sh Executable file
View file

@ -0,0 +1,279 @@
#!/bin/bash
#
# Integration Infiniband test using villas-node.
#
# @author Dennis Potter <dennis@dennispotter.eu>
# @copyright 2018, 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 <http://www.gnu.org/licenses/>.
##################################################################################
######################################
# SETTINGS ###########################
######################################
# ${NUM_VALUES}, ${RATE_SAMPLES}, and ${IB_MODES} may be a list.
NUM_VALUES=(1)
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/integration-tests-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
######################################
# SPECIAL CASES FOR SOME NODES #######
######################################
# Some nodes require special treatment:
# * loopback node: target_node is identical to source_node
# * infiniband node: one node must be executed in a namespace
# loopback
if [ "${NODETYPE}" == "loopback" ]; then
TARGET_NODE='source_node'
else
TARGET_NODE='target_node'
fi
# infiniband
if [ "${NODETYPE}" == "infiniband" ]; then
NAMESPACE_CMD='ip netns exec namespace0'
else
NAMESPACE_CMD=''
fi
######################################
# CREATE PATH CONFIG FILES ###########
######################################
# Set target and source config file, which is the same for both runs
cat > ${CONFIG_TARGET} <<EOF
@include "${CONFIG//\/tmp\/}"
paths = (
{
in = "${TARGET_NODE}",
out = "results_out",
original_sequence_no = true
}
)
EOF
cat > ${CONFIG_SOURCE} <<EOF
@include "${CONFIG//\/tmp\/}"
paths = (
{
in = "siggen",
out = ("source_node", "results_in"),
}
)
EOF
######################################
# RUN THROUGH MODES ##################
######################################
for IB_MODE in "${IB_MODES[@]}"
do
LOG_DIR=$(date +%Y%m%d_%H-%M-%S)_benchmark_${NODETYPE}_${IB_MODE}
for NUM_VALUE in "${NUM_VALUES[@]}"
do
for RATE_SAMPLE in "${RATE_SAMPLES[@]}"
do
NUM_SAMPLE=$((${RATE_SAMPLE} * ${TIME_TO_RUN}))
#TIME_TO_RUN=$((${NUM_SAMPLE} / ${RATE_SAMPLE}))
echo "########################################################"
echo "########################################################"
echo "## START ${IB_MODE}"
echo "## NUM_VALUES: ${NUM_VALUE}"
echo "## RATE_SAMPLES: ${RATE_SAMPLE}"
echo "## NUM_SAMPLES: ${NUM_SAMPLE}"
echo "########################################################"
echo "########################################################"
# Set wrapper of config file
cat > ${CONFIG} <<EOF
logging = {
level = 0,
facilities = "all",
}
http = {
enabled = false,
},
nodes = {
siggen = {
type = "signal",
signal = "mixed",
values = ${NUM_VALUE},
frequency = 3,
rate = ${RATE_SAMPLE},
limit = ${NUM_SAMPLE},
monitor_missed = false
},
results_in = {
type = "file",
format = "csv",
uri = "${LOG_DIR}/$(printf "%03d" ${COUNT})_${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_input.csv",
buffer_size = 500000000
},
results_out = {
type = "file",
format = "csv",
uri = "${LOG_DIR}/$(printf "%03d" ${COUNT})_${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_output.csv",
buffer_size = 500000000
},
EOF
cat configs/${NODETYPE}.conf | sed -e "s/\${NUM_VALUE}/${NUM_VALUE}/" -e "s/\${IB_MODE}/${IB_MODE}/" >> ${CONFIG}
cat >> ${CONFIG} <<EOF
}
EOF
# Start receiving node
VILLAS_LOG_PREFIX=$(colorize "[Target Node] ") \
cset proc --set=real-time-0 --exec ../../build/src/villas-node -- ${CONFIG_TARGET} &
target_node_proc=$!
# Wait for node to complete init
sleep 2
# Start sending pipe
VILLAS_LOG_PREFIX=$(colorize "[Source Node] ") \
${NAMESPACE_CMD} cset proc --set=real-time-1 --exec ../../build/src/villas-node -- ${CONFIG_SOURCE} &
source_node_proc=$!
sleep $((${TIME_TO_RUN} + 5))
# Stop node
kill $target_node_proc
sleep 1
echo "########################################################"
echo "## STOP $IB_MODE"-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}
echo "########################################################"
echo ""
((COUNT++))
sleep 1
done
done
# Since this script will be executed as sudo we should chmod the
# log dir 777. Otherwise too many unnecessary 'sudo rm -rf' will be invoked.
chmod -R 777 ${LOG_DIR}
done
done
rm ${CONFIG} ${CONFIG_TARGET} ${CONFIG_SOURCE}
exit 0