diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 1f3952888ccc6d22666a94688b8366bf059ac2f4..b177933cbbbdad3e43a2797ff775734d13785ee0 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -185,8 +185,11 @@ target_include_directories(Algo ${CMAKE_CURRENT_SOURCE_DIR}/unpack ${CMAKE_CURRENT_SOURCE_DIR}/detectors ${CMAKE_CURRENT_SOURCE_DIR}/qa - ${CMAKE_CURRENT_SOURCE_DIR}/ca ${CMAKE_CURRENT_SOURCE_DIR}/qa/unpack + ${CMAKE_CURRENT_SOURCE_DIR}/kf + ${CMAKE_CURRENT_SOURCE_DIR}/kf/core + ${CMAKE_CURRENT_SOURCE_DIR}/kf/core/utils + ${CMAKE_CURRENT_SOURCE_DIR}/ca ${CMAKE_CURRENT_SOURCE_DIR}/ca/qa ${CMAKE_CURRENT_SOURCE_DIR}/ca/core/data ${CMAKE_CURRENT_SOURCE_DIR} @@ -195,6 +198,7 @@ target_include_directories(Algo target_link_libraries(Algo PUBLIC OnlineData + KfCore CaCore ROOT::GenVector GSL diff --git a/algo/ca/core/CMakeLists.txt b/algo/ca/core/CMakeLists.txt index b255a4bfdb7436a96d8393efbbcd8dd86513603f..b80a507590a8d3c227bc68c092e5d0983779a2f0 100644 --- a/algo/ca/core/CMakeLists.txt +++ b/algo/ca/core/CMakeLists.txt @@ -43,6 +43,7 @@ set(SRCS SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS "-O3") + If(CMAKE_CXX_COMPILER_ID MATCHES "Clang") ADD_DEFINITIONS(-Wall -Wextra -Wsign-promo -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wno-parentheses) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root. Else() @@ -51,19 +52,19 @@ EndIf() add_library(CaCore SHARED ${SRCS}) +list(APPEND HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/utils/CaSimd.h) + target_include_directories(CaCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_CURRENT_SOURCE_DIR}/pars ${CMAKE_CURRENT_SOURCE_DIR}/qa ${CMAKE_CURRENT_SOURCE_DIR}/tracking - ${CMAKE_CURRENT_SOURCE_DIR} ) target_compile_definitions(CaCore PUBLIC NO_ROOT) target_link_libraries(CaCore - KfCore - Vc::Vc + PUBLIC KfCore Boost::serialization OnlineDataLog # needed for the logger external::fles_logging # needed for the logger @@ -74,6 +75,7 @@ target_link_libraries(CaCore install(TARGETS CaCore DESTINATION lib) install(DIRECTORY utils TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY data TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +install(DIRECTORY tracking TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY pars TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install( @@ -113,8 +115,6 @@ install( utils/CaMonitorData.h utils/CaObjectInitController.h utils/CaSimd.h - utils/CaSimdVc.h - utils/CaSimdPseudo.h utils/CaTimer.h utils/CaVector.h utils/CaUtils.h diff --git a/algo/ca/core/utils/CaSimd.h b/algo/ca/core/utils/CaSimd.h index 06f4017fdc1a623ec9ee4bcf61c073110f9f0c58..99ac74afe1b9a93fc770cc9a19f434dd67bdabb6 100644 --- a/algo/ca/core/utils/CaSimd.h +++ b/algo/ca/core/utils/CaSimd.h @@ -4,5 +4,12 @@ #pragma once // include this header only once per compilation unit -#include "CaSimdVc.h" -//#include "CaSimdPseudo.h" +#include "KfSimd.h" + +namespace cbm::algo::ca +{ + // Backward compatebility to ca::fvec etc. + using fvec = kf::fvec; + using fscal = kf::fscal; + using fmask = kf::fmask; +} // namespace cbm::algo::ca diff --git a/algo/kf/core/CMakeLists.txt b/algo/kf/core/CMakeLists.txt index f89e9015c657af292e9f71a91d937c98cfd115b0..18c994e8febecbed659da8ecc40ed1f07da14084 100644 --- a/algo/kf/core/CMakeLists.txt +++ b/algo/kf/core/CMakeLists.txt @@ -14,6 +14,7 @@ set(SRCS SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS "-O3") + If(CMAKE_CXX_COMPILER_ID MATCHES "Clang") ADD_DEFINITIONS(-Wall -Wextra -Wsign-promo -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wno-parentheses) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root. Else() @@ -22,6 +23,8 @@ EndIf() add_library(KfCore SHARED ${SRCS}) +list(APPEND HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/utils/KfSimd.h) + target_include_directories(KfCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_SOURCE_DIR}/pars @@ -32,7 +35,7 @@ target_include_directories(KfCore target_compile_definitions(KfCore PUBLIC NO_ROOT) target_link_libraries(KfCore - Vc::Vc + PUBLIC Vc::Vc Boost::serialization OnlineDataLog # needed for the logger external::fles_logging # needed for the logger @@ -54,6 +57,7 @@ install( pars/KfParameters.h pars/KfSetup.h utils/KfVector.h + utils/KfSimd.h DESTINATION include/ ) diff --git a/algo/kf/core/utils/KfSimd.h b/algo/kf/core/utils/KfSimd.h new file mode 100644 index 0000000000000000000000000000000000000000..1804fc7e8b4127ef62a11db961f7aa9830ad0e3f --- /dev/null +++ b/algo/kf/core/utils/KfSimd.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergei Zharko [committer] */ + +/// \file KfSimd.h +/// \brief Implementation selection for the SIMD utilities (VS or pseudo) +/// \since 30.03.2024 +/// \author Sergey Gorbunov <se.gorbunov@gsi.de> +/// \author Sergei Zharko <s.zharko@gsi.de> + +#pragma once // include this header only once per compilation unit + +#include "KfSimdVc.h" +//#include "KfSimdPseudo.h" diff --git a/algo/ca/core/utils/CaSimdPseudo.h b/algo/kf/core/utils/KfSimdPseudo.h similarity index 98% rename from algo/ca/core/utils/CaSimdPseudo.h rename to algo/kf/core/utils/KfSimdPseudo.h index 557b3da268be5e582ad4ea0b17e7e1c9975c76e6..e6783ab61dc8339457edd5975954a05fd4edb602 100644 --- a/algo/ca/core/utils/CaSimdPseudo.h +++ b/algo/kf/core/utils/KfSimdPseudo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt +/* Copyright (C) 2010-2024 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt SPDX-License-Identifier: GPL-3.0-only Authors: Igor Kulakov [committer] */ @@ -10,7 +10,7 @@ #include <iomanip> #include <iostream> -namespace cbm::algo::ca +namespace cbm::algo::kf { typedef float fscal; @@ -278,4 +278,4 @@ namespace cbm::algo::ca #define _fvecalignment __attribute__((aligned(fvec::size() * sizeof(fscal)))) -} // namespace cbm::algo::ca +} // namespace cbm::algo::kf diff --git a/algo/ca/core/utils/CaSimdVc.h b/algo/kf/core/utils/KfSimdVc.h similarity index 61% rename from algo/ca/core/utils/CaSimdVc.h rename to algo/kf/core/utils/KfSimdVc.h index a254dc65b786437e594e20fa0f0481cf7d0f82bd..6162119184bdbd1edbc67ecdd4083230d0bd16a0 100644 --- a/algo/ca/core/utils/CaSimdVc.h +++ b/algo/kf/core/utils/KfSimdVc.h @@ -1,6 +1,6 @@ -/* Copyright (C) 2010-2014 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt +/* Copyright (C) 2010-2024 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt SPDX-License-Identifier: GPL-3.0-only - Authors: Igor Kulakov [committer], Maksym Zyzak */ + Authors: Igor Kulakov [committer], Maksym Zyzak, Sergei Zharko */ #pragma once // include this header only once per compilation unit @@ -10,7 +10,7 @@ #include <Vc/Vc> -namespace cbm::algo::ca +namespace cbm::algo::kf { typedef Vc::float_v fvec; //typedef Vc::double_v fvec; @@ -21,33 +21,33 @@ namespace cbm::algo::ca typedef fvec::MaskType fmask; #define _fvecalignment __attribute__((aligned(Vc::VectorAlignment))) -} // namespace cbm::algo::ca +} // namespace cbm::algo::kf /// \brief Serializer for SIMD vectors namespace boost::serialization { template<class Archive> - void save(Archive& ar, const cbm::algo::ca::fvec& vect, unsigned int) + void save(Archive& ar, const cbm::algo::kf::fvec& vect, unsigned int) { - std::array<cbm::algo::ca::fscal, cbm::algo::ca::fvec::size()> buffer; - for (size_t i = 0; i < cbm::algo::ca::fvec::size(); ++i) { + std::array<cbm::algo::kf::fscal, cbm::algo::kf::fvec::size()> buffer; + for (size_t i = 0; i < cbm::algo::kf::fvec::size(); ++i) { buffer[i] = vect[i]; } ar << buffer; } template<class Archive> - void load(Archive& ar, cbm::algo::ca::fvec& vect, unsigned int) + void load(Archive& ar, cbm::algo::kf::fvec& vect, unsigned int) { - std::array<cbm::algo::ca::fscal, cbm::algo::ca::fvec::size()> buffer; + std::array<cbm::algo::kf::fscal, cbm::algo::kf::fvec::size()> buffer; ar >> buffer; - for (size_t i = 0; i < cbm::algo::ca::fvec::size(); ++i) { + for (size_t i = 0; i < cbm::algo::kf::fvec::size(); ++i) { vect[i] = buffer[i]; } } template<class Archive> - void serialize(Archive& ar, cbm::algo::ca::fvec& vect, const unsigned int version) + void serialize(Archive& ar, cbm::algo::kf::fvec& vect, const unsigned int version) { split_free(ar, vect, version); } diff --git a/reco/littrack/parallel/CMakeLists.txt b/reco/littrack/parallel/CMakeLists.txt index 48d06d4bc17da5859c829593bd9a7570f9324e28..0ea8149dc1407d43579400e9d726bd768fd21d43 100644 --- a/reco/littrack/parallel/CMakeLists.txt +++ b/reco/littrack/parallel/CMakeLists.txt @@ -2,7 +2,8 @@ set(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} - ${CBMROOT_SOURCE_DIR}/algo/ca/core/utils + ${CBMROOT_SOURCE_DIR}/algo/kf/core/utils # For SIMD (TODO: Should be re-worked) + ${CBMROOT_SOURCE_DIR}/algo/ca/core/utils # For SIMD (TODO: Should be re-worked) )