-
Notifications
You must be signed in to change notification settings - Fork 225
Open
Description
problem
in include/exec/static_thread_pool.hpp
schedule_all cpo invoke
void start() & noexcept {
std::size_t size = items_.size();
std::size_t nthreads = this->pool_.static_thread_poolilable_parallelism();
bwos_params params = this->pool_.params();
std::size_t local_size = params.blockSize * params.numBlocks;
std::size_t chunk_size = std::min(size / nthreads, local_size * nthreads);
auto& remote_queue = *this->pool_.get_remote_queue();
auto it = std::ranges::begin(this->range_);
std::size_t i0 = 0;
while (i0 + chunk_size < size) {
for (std::size_t i = i0; i < i0 + chunk_size; ++i) {
items_[i].__construct_from(
stdexec::connect,
set_next(this->rcvr_, item_sender_t{this, it + i}),
next_receiver_t{this});
stdexec::start(items_[i].__get());
}
std::unique_lock lock{this->start_mutex_};
this->pool_.bulk_enqueue(remote_queue, std::move(this->tasks_), this->tasks_size_);
lock.unlock();
i0 += chunk_size;
}When the ready batch is smaller than the pool size (size < nthreads), size / nthreads becomes 0, so chunk_size is
0 and the loop never advances. That spins forever, no tasks are enqueued.
usage pattern:
std::span<const int> node_indices;
auto task = exec::schedule_all(pool,node_indices) |
exec::transform_each(stdexec::then([](int node_index) noexcept {
})) |
exec::ignore_all_values();
stdexec::start_detached(std::move(task));Metadata
Metadata
Assignees
Labels
No labels