MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / operator()

Method operator()

examples/benchmark/static_thread_pool_bulk_enqueue.cpp:25–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23struct RunThread
24{
25 void operator()(exec::static_thread_pool& pool,
26 std::size_t total_scheds,
27 std::size_t tid,
28 std::barrier<>& barrier,
29#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
30 std::span<char> buffer,
31#endif
32 std::atomic<bool>& stop,
33 exec::numa_policy numa)
34 {
35 int numa_node = numa.thread_index_to_node(tid);
36 void(numa.bind_to_node(numa_node));
37 while (true)
38 {
39 barrier.arrive_and_wait();
40 if (stop.load())
41 {
42 break;
43 }
44#ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE
45 pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()};
46 pmr::polymorphic_allocator<char> alloc{&rsrc};
47 auto env = stdexec::prop{stdexec::get_allocator, alloc};
48 auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
49 auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
50 | exec::ignore_all_values() | stdexec::write_env(env);
51#else
52 auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
53 auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
54 | exec::ignore_all_values();
55#endif
56 stdexec::sync_wait(iterate);
57 barrier.arrive_and_wait();
58 }
59 }
60};
61
62struct my_numa_distribution : public exec::default_numa_policy

Callers

nothing calls this directly

Calls 7

even_shareFunction · 0.85
thread_index_to_nodeMethod · 0.45
bind_to_nodeMethod · 0.45
loadMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
available_parallelismMethod · 0.45

Tested by

no test coverage detected