diff --git a/CMakeLists.txt b/CMakeLists.txt
index d09aa4e5830f..b78be6923d36 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -569,33 +569,84 @@ hpx_option(
# ##############################################################################
# HPX datapar configuration
# ##############################################################################
+set(DATAPAR_BACKEND "NONE")
hpx_option(
- HPX_WITH_DATAPAR_VC
- BOOL
- "Enable data parallel algorithm support using the external Vc library (default: OFF)"
- OFF
- ADVANCED
+ HPX_WITH_DATAPAR_BACKEND
+ STRING
+ "Define which vectorization library should be used. Options are: DATAPAR_VC, DATAPAR_EVE, DATAPAR_STD_EXPERIMENTAL_SIMD"
+ ${DATAPAR_BACKEND}
+ STRINGS "DATAPAR_VC;DATAPAR_EVE;DATAPAR_STD_EXPERIMENTAL_SIMD"
)
-if(HPX_WITH_DATAPAR_VC)
+
+# ##############################################################################
+# HPX Vc configuration
+# ##############################################################################
+if ("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "DATAPAR_VC")
hpx_option(
- HPX_WITH_DATAPAR_VC_NO_LIBRARY BOOL
- "Don't link with the Vc static library (default: OFF)" OFF ADVANCED
+ HPX_WITH_DATAPAR_VC
+ BOOL
+ "Enable data parallel algorithm support using the external Vc library (default: ON)"
+ ON
+ ADVANCED
)
+ if(HPX_WITH_DATAPAR_VC)
+ hpx_option(
+ HPX_WITH_DATAPAR_VC_NO_LIBRARY BOOL
+ "Don't link with the Vc static library (default: OFF)" OFF ADVANCED
+ )
+ endif()
+
+ if(HPX_WITH_DATAPAR_VC)
+ hpx_warn(
+ "Vc support is deprecated. This option will be removed in a future release. It will be replaced with SIMD support from the C++ standard library"
+ )
+ include(HPX_SetupVc)
+ hpx_option(
+ HPX_WITH_DATAPAR BOOL
+ "Enable data parallel algorithm support using Vc library (default: ON)" ON ADVANCED
+ )
+ endif()
endif()
-if(HPX_WITH_DATAPAR_VC)
- hpx_warn(
- "Vc support is deprecated. This option will be removed in a future release. It will be replaced with SIMD support from the C++ standard library"
+# ##############################################################################
+# HPX Eve configuration
+# ##############################################################################
+if ("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "DATAPAR_EVE")
+ hpx_option(
+ HPX_WITH_DATAPAR_EVE
+ BOOL
+ "Use Eve as datapar library (default: ON)"
+ ON
+ CATEGORY "Build Targets"
+ ADVANCED
)
- include(HPX_SetupVc)
-endif()
-if(NOT HPX_WITH_DATAPAR_VC)
- hpx_info("No vectorization library configured")
-else()
hpx_option(
- HPX_WITH_DATAPAR BOOL
- "Enable data parallel algorithm support (default: ON)" ON ADVANCED
+ HPX_WITH_FETCH_DATAPAR_EVE
+ BOOL
+ "Use FetchContent to fetch Eve. By default an installed Eve will be used. (default: OFF)"
+ OFF
+ CATEGORY "Build Targets"
+ ADVANCED
)
+ hpx_option(
+ HPX_WITH_DATAPAR_EVE_TAG STRING "Eve repository tag or branch" "develop"
+ CATEGORY "Build Targets"
+ ADVANCED
+ )
+
+ if (HPX_WITH_DATAPAR_EVE)
+ if(HPX_WITH_FETCH_DATAPAR_EVE)
+ include(HPX_SetupEve)
+ else()
+ find_package(Eve)
+ endif()
+ hpx_option(
+ HPX_WITH_DATAPAR BOOL
+ "Enable data parallel algorithm support using Eve library (default: ON)" ON ADVANCED
+ )
+ hpx_add_config_define(HPX_HAVE_DATAPAR_EVE)
+ hpx_add_config_define(HPX_HAVE_DATAPAR)
+ endif()
endif()
# ##############################################################################
@@ -2051,6 +2102,31 @@ if(HPX_ITERATOR_SUPPORT_WITH_BOOST_ITERATOR_TRAVERSAL_TAG_COMPATIBILITY)
)
endif()
+if ("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "DATAPAR_STD_EXPERIMENTAL_SIMD")
+ if (HPX_WITH_CXX20_EXPERIMENTAL_SIMD)
+ hpx_option(
+ HPX_WITH_DATAPAR_STD_EXPERIMENTAL_SIMD
+ BOOL
+ "Use STD_EXPERIMENTAL_SIMD as datapar library (default: ON)"
+ ON
+ CATEGORY "Build Targets"
+ ADVANCED
+ )
+ hpx_option(
+ HPX_WITH_DATAPAR BOOL
+ "Enable data parallel algorithm support using std experimental/simd (default: ON)" ON ADVANCED
+ )
+ hpx_add_config_define(HPX_HAVE_DATAPAR_STD_EXPERIMENTAL_SIMD)
+ hpx_add_config_define(HPX_HAVE_DATAPAR)
+ else()
+ hpx_error("Could not find std experimental/simd. Use CXX COMPILER GCC 11 OR CLANG 12 AND ABOVE ")
+ endif()
+endif()
+
+if (HPX_WITH_DATAPAR)
+ hpx_info("Using datapar backend: ${HPX_WITH_DATAPAR_BACKEND}")
+endif()
+
# ##############################################################################
# Find Our dependencies: These are all dependencies needed to build the core
# library. Dependencies that are only needed by plugins, examples or tests
diff --git a/cmake/FindEve.cmake b/cmake/FindEve.cmake
new file mode 100644
index 000000000000..b6888596abf2
--- /dev/null
+++ b/cmake/FindEve.cmake
@@ -0,0 +1,61 @@
+# Copyright (c) 2022 Srinivas Yadav
+#
+# SPDX-License-Identifier: BSL-1.0
+# Distributed under the Boost Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+if(NOT TARGET Eve::eve)
+ find_path(
+ EVE_INCLUDE_DIR eve/eve.hpp
+ HINTS "${EVE_ROOT}" ENV EVE_ROOT "${HPX_EVE_ROOT}"
+ PATH_SUFFIXES include
+ )
+
+ if(NOT EVE_INCLUDE_DIR)
+ hpx_error(
+ "Could not find Eve. Set EVE_ROOT as a CMake or environment variable to point to the Eve root install directory. Alternatively, set HPX_WITH_FETCH_DATAPAR_EVE=ON to fetch Eve using CMake's FetchContent (when using this option Eve will be installed together with HPX, be careful about conflicts with separately installed versions of Eve)."
+ )
+ endif()
+
+ # Set EVE_ROOT in case the other hints are used
+ if(EVE_ROOT)
+ # The call to file is for compatibility with windows paths
+ file(TO_CMAKE_PATH ${EVE_ROOT} EVE_ROOT)
+ elseif("$ENV{EVE_ROOT}")
+ file(TO_CMAKE_PATH $ENV{EVE_ROOT} EVE_ROOT)
+ else()
+ file(TO_CMAKE_PATH "${EVE_INCLUDE_DIR}" EVE_INCLUDE_DIR)
+ string(REPLACE "/include" "" EVE_ROOT "${EVE_INCLUDE_DIR}")
+ endif()
+
+ if(EVE_INCLUDE_DIR AND EXISTS "${EVE_INCLUDE_DIR}/eve/version.hpp")
+ # Matches a line of the form:
+ #
+ # #define EVE_VERSION "AA.BB.CC.DD"
+ #
+ # with arbitrary whitespace between the tokens
+ file(
+ STRINGS "${EVE_INCLUDE_DIR}/eve/version.hpp" EVE_VERSION_DEFINE_LINE
+ REGEX
+ "#define[ \t]+EVE_LIB_VERSION[ \t]+\"+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\"[ \t]*"
+ )
+ # Extracts the dotted version number in quotation marks as
+ # EVE_VERSION_STRING
+ string(REGEX
+ REPLACE "#define EVE_LIB_VERSION \"([0-9]+\.[0-9]+\.[0-9]+\.[0-9])\""
+ "\\1" EVE_VERSION_STRING "${EVE_VERSION_DEFINE_LINE}"
+ )
+ endif()
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(
+ Eve
+ REQUIRED_VARS EVE_INCLUDE_DIR
+ VERSION_VAR EVE_VERSION_STRING
+ )
+
+ add_library(Eve::eve INTERFACE IMPORTED)
+ target_include_directories(Eve::eve SYSTEM INTERFACE ${EVE_INCLUDE_DIR})
+
+ mark_as_advanced(EVE_ROOT EVE_INCLUDE_DIR EVE_VERSION_STRING)
+endif()
diff --git a/cmake/HPX_PerformCxxFeatureTests.cmake b/cmake/HPX_PerformCxxFeatureTests.cmake
index 4f59372a8b93..55449663f65b 100644
--- a/cmake/HPX_PerformCxxFeatureTests.cmake
+++ b/cmake/HPX_PerformCxxFeatureTests.cmake
@@ -86,7 +86,7 @@ function(hpx_perform_cxx_feature_tests)
hpx_check_for_cxx20_coroutines(DEFINITIONS HPX_HAVE_CXX20_COROUTINES)
hpx_check_for_cxx20_experimental_simd(
- DEFINITIONS HPX_HAVE_CXX20_EXPERIMENTAL_SIMD HPX_HAVE_DATAPAR
+ DEFINITIONS HPX_HAVE_CXX20_EXPERIMENTAL_SIMD
)
hpx_check_for_cxx20_lambda_capture(
diff --git a/cmake/HPX_SetupEve.cmake b/cmake/HPX_SetupEve.cmake
new file mode 100644
index 000000000000..f18d71a527d4
--- /dev/null
+++ b/cmake/HPX_SetupEve.cmake
@@ -0,0 +1,66 @@
+# Copyright (c) 2022 Srinivas Yadav
+#
+# SPDX-License-Identifier: BSL-1.0
+# Distributed under the Boost Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+if(HPX_WITH_FETCH_DATAPAR_EVE)
+ if(FETCHCONTENT_SOURCE_DIR_EVE)
+ hpx_info(
+ "HPX_WITH_FETCH_DATAPAR_EVE=${HPX_WITH_FETCH_DATAPAR_EVE}, EVE will be used through CMake's FetchContent and installed alongside HPX (FETCHCONTENT_SOURCE_DIR_EVE=${FETCHCONTENT_SOURCE_DIR_EVE})"
+ )
+ else()
+ hpx_info(
+ "HPX_WITH_FETCH_DATAPAR_EVE=${HPX_WITH_FETCH_DATAPAR_EVE}, EVE will be fetched using CMake's FetchContent and installed alongside HPX (HPX_WITH_DATAPAR_EVE_TAG=${HPX_WITH_DATAPAR_EVE_TAG})"
+ )
+ endif()
+ include(FetchContent)
+ FetchContent_Declare(
+ eve
+ GIT_REPOSITORY https://github.com/jfalcou/eve.git
+ GIT_TAG ${HPX_WITH_DATAPAR_EVE_TAG}
+ )
+
+ fetchcontent_getproperties(eve)
+ if(NOT eve_POPULATED)
+ fetchcontent_populate(eve)
+ endif()
+ set(EVE_ROOT ${eve_SOURCE_DIR})
+
+ add_library(eve INTERFACE)
+ target_include_directories(
+ eve SYSTEM INTERFACE $
+ $
+ )
+
+ install(
+ TARGETS eve
+ EXPORT HPXEveTarget
+ COMPONENT core
+ )
+
+ install(
+ DIRECTORY ${EVE_ROOT}/include/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT core
+ FILES_MATCHING
+ PATTERN "*.hpp"
+ PATTERN "*.ipp"
+ )
+
+ export(
+ TARGETS eve
+ NAMESPACE Eve::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/HPXEveTarget.cmake"
+ )
+
+ install(
+ EXPORT HPXEveTarget
+ NAMESPACE Eve::
+ FILE HPXEveTarget.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}
+ )
+
+ add_library(Eve::eve ALIAS eve)
+
+endif()
\ No newline at end of file
diff --git a/cmake/templates/HPXConfig.cmake.in b/cmake/templates/HPXConfig.cmake.in
index ffa92f9c1c47..523b7940bbd2 100644
--- a/cmake/templates/HPXConfig.cmake.in
+++ b/cmake/templates/HPXConfig.cmake.in
@@ -41,6 +41,17 @@ else()
endif()
endif()
+# Eve can be installed by HPX or externally installed. In the first case we use
+# exported targets, in the second we find Eve again using find_package.
+if("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "DATAPAR_EVE")
+ if(HPX_WITH_FETCH_DATAPAR_EVE)
+ include("${CMAKE_CURRENT_LIST_DIR}/HPXEveTarget.cmake")
+ else()
+ set(HPX_EVE_ROOT "@EVE_ROOT@")
+ include(HPX_SetupEVE)
+ endif()
+endif()
+
include("${CMAKE_CURRENT_LIST_DIR}/HPXInternalTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/HPXTargets.cmake")
diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
index 071918d4fce1..847aff33ea0b 100644
--- a/libs/CMakeLists.txt
+++ b/libs/CMakeLists.txt
@@ -359,6 +359,10 @@ if(HPX_WITH_DATAPAR_VC)
target_link_libraries(hpx_core PUBLIC Vc::vc)
endif()
+if(HPX_WITH_DATAPAR_EVE)
+ target_link_libraries(hpx_core PUBLIC Eve::eve)
+endif()
+
if(HPX_WITH_ITTNOTIFY)
target_link_libraries(hpx_core PUBLIC Amplifier::amplifier)
endif()
diff --git a/libs/core/algorithms/tests/regressions/CMakeLists.txt b/libs/core/algorithms/tests/regressions/CMakeLists.txt
index 6f12301d2b7f..654703594a23 100644
--- a/libs/core/algorithms/tests/regressions/CMakeLists.txt
+++ b/libs/core/algorithms/tests/regressions/CMakeLists.txt
@@ -24,7 +24,7 @@ set(tests
ranges_facilities
)
-if(HPX_WITH_DATAPAR_VC OR HPX_WITH_CXX20_EXPERIMENTAL_SIMD)
+if(HPX_WITH_DATAPAR)
list(APPEND tests for_each_datapar)
endif()
diff --git a/libs/core/algorithms/tests/unit/CMakeLists.txt b/libs/core/algorithms/tests/unit/CMakeLists.txt
index 3a7e0e611fa9..2a9ea3ec2f8f 100644
--- a/libs/core/algorithms/tests/unit/CMakeLists.txt
+++ b/libs/core/algorithms/tests/unit/CMakeLists.txt
@@ -7,7 +7,7 @@
# add subdirectories
set(subdirs algorithms block container_algorithms)
-if(HPX_WITH_DATAPAR_VC OR HPX_WITH_CXX20_EXPERIMENTAL_SIMD)
+if(HPX_WITH_DATAPAR)
set(subdirs ${subdirs} datapar_algorithms)
endif()
diff --git a/libs/core/algorithms/tests/unit/datapar_algorithms/CMakeLists.txt b/libs/core/algorithms/tests/unit/datapar_algorithms/CMakeLists.txt
index 7976a2e10e45..9cc59a8fa4bb 100644
--- a/libs/core/algorithms/tests/unit/datapar_algorithms/CMakeLists.txt
+++ b/libs/core/algorithms/tests/unit/datapar_algorithms/CMakeLists.txt
@@ -6,7 +6,7 @@
set(tests)
-if(HPX_WITH_DATAPAR_VC OR HPX_WITH_CXX20_EXPERIMENTAL_SIMD)
+if(HPX_WITH_DATAPAR)
set(tests
${tests}
adjacentfind_datapar
diff --git a/tests/performance/local/CMakeLists.txt b/tests/performance/local/CMakeLists.txt
index 5047d9b18728..9566be850d4f 100644
--- a/tests/performance/local/CMakeLists.txt
+++ b/tests/performance/local/CMakeLists.txt
@@ -43,7 +43,7 @@ if(HPX_WITH_LIBCDS)
set(libcds_hazard_pointer_overhead_FLAGS DEPENDENCIES iostreams_component)
endif()
-if(HPX_WITH_CXX20_EXPERIMENTAL_SIMD OR HPX_WITH_DATAPAR_VC)
+if(HPX_WITH_DATAPAR)
list(APPEND benchmarks transform_reduce_binary_scaling)
set(transform_reduce_binary_scaling_FLAGS DEPENDENCIES iostreams_component)
endif()