Compare commits

..

7 Commits

Author SHA1 Message Date
12c5844bc9 removed commented out lines 2022-04-28 11:38:07 +02:00
3db8f9957c fixed location of cmake files 2022-04-28 11:32:52 +02:00
6bad9e9f31 build only py 2022-04-28 09:30:54 +02:00
b7153fe3e0 cmake fix 2022-04-27 11:29:04 +02:00
2db2694660 m3 rxr: inconsistent generaldata default (#435)
* inconsistent copy with generalData and implementation members, especially for m3 (non default rxr generic values), issue caught on second configure with non m3 default values, eg tengiga 0

* removing test
2022-04-22 16:02:10 +02:00
e1642cf37c bugfix cmake zeromq 2022-04-19 20:11:31 +02:00
086d22f1a3 Cleaning up the find zmq (#431) 2022-04-19 17:17:31 +02:00
9 changed files with 72 additions and 39 deletions

View File

@ -71,6 +71,7 @@ if(SLS_BUILD_ONLY_MOENCH)
endif() endif()
set(ClangFormat_EXCLUDE_PATTERNS "build/" set(ClangFormat_EXCLUDE_PATTERNS "build/"
"libs/" "libs/"
"slsDetectorCalibration/" "slsDetectorCalibration/"
@ -102,6 +103,7 @@ else()
endif() endif()
#Add two fake libraries to manage options #Add two fake libraries to manage options
add_library(slsProjectOptions INTERFACE) add_library(slsProjectOptions INTERFACE)
add_library(slsProjectWarnings INTERFACE) add_library(slsProjectWarnings INTERFACE)
@ -224,8 +226,6 @@ if (SLS_USE_INTEGRATION_TESTS)
endif (SLS_USE_INTEGRATION_TESTS) endif (SLS_USE_INTEGRATION_TESTS)
if (SLS_USE_PYTHON) if (SLS_USE_PYTHON)
find_package (Python 3.6 COMPONENTS Interpreter Development)
add_subdirectory(libs/pybind11)
add_subdirectory(python) add_subdirectory(python)
endif(SLS_USE_PYTHON) endif(SLS_USE_PYTHON)

View File

@ -66,6 +66,8 @@ This document describes the differences between v7.0.0 and v6.x.x
- registerCallBackRawDataReady and registerCallBackRawDataModifyReady now gives a sls_receiver_header* instead of a char*, and uint32_t to size_t - registerCallBackRawDataReady and registerCallBackRawDataModifyReady now gives a sls_receiver_header* instead of a char*, and uint32_t to size_t
- registerCallBackStartAcquisition gave incorrect imagesize (+120 bytes). corrected. - registerCallBackStartAcquisition gave incorrect imagesize (+120 bytes). corrected.
- registerCallBackStartAcquisition parameter is a const string reference - registerCallBackStartAcquisition parameter is a const string reference
- m3 (runnig config second time with tengiga 0, dr !=32, counters !=0x7) calculated incorrect image size expected
2. Resolved Issues 2. Resolved Issues
================== ==================

View File

@ -6,7 +6,7 @@ function(custom_find_zmq)
message(STATUS "Looking for ZeroMQ in: ${ZeroMQ_HINT}") message(STATUS "Looking for ZeroMQ in: ${ZeroMQ_HINT}")
find_package(ZeroMQ 4 find_package(ZeroMQ 4
NO_DEFAULT_PATH NO_DEFAULT_PATH
HINTS ${ZeroMQ_DIR} HINTS ${ZeroMQ_HINT}
) )
else() else()
find_package(ZeroMQ 4 QUIET) find_package(ZeroMQ 4 QUIET)

View File

@ -4,25 +4,33 @@ find_package(PkgConfig)
pkg_check_modules(PC_LIBZMQ QUIET libzmq) pkg_check_modules(PC_LIBZMQ QUIET libzmq)
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION}) set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
find_library(ZeroMQ_LIBRARY NAMES libzmq.so libzmq.dylib libzmq.dll
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS}) find_path(ZeroMQ_INCLUDE_DIR zmq.h
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq-static.a libzmq.a libzmq.dll.a PATHS ${ZeroMQ_DIR}/include
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS}) ${PC_LIBZMQ_INCLUDE_DIRS}
)
find_library(ZeroMQ_LIBRARY
NAMES zmq
PATHS ${ZeroMQ_DIR}/lib
${PC_LIBZMQ_LIBDIR}
${PC_LIBZMQ_LIBRARY_DIRS}
)
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY) if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
set(ZeroMQ_FOUND ON) set(ZeroMQ_FOUND ON)
message(STATUS "Found libzmq using PkgConfig") message(STATUS "Found libzmq using PkgConfig")
endif() endif()
if (TARGET libzmq) set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
# avoid errors defining targets twice set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )
return()
if (NOT TARGET libzmq)
add_library(libzmq UNKNOWN IMPORTED)
set_target_properties(libzmq PROPERTIES
IMPORTED_LOCATION ${ZeroMQ_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
endif() endif()
add_library(libzmq SHARED IMPORTED) include ( FindPackageHandleStandardArgs )
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS}) find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS )
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})

View File

@ -26,7 +26,7 @@ install(FILES
) )
install(FILES install(FILES
"${CMAKE_SOURCE_DIR}/libzmq-pkg-config/FindZeroMQ.cmake" "${CMAKE_SOURCE_DIR}/cmake/libzmq-pkg-config/FindZeroMQ.cmake"
COMPONENT devel COMPONENT devel
DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config
) )

View File

@ -19,4 +19,4 @@ cp build/install/bin/slsMultiReceiver $PREFIX/bin/.
cp build/install/include/sls/* $PREFIX/include/sls cp build/install/include/sls/* $PREFIX/include/sls
cp -r build/install/share/ $PREFIX/share cp -rv build/install/share $PREFIX

View File

@ -1,6 +1,17 @@
# SPDX-License-Identifier: LGPL-3.0-or-other # SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package # Copyright (C) 2021 Contributors to the SLS Detector Package
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
#if we are only building the python extension
cmake_minimum_required(VERSION 3.12)
project(slsdet)
find_package(slsDetectorPackage 6 REQUIRED)
endif()
find_package (Python 3.6 COMPONENTS Interpreter Development)
add_subdirectory(../libs/pybind11 ${CMAKE_BINARY_DIR}/bin/)
pybind11_add_module(_slsdet pybind11_add_module(_slsdet
src/main.cpp src/main.cpp
src/enums.cpp src/enums.cpp

View File

@ -62,6 +62,7 @@ class GeneralData {
uint32_t adcEnableMaskOneGiga{BIT32_MASK}; uint32_t adcEnableMaskOneGiga{BIT32_MASK};
uint32_t adcEnableMaskTenGiga{BIT32_MASK}; uint32_t adcEnableMaskTenGiga{BIT32_MASK};
slsDetectorDefs::ROI roi{}; slsDetectorDefs::ROI roi{};
uint32_t counterMask{0};
GeneralData(){}; GeneralData(){};
virtual ~GeneralData(){}; virtual ~GeneralData(){};
@ -122,8 +123,8 @@ class GeneralData {
ThrowGenericError("SetNumberofInterfaces"); ThrowGenericError("SetNumberofInterfaces");
}; };
virtual void SetNumberofCounters(const int n) { virtual void SetCounterMask(const int n) {
ThrowGenericError("SetNumberofCounters"); ThrowGenericError("setCounterMask");
}; };
virtual int GetNumberOfAnalogDatabytes() { virtual int GetNumberOfAnalogDatabytes() {
@ -359,13 +360,12 @@ class JungfrauData : public GeneralData {
class Mythen3Data : public GeneralData { class Mythen3Data : public GeneralData {
private: private:
int ncounters; int ncounters{0};
const int NCHAN = 1280; const int NCHAN = 1280;
public: public:
Mythen3Data() { Mythen3Data() {
myDetectorType = slsDetectorDefs::MYTHEN3; myDetectorType = slsDetectorDefs::MYTHEN3;
ncounters = 3;
nPixelsY = 1; nPixelsY = 1;
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header); headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
maxFramesPerFile = MYTHEN3_MAX_FRAMES_PER_FILE; maxFramesPerFile = MYTHEN3_MAX_FRAMES_PER_FILE;
@ -376,6 +376,7 @@ class Mythen3Data : public GeneralData {
defaultUdpSocketBufferSize = (1000 * 1024 * 1024); defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
dynamicRange = 32; dynamicRange = 32;
tengigaEnable = true; tengigaEnable = true;
SetCounterMask(0x7);
UpdateImageSize(); UpdateImageSize();
}; };
@ -389,7 +390,13 @@ class Mythen3Data : public GeneralData {
UpdateImageSize(); UpdateImageSize();
}; };
virtual void SetNumberofCounters(const int n) { virtual void SetCounterMask(const int mask) {
int n = __builtin_popcount(mask);
if (n < 1 || n > 3) {
throw sls::RuntimeError("Invalid number of counters " +
std::to_string(n) + ". Expected 1-3.");
}
counterMask = mask;
ncounters = n; ncounters = n;
UpdateImageSize(); UpdateImageSize();
}; };

View File

@ -153,10 +153,20 @@ void Implementation::setDetectorType(const detectorType d) {
default: default:
break; break;
} }
numUDPInterfaces = generalData->numUDPInterfaces;
fifoDepth = generalData->defaultFifoDepth;
udpSocketBufferSize = generalData->defaultUdpSocketBufferSize;
framesPerFile = generalData->maxFramesPerFile; framesPerFile = generalData->maxFramesPerFile;
fifoDepth = generalData->defaultFifoDepth;
numUDPInterfaces = generalData->numUDPInterfaces;
udpSocketBufferSize = generalData->defaultUdpSocketBufferSize;
dynamicRange = generalData->dynamicRange;
tengigaEnable = generalData->tengigaEnable;
numberOfAnalogSamples = generalData->nAnalogSamples;
numberOfDigitalSamples = generalData->nDigitalSamples;
readoutType = generalData->readoutType;
adcEnableMaskOneGiga = generalData->adcEnableMaskOneGiga;
adcEnableMaskTenGiga = generalData->adcEnableMaskTenGiga;
roi = generalData->roi;
counterMask = generalData->counterMask;
SetLocalNetworkParameters(); SetLocalNetworkParameters();
SetupFifoStructure(); SetupFifoStructure();
@ -523,10 +533,10 @@ void Implementation::startReceiver() {
// callbacks // callbacks
if (startAcquisitionCallBack) { if (startAcquisitionCallBack) {
try { try {
std::size_t imageSize = static_cast<uint32_t>(generalData->imageSize); std::size_t imageSize =
startAcquisitionCallBack( static_cast<uint32_t>(generalData->imageSize);
filePath, fileName, fileIndex, imageSize, startAcquisitionCallBack(filePath, fileName, fileIndex, imageSize,
pStartAcquisition); pStartAcquisition);
} catch (const std::exception &e) { } catch (const std::exception &e) {
throw sls::RuntimeError("Start Acquisition Callback Error: " + throw sls::RuntimeError("Start Acquisition Callback Error: " +
std::string(e.what())); std::string(e.what()));
@ -1395,14 +1405,8 @@ uint32_t Implementation::getCounterMask() const { return counterMask; }
void Implementation::setCounterMask(const uint32_t i) { void Implementation::setCounterMask(const uint32_t i) {
if (counterMask != i) { if (counterMask != i) {
int ncounters = __builtin_popcount(i); generalData->SetCounterMask(i);
if (ncounters < 1 || ncounters > 3) {
throw sls::RuntimeError("Invalid number of counters " +
std::to_string(ncounters) +
". Expected 1-3.");
}
counterMask = i; counterMask = i;
generalData->SetNumberofCounters(ncounters);
SetupFifoStructure(); SetupFifoStructure();
} }
LOG(logINFO) << "Counter mask: " << sls::ToStringHex(counterMask); LOG(logINFO) << "Counter mask: " << sls::ToStringHex(counterMask);
@ -1627,7 +1631,8 @@ void Implementation::setDbitOffset(const int s) { ctbDbitOffset = s; }
* * * *
* ************************************************/ * ************************************************/
void Implementation::registerCallBackStartAcquisition( void Implementation::registerCallBackStartAcquisition(
int (*func)(const std::string &, const std::string &, uint64_t, size_t, void *), int (*func)(const std::string &, const std::string &, uint64_t, size_t,
void *),
void *arg) { void *arg) {
startAcquisitionCallBack = func; startAcquisitionCallBack = func;
pStartAcquisition = arg; pStartAcquisition = arg;