diff --git a/scripts/JF07-buffer-worker.sh b/scripts/JF07-buffer-worker.sh new file mode 100644 index 0000000..981f4ca --- /dev/null +++ b/scripts/JF07-buffer-worker.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ $# != 1 ] +then + systemctl start JF07-buffer-worker@{00..31} + exit +fi + +M=$1 + +#8 udp2buffer workers per core +#coreAssociatedBuffer=(1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8) +#4 udp2buffer workers per core +coreAssociatedBuffer=(1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16) +initialUDPport=50100 +# strange that it doesn't work to add 08 or 09 (value too great for base (error token is "09")) +port=$((${initialUDPport}+10#${M})) +#port=`expr ${initialUDPport} + ${M}` +DETECTOR=JF07T32V01 +echo ${port} + +#taskset -c ${coreAssociatedBuffer[10#${M}]} /home/dbe/test/sf_buffer M${M} ${port} /gpfs/photonics/swissfel/buffer/${DETECTOR} > /gpfs/photonics/swissfel/buffer/${port}.log +taskset -c ${coreAssociatedBuffer[10#${M}]} /home/dbe/test/sf_buffer M${M} ${port} /gpfs/photonics/swissfel/buffer/${DETECTOR} diff --git a/scripts/JF07-buffer-worker@.service b/scripts/JF07-buffer-worker@.service new file mode 100644 index 0000000..5da760c --- /dev/null +++ b/scripts/JF07-buffer-worker@.service @@ -0,0 +1,16 @@ +[Unit] +Description=JF07 UDP2buffer worker instance as a service, instance %i +Requires=JF07-buffer.service +Before=JF07-buffer.service +BindsTo=JF07-buffer.service + +[Service] +PermissionsStartOnly=true +Type=idle +User=root +ExecStart=/usr/bin/sh /home/dbe/test/systemd/JF07-buffer-worker.sh %i +TimeoutStartSec=10 +RestartSec=10 + +[Install] +WantedBy=JF07-buffer.service diff --git a/scripts/JF07-buffer.service b/scripts/JF07-buffer.service new file mode 100644 index 0000000..a6967bc --- /dev/null +++ b/scripts/JF07-buffer.service @@ -0,0 +1,10 @@ +[Unit] +Description=All UDP-buffer instances of JF07 + +[Service] +Type=oneshot +ExecStart=/usr/bin/sh /home/dbe/test/systemd/JF07-buffer-worker.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/scripts/JF07-replay-worker.sh b/scripts/JF07-replay-worker.sh new file mode 100644 index 0000000..fc82903 --- /dev/null +++ b/scripts/JF07-replay-worker.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ $# != 1 ] +then + echo "need parameter, exit" + exit +fi + +M=$1 + +#8 replay workers per core, last writer worker occupies 4 +coreAssociated=(17 17 17 17 17 17 17 17 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 20 20 20 20 20 20 20 20 21,22,23,24) + +latest_file=`cat /gpfs/photonics/swissfel/buffer/JF07T32V01/M00/LATEST` +last_pulse_id=`basename ${latest_file} | sed 's/.h5//'` +#first_pulse_id=$((${last_pulse_id}-100000)) +first_pulse_id=$((${last_pulse_id}-1000)) + +echo "First/last pulse_id : ${first_pulse_id} ${last_pulse_id}" + +if [ ${M} == 32 ] +then + taskset -c ${coreAssociated[10#${M}]} /home/dbe/test/sf_writer /gpfs/photonics/swissfel/buffer/test.${first_pulse_id}-${last_pulse_id}.h5 ${first_pulse_id} ${last_pulse_id} +else + taskset -c ${coreAssociated[10#${M}]} /home/dbe/test/sf_replay /gpfs/photonics/swissfel/buffer/JF07T32V01 M${M} ${M} ${first_pulse_id} ${last_pulse_id} +fi diff --git a/scripts/JF07-replay-worker@.service b/scripts/JF07-replay-worker@.service new file mode 100644 index 0000000..8524c99 --- /dev/null +++ b/scripts/JF07-replay-worker@.service @@ -0,0 +1,16 @@ +[Unit] +Description=JF07 replay worker instance as a service, instance %i +Requires=JF07-replay.service +Before=JF07-replay.service +BindsTo=JF07-replay.service + +[Service] +PermissionsStartOnly=true +Type=idle +User=root +ExecStart=/usr/bin/sh /home/dbe/test/systemd/JF07-replay-worker.sh %i +TimeoutStartSec=10 +RestartSec=10 + +[Install] +WantedBy=JF07-replay.service diff --git a/scripts/JF07-replay.service b/scripts/JF07-replay.service new file mode 100644 index 0000000..193276c --- /dev/null +++ b/scripts/JF07-replay.service @@ -0,0 +1,10 @@ +[Unit] +Description=All replay instances of JF07 + +[Service] +Type=oneshot +ExecStart=/usr/bin/sh /home/dbe/test/systemd/JF07-replay.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/scripts/JF07-replay.sh b/scripts/JF07-replay.sh new file mode 100644 index 0000000..63a2f8d --- /dev/null +++ b/scripts/JF07-replay.sh @@ -0,0 +1,2 @@ +#!/bin/bash +systemctl start JF07-replay-worker@{00..32}