Skip to content

Commit d2909f0

Browse files
authored
Merge pull request #1880 from ericniebler/move-execpools
Move `execpools/` under `exec/` directory and unify ASIO config
2 parents a667223 + 3f59475 commit d2909f0

37 files changed

+1112
-929
lines changed

CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ PUBLIC
165165
FILES
166166
${exec_headers}
167167
${stdexec_headers}
168-
include/execpools/thread_pool_base.hpp
169168
# stdexec_version_config.hpp is generated by rapids' script
170169
FILE_SET version_config
171170
TYPE HEADERS
@@ -273,13 +272,6 @@ target_compile_options(stdexec_executable_flags INTERFACE
273272
-include stdexec/__detail/__force_include.hpp>
274273
)
275274

276-
if (STDEXEC_IS_TOP_LEVEL)
277-
# Integrate with LLVM/clang tooling
278-
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/clangd_compile_info.cmake)
279-
add_executable(_clangd_helper_file include/._clangd_helper_file.cpp)
280-
target_link_libraries(_clangd_helper_file PRIVATE STDEXEC::stdexec)
281-
endif()
282-
283275
# Set up nvexec library
284276
option(STDEXEC_ENABLE_CUDA "Enable CUDA targets for non-nvc++ compilers" OFF)
285277

@@ -465,6 +457,19 @@ if(STDEXEC_BUILD_EXAMPLES)
465457
add_subdirectory(examples)
466458
endif()
467459

460+
if (STDEXEC_IS_TOP_LEVEL)
461+
# Integrate with LLVM/clang tooling
462+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/clangd_compile_info.cmake)
463+
add_executable(_clangd_helper_file include/._clangd_helper_file.cpp)
464+
target_link_libraries(_clangd_helper_file PRIVATE
465+
STDEXEC::stdexec
466+
$<TARGET_NAME_IF_EXISTS:STDEXEC::asioexec>
467+
$<TARGET_NAME_IF_EXISTS:STDEXEC::tbbexec>
468+
$<TARGET_NAME_IF_EXISTS:STDEXEC::taskflowexec>
469+
$<TARGET_NAME_IF_EXISTS:STDEXEC::nvexec>
470+
)
471+
endif()
472+
468473
##############################################################################
469474
# Install targets ------------------------------------------------------------
470475

cmake/Modules/ConfigureASIO.cmake

Lines changed: 33 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,13 @@ if(STDEXEC_ENABLE_ASIO)
1414
message(FATAL_ERROR "Unknown configuration for ASIO implementation: " ${STDEXEC_ASIO_IMPLEMENTATION})
1515
endif()
1616

17-
set(ASIOEXEC_USES_BOOST ${STDEXEC_ASIO_USES_BOOST})
18-
set(ASIOEXEC_USES_STANDALONE ${STDEXEC_ASIO_USES_STANDALONE})
17+
set(STDEXEC_ASIO_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/exec/asio/asio_config.hpp)
1918

20-
set(STDEXEC_ASIO_POOL_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/execpools/asio/asio_config.hpp)
21-
set(ASIOEXEC_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/exec/asio/asio_config.hpp)
22-
23-
configure_file(
24-
include/execpools/asio/asio_config.hpp.in
25-
${STDEXEC_ASIO_POOL_CONFIG_HPP}
26-
)
2719
configure_file(
2820
include/exec/asio/asio_config.hpp.in
29-
${ASIOEXEC_CONFIG_HPP}
21+
${STDEXEC_ASIO_CONFIG_HPP}
3022
)
3123

32-
file(GLOB_RECURSE boost_pool_sources CONFIGURE_DEPENDS include/execpools/asio/*.hpp)
3324
file(GLOB_RECURSE asioexec_sources CONFIGURE_DEPENDS include/exec/asio/*.hpp)
3425

3526
if(${STDEXEC_ASIO_USES_BOOST})
@@ -41,98 +32,72 @@ if(STDEXEC_ENABLE_ASIO)
4132
OPTIONS "BOOST_SKIP_INSTALL_RULES OFF"
4233
)
4334

44-
add_library(stdexec_boost_pool INTERFACE)
45-
list(APPEND stdexec_export_targets stdexec_boost_pool)
46-
add_library(STDEXEC::asio_pool ALIAS stdexec_boost_pool)
35+
add_library(asioexec INTERFACE)
36+
list(APPEND stdexec_export_targets asioexec)
37+
add_library(STDEXEC::asioexec ALIAS asioexec)
38+
39+
# These aliases are provided for backwards compatibility with the old target names
40+
add_library(asioexec_boost ALIAS asioexec)
41+
add_library(stdexec_boost_pool ALIAS asioexec)
42+
add_library(STDEXEC::asio_pool ALIAS asioexec)
43+
add_library(STDEXEC::asioexec_boost ALIAS asioexec)
4744

48-
target_sources(stdexec_boost_pool PUBLIC
45+
target_sources(asioexec PUBLIC
4946
FILE_SET headers
5047
TYPE HEADERS
5148
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
52-
FILES ${boost_pool_sources}
49+
FILES ${asioexec_sources}
5350
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
54-
FILES ${STDEXEC_ASIO_POOL_CONFIG_HPP}
51+
FILES ${STDEXEC_ASIO_CONFIG_HPP}
5552
)
5653

57-
target_compile_definitions(stdexec_boost_pool INTERFACE STDEXEC_ASIO_USES_BOOST)
54+
target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_BOOST)
5855

59-
target_link_libraries(stdexec_boost_pool INTERFACE
56+
target_link_libraries(asioexec INTERFACE
6057
STDEXEC::stdexec
6158
Boost::asio
6259
)
63-
install(TARGETS stdexec_boost_pool
60+
install(TARGETS asioexec
6461
EXPORT stdexec-exports
6562
FILE_SET headers
6663
)
6764

68-
add_library(asioexec_boost INTERFACE)
69-
list(APPEND stdexec_export_targets asioexec_boost)
70-
add_library(STDEXEC::asioexec_boost ALIAS asioexec_boost)
71-
72-
target_sources(asioexec_boost PUBLIC
73-
FILE_SET headers
74-
TYPE HEADERS
75-
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
76-
FILES ${asioexec_sources}
77-
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
78-
FILES ${ASIOEXEC_CONFIG_HPP}
79-
)
80-
81-
target_compile_definitions(asioexec_boost INTERFACE STDEXEC_ASIO_USES_BOOST)
82-
83-
target_link_libraries(asioexec_boost INTERFACE
84-
STDEXEC::stdexec
85-
Boost::asio
86-
)
87-
install(TARGETS asioexec_boost EXPORT stdexec-exports FILE_SET headers)
88-
8965
elseif(${STDEXEC_ASIO_USES_STANDALONE})
9066
include(cmake/import_standalone_asio.cmake)
9167
import_standalone_asio(
9268
TAG "asio-1-31-0"
9369
VERSION "1.31.0")
9470

95-
add_library(stdexec_asio_pool INTERFACE)
96-
list(APPEND stdexec_export_targets stdexec_asio_pool)
97-
add_library(STDEXEC::asio_pool ALIAS stdexec_asio_pool)
71+
add_library(asioexec INTERFACE)
72+
list(APPEND stdexec_export_targets asioexec)
73+
add_library(STDEXEC::asioexec ALIAS asioexec)
9874

99-
target_sources(stdexec_asio_pool PUBLIC
75+
# These aliases are provided for backwards compatibility with the old target names
76+
add_library(asioexec_asio ALIAS asioexec)
77+
add_library(stdexec_asio_pool ALIAS asioexec)
78+
add_library(STDEXEC::asio_pool ALIAS asioexec)
79+
add_library(STDEXEC::asioexec_asio ALIAS asioexec)
80+
81+
target_sources(asioexec PUBLIC
10082
FILE_SET headers
10183
TYPE HEADERS
10284
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
103-
FILES ${boost_pool_sources}
85+
FILES ${asioexec_sources}
10486
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
105-
FILES ${STDEXEC_ASIO_POOL_CONFIG_HPP}
87+
FILES ${STDEXEC_ASIO_CONFIG_HPP}
10688
)
10789

108-
target_compile_definitions(stdexec_asio_pool INTERFACE STDEXEC_ASIO_USES_STANDALONE)
90+
target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_STANDALONE)
10991

110-
target_link_libraries(stdexec_asio_pool INTERFACE
92+
target_link_libraries(asioexec INTERFACE
11193
STDEXEC::stdexec
11294
asio
11395
)
114-
install(TARGETS stdexec_asio_pool EXPORT stdexec-exports FILE_SET headers)
115-
116-
add_library(asioexec_asio INTERFACE)
117-
list(APPEND stdexec_export_targets asioexec_asio)
118-
add_library(STDEXEC::asioexec_asio ALIAS asioexec_asio)
119-
120-
target_sources(asioexec_asio PUBLIC
96+
install(TARGETS asioexec
97+
EXPORT stdexec-exports
12198
FILE_SET headers
122-
TYPE HEADERS
123-
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
124-
FILES ${asioexec_sources}
125-
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
126-
FILES ${ASIOEXEC_CONFIG_HPP}
12799
)
128100

129-
target_compile_definitions(asioexec_asio INTERFACE STDEXEC_ASIO_USES_STANDALONE)
130-
131-
target_link_libraries(asioexec_asio INTERFACE
132-
STDEXEC::stdexec
133-
asio
134-
)
135-
install(TARGETS asioexec_asio EXPORT stdexec-exports FILE_SET headers)
136101
else()
137102
message(FATAL_ERROR "ASIO implementation is not configured")
138103
endif()

cmake/Modules/ConfigureTBB.cmake

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,35 @@ endif()
3333
if (STDEXEC_ENABLE_TBB)
3434
# CONFIGURE_DEPENDS ensures that CMake reconfigures when a relevant hpp file is
3535
# added or removed.
36-
file(GLOB_RECURSE tbbpool_headers CONFIGURE_DEPENDS include/execpools/tbb/*.hpp)
37-
add_library(tbbpool INTERFACE)
38-
list(APPEND stdexec_export_targets tbbpool)
39-
add_library(STDEXEC::tbbpool ALIAS tbbpool)
40-
target_sources(tbbpool
36+
file(GLOB_RECURSE tbbexec_headers CONFIGURE_DEPENDS include/exec/tbb/*.hpp)
37+
add_library(tbbexec INTERFACE)
38+
list(APPEND stdexec_export_targets tbbexec)
39+
add_library(STDEXEC::tbbexec ALIAS tbbexec)
40+
41+
# These aliases are provided for backwards compatibility with the old target names
42+
add_library(tbbpool ALIAS tbbexec)
43+
add_library(STDEXEC::tbbpool ALIAS tbbexec)
44+
45+
target_sources(tbbexec
4146
PUBLIC
4247
FILE_SET headers
4348
TYPE HEADERS
4449
BASE_DIRS include
45-
FILES ${tbbpool_headers}
50+
FILES ${tbbexec_headers}
4651
)
47-
target_compile_definitions(tbbpool INTERFACE
52+
target_compile_definitions(tbbexec INTERFACE
4853
STDEXEC_ENABLE_TBB
4954
)
5055

5156
target_link_libraries(stdexec INTERFACE
5257
TBB::tbb
5358
)
5459

55-
target_link_libraries(tbbpool INTERFACE
60+
target_link_libraries(tbbexec INTERFACE
5661
STDEXEC::stdexec
5762
)
5863

59-
install(TARGETS tbbpool
64+
install(TARGETS tbbexec
6065
EXPORT stdexec-exports
6166
FILE_SET headers
6267
)

cmake/Modules/ConfigureTaskflow.cmake

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,29 @@ if(STDEXEC_ENABLE_TASKFLOW)
77
GIT_TAG v3.7.0
88
OPTIONS "TF_BUILD_TESTS OFF"
99
)
10-
file(GLOB_RECURSE taskflow_pool include/execpools/taskflow/*.hpp)
11-
add_library(taskflow_pool INTERFACE ${taskflowexec_sources})
12-
target_compile_definitions(taskflow_pool INTERFACE STDEXEC_ENABLE_TASKFLOW)
13-
list(APPEND stdexec_export_targets taskflow_pool)
14-
add_library(STDEXEC::taskflow_pool ALIAS taskflow_pool)
10+
file(GLOB_RECURSE taskflowexec_headers CONFIGURE_DEPENDS include/exec/taskflow/*.hpp)
11+
add_library(taskflowexec INTERFACE ${taskflowexec_headers})
12+
list(APPEND stdexec_export_targets taskflowexec)
13+
add_library(STDEXEC::taskflowexec ALIAS taskflowexec)
1514

16-
target_link_libraries(taskflow_pool
17-
INTERFACE
18-
STDEXEC::stdexec
15+
# These aliases are provided for backwards compatibility with the old target names
16+
add_library(taskflow_pool ALIAS taskflowexec)
17+
add_library(STDEXEC::taskflow_pool ALIAS taskflowexec)
18+
19+
target_sources(taskflowexec
20+
PUBLIC
21+
FILE_SET headers
22+
TYPE HEADERS
23+
BASE_DIRS include
24+
FILES ${taskflowexec_headers}
25+
)
26+
target_compile_definitions(taskflowexec INTERFACE STDEXEC_ENABLE_TASKFLOW)
27+
28+
target_link_libraries(stdexec INTERFACE
1929
Taskflow
2030
)
31+
32+
target_link_libraries(taskflowexec INTERFACE
33+
STDEXEC::stdexec
34+
)
2135
endif()

examples/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ endif()
7272

7373
if (STDEXEC_ENABLE_TBB)
7474
add_executable(example.benchmark.tbb_thread_pool benchmark/tbb_thread_pool.cpp)
75-
target_link_libraries(example.benchmark.tbb_thread_pool PRIVATE STDEXEC::tbbpool)
75+
target_link_libraries(example.benchmark.tbb_thread_pool PRIVATE STDEXEC::tbbexec)
7676

7777
add_executable(example.benchmark.tbb_thread_pool_nested benchmark/tbb_thread_pool_nested.cpp)
78-
target_link_libraries(example.benchmark.tbb_thread_pool_nested PRIVATE STDEXEC::tbbpool)
78+
target_link_libraries(example.benchmark.tbb_thread_pool_nested PRIVATE STDEXEC::tbbexec)
7979

8080
add_executable(example.benchmark.fibonacci benchmark/fibonacci.cpp)
81-
target_link_libraries(example.benchmark.fibonacci PRIVATE STDEXEC::tbbpool)
81+
target_link_libraries(example.benchmark.fibonacci PRIVATE STDEXEC::tbbexec)
8282
endif()
8383

8484
if(STDEXEC_ENABLE_TASKFLOW)
8585
add_executable(example.benchmark.taskflow_thread_pool benchmark/taskflow_thread_pool.cpp)
86-
target_link_libraries(example.benchmark.taskflow_thread_pool PRIVATE STDEXEC::taskflow_pool)
86+
target_link_libraries(example.benchmark.taskflow_thread_pool PRIVATE STDEXEC::taskflowexec)
8787
endif()
8888

8989
if(STDEXEC_ENABLE_ASIO)
9090
add_executable(example.benchmark.asio_thread_pool benchmark/asio_thread_pool.cpp)
91-
target_link_libraries(example.benchmark.asio_thread_pool PRIVATE STDEXEC::asio_pool)
91+
target_link_libraries(example.benchmark.asio_thread_pool PRIVATE STDEXEC::asioexec)
9292
endif()

examples/benchmark/asio_thread_pool.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@
1515
* limitations under the License.
1616
*/
1717
#include "./common.hpp"
18+
#include <exec/asio/asio_thread_pool.hpp>
1819
#include <exec/start_detached.hpp>
19-
#include <execpools/asio/asio_thread_pool.hpp>
2020

2121
struct RunThread {
22-
void operator()(
23-
execpools::asio_thread_pool& pool,
24-
std::size_t total_scheds,
25-
std::size_t tid,
26-
std::barrier<>& barrier,
22+
void operator()(exec::asio::asio_thread_pool& pool,
23+
std::size_t total_scheds,
24+
std::size_t tid,
25+
std::barrier<>& barrier,
2726
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
28-
std::span<char> buffer,
27+
std::span<char> buffer,
2928
#endif
30-
std::atomic<bool>& stop,
31-
exec::numa_policy numa) {
29+
std::atomic<bool>& stop,
30+
exec::numa_policy numa) {
3231
int numa_node = numa.thread_index_to_node(tid);
3332
numa.bind_to_node(numa_node);
3433
auto scheduler = pool.get_scheduler();
@@ -83,5 +82,5 @@ struct RunThread {
8382
};
8483

8584
auto main(int argc, char** argv) -> int {
86-
my_main<execpools::asio_thread_pool, RunThread>(argc, argv);
85+
my_main<exec::asio::asio_thread_pool, RunThread>(argc, argv);
8786
}

examples/benchmark/fibonacci.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <exec/start_detached.hpp>
2121
#include <exec/static_thread_pool.hpp>
22-
#include <execpools/tbb/tbb_thread_pool.hpp>
22+
#include <exec/tbb/tbb_thread_pool.hpp>
2323

2424
#include <exec/any_sender_of.hpp>
2525
#include <stdexec/execution.hpp>
@@ -102,10 +102,10 @@ auto main(int argc, char** argv) -> int {
102102
return -1;
103103
}
104104

105-
std::variant<execpools::tbb_thread_pool, exec::static_thread_pool> pool;
105+
std::variant<exec::tbb::tbb_thread_pool, exec::static_thread_pool> pool;
106106

107107
if (argv[4] == std::string_view("tbb")) {
108-
pool.emplace<execpools::tbb_thread_pool>(static_cast<int>(std::thread::hardware_concurrency()));
108+
pool.emplace<exec::tbb::tbb_thread_pool>(static_cast<int>(std::thread::hardware_concurrency()));
109109
} else {
110110
pool.emplace<exec::static_thread_pool>(
111111
std::thread::hardware_concurrency(), exec::bwos_params{}, exec::get_numa_policy());

examples/benchmark/taskflow_thread_pool.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
*/
1717
#include "./common.hpp"
1818
#include <exec/start_detached.hpp>
19-
#include <execpools/taskflow/taskflow_thread_pool.hpp>
19+
#include <exec/taskflow/taskflow_thread_pool.hpp>
2020

2121
struct RunThread {
2222
void operator()(
23-
execpools::taskflow_thread_pool& pool,
23+
exec::taskflow::taskflow_thread_pool& pool,
2424
std::size_t total_scheds,
2525
std::size_t tid,
2626
std::barrier<>& barrier,
@@ -83,5 +83,5 @@ struct RunThread {
8383
};
8484

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

0 commit comments

Comments
 (0)