Skip to content

Commit

Permalink
apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ericniebler committed Nov 6, 2023
1 parent 361691e commit 8a083a8
Show file tree
Hide file tree
Showing 18 changed files with 147 additions and 162 deletions.
16 changes: 8 additions & 8 deletions examples/benchmark/static_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
#include "./common.hpp"
#include <exec/static_thread_pool.hpp>

struct RunThread {
void operator()(
exec::static_thread_pool& pool,
Expand Down Expand Up @@ -62,13 +63,13 @@ struct RunThread {
while (scheds) {
stdexec::start_detached( //
stdexec::schedule(scheduler) //
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}));
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}));
--scheds;
}
#endif
Expand All @@ -80,7 +81,6 @@ struct RunThread {
}
};


int main(int argc, char** argv) {
my_main<exec::static_thread_pool, RunThread>(argc, argv);
}
12 changes: 6 additions & 6 deletions examples/benchmark/static_thread_pool_bulk_enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ struct RunThread {
break;
}
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()};
pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()};
pmr::polymorphic_allocator<char> alloc{&rsrc};
auto env = exec::make_env(exec::with(stdexec::get_allocator, alloc));
auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism());
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
| exec::ignore_all_values()
| exec::write(env);
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
| exec::ignore_all_values() | exec::write(env);
#else
auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism());
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
| exec::ignore_all_values();
#endif
stdexec::sync_wait(iterate);
Expand All @@ -59,5 +58,6 @@ int main(int argc, char** argv) {
my_main<exec::static_thread_pool, RunThread>(argc, argv);
}
#else
int main() {}
int main() {
}
#endif
11 changes: 5 additions & 6 deletions examples/benchmark/static_thread_pool_bulk_enqueue_nested.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ struct RunThread {
break;
}
#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()};
pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()};
pmr::polymorphic_allocator<char> alloc{&rsrc};
auto env = exec::make_env(exec::with(stdexec::get_allocator, alloc));
auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism());
auto iterate = exec::iterate(std::views::iota(start, end))
| exec::ignore_all_values()
auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values()
| exec::write(env);
#else
auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism());
auto iterate = exec::iterate(std::views::iota(start, end))
| exec::ignore_all_values();
auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values();
#endif
stdexec::sync_wait(stdexec::on(scheduler, iterate));
barrier.arrive_and_wait();
Expand All @@ -60,5 +58,6 @@ int main(int argc, char** argv) {
my_main<exec::static_thread_pool, RunThread>(argc, argv);
}
#else
int main() {}
int main() {
}
#endif
18 changes: 9 additions & 9 deletions examples/benchmark/static_thread_pool_nested.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ struct RunThread {
| stdexec::then([&] {
auto nested_scheduler = pool.get_scheduler();
while (scheds) {
stdexec::start_detached( //
stdexec::start_detached( //
stdexec::schedule(nested_scheduler) //
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}),
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}),
env);
--scheds;
}
Expand All @@ -70,7 +70,7 @@ struct RunThread {
| stdexec::then([&] {
auto nested_scheduler = pool.get_scheduler();
while (scheds) {
stdexec::start_detached( //
stdexec::start_detached( //
stdexec::schedule(nested_scheduler) //
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
Expand Down
18 changes: 9 additions & 9 deletions examples/benchmark/static_thread_pool_nested_old.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ struct RunThread {
stdexec::schedule(scheduler) //
| stdexec::then([&] {
while (scheds) {
stdexec::start_detached( //
stdexec::start_detached( //
stdexec::schedule(scheduler) //
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}),
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}),
env);
--scheds;
}
Expand All @@ -68,7 +68,7 @@ struct RunThread {
stdexec::schedule(scheduler) //
| stdexec::then([&] {
while (scheds) {
stdexec::start_detached( //
stdexec::start_detached( //
stdexec::schedule(scheduler) //
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
Expand Down
14 changes: 7 additions & 7 deletions examples/benchmark/static_thread_pool_old.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ struct RunThread {
while (scheds) {
stdexec::start_detached( //
stdexec::schedule(scheduler) //
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}));
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}));
--scheds;
}
#endif
Expand Down
17 changes: 8 additions & 9 deletions examples/benchmark/tbb_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ struct RunThread {
while (scheds) {
stdexec::start_detached( //
stdexec::schedule(scheduler) //
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}));
| stdexec::then([&] {
auto prev = counter.fetch_sub(1);
if (prev == 1) {
std::lock_guard lock{mut};
cv.notify_one();
}
}));
--scheds;
}
#endif
Expand All @@ -81,7 +81,6 @@ struct RunThread {
}
};

int main(int argc, char** argv)
{
int main(int argc, char** argv) {
my_main<tbbexec::tbb_thread_pool, RunThread>(argc, argv);
}
5 changes: 2 additions & 3 deletions examples/benchmark/tbb_thread_pool_nested.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct RunThread {
auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism());
std::size_t scheds = end - start;
tbb::task_group tg{};
stdexec::sync_wait( //
stdexec::sync_wait( //
stdexec::schedule(scheduler) //
| stdexec::then([&] {
for (std::size_t i = 0; i < scheds; ++i) {
Expand All @@ -55,7 +55,6 @@ struct RunThread {
}
};

int main(int argc, char** argv)
{
int main(int argc, char** argv) {
my_main<tbbexec::tbb_thread_pool, RunThread>(argc, argv);
}
4 changes: 3 additions & 1 deletion include/exec/__detail/__atomic_intrusive_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ namespace exec {
try_push_result try_push_front(__node_pointer t) noexcept {
__node_pointer __old_head = __head_.load(std::memory_order_relaxed);
t->*_NextPtr = __old_head;
return {__head_.compare_exchange_strong(__old_head, t, std::memory_order_acq_rel), __old_head == nullptr};
return {
__head_.compare_exchange_strong(__old_head, t, std::memory_order_acq_rel),
__old_head == nullptr};
}

bool push_front(__node_pointer t) noexcept {
Expand Down
3 changes: 1 addition & 2 deletions include/exec/__detail/__bwos_lifo_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ namespace exec::bwos {

template <class Tp, class Allocator>
template <class Iterator, class Sentinel>
Iterator
lifo_queue<Tp, Allocator>::block_type::bulk_put(Iterator first, Sentinel last) noexcept {
Iterator lifo_queue<Tp, Allocator>::block_type::bulk_put(Iterator first, Sentinel last) noexcept {
std::uint64_t back = tail_.load(std::memory_order_relaxed);
while (first != last && back < block_size()) {
ring_buffer_[back] = static_cast<Tp &&>(*first);
Expand Down
6 changes: 3 additions & 3 deletions include/exec/static_thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ namespace exec {
} else {
static_assert( //
stdexec::__starts_on<Sender, static_thread_pool::scheduler, Env>
|| stdexec::__completes_on<Sender, static_thread_pool::scheduler>,
|| stdexec::__completes_on<Sender, static_thread_pool::scheduler>,
"No static_thread_pool instance can be found in the sender's or receiver's "
"environment on which to schedule bulk work.");
return not_a_sender<stdexec::__name_of<Sender>>();
Expand Down Expand Up @@ -615,7 +615,7 @@ namespace exec {
static thread_local std::thread::id this_id = std::this_thread::get_id();
std::size_t nTasks = 0;
std::size_t idx = 0;
for ([[maybe_unused]] auto t : tasks) {
for ([[maybe_unused]] auto t: tasks) {
++nTasks;
}
for (std::thread& t: threads_) {
Expand Down Expand Up @@ -653,7 +653,7 @@ namespace exec {
inline static_thread_pool::thread_state::pop_result
static_thread_pool::thread_state::try_remote() {
pop_result result{nullptr, index_};
__intrusive_queue<&task_base::next> remotes = pool_->remotes_.pop_all_reversed(index_);
__intrusive_queue<& task_base::next> remotes = pool_->remotes_.pop_all_reversed(index_);
pending_queue_.append(std::move(remotes));
if (!pending_queue_.empty()) {
move_pending_to_local(pending_queue_, local_queue_);
Expand Down
6 changes: 2 additions & 4 deletions include/nvexec/stream/when_all.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
template <class Env, class... Senders>
struct completions {
using InvalidArg = //
__minvoke<
__mfind_if<__mbind_back_q<too_many_completions, Env>, __q<__mfront>>,
Senders...>;
__minvoke< __mfind_if<__mbind_back_q<too_many_completions, Env>, __q<__mfront>>, Senders...>;

using __t = stdexec::__when_all::__too_many_value_completions_error<InvalidArg, Env>;
};
Expand All @@ -67,7 +65,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
}

template <class Env, class... Senders>
requires (!__v<too_many_completions<Senders, Env>> &&...)
requires(!__v<too_many_completions<Senders, Env>> && ...)
struct completions<Env, Senders...> {
using non_values = //
__concat_completion_signatures_t<
Expand Down
6 changes: 2 additions & 4 deletions include/stdexec/__detail/__basic_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ namespace stdexec {

template <class _Tag>
template <class _Data, class... _Children>
constexpr auto
__make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const {
constexpr auto __make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const {
return __sexpr{__make_tuple(_Tag(), __detail::__mbc(__data), __detail::__mbc(__children)...)};
}
#else
Expand All @@ -212,8 +211,7 @@ namespace stdexec {

template <class _Tag>
template <class _Data, class... _Children>
constexpr auto
__make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const {
constexpr auto __make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const {
return __sexpr{__make_tuple(_Tag(), (_Data&&) __data, (_Children&&) __children...)};
};
#endif
Expand Down
9 changes: 5 additions & 4 deletions include/stdexec/__detail/__p2300.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ namespace std {
using stop_token_of_t STDEXEC_STD_DEPRECATED = stdexec::stop_token_of_t<_StopTokenProvider>;

// [exec.env], execution environments
struct __no_env {};
struct __no_env { };

using no_env STDEXEC_STD_DEPRECATED = __no_env;
using get_env_t STDEXEC_STD_DEPRECATED = stdexec::get_env_t;
//using forwarding_env_query_t STDEXEC_STD_DEPRECATED = stdexec::forwarding_env_query_t; // BUGBUG
Expand Down Expand Up @@ -166,14 +167,14 @@ namespace std {

template < //
class _Sender, //
class _Env = __no_env, //
class _Env = __no_env, //
template <class...> class _Tuple = stdexec::__decayed_tuple, //
template <class...> class _Variant = stdexec::__variant>
using value_types_of_t STDEXEC_STD_DEPRECATED =
stdexec::value_types_of_t<_Sender, _Env, _Tuple, _Variant>;

template < //
class _Sender, //
template < //
class _Sender, //
class _Env = __no_env, //
template <class...> class _Variant = stdexec::__variant>
using error_types_of_t STDEXEC_STD_DEPRECATED =
Expand Down
Loading

0 comments on commit 8a083a8

Please sign in to comment.