MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / start

Method start

include/exec/static_thread_pool.hpp:1746–1781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1744 }
1745
1746 void start() & noexcept
1747 {
1748 std::size_t size = items_.size();
1749 std::size_t nthreads = this->pool_.available_parallelism();
1750 bwos_params params = this->pool_.params();
1751 std::size_t local_size = params.blockSize * params.numBlocks;
1752 std::size_t chunk_size = __umin({size / nthreads, local_size * nthreads});
1753 auto& remote_queue = *this->pool_.get_remote_queue();
1754 auto it = std::ranges::begin(this->range_);
1755 std::size_t i0 = 0;
1756 while (i0 + chunk_size < size)
1757 {
1758 for (std::size_t i = i0; i < i0 + chunk_size; ++i)
1759 {
1760 items_[i].__construct_from(STDEXEC::connect,
1761 set_next(this->rcvr_, item_sender_t{this, it + i}),
1762 next_receiver_t{this});
1763 STDEXEC::start(items_[i].__get());
1764 }
1765
1766 std::unique_lock lock{this->start_mutex_};
1767 this->pool_.bulk_enqueue(remote_queue, std::move(this->tasks_), this->tasks_size_);
1768 lock.unlock();
1769 i0 += chunk_size;
1770 }
1771 for (std::size_t i = i0; i < size; ++i)
1772 {
1773 items_[i].__construct_from(STDEXEC::connect,
1774 set_next(this->rcvr_, item_sender_t{this, it + i}),
1775 next_receiver_t{this});
1776 STDEXEC::start(items_[i].__get());
1777 }
1778 std::unique_lock lock{this->start_mutex_};
1779 this->has_started_ = true;
1780 this->pool_.bulk_enqueue(remote_queue, std::move(this->tasks_), this->tasks_size_);
1781 }
1782 };
1783
1784 template <class Range>

Callers

nothing calls this directly

Calls 7

__uminFunction · 0.85
bulk_enqueueMethod · 0.80
startFunction · 0.70
sizeMethod · 0.45
available_parallelismMethod · 0.45
__construct_fromMethod · 0.45
__getMethod · 0.45

Tested by

no test coverage detected