start daq and test script for eiger

This commit is contained in:
lhdamiani
2021-07-14 21:49:47 +02:00
parent 731327d50a
commit 4ada4693dc
2 changed files with 179 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
ENDPOINT="http://127.0.0.1:5000"
SYNC="/write_sync"
ASYNC="/write_async"
KILL="/kill"
HEADER="Content-Type:application/json"
N_IMAGES=5
SOURCES="eiger"
# Define a timestamp function
timestamp() {
date +"%T" # current time
}
generate_post_data()
{
cat <<EOF
{"n_images": 5, "output_file": "$OUTPUT_FILE", "sources": "eiger"}
EOF
}
for((i=1;i<=10;i+=1)); do
TIMESTAMP=$(date +%d-%m-%Y_%H-%M-%S)
echo "[${TIMESTAMP}] Starting Request ${i}..."
OUTPUT_FILE="/home/hax_l/tests/output_"${i}"_"${TIMESTAMP}".h5"
# echo "$(generate_post_data)"
curl -X POST -H ${HEADER} --data "$(generate_post_data)" ${ENDPOINT}${SYNC}
done
+151
View File
@@ -0,0 +1,151 @@
#!/bin/bash
# conda activate
export PATH=/home/dbe/miniconda3/bin:$PATH
source /home/dbe/miniconda3/etc/profile.d/conda.sh
conda deactivate
conda activate sf-daq
# path to build dir
BUILD_PATH='/home/hax_l/sf_daq_buffer/build/'
# executables
UDP_RECV='std_udp_recv'
UDP_SYNC='std_udp_sync'
EIGER_ASSEMBLER='eiger_assembler'
STD_DET_WRITER='std_det_writer'
# default config file
CONFIG_FILE='/home/hax_l/sf_daq_buffer/eiger/sf-daq-4/config/eiger.json'
HELP_FLAG=0
# CONFIGURATION
BIT_DEPTH=16
N_MPI_EXEC=3
while getopts h:c:b:m: flag
do
case "${flag}" in
h ) HELP_FLAG=${OPTARG};;
c ) CONFIG_FILE=${OPTARG};;
b ) BIT_DEPTH=${OPTARG};;
m ) N_MPIT_EXEC=${OPTARG};;
esac
done
# prints help and exits
if (( ${HELP_FLAG} == 1 )); then
echo "Usage : $0 -h <help_flag> -c <config_file> -b <bit_depth>"
echo " help_flag : show this help and exits."
echo " config_file : detector configuration file."
echo " bit_depth : detector bit depth."
exit
fi
if [ -f "${CONFIG_FILE}" ]; then
N_UDP_RECVS="`cat ${CONFIG_FILE} | grep -P '"n_modules":' | grep -o '[0-9]\+'`"
else
echo "Something went wrong with the config file... ${CONFIG_FILE}..."
exit
fi
if [ ${N_MPI_EXEC} -gt 0 ]
then
echo "Number of mpi writers: ${N_MPI_EXEC}."
else
echo "Something went wrong with the number of mpi writer processes..."
exit
fi
if [ -f "${CONFIG_FILE}" ]; then
N_UDP_RECVS="`cat ${CONFIG_FILE} | grep -P '"n_modules":' | grep -o '[0-9]\+'`"
else
echo "Something went wrong with the config file... ${CONFIG_FILE}..."
exit
fi
# Start the receivers
echo "Starting ${N_UDP_RECVS} udp receivers..."
COUNTER=0
if [ -f "${BUILD_PATH}${UDP_RECV}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
if [ ${BIT_DEPTH} -ne 0 ]; then
while [ $COUNTER -lt ${N_UDP_RECVS} ]; do
${BUILD_PATH}${UDP_RECV} ${CONFIG_FILE} ${COUNTER} ${BIT_DEPTH} &
let COUNTER=COUNTER+1
sleep 0.5
done
else
echo "Error: ${BIT_DEPTH} can't be zero..."
exit
fi
else
echo "Something went wrong while starting the ${UDP_RECV}..."
exit
fi
else
echo "Error: ${UDP_RECV} wasn't found..."
exit
fi
# Start the std-udp-sync
echo "Starting the ${UDP_SYNC}..."
COUNTER=0
if [ -f "${BUILD_PATH}${UDP_SYNC}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
if [ ${BIT_DEPTH} -ne 0 ]; then
${BUILD_PATH}${UDP_SYNC} ${CONFIG_FILE} ${BIT_DEPTH} &
sleep 0.5
else
echo "Error: ${BIT_DEPTH} can't be zero..."
exit
fi
else
echo "Something went wrong while starting the ${UDP_SYNC}..."
exit
fi
else
echo "Error: ${UDP_SYNC} wasn't found..."
exit
fi
# Start the eiger assembler
echo "Starting the ${EIGER_ASSEMBLER}..."
if [ -f "${BUILD_PATH}${EIGER_ASSEMBLER}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
if [ ${BIT_DEPTH} -ne 0 ]; then
${BUILD_PATH}${EIGER_ASSEMBLER} ${CONFIG_FILE} ${BIT_DEPTH} &
sleep 0.5
else
echo "Error: ${BIT_DEPTH} can't be zero..."
exit
fi
else
echo "Something went wrong while starting the ${EIGER_ASSEMBLER}..."
exit
fi
else
echo "Error: ${EIGER_ASSEMBLER} wasn't found..."
exit
fi
# Start the eiger writer
echo "Starting the ${STD_DET_WRITER}..."
export PATH="/usr/lib64/mpich/bin:${PATH}";
export LD_LIBRARY_PATH="/usr/lib64/mpich/lib:${LD_LIBRARY_PATH}";
if [ -f "${BUILD_PATH}${STD_DET_WRITER}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
mpiexec -n ${N_MPI_EXEC} ${BUILD_PATH}${STD_DET_WRITER} ${CONFIG_FILE} ${BIT_DEPTH} &
sleep 0.5
else
echo "Something went wrong while starting the ${STD_DET_WRITER}..."
exit
fi
else
echo "Error: ${STD_DET_WRITER} wasn't found..."
exit
fi