NSCL DAQ

From FSU Fox's Lab Wiki
Jump to navigation Jump to search

Installation in Ubuntu or Debian

In order to run the NSCLDAQ in a container (or a VM, Virtual Machine). We need 3 things,

  1. The container program, we are using singularity container
  2. The OS image for the container, which is Debian 8 or 10 for NSCLDAQ
  3. The compiled NSCLDAQ for the corresponding OS.

install singularity

  • add neuro debain repository (when the following command fail, go to [1]
~>wget -O- http://neuro.debian.net/lists/focal.us-tn.libre | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
~>sudo apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9
  • update the repository
~>sudo apt update
  • install singularity
~>sudo apt install signularity-container

Download the OS image

Like any Virtual Machine, we need an OS for it to run. NSCL DAQ works on Debian 8 or 10.

/usr/opt>singularity build nscl-buster.img docker://fribdaq/frib-buster:XXX

/usr/opt>singularity build nscl-jessie.img docker://fribdaq/frib-jessie:XXX

where XXX is the version, please check Jessie here and Buster here

to test the singularity is working

anywhere>singularity shell /usr/opt/nscl-jessie.img

you will bring to the singularity interactive shell

Singularity: Invoking an interactive shell within container...

Singularity nscl-jessie.img:~>

We can check the OS by

Singularity nscl-jessie.img:~>lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 8.11 (jessie)
Release:	8.11
Codename:	jessie

That means we have a running jessie.

Download the compiled NSCLDAQ

The last thing we need is a per-compiled NSCLDAQ

Link to download Debian 8 Jessie

Link to download Debian 10 buster

And decompress it into /usr/opt/ -> so that the path is /usr/opt/opt-jessie

To run NSCL DAQ

Singularity allows user to "mount" the host system directory by using --bind option.

In the following, we will bind the /usr/opt/opt-jessie to /usr/opt/, which is in the VM

~>singularity shell --bind /usr/opt/opt-jessie:/usr/opt /usr/opt/nscl-jessie.img

after entered the shell, we check

Singularity nscl-jessie.img:~> ls /usr/opt/
caendigitizerlibs		epics		iseg			  plx
caenhv-5.22			epicstcl	iseg-beta		  PLX7
caenhv-5.82			geco		JESSIE			  root
cmake				genx		mesycontrol-1.0.4-x86_64  spectcl
daq				GET		mpi			  xiaapi
ddas				gretina		mpitcl
ddastoys			gretinaglom	nscldaq
ddastoys.saved			gsl		NSCLGET

With that, we can use the exec option to run the DAQ without going into the VM or singularity shell.

The NSCLDAQ runs on two major components

  1. DaqPortManager
  2. RingMaster

It is more easy to have a bash script to do it for us.

#!/bin/bash

export USROPT=/usr/opt/opt-jessie/
export SINGULARITY_CONTAINER=/usr/opt/nscl-jessie.img
export DAQPORTMANAGER=/usr/opt/daq/11.3-023/bin/DaqPortManager
export DAQPORTMANAGERLOGFILE=$HOME/daq.log
export DAQPORTMANAGERPIDFILE=$HOME/daq.pid
export RINGMASTER=/usr/opt/daq/11.3-023/bin/RingMaster
export RINGMASTERLOGFILE=$HOME/ring.log

nohup singularity exec --bind ${USROPT}:/usr/opt ${SINGULARITY_CONTAINER} ${DAQPORTMANAGER} -log ${DAQPORTMANAGERLOGFILE} -pidfile ${DAQPORTMANAGERPIDFILE} </dev/null >/dev/null 2>&1 &
echo $! > nscl_pid.txt

nohup singularity exec --bind ${USROPT}:/usr/opt ${SINGULARITY_CONTAINER} ${RINGMASTER} -f ${RINGMASTERLOGFILE} </dev/null >/dev/null 2>&1 &
echo $! >> nscl_pid.txt

echo "============= here are the PID for the DaqPortManager and RingMaster"
cat nscl_pid.txt

#singularity exec --bind ${USROPT}:/usr/opt ${SINGULARITY_CONTAINER} ${DAQPORTMANAGER} -log ${DAQPORTMANAGERLOGFILE} -pidfile ${DAQPORTMANAGERPIDFILE}
#singularity shell --bind ${USROPT}:/usr/opt/ ${SINGULARITY_CONTAINER} 

I saved this bash script as ~/start_nscldaq.sh

To run it, we need sudo, otherwise, the DaqPortManager compiles that it does not have permission to /var/tmp/daqportmgr/listen.port

We can check the DaqPortManager and RingMaster are running by

ps -ef | grep -E 'Daq*|Ring*'