Skip to content

[WIP][Do not merge] GenVectorX #18461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/root-ci-config/buildconfig/fedora41.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ builtin_zstd=ON
builtin_zlib=ON
builtin_nlohmannjson=On
builtin_vdt=On
experimental_adaptivecpp=ON
experimental_genvectorx=ON
pythia8=Off
ccache=On
4 changes: 3 additions & 1 deletion .github/workflows/root-ci-config/buildconfig/fedora42.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ builtin_unuran=OFF
builtin_zlib=ON
builtin_zstd=ON
ccache=ON
experimental_adaptivecpp=ON
experimental_genvectorx=ON
pythia8=OFF
unuran=OFF
vdt=OFF
vdt=OFF
2 changes: 2 additions & 0 deletions .github/workflows/root-ci-config/buildconfig/global.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ davix=ON
dcache=OFF
dev=OFF
distcc=OFF
experimental_adaptivecpp=OFF
experimental_genvectorx=OFF
fail-on-missing=On
fcgi=OFF
fftw3=ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ CMAKE_BUILD_TYPE=RelWithDebInfo
pythia8=OFF
cuda=ON
ccache=ON
experimental_adaptivecpp=ON
experimental_genvectorx=ON
tmva=ON
tmva-cpu=ON
tmva-gpu=ON
Expand All @@ -14,4 +16,4 @@ sqlite=OFF
test_distrdf_dask=OFF
test_distrdf_pyspark=OFF
unfold=OFF
webgui=ON
webgui=ON
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
experimental_adaptivecpp=ON
experimental_genvectorx=ON
pythia8=OFF
tmva-sofie=ON
ccache=On
ccache=On
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
experimental_adaptivecpp=ON
experimental_genvectorx=ON
ccache=ON
pythia8=OFF
pythia8=OFF
120 changes: 120 additions & 0 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,126 @@ if (vecgeom)
endif()
endif()

if(experimental_builtin_adaptivecpp)
ROOT_CHECK_CONNECTION_AND_DISABLE_OPTION("experimental_builtin_adaptivecpp")
endif()

#---Check for AdaptiveCpp-------------------------------------------------------------------
if (experimental_adaptivecpp OR experimental_builtin_adaptivecpp)
if (experimental_oneapi)
message(WARNING "Disable OneAPI to load AdaptiveCpp")
set(sycl OFF CACHE BOOL "Disabled because AdaptiveCpp is enabled" FORCE)
else()

if(NOT experimental_builtin_adaptivecpp)
message(STATUS "Looking for AdaptiveCpp")
find_package(AdaptiveCpp)

if(NOT AdaptiveCpp_FOUND)
message(STATUS "AdaptiveCpp not found. Ensure that the installation of AdaptiveCpp is in the CMAKE_PREFIX_PATH")
if(NO_CONNECTION)
set(experimental_builtin_adaptivecpp OFF CACHE BOOL "Disabled because not found and no internet connection" FORCE)
set(sycl OFF CACHE BOOL FORCE)
if(fail-on-missing)
message(FATAL_ERROR "AdaptiveCpp cannot be built.")
endif()
else()
message(STATUS " Switching ON 'experimental_builtin_adaptivecpp' option")
set(experimental_builtin_adaptivecpp ON CACHE BOOL "Enabled because external AdaptiveCpp not found" FORCE)
endif()
endif()
endif()

if(experimental_builtin_adaptivecpp)
# Use ADAPTIVE_CPP_SOURCE_DIR variable if it is defined in the CMake
# configuration
if(NOT DEFINED ADAPTIVE_CPP_SOURCE_DIR)
include(FetchContent)
set(ADAPTIVE_CPP_SOURCE_DIR "${CMAKE_BINARY_DIR}/AdaptiveCpp")
FetchContent_Declare(
AdaptiveCpp
GIT_REPOSITORY https://github.com/devajithvs/AdaptiveCpp.git
GIT_TAG 3fb375fdc84ad0423139e05167739e9e906ca183
)
FetchContent_GetProperties(AdaptiveCpp)
if(NOT AdaptiveCpp_POPULATED)
FetchContent_Populate(AdaptiveCpp)
endif()

set(ADAPTIVE_CPP_SOURCE_DIR "${adaptivecpp_SOURCE_DIR}")
endif()

set(AdaptiveCpp_FOUND True)

list(INSERT CMAKE_MODULE_PATH 0 "${ADAPTIVE_CPP_SOURCE_DIR}/cmake/")

set(ADAPTIVE_CPP_HEADER_BUILD_PATH
"${CMAKE_CURRENT_BINARY_DIR}/include/AdaptiveCpp")
set(ADAPTIVE_CPP_HEADER_INSTALL_PATH
"${CMAKE_INSTALL_PREFIX}/include/AdaptiveCpp")

add_subdirectory(
${ADAPTIVE_CPP_SOURCE_DIR}
${adaptivecpp_BINARY_DIR}
)

set(ACPP_EXPORTS
acpp-common
acpp-rt
acpp-clang-cbs
acpp-clang
llvm-to-backend
llvm-to-host
rt-backend-omp)

if(WITH_CUDA_BACKEND)
list(APPEND ACPP_EXPORTS llvm-to-ptx rt-backend-cuda)
endif()

if(WITH_OPENCL_BACKEND)
list(APPEND ACPP_EXPORTS llvm-to-spirv rt-backend-ocl ocl-cxx-headers ocl-headers)
endif()

if(WITH_ROCM_BACKEND)
list(APPEND ACPP_EXPORTS llvm-to-amdgpu rt-backend-hip)
endif()
endif()

if (AdaptiveCpp_FOUND)
set(sycl ON)
set(SYCL_COMPILER_FLAGS "-ffast-math ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_BUILD_TYPE_UPPER}}")
message(STATUS "SYCL compiler flags: ${SYCL_COMPILER_FLAGS}")
separate_arguments(SYCL_COMPILER_FLAGS NATIVE_COMMAND ${SYCL_COMPILER_FLAGS})
function(add_sycl_library_to_root_target)
CMAKE_PARSE_ARGUMENTS(ARG "" "TARGET" "SOURCES" ${ARGN})
add_sycl_to_target(TARGET ${ARG_TARGET} SOURCES ${ARG_SOURCES})
target_link_libraries(${ARG_TARGET} INTERFACE AdaptiveCpp::acpp-rt)
target_compile_options(${ARG_TARGET} PUBLIC ${SYCL_COMPILER_FLAGS})
endfunction()
function(add_sycl_library_to_main_root_target)
CMAKE_PARSE_ARGUMENTS(ARG "" "TARGET" "SOURCES" ${ARGN})
add_sycl_to_target(TARGET ${ARG_TARGET} SOURCES ${ARG_SOURCES})
target_link_libraries(${ARG_TARGET} INTERFACE AdaptiveCpp::acpp-rt)
target_compile_options(${ARG_TARGET} PUBLIC ${SYCL_COMPILER_FLAGS})
endfunction()
function(add_sycl_to_root_target)
CMAKE_PARSE_ARGUMENTS(ARG "" "TARGET" "SOURCES" ${ARGN})
add_sycl_to_target(TARGET ${ARG_TARGET} SOURCES ${ARG_SOURCES})
target_link_libraries(${ARG_TARGET} INTERFACE AdaptiveCpp::acpp-rt)
target_compile_options(${ARG_TARGET} PUBLIC ${SYCL_COMPILER_FLAGS})
endfunction()
message(STATUS "AdaptiveCpp sycl enabled")
else()
if(fail-on-missing)
message(FATAL_ERROR "AdaptiveCpp library not found")
else()
message(STATUS "AdaptiveCpp library not found")
set(sycl OFF CACHE BOOL "Disabled because no SYCL implementation is not found" FORCE)
endif()
endif()
endif()
endif()

#---Check for protobuf-------------------------------------------------------------------

if(tmva-sofie)
Expand Down
3 changes: 3 additions & 0 deletions math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ add_subdirectory(smatrix)
add_subdirectory(splot)
#add_subdirectory(mathcore/test EXCLUDE_FROM_ALL)
add_subdirectory(genvector)
if(sycl AND experimental_genvectorx)
add_subdirectory(experimental/genvectorx)
endif()
if(tmva)
add_subdirectory(genetic)
endif()
Expand Down
65 changes: 65 additions & 0 deletions math/experimental/genvectorx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

############################################################################
# CMakeLists.txt file for building ROOT math/genvector package
############################################################################

message(STATUS "Experimental GenVectorX")

ROOT_LINKER_LIBRARY(GenVectorSYCL
src/3DConversions.cxx
src/3DDistances.cxx
src/AxisAngle.cxx
src/AxisAngleXother.cxx
src/BitReproducible.cxx
src/Boost.cxx
src/BoostX.cxx
src/BoostY.cxx
src/BoostZ.cxx
src/EulerAngles.cxx
src/LorentzRotation.cxx
src/Quaternion.cxx
src/QuaternionXaxial.cxx
src/Rotation3D.cxx
src/Rotation3DxAxial.cxx
src/RotationZYX.cxx
src/VectorUtil.cxx
DEPENDENCIES
Core
MathCore
)

add_sycl_library_to_root_target(
TARGET
GenVectorSYCL
SOURCES
src/3DConversions.cxx
src/3DDistances.cxx
src/AxisAngle.cxx
src/AxisAngleXother.cxx
src/BitReproducible.cxx
src/Boost.cxx
src/BoostX.cxx
src/BoostY.cxx
src/BoostZ.cxx
src/EulerAngles.cxx
src/LorentzRotation.cxx
src/Quaternion.cxx
src/QuaternionXaxial.cxx
src/Rotation3D.cxx
src/Rotation3DxAxial.cxx
src/RotationZYX.cxx
src/VectorUtil.cxx
COMPILE_DEFINITIONS
ROOT_MATH_SYCL
)

target_compile_definitions(GenVectorSYCL PUBLIC ROOT_MATH_SYCL)

ROOT_ADD_TEST_SUBDIRECTORY(test)

ROOT_INSTALL_HEADERS()
Loading
Loading