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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros: [
STDEXEC_SYSTEM_CONTEXT_INLINE
STDEXEC_PARALLEL_SCHEDULER_INLINE
STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS
]
BinPackArguments: false
Expand Down
4 changes: 2 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ ImplementationFileExtensions:
- cpp
- cu
HeaderFilterRegex: '^.*[.](h|hpp|cuh)$'
ExcludeHeaderFilterRegex: '^.*__system_context_default_impl_entry[.]hpp$'
ExcludeHeaderFilterRegex: '^.*__parallel_scheduler_default_impl_entry[.]hpp$'
FormatStyle: none
User: eniebler
ExtraArgsBefore: [
'-DSTDEXEC_SYSTEM_CONTEXT_HEADER_ONLY=1',
'-DSTDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY=1',
'-DSTDEXEC_CLANG_TIDY_INVOKED=1',
]
CheckOptions:
Expand Down
4 changes: 2 additions & 2 deletions .clangd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ CompileFlags:

# The following file assumes a define.
If:
PathMatch: .*/__system_context_default_impl_entry\.hpp
PathMatch: .*/__parallel_scheduler_default_impl_entry\.hpp
CompileFlags:
Add:
- "-DSTDEXEC_SYSTEM_CONTEXT_INLINE=inline"
- "-DSTDEXEC_PARALLEL_SCHEDULER_INLINE=inline"

---

Expand Down
30 changes: 18 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -436,23 +436,29 @@ if (STDEXEC_ENABLE_NUMA)
target_compile_definitions(stdexec INTERFACE STDEXEC_ENABLE_NUMA)
endif()

option(STDEXEC_BUILD_SYSTEM_CONTEXT "Build the system_context compiled library" OFF)
option(STDEXEC_BUILD_PARALLEL_SCHEDULER "Build the parallel_scheduler compiled library" OFF)
if (DEFINED STDEXEC_BUILD_SYSTEM_CONTEXT)
message(DEPRECATION "STDEXEC_BUILD_SYSTEM_CONTEXT is deprecated. Use STDEXEC_BUILD_PARALLEL_SCHEDULER instead.")
set(STDEXEC_BUILD_PARALLEL_SCHEDULER ${STDEXEC_BUILD_SYSTEM_CONTEXT})
endif()

if(STDEXEC_BUILD_SYSTEM_CONTEXT)
set(SYSTEM_CONTEXT_SOURCES src/system_context/system_context.cpp)
add_library(system_context ${SYSTEM_CONTEXT_SOURCES})
target_compile_features(system_context PUBLIC cxx_std_20)
set_target_properties(system_context PROPERTIES
if(STDEXEC_BUILD_PARALLEL_SCHEDULER)
set(STDEXEC_PARALLEL_SCHEDULER_SOURCES src/parallel_scheduler/parallel_scheduler.cpp)
add_library(parallel_scheduler ${STDEXEC_PARALLEL_SCHEDULER_SOURCES})
target_compile_features(parallel_scheduler PUBLIC cxx_std_20)
set_target_properties(parallel_scheduler PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF)
target_compile_options(system_context PUBLIC
target_compile_options(parallel_scheduler PUBLIC
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/Zc:__cplusplus /Zc:preprocessor /Zc:externConstexpr>
)
add_library(STDEXEC::system_context ALIAS system_context)
target_link_libraries(system_context PUBLIC stdexec)
endif()
target_link_libraries(parallel_scheduler PUBLIC stdexec)

add_library(STDEXEC::parallel_scheduler ALIAS parallel_scheduler)
add_library(system_context ALIAS parallel_scheduler)
add_library(STDEXEC::system_context ALIAS parallel_scheduler)
endif()

option(STDEXEC_ENABLE_IO_URING "Enable the use of the io_uring scheduler on Linux" OFF)

Expand Down Expand Up @@ -518,8 +524,8 @@ if(STDEXEC_INSTALL)
include(CPack)

set(stdexec_install_targets stdexec)
if(STDEXEC_BUILD_SYSTEM_CONTEXT)
list(APPEND stdexec_install_targets system_context)
if(STDEXEC_BUILD_PARALLEL_SCHEDULER)
list(APPEND stdexec_install_targets parallel_scheduler)
endif()

install(TARGETS ${stdexec_install_targets}
Expand Down
19 changes: 12 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ class StdexecPackage(ConanFile):

settings = "os", "arch", "compiler", "build_type"
options = {
# Legacy name for backward compatibility. Use parallel_scheduler instead.
"system_context": [True, False],
"parallel_scheduler": [True, False],
}
default_options = {
"system_context": False,
"parallel_scheduler": False,
}
exports_sources = (
"include/*",
Expand All @@ -32,6 +35,8 @@ class StdexecPackage(ConanFile):

def configure(self):
if self.options.system_context:
self.options.parallel_scheduler = True
if self.options.parallel_scheduler:
self.package_type = "static-library"
else:
self.package_type = "header-library"
Expand All @@ -49,19 +54,19 @@ def layout(self):

def build(self):
tests = "OFF" if self.conf.get("tools.build:skip_test", default=False) else "ON"
system_context = "ON" if self.options.system_context else "OFF"
parallel_scheduler = "ON" if self.options.parallel_scheduler else "OFF"

cmake = CMake(self)
cmake.configure(variables={
"STDEXEC_BUILD_TESTS": tests,
"STDEXEC_BUILD_EXAMPLES": tests,
"STDEXEC_BUILD_SYSTEM_CONTEXT": system_context,
"STDEXEC_BUILD_PARALLEL_SCHEDULER": parallel_scheduler,
})
cmake.build()
cmake.test()

def package_id(self):
if not self.info.options.system_context:
if not self.info.options.parallel_scheduler:
# Clear settings because this package is header-only.
self.info.clear()

Expand All @@ -73,8 +78,8 @@ def package_info(self):
self.cpp_info.set_property("cmake_file_name", "P2300")
self.cpp_info.set_property("cmake_target_name", "P2300::P2300")
self.cpp_info.set_property("cmake_target_aliases", ["STDEXEC::stdexec"])
if self.options.system_context:
self.cpp_info.components["system_context"].libs = ["system_context"]
self.cpp_info.components["system_context"].set_property(
"cmake_target_name", "STDEXEC::system_context"
if self.options.parallel_scheduler:
self.cpp_info.components["parallel_scheduler"].libs = ["parallel_scheduler"]
self.cpp_info.components["parallel_scheduler"].set_property(
"cmake_target_name", "STDEXEC::parallel_scheduler"
)
6 changes: 3 additions & 3 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2368,8 +2368,8 @@ INCLUDE_FILE_PATTERNS =
PREDEFINED = "__cplusplus=202302L" \
"STDEXEC_DOXYGEN_INVOKED=1" \
"STDEXEC=stdexec" \
"STDEXEC_SYSTEM_CONTEXT_HEADER_ONLY=1" \
"STDEXEC_SYSTEM_CONTEXT_INLINE=inline" \
"STDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY=1" \
"STDEXEC_PARALLEL_SCHEDULER_INLINE=inline" \
"STDEXEC_ATTRIBUTE(X)= " \
"STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS= " \
"STDEXEC_AUTO_RETURN(...)=->decltype(auto){ return __VA_ARGS__; }" \
Expand Down Expand Up @@ -2816,4 +2816,4 @@ CLANG_DATABASE_PATH = "@COMPILATION_DB_PATH@"
CLANG_OPTIONS = -isystem "@STDDEF_INCLUDE_PATH@" \
-std=c++23 \
-DSTDEXEC_DOXYGEN_INVOKED=1 \
-DSTDEXEC_SYSTEM_CONTEXT_HEADER_ONLY=1
-DSTDEXEC_PARALLEL_SCHEDULER_HEADER_ONLY=1
1 change: 0 additions & 1 deletion examples/hello_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ using stdexec::sync_wait;

auto main() -> int
{
exec::numa_policy numa{exec::no_numa_policy{}};
exec::static_thread_pool ctx{8};
scheduler auto sch = ctx.get_scheduler(); // 1

Expand Down
2 changes: 1 addition & 1 deletion include/exec/any_sender_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ namespace experimental::execution
// Adds the get_completion_scheduler_t<set_value_t> query to the type-erased sender's
// attributes. This type is used for the return of any_scheduler::schedule.
template <class AnyScheduler, class AnySender>
struct _any_schedule_sender : AnySender
struct _any_schedule_sender final : AnySender
{
private:
using _any_receiver_ref_t = AnySender::_any_receiver_ref_t;
Expand Down
88 changes: 47 additions & 41 deletions include/exec/detail/system_context_replaceability_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,62 @@
#define STDEXEC_SYSTEM_CONTEXT_REPLACEABILITY_API_H

#include "../../stdexec/__detail/__execution_fwd.hpp"
#include "../../stdexec/__detail/__system_context_replaceability_api.hpp"
#include "../../stdexec/__detail/__parallel_scheduler_replacement_api.hpp"

#include <memory>

namespace experimental::execution::system_context_replaceability
namespace experimental::execution
{
using STDEXEC::system_context_replaceability::__parallel_scheduler_backend_factory_t;
namespace [[deprecated("Use the STDEXEC::parallel_scheduler_replacement namespace "
"instead.")]] system_context_replaceability
{
using STDEXEC::parallel_scheduler_replacement::__parallel_scheduler_backend_factory_t;

/// Interface for the parallel scheduler backend.
using parallel_scheduler_backend
[[deprecated("Use STDEXEC::system_context_replaceability::parallel_scheduler_backend "
"instead.")]] = STDEXEC::system_context_replaceability::parallel_scheduler_backend;
/// Interface for the parallel scheduler backend.
using parallel_scheduler_backend //
[[deprecated("Use STDEXEC::parallel_scheduler_replacement::parallel_scheduler_backend "
"instead.")]] = //
STDEXEC::parallel_scheduler_replacement::parallel_scheduler_backend;

/// Get the backend for the parallel scheduler.
/// Users might replace this function.
[[deprecated("Use STDEXEC::system_context_replaceability::query_parallel_scheduler_backend "
"instead.")]]
inline auto query_parallel_scheduler_backend()
-> std::shared_ptr<STDEXEC::system_context_replaceability::parallel_scheduler_backend>
{
return STDEXEC::system_context_replaceability::query_parallel_scheduler_backend();
}
/// Get the backend for the parallel scheduler.
/// Users might replace this function.
[[deprecated("Use STDEXEC::parallel_scheduler_replacement::query_parallel_scheduler_backend "
"instead.")]]
inline auto query_parallel_scheduler_backend()
-> std::shared_ptr<STDEXEC::parallel_scheduler_replacement::parallel_scheduler_backend>
{
return STDEXEC::parallel_scheduler_replacement::query_parallel_scheduler_backend();
}

STDEXEC_PRAGMA_PUSH()
STDEXEC_PRAGMA_IGNORE_GNU("-Wdeprecated-declarations")
STDEXEC_PRAGMA_IGNORE_MSVC(4996) // warning C4996: 'function': was declared deprecated
STDEXEC_PRAGMA_IGNORE_EDG(deprecated_entity)
/// Set a factory for the parallel scheduler backend.
/// Can be used to replace the parallel scheduler at runtime.
/// Out of spec.
[[deprecated("Use STDEXEC::system_context_replaceability::set_parallel_scheduler_backend "
"instead.")]]
inline auto set_parallel_scheduler_backend(__parallel_scheduler_backend_factory_t __new_factory)
-> __parallel_scheduler_backend_factory_t
{
return STDEXEC::system_context_replaceability::set_parallel_scheduler_backend(__new_factory);
}
STDEXEC_PRAGMA_POP()
STDEXEC_PRAGMA_PUSH()
STDEXEC_PRAGMA_IGNORE_GNU("-Wdeprecated-declarations")
STDEXEC_PRAGMA_IGNORE_MSVC(4996) // warning C4996: 'function': was declared deprecated
STDEXEC_PRAGMA_IGNORE_EDG(deprecated_entity)
STDEXEC_PRAGMA_IGNORE_EDG(deprecated_entity_with_custom_message)
/// Set a factory for the parallel scheduler backend.
/// Can be used to replace the parallel scheduler at runtime.
/// Out of spec.
[[deprecated("Use STDEXEC::parallel_scheduler_replacement::set_parallel_scheduler_backend "
"instead.")]]
inline auto set_parallel_scheduler_backend(__parallel_scheduler_backend_factory_t __new_factory)
-> __parallel_scheduler_backend_factory_t
{
return STDEXEC::parallel_scheduler_replacement::set_parallel_scheduler_backend(__new_factory);
}
STDEXEC_PRAGMA_POP()

/// Interface for completing a sender operation. Backend will call frontend though this interface
/// for completing the `schedule` and `schedule_bulk` operations.
using receiver
[[deprecated("Use STDEXEC::system_context_replaceability::receiver_proxy "
"instead.")]] = STDEXEC::system_context_replaceability::receiver_proxy;
/// Interface for completing a sender operation. Backend will call frontend though this interface
/// for completing the `schedule` and `schedule_bulk` operations.
using receiver
[[deprecated("Use STDEXEC::parallel_scheduler_replacement::receiver_proxy "
"instead.")]] = STDEXEC::parallel_scheduler_replacement::receiver_proxy;

/// Receiver for bulk scheduling operations.
using bulk_item_receiver
[[deprecated("Use STDEXEC::system_context_replaceability::bulk_item_receiver_proxy "
"instead.")]] = STDEXEC::system_context_replaceability::bulk_item_receiver_proxy;
} // namespace experimental::execution::system_context_replaceability
/// Receiver for bulk scheduling operations.
using bulk_item_receiver [[deprecated(
"Use STDEXEC::parallel_scheduler_replacement::bulk_item_receiver_proxy "
"instead.")]] = STDEXEC::parallel_scheduler_replacement::bulk_item_receiver_proxy;
} // namespace system_context_replaceability
} // namespace experimental::execution

namespace exec = experimental::execution;

Expand Down
14 changes: 12 additions & 2 deletions include/stdexec/__detail/__config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,18 @@
#endif

STDEXEC_NAMESPACE_STD_BEGIN
namespace execution::system_context_replaceability
{}
namespace execution
{
namespace parallel_scheduler_replacement
{}

namespace [[deprecated("Use the std::execution::parallel_scheduler_replacement namespace "
"instead.")]] system_context_replaceability
{
using namespace parallel_scheduler_replacement;
} // namespace system_context_replaceability
} // namespace execution

namespace this_thread
{}
STDEXEC_NAMESPACE_STD_END
Expand Down
Loading
Loading