Skip to content
Merged
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
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ PUBLIC
FILES
${exec_headers}
${stdexec_headers}
include/execpools/thread_pool_base.hpp
# stdexec_version_config.hpp is generated by rapids' script
FILE_SET version_config
TYPE HEADERS
Expand Down Expand Up @@ -273,13 +272,6 @@ target_compile_options(stdexec_executable_flags INTERFACE
-include stdexec/__detail/__force_include.hpp>
)

if (STDEXEC_IS_TOP_LEVEL)
# Integrate with LLVM/clang tooling
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/clangd_compile_info.cmake)
add_executable(_clangd_helper_file include/._clangd_helper_file.cpp)
target_link_libraries(_clangd_helper_file PRIVATE STDEXEC::stdexec)
endif()

# Set up nvexec library
option(STDEXEC_ENABLE_CUDA "Enable CUDA targets for non-nvc++ compilers" OFF)

Expand Down Expand Up @@ -465,6 +457,19 @@ if(STDEXEC_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

if (STDEXEC_IS_TOP_LEVEL)
# Integrate with LLVM/clang tooling
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/clangd_compile_info.cmake)
add_executable(_clangd_helper_file include/._clangd_helper_file.cpp)
target_link_libraries(_clangd_helper_file PRIVATE
STDEXEC::stdexec
$<TARGET_NAME_IF_EXISTS:STDEXEC::asioexec>
$<TARGET_NAME_IF_EXISTS:STDEXEC::tbbexec>
$<TARGET_NAME_IF_EXISTS:STDEXEC::taskflowexec>
$<TARGET_NAME_IF_EXISTS:STDEXEC::nvexec>
)
endif()

##############################################################################
# Install targets ------------------------------------------------------------

Expand Down
101 changes: 33 additions & 68 deletions cmake/Modules/ConfigureASIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,13 @@ if(STDEXEC_ENABLE_ASIO)
message(FATAL_ERROR "Unknown configuration for ASIO implementation: " ${STDEXEC_ASIO_IMPLEMENTATION})
endif()

set(ASIOEXEC_USES_BOOST ${STDEXEC_ASIO_USES_BOOST})
set(ASIOEXEC_USES_STANDALONE ${STDEXEC_ASIO_USES_STANDALONE})
set(STDEXEC_ASIO_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/exec/asio/asio_config.hpp)

set(STDEXEC_ASIO_POOL_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/execpools/asio/asio_config.hpp)
set(ASIOEXEC_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/exec/asio/asio_config.hpp)

configure_file(
include/execpools/asio/asio_config.hpp.in
${STDEXEC_ASIO_POOL_CONFIG_HPP}
)
configure_file(
include/exec/asio/asio_config.hpp.in
${ASIOEXEC_CONFIG_HPP}
${STDEXEC_ASIO_CONFIG_HPP}
)

file(GLOB_RECURSE boost_pool_sources CONFIGURE_DEPENDS include/execpools/asio/*.hpp)
file(GLOB_RECURSE asioexec_sources CONFIGURE_DEPENDS include/exec/asio/*.hpp)

if(${STDEXEC_ASIO_USES_BOOST})
Expand All @@ -41,98 +32,72 @@ if(STDEXEC_ENABLE_ASIO)
OPTIONS "BOOST_SKIP_INSTALL_RULES OFF"
)

add_library(stdexec_boost_pool INTERFACE)
list(APPEND stdexec_export_targets stdexec_boost_pool)
add_library(STDEXEC::asio_pool ALIAS stdexec_boost_pool)
add_library(asioexec INTERFACE)
list(APPEND stdexec_export_targets asioexec)
add_library(STDEXEC::asioexec ALIAS asioexec)

# These aliases are provided for backwards compatibility with the old target names
add_library(asioexec_boost ALIAS asioexec)
add_library(stdexec_boost_pool ALIAS asioexec)
add_library(STDEXEC::asio_pool ALIAS asioexec)
add_library(STDEXEC::asioexec_boost ALIAS asioexec)

target_sources(stdexec_boost_pool PUBLIC
target_sources(asioexec PUBLIC
FILE_SET headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES ${boost_pool_sources}
FILES ${asioexec_sources}
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
FILES ${STDEXEC_ASIO_POOL_CONFIG_HPP}
FILES ${STDEXEC_ASIO_CONFIG_HPP}
)

target_compile_definitions(stdexec_boost_pool INTERFACE STDEXEC_ASIO_USES_BOOST)
target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_BOOST)

target_link_libraries(stdexec_boost_pool INTERFACE
target_link_libraries(asioexec INTERFACE
STDEXEC::stdexec
Boost::asio
)
install(TARGETS stdexec_boost_pool
install(TARGETS asioexec
EXPORT stdexec-exports
FILE_SET headers
)

add_library(asioexec_boost INTERFACE)
list(APPEND stdexec_export_targets asioexec_boost)
add_library(STDEXEC::asioexec_boost ALIAS asioexec_boost)

target_sources(asioexec_boost PUBLIC
FILE_SET headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES ${asioexec_sources}
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
FILES ${ASIOEXEC_CONFIG_HPP}
)

target_compile_definitions(asioexec_boost INTERFACE STDEXEC_ASIO_USES_BOOST)

target_link_libraries(asioexec_boost INTERFACE
STDEXEC::stdexec
Boost::asio
)
install(TARGETS asioexec_boost EXPORT stdexec-exports FILE_SET headers)

elseif(${STDEXEC_ASIO_USES_STANDALONE})
include(cmake/import_standalone_asio.cmake)
import_standalone_asio(
TAG "asio-1-31-0"
VERSION "1.31.0")

add_library(stdexec_asio_pool INTERFACE)
list(APPEND stdexec_export_targets stdexec_asio_pool)
add_library(STDEXEC::asio_pool ALIAS stdexec_asio_pool)
add_library(asioexec INTERFACE)
list(APPEND stdexec_export_targets asioexec)
add_library(STDEXEC::asioexec ALIAS asioexec)

target_sources(stdexec_asio_pool PUBLIC
# These aliases are provided for backwards compatibility with the old target names
add_library(asioexec_asio ALIAS asioexec)
add_library(stdexec_asio_pool ALIAS asioexec)
add_library(STDEXEC::asio_pool ALIAS asioexec)
add_library(STDEXEC::asioexec_asio ALIAS asioexec)

target_sources(asioexec PUBLIC
FILE_SET headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES ${boost_pool_sources}
FILES ${asioexec_sources}
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
FILES ${STDEXEC_ASIO_POOL_CONFIG_HPP}
FILES ${STDEXEC_ASIO_CONFIG_HPP}
)

target_compile_definitions(stdexec_asio_pool INTERFACE STDEXEC_ASIO_USES_STANDALONE)
target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_STANDALONE)

target_link_libraries(stdexec_asio_pool INTERFACE
target_link_libraries(asioexec INTERFACE
STDEXEC::stdexec
asio
)
install(TARGETS stdexec_asio_pool EXPORT stdexec-exports FILE_SET headers)

add_library(asioexec_asio INTERFACE)
list(APPEND stdexec_export_targets asioexec_asio)
add_library(STDEXEC::asioexec_asio ALIAS asioexec_asio)

target_sources(asioexec_asio PUBLIC
install(TARGETS asioexec
EXPORT stdexec-exports
FILE_SET headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES ${asioexec_sources}
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
FILES ${ASIOEXEC_CONFIG_HPP}
)

target_compile_definitions(asioexec_asio INTERFACE STDEXEC_ASIO_USES_STANDALONE)

target_link_libraries(asioexec_asio INTERFACE
STDEXEC::stdexec
asio
)
install(TARGETS asioexec_asio EXPORT stdexec-exports FILE_SET headers)
else()
message(FATAL_ERROR "ASIO implementation is not configured")
endif()
Expand Down
23 changes: 14 additions & 9 deletions cmake/Modules/ConfigureTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,35 @@ endif()
if (STDEXEC_ENABLE_TBB)
# CONFIGURE_DEPENDS ensures that CMake reconfigures when a relevant hpp file is
# added or removed.
file(GLOB_RECURSE tbbpool_headers CONFIGURE_DEPENDS include/execpools/tbb/*.hpp)
add_library(tbbpool INTERFACE)
list(APPEND stdexec_export_targets tbbpool)
add_library(STDEXEC::tbbpool ALIAS tbbpool)
target_sources(tbbpool
file(GLOB_RECURSE tbbexec_headers CONFIGURE_DEPENDS include/exec/tbb/*.hpp)
add_library(tbbexec INTERFACE)
list(APPEND stdexec_export_targets tbbexec)
add_library(STDEXEC::tbbexec ALIAS tbbexec)

# These aliases are provided for backwards compatibility with the old target names
add_library(tbbpool ALIAS tbbexec)
add_library(STDEXEC::tbbpool ALIAS tbbexec)

target_sources(tbbexec
PUBLIC
FILE_SET headers
TYPE HEADERS
BASE_DIRS include
FILES ${tbbpool_headers}
FILES ${tbbexec_headers}
)
target_compile_definitions(tbbpool INTERFACE
target_compile_definitions(tbbexec INTERFACE
STDEXEC_ENABLE_TBB
)

target_link_libraries(stdexec INTERFACE
TBB::tbb
)

target_link_libraries(tbbpool INTERFACE
target_link_libraries(tbbexec INTERFACE
STDEXEC::stdexec
)

install(TARGETS tbbpool
install(TARGETS tbbexec
EXPORT stdexec-exports
FILE_SET headers
)
Expand Down
30 changes: 22 additions & 8 deletions cmake/Modules/ConfigureTaskflow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,29 @@ if(STDEXEC_ENABLE_TASKFLOW)
GIT_TAG v3.7.0
OPTIONS "TF_BUILD_TESTS OFF"
)
file(GLOB_RECURSE taskflow_pool include/execpools/taskflow/*.hpp)
add_library(taskflow_pool INTERFACE ${taskflowexec_sources})
target_compile_definitions(taskflow_pool INTERFACE STDEXEC_ENABLE_TASKFLOW)
list(APPEND stdexec_export_targets taskflow_pool)
add_library(STDEXEC::taskflow_pool ALIAS taskflow_pool)
file(GLOB_RECURSE taskflowexec_headers CONFIGURE_DEPENDS include/exec/taskflow/*.hpp)
add_library(taskflowexec INTERFACE ${taskflowexec_headers})
list(APPEND stdexec_export_targets taskflowexec)
add_library(STDEXEC::taskflowexec ALIAS taskflowexec)

target_link_libraries(taskflow_pool
INTERFACE
STDEXEC::stdexec
# These aliases are provided for backwards compatibility with the old target names
add_library(taskflow_pool ALIAS taskflowexec)
add_library(STDEXEC::taskflow_pool ALIAS taskflowexec)

target_sources(taskflowexec
PUBLIC
FILE_SET headers
TYPE HEADERS
BASE_DIRS include
FILES ${taskflowexec_headers}
)
target_compile_definitions(taskflowexec INTERFACE STDEXEC_ENABLE_TASKFLOW)

target_link_libraries(stdexec INTERFACE
Taskflow
)

target_link_libraries(taskflowexec INTERFACE
STDEXEC::stdexec
)
endif()
10 changes: 5 additions & 5 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ endif()

if (STDEXEC_ENABLE_TBB)
add_executable(example.benchmark.tbb_thread_pool benchmark/tbb_thread_pool.cpp)
target_link_libraries(example.benchmark.tbb_thread_pool PRIVATE STDEXEC::tbbpool)
target_link_libraries(example.benchmark.tbb_thread_pool PRIVATE STDEXEC::tbbexec)

add_executable(example.benchmark.tbb_thread_pool_nested benchmark/tbb_thread_pool_nested.cpp)
target_link_libraries(example.benchmark.tbb_thread_pool_nested PRIVATE STDEXEC::tbbpool)
target_link_libraries(example.benchmark.tbb_thread_pool_nested PRIVATE STDEXEC::tbbexec)

add_executable(example.benchmark.fibonacci benchmark/fibonacci.cpp)
target_link_libraries(example.benchmark.fibonacci PRIVATE STDEXEC::tbbpool)
target_link_libraries(example.benchmark.fibonacci PRIVATE STDEXEC::tbbexec)
endif()

if(STDEXEC_ENABLE_TASKFLOW)
add_executable(example.benchmark.taskflow_thread_pool benchmark/taskflow_thread_pool.cpp)
target_link_libraries(example.benchmark.taskflow_thread_pool PRIVATE STDEXEC::taskflow_pool)
target_link_libraries(example.benchmark.taskflow_thread_pool PRIVATE STDEXEC::taskflowexec)
endif()

if(STDEXEC_ENABLE_ASIO)
add_executable(example.benchmark.asio_thread_pool benchmark/asio_thread_pool.cpp)
target_link_libraries(example.benchmark.asio_thread_pool PRIVATE STDEXEC::asio_pool)
target_link_libraries(example.benchmark.asio_thread_pool PRIVATE STDEXEC::asioexec)
endif()
19 changes: 9 additions & 10 deletions examples/benchmark/asio_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
* limitations under the License.
*/
#include "./common.hpp"
#include <exec/asio/asio_thread_pool.hpp>
#include <exec/start_detached.hpp>
#include <execpools/asio/asio_thread_pool.hpp>

struct RunThread {
void operator()(
execpools::asio_thread_pool& pool,
std::size_t total_scheds,
std::size_t tid,
std::barrier<>& barrier,
void operator()(exec::asio::asio_thread_pool& pool,
std::size_t total_scheds,
std::size_t tid,
std::barrier<>& barrier,
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
std::span<char> buffer,
std::span<char> buffer,
#endif
std::atomic<bool>& stop,
exec::numa_policy numa) {
std::atomic<bool>& stop,
exec::numa_policy numa) {
int numa_node = numa.thread_index_to_node(tid);
numa.bind_to_node(numa_node);
auto scheduler = pool.get_scheduler();
Expand Down Expand Up @@ -83,5 +82,5 @@ struct RunThread {
};

auto main(int argc, char** argv) -> int {
my_main<execpools::asio_thread_pool, RunThread>(argc, argv);
my_main<exec::asio::asio_thread_pool, RunThread>(argc, argv);
}
6 changes: 3 additions & 3 deletions examples/benchmark/fibonacci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <exec/start_detached.hpp>
#include <exec/static_thread_pool.hpp>
#include <execpools/tbb/tbb_thread_pool.hpp>
#include <exec/tbb/tbb_thread_pool.hpp>

#include <exec/any_sender_of.hpp>
#include <stdexec/execution.hpp>
Expand Down Expand Up @@ -102,10 +102,10 @@ auto main(int argc, char** argv) -> int {
return -1;
}

std::variant<execpools::tbb_thread_pool, exec::static_thread_pool> pool;
std::variant<exec::tbb::tbb_thread_pool, exec::static_thread_pool> pool;

if (argv[4] == std::string_view("tbb")) {
pool.emplace<execpools::tbb_thread_pool>(static_cast<int>(std::thread::hardware_concurrency()));
pool.emplace<exec::tbb::tbb_thread_pool>(static_cast<int>(std::thread::hardware_concurrency()));
} else {
pool.emplace<exec::static_thread_pool>(
std::thread::hardware_concurrency(), exec::bwos_params{}, exec::get_numa_policy());
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmark/taskflow_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/
#include "./common.hpp"
#include <exec/start_detached.hpp>
#include <execpools/taskflow/taskflow_thread_pool.hpp>
#include <exec/taskflow/taskflow_thread_pool.hpp>

struct RunThread {
void operator()(
execpools::taskflow_thread_pool& pool,
exec::taskflow::taskflow_thread_pool& pool,
std::size_t total_scheds,
std::size_t tid,
std::barrier<>& barrier,
Expand Down Expand Up @@ -83,5 +83,5 @@ struct RunThread {
};

auto main(int argc, char** argv) -> int {
my_main<execpools::taskflow_thread_pool, RunThread>(argc, argv);
my_main<exec::taskflow::taskflow_thread_pool, RunThread>(argc, argv);
}
Loading
Loading