-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6431 from isidorostsa/include_stdexec
Integrate NVIDIA's S/R implementation into HPX
- Loading branch information
Showing
118 changed files
with
6,143 additions
and
1,019 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (c) 2024 Isidoros Tsaousis-Seiras | ||
# | ||
# 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 STDEXEC::stdexec) | ||
if(STDEXEC_ROOT AND NOT Stdexec_ROOT) | ||
set(Stdexec_ROOT | ||
${STDEXEC_ROOT} | ||
CACHE PATH "stdexec base directory" | ||
) | ||
unset(STDEXEC_ROOT CACHE) | ||
endif() | ||
|
||
find_path(Stdexec_INCLUDE_DIR stdexec HINTS ${Stdexec_ROOT}) | ||
message(STATUS "stdexec include dir: ${Stdexec_INCLUDE_DIR}") | ||
if(Stdexec_INCLUDE_DIR) | ||
file(TO_CMAKE_PATH ${Stdexec_INCLUDE_DIR} Stdexec_INCLUDE_DIR) | ||
else() | ||
message(FATAL_ERROR "stdexec not found") | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
Stdexec | ||
REQUIRED_VARS Stdexec_INCLUDE_DIR | ||
FOUND_VAR Stdexec_FOUND | ||
VERSION_VAR Stdexec_VERSION | ||
FAIL_MESSAGE "stdexec not found" | ||
) | ||
|
||
add_library(STDEXEC::stdexec INTERFACE IMPORTED) | ||
target_include_directories( | ||
STDEXEC::stdexec SYSTEM INTERFACE ${Stdexec_INCLUDE_DIR} | ||
) | ||
|
||
mark_as_advanced(Stdexec_INCLUDE_DIR Stdexec_ROOT) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Copyright (c) 2024 Isidoros Tsaousis-Seiras | ||
# | ||
# 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_STDEXEC) | ||
if(HPX_WITH_CXX_STANDARD LESS 20) | ||
hpx_error("HPX_WITH_STDEXEC Requires C++20 or later.") | ||
endif() | ||
if(NOT HPX_WITH_CXX20_STD_IDENTITY) | ||
hpx_error("HPX_WITH_STDEXEC Requires std::identity.") | ||
endif() | ||
if(MSVC) | ||
hpx_error("HPX_WITH_STDEXEC is not available on MSVC.") | ||
endif() | ||
endif() | ||
|
||
if(STDEXEC_ROOT AND NOT Stdexec_ROOT) | ||
set(Stdexec_ROOT ${STDEXEC_ROOT}) | ||
# remove STDEXEC_ROOT from the cache | ||
unset(STDEXEC_ROOT CACHE) | ||
endif() | ||
|
||
if(HPX_WITH_STDEXEC) | ||
# prefer HPX_WITH_FETCH_STDEXEC by default | ||
if(Stdexec_ROOT AND HPX_WITH_FETCH_STDEXEC) | ||
hpx_warn( | ||
"Both Stdexec_ROOT and HPX_WITH_FETCH_STDEXEC are provided. HPX_WITH_FETCH_STDEXEC will take precedence." | ||
) | ||
endif() | ||
|
||
hpx_add_config_define(HPX_HAVE_STDEXEC) | ||
|
||
if(HPX_WITH_FETCH_STDEXEC) | ||
hpx_info( | ||
"HPX_WITH_FETCH_STDEXEC=${HPX_WITH_FETCH_STDEXEC}, Stdexec will be fetched using CMake's FetchContent and installed alongside HPX (HPX_WITH_STDEXEC_TAG=${HPX_WITH_STDEXEC_TAG})" | ||
) | ||
if(UNIX) | ||
include(FetchContent) | ||
fetchcontent_declare( | ||
Stdexec | ||
GIT_REPOSITORY https://github.com/NVIDIA/stdexec.git | ||
GIT_TAG ${HPX_WITH_STDEXEC_TAG} | ||
) | ||
|
||
fetchcontent_getproperties(Stdexec) | ||
if(NOT Stdexec_POPULATED) | ||
fetchcontent_populate(Stdexec) | ||
endif() | ||
set(Stdexec_ROOT ${stdexec_SOURCE_DIR}) | ||
|
||
add_library(Stdexec INTERFACE) | ||
target_include_directories( | ||
Stdexec INTERFACE $<BUILD_INTERFACE:${stdexec_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
) | ||
|
||
install( | ||
TARGETS Stdexec | ||
EXPORT HPXStdexecTarget | ||
COMPONENT core | ||
) | ||
|
||
install( | ||
DIRECTORY ${Stdexec_ROOT}/include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
COMPONENT core | ||
FILES_MATCHING | ||
PATTERN "*.hpp" | ||
) | ||
|
||
export( | ||
TARGETS Stdexec | ||
NAMESPACE Stdexec:: | ||
FILE "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/HPXStdexecTarget.cmake" | ||
) | ||
|
||
install( | ||
EXPORT HPXStdexecTarget | ||
NAMESPACE Stdexec:: | ||
FILE HPXStdexecTarget.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME} | ||
COMPONENT cmake | ||
) | ||
|
||
# TODO: Enforce a single spelling | ||
add_library(Stdexec::Stdexec ALIAS Stdexec) | ||
add_library(STDEXEC::stdexec ALIAS Stdexec) | ||
|
||
endif() | ||
|
||
else() | ||
find_package(Stdexec REQUIRED) | ||
|
||
if(Stdexec_FOUND) | ||
hpx_add_config_define(HPX_HAVE_STDEXEC) | ||
else() | ||
hpx_error( | ||
"Stdexec could not be found, please specify Stdexec_ROOT to point to the correct location or enable HPX_WITH_FETCH_STDEXEC" | ||
) | ||
endif() | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) 2024 Isidoros Tsaousis-Seiras | ||
// | ||
// 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) | ||
|
||
// test for availability of std::identity | ||
|
||
#include <functional> | ||
|
||
int main() | ||
{ | ||
auto f = std::identity{}(3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.