Merge branch '7.0.0.rc' into developer

This commit is contained in:
maliakal_d 2022-12-13 09:58:55 +01:00
commit 1340408c2d
35 changed files with 243 additions and 90 deletions

View File

@ -1,4 +1,4 @@
SLS Detector Package Minor Release 7.0.0.rc1 released on xx.11.2021
SLS Detector Package Minor Release 7.0.0.rc1 released on 12.12.2021
===================================================================
This document describes the differences between v7.0.0.rc1 and v6.1.2
@ -22,10 +22,6 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
@Erik:- adding LTO to test and disable them for Debug builds?
@Erik:- support external build of python lib,
1. New or Changed Features
==========================
@ -42,7 +38,6 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
Option to provide a custom location to look for ZeroMQ, if not found
using FindZeroMQ.cmake
For example, to use the system installed zmq:
Using cmake: -DZeroMQ_HINT=/usr/lib64
Using cmk.sh script: -q /usr/lib64
@ -441,6 +436,11 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
Changes or Fixes:
* [Jungfrau][Gotthard2][Mythen3][Gotthard][Moench][Ctb] Can't stop
This bug was introduced in 6.1.1, when stopping an acquisition saying it
cannot stop, even though it was successful. It is fixed now.
* Free and config command fail
Free and config command checked mismatch of size of shared memory before
freeing or loading new config. Fixed.

View File

@ -21,4 +21,4 @@ echo "Building using: ${NCORES} cores"
cmake --build . -- -j${NCORES}
cmake --build . --target install
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 1

View File

@ -1,9 +1,8 @@
python:
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11
numpy:
- 1.17

View File

@ -17,8 +17,7 @@ requirements:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- cmake
- qwt 6.*
- qt 4.8.*
- qt 5.*
- zeromq
- xorg-libx11
- xorg-libice
@ -111,12 +110,10 @@ outputs:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- {{ pin_subpackage('slsdetlib', exact=True) }}
- qwt 6.*
run:
- {{ pin_subpackage('slsdetlib', exact=True) }}
- qwt 6.*
- qt 4.8.*
- qt 5.*
- expat
- name: moenchzmq

View File

@ -55,7 +55,13 @@ We have three different packages available:
.. code-block:: bash
#List available versions
# lib and binaries
conda search slsdetlib
# python
conda search slsdet
# gui
conda search slsdetgui
@ -133,7 +139,7 @@ Example cmake options Comment
=============================== ===========================================
-DSLS_USE_PYTHON=ON Python
-DPython_FIND_VIRTUALENV=ONLY Python from only the conda environment
-DZeroMQ_HINT=/usr/lib64 System zmq instead of conda
-DZeroMQ_HINT=/usr/lib64 Use system zmq instead
-DSLS_USE_GUI=ON GUI
=============================== ===========================================
@ -181,7 +187,7 @@ Build using in-built cmk.sh script
# new build, python and compile in parallel:
./cmk.sh -bpj5
#To use the system zmq (/usr/lib64) instead of conda
#To use the system zmq (/usr/lib64) instead
./cmk.sh -bj5 -q /usr/lib64
@ -206,6 +212,54 @@ using this compiler
Build slsDetectorGui (Qt5)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1. Using pre-built binary on conda
.. code-block:: bash
conda create -n myenv slsdetgui=7.0.0
conda activate myenv
2. Using system installation on RHEL7
.. code-block:: bash
yum install qt5-qtbase-devel.x86_64
yum install qt5-qtsvg-devel.x86_64
3. Using conda
.. code-block:: bash
#Add channels for dependencies and our library
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda config --set channel_priority strict
# create environment to compile
# on rhel7
conda create -n slsgui zeromq gxx_linux-64 gxx_linux-64 mesa-libgl-devel-cos6-x86_64 qt
# on fedora or newer systems
conda create -n slsgui zeromq qt
# when using conda compilers, would also need libgl, but no need for it on fedora unless maybe using it with ROOT
# activate environment
conda activate slsgui
# compile with cmake outside slsDetecorPackage folder
mkdir build && cd build
cmake ../slsDetectorPackage -DSLS_USE_GUI=ON
make -j12
# or compile with cmk.sh
cd slsDetectorPackage
./cmk.sh -cbgj9
Build this documentation
^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -66,11 +66,15 @@ For a Single Module
# sets destination udp ports (not needed, default is 50001)
udp_dstport 50012
# 1g data out
# source udp ips must be same subnet at destintaion udp ips
udp_srcip 192.168.1.112
# udp_srcip 192.168.1.112
# destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto
# udp_dstip auto
# 10g data out
udp_srcip 10.30.20.200
udp_dstip 10.30.20.6
# set file path
fpath /tmp

View File

@ -8,21 +8,24 @@ open an issue at our `github repo issues
Common
------
Missing Packets
^^^^^^^^^^^^^^^
Possible causes could be the following:
#. Receiver PC is not tuned for socket buffer size and input packet queue.
* Refer to :ref:`Increase rmem_default, rmem_max and max_backlog<Receiver PC Tuning>`
1. Total Failure of Packet Delivery
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Wiring
* Faulty wiring or connecting cable to incorrect interface.
#. Data cable plugged into the wrong interface on board (Jungfrau)
* Please ensure that the data cable is plugged into the rightmost interface (default for single interface). The inner one is disabled for PCB v1.0 and must be selected via command for PCB v2.0.
#. Link up and speed
* Check to see if there is a blue LED on board to signal that the link is up. Check ethtool and find if Link Deteced:Yes and Speed is acceptable (>10k).
* Check ethtool and find if Link Deteced:Yes and Speed is acceptable (>10k).
* Check to see if the 10G link is up (blue or red LED on board, close to SFP+). If not:
* Check transeiver and fibers are compatible (all MMF 850nm or all SMF 1030nm)
* Check fiber
* Check fiber polarity (if short range, unplug the link anywhere, and look at the light/dark pattern: dark has to mate with light)
#. Detector is not acquiring (Not Eiger)
* Take an acquisition with many images and using the following steps instead of acquire:
.. code-block:: bash
sls_detector_put status start
@ -30,37 +33,63 @@ Possible causes could be the following:
# which means the detector is acquiring.
sls_detector_get framesl
.. note ::
If you are using multiple modules, the previous command can return -1 because each module will return different values. Then, check for a single module instead: sls_detector_get 0:framesl
# If you are using multiple modules, the previous command can return -1 because each module will return different values. Then, check for a single module instead: sls_detector_get 0:framesl
#. Data cable plugged into the wrong interface on board (Jungfrau)
* Please ensure that the data cable is plugged into the rightmost interface. The middle one is disabled for PCB v1.0 and must be selected via command for PCB v2.0.
#. Detector is not sending data
* Check the board to see if the green LED is blinking next to the data cable, which means that the detector is sending data.
#. Detector is not sending data (Except Eiger)
* Check the board to see if the green LED close to SFP is blinking (detector is sending data). If not, detector is not operated properly (period too short/long, no trigger in trigger mode) or misconfigured and needs reboot.
#. Firewall or security feature
* A firewall or some security feature could be blocking the reception of data.
#. Ethernet interface not configured properly
* Ensure that the interfaces used are configured properly with the right mask and ip. Eg. use ifconfig and route commands to verify.
#. Power supply
* Check if power supply has enough current.
* For Jungfrau, refer to :ref:`Jungfrau Power Supply Troubleshooting<Jungfrau Troubleshooting Power Supply>`.
#. Ethernet interface not configured for Jumbo frames (10Gb)
* Ensure that the interfaces used in receiver pc have MTU 9000 (jumbo frames) enabled.
* Ensure that the interfaces (on NIC and the switch) used in receiver pc have MTU 9000 (jumbo frames) enabled.
#. Detector IP (Not Eiger)
* Ensure it is valid and does not end if 0 or 255. Also ensure that the detector ip is in the same subnet as rx_udpip and the masking in the interface configuration ensures this rule.
#. Tcpdump or wireshark
#. Check if 'rx_frames' counter in 'ifconfig' do not increment for interface.
* If no, check switch configuration if present. Port counters of switch can also help to identify problem.
* If yes, but receiver software does not see it:
* Check no firewall (eg. firewalld) is present or add rules
* Check that selinux is disabled ( or add rules)
#. Source UDP IP in config file (Not Eiger)
* Ensure it is valid and does not end if 0 or 255. Also ensure that the source ip 'udp_srcip' is in the same subnet as destination ip 'udp_dstip' and the masking in the interface configuration ensures this rule.
* Eg. If interface IP is 102.10.10.110 and mask is 255.255.255.0, udp_srcip has to be 102.10.10.xxx (same subnet)
* Use ifconfig and route commands to verify etheret interface configuration
#. Netstat and netcat
* Try with netstat to see if its really listening to the right interface. Or netcat to see if you get packets.
#. Wireshark or Tcpdump
* Use one of these to confirm that you receive packets (with the right filtering ie. source and destination ports, ip).
#. Check SFP modules
* Check if the SFP modules on both sides of the fiber are of same type.
2. Partial or Random Packet Loss (Performance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note ::
The following suggestions are for convenience. Please do not follow blindly, research each parameter and adapt it to your system.
#. Receiver PC is not tuned for socket buffer size and input packet queue or other parameters.
* Refer to :ref:`Receiver PC Tuning<Receiver PC Tuning>`
#. Wiring
* Faulty wiring or connecting cable to incorrect interface.
#. Pinging the subnet (receiving only a few number of packets each time)
* If a switch is used between a receiver pc and detector instead of plugging the cables directly, one might have to ping any ip in the subnet of the Ethernet interface constantly so that it does not forget the ip during operation.
* Eg. if rx_udpip is 10.2.3.100, then ping constantly 10.2.3.xxx, where xxx is any ip other than 100.
* Using slsReceiver, you can use a command that does this for you:
.. code-block:: bash
# arping the interface in a separate thread every minute
sls_detector_put rx_arping 1
@ -68,6 +97,12 @@ Possible causes could be the following:
Receiver PC Tuning Options
^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note ::
| xth1 is example interface name in the following examples.
| These settings are lost at pc reboot.
#. Increase maximum receive socket buffer size and socket input packet queue.
* Temporarily (until shut down)
.. code-block:: bash
@ -111,6 +146,7 @@ Receiver PC Tuning Options
# check how many GB memory you can allocate, to avoid swapping otherwise
#. Modify ethtool settings.
* rx ring parameters
.. code-block:: bash
@ -127,6 +163,9 @@ Receiver PC Tuning Options
# check
ethtool -c xth1
# enable adaptive xoalescence parameters
ethtool -C xth1 adaptive-rx on
# set to max value in your pc settings
ethtool -C xth1 rx-usecs 100
@ -138,13 +177,18 @@ Receiver PC Tuning Options
# set to max value in your pc settings
ethtool -A xth1 rx on
.. note ::
* generic receiver offload (might not always work)
.. code-block:: bash
| xth1 is example interface name.
| These settings are lost at pc reboot.
# check
ethtool -k xth1
#. Disable CPU frequency scaling and set system to performance
# enable generic receiver offload
ethtool -K xth1 gro
#. Disable power saving in CPU frequency scaling and set system to performance
* Check current policy (default might be powersave or schedutil)
.. code-block:: bash
@ -159,7 +203,10 @@ Receiver PC Tuning Options
# set to performance
sudo cpupower frequency-set -g performance
# or
cpufreq-info
for i in seq 0 7; do cpufreq-set -c $i -g performance; done
* Permanently
.. code-block:: bash
@ -179,18 +226,29 @@ Receiver PC Tuning Options
This is also set if slsReceiver is run as root user.
#. Some more advanced options:
.. warning ::
#. Disable power saving in CPU frequency
.. code-block:: bash
Please do not try if you do not understand
# or similar command depending on your distribution
cpupower frequency-info
cpupower frequency-set -g performance
#. reduce the number of queue per NIC to the number of expected streams: ethtool -L xth0 combined 2
#. assign each queue to its stream: ethtool -U xth0 flow-type tcp4 dst-port 50004 action 1
#. assign to each queue (IRQ) one CPU on the right socket: echo "3"> /proc/irq/47/smp_affinity_list #change the numbers looking at /proc/interrupts
#. disable irqbalance service
#. Be sure that the switch knows the receiver mac address. Most switches reset the mac lists every few minutes, and since the receiver only receives, there is not a periodic refresh of the mac list. In this case, one can set a fixed mac list in the switch, or setup some kind of script arping or pinging out from that interface (will be available in 7.0.0).
#. assign the receiver numa node (also with -m) to the socket where the NIC is attached. To know it, cat /sys/class/net/ethxxx/device/numa_node
#. ensure file system performance can handle sustained high data rate:
* One can use dd:
# or
cpufreq-info
for i in seq 0 7; do cpufreq-set -c $i -g performance; done
.. code-block:: bash
dd if=/dev/zero of=/testpath/testfile bs=1M count=100000
* Or better fio (which needs to be installed)
.. code-block:: bash
fio --name=global directory=/testpath/ --rw=write --ioengine=libaio --direct=0 --size=200G -- numjobs=2 --iodepth=1 --bs=1M name=job
slsReceiver Tuning
^^^^^^^^^^^^^^^^^^
@ -198,18 +256,25 @@ slsReceiver Tuning
#. Starting receiver as root to have scheduling privileges.
#. For 10g, enable flow control
.. code-block:: bash
sls_detector_put flowcontrol10g 1
#. Increase slsReceiver fifo depth between listening and processing threads.
#. Increase slsReceiver ring buffer depth
This can be tuned depending on the number of receivers (modules) and memory available.
.. code-block:: bash
sls_detector_get rx_fifodepth
# sets number of frames in fifo to 5000
sls_detector_put rx_fifodepth 5000
# sugggested not to use more than half memory of CPU socket in case of NUMA systems) for this
sls_detector_get rx_fifodepth
# sets number of frames in fifo to 1024 ~1GB per receiver. Default is 2500
sls_detector_put rx_fifodepth 1024
#. Increase number of frames per file
This can reduce time taken to open and close files.
#. Increase number of frames per file to reduce time taken to open and close files.
.. code-block:: bash
sls_detector_get rx_framesperfile
@ -217,10 +282,31 @@ slsReceiver Tuning
# writes all frames into a single file
sls_detector_put rx_framesperfile 0
#. Disable file write
This can ensure it is not the file system performance hampering high date rate.
.. code-block:: bash
sls_detector_put fwrite 0
Shared memory error
^^^^^^^^^^^^^^^^^^^
| For errors due to access or size, delete shared memory files nd try again.
For errors due to access or size, use any of the following suggestions.
#. Delete shared memory files and try again
#. Use environment variable to use a different shared memory ending in jfxx
.. code-block:: bash
# shared memory ending in jfxx
export SLSDETNAME=jfxx
#. USe a different multi shared memory ID
.. code-block:: bash
sls_detector_put 2-config xxxx.config
# or
sls_detector_put 2-hostname bchipxxx
To list all shared memory files of sls detector package.
.. code-block:: bash
@ -331,6 +417,7 @@ Cannot get multi module data
#. Check :ref:`Common Multi Module Troubleshooting<common troubleshooting multi module data>`
#. Power Supply
* Jungfrau needs a ~4A per module for a short time at startup. If not, it reboots misconfigured.
* Comment out this line in the config file: powerchip 1
* Powering on the chip increases the power consumption by a considerable amount. If commenting out this line aids in getting data (strange data due to powered off chip), then it could be the power supply current limit. Fix it (possibly to 8A current limit) and uncomment the powerchip line back in config file.

View File

@ -5,7 +5,7 @@ detsize 1024 1024
hostname bchip048+bchip052+
# 1Gb receiver pc hostname (default tcpport: 1954)
rx_hostname pcmoench01+pcmoench01:1955
rx_hostname pcmoench01:1954+pcmoench01:1955+

View File

@ -7,7 +7,7 @@ Build upon the pybind11 example found here: https://github.com/pybind/python_exa
import os
import sys
sys.path.append('../libs/pybind11')
sys.path.append('../libs/pybind')
from setuptools import setup, find_packages
from pybind11.setup_helpers import Pybind11Extension, build_ext
@ -22,19 +22,25 @@ def get_conda_path():
return os.environ['CONDA_PREFIX']
#TODO migrate to CMake build?
#TODO migrate to CMake build or fetch files from cmake?
ext_modules = [
Pybind11Extension(
'_slsdet',
['src/main.cpp',
'src/current.cpp',
'src/enums.cpp',
'src/current.cpp',
'src/detector.cpp',
'src/network.cpp',
'src/pattern.cpp',
'src/scan.cpp',],
'src/scan.cpp',
'src/duration.cpp',
'src/DurationWrapper.cpp',
]
,
include_dirs=[
os.path.join('../libs/pybind11/include'),
os.path.join('../libs/pybind/include'),
os.path.join(get_conda_path(), 'include'),
],

View File

@ -1 +0,0 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv7.0.0.rc1

View File

@ -1 +0,0 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv7.0.0.rc1

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv6.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv7.0.0.rc1

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv6.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv7.0.0.rc1

View File

@ -1 +0,0 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv6.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv7.0.0.rc1

View File

@ -1 +0,0 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv7.0.0.rc1

View File

@ -1 +0,0 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv6.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.0.rc1

View File

@ -87,7 +87,8 @@ int updateModeAllowedFunction(int file_des) {
F_PROGRAM_FPGA, F_RESET_FPGA, F_INITIAL_CHECKS,
F_REBOOT_CONTROLLER, F_GET_KERNEL_VERSION, F_UPDATE_KERNEL,
F_UPDATE_DETECTOR_SERVER, F_GET_UPDATE_MODE, F_SET_UPDATE_MODE,
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE};
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE,
F_GET_HARDWARE_VERSION};
size_t allowedFuncsSize = sizeof(allowedFuncs) / sizeof(enum detFuncs);
for (unsigned int i = 0; i < allowedFuncsSize; ++i) {

View File

@ -826,7 +826,12 @@ void Detector::stopDetector(Positions pos) {
int retries{0};
// avoid default construction of runStatus::IDLE on squash
auto status = getDetectorStatus().squash(defs::runStatus::RUNNING);
while (status != defs::runStatus::IDLE) {
while (status != defs::runStatus::IDLE &&
status != defs::runStatus::STOPPED) {
if (status == defs::runStatus::ERROR) {
throw RuntimeError(
"Could not stop detector. Returned error status.");
}
pimpl->Parallel(&Module::stopAcquisition, pos);
status = getDetectorStatus().squash(defs::runStatus::RUNNING);
++retries;

View File

@ -1,13 +1,13 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */
#define RELEASE "developer"
#define APILIB "developer 0x221108"
#define APIRECEIVER "developer 0x221108"
#define APICTB "developer 0x221207"
#define APIGOTTHARD "developer 0x221207"
#define APIGOTTHARD2 "developer 0x221207"
#define APIJUNGFRAU "developer 0x221207"
#define APIMYTHEN3 "developer 0x221207"
#define APIMOENCH "developer 0x221207"
#define APIEIGER "developer 0x221207"
#define RELEASE "7.0.0.rc1"
#define APILIB "7.0.0.rc1 0x221208"
#define APIRECEIVER "7.0.0.rc1 0x221208"
#define APICTB "7.0.0.rc1 0x221212"
#define APIGOTTHARD "7.0.0.rc1 0x221212"
#define APIGOTTHARD2 "7.0.0.rc1 0x221212"
#define APIJUNGFRAU "7.0.0.rc1 0x221212"
#define APIMYTHEN3 "7.0.0.rc1 0x221212"
#define APIMOENCH "7.0.0.rc1 0x221212"
#define APIEIGER "7.0.0.rc1 0x221212"