Skip to content

Commit 65eb247

Browse files
author
Sai Charan
committed
define stdexec
1 parent c432ecb commit 65eb247

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ namespace hpx::execution::experimental {
215215
{
216216
auto shape_begin = hpx::util::begin(shape);
217217
auto args_tuple = hpx::make_tuple(HPX_FORWARD(Ts, ts)...);
218+
#if defined(HPX_HAVE_STDEXEC)
218219
return bulk(schedule(exec.sched_), hpx::execution::experimental::par,
220+
#else
221+
return bulk(schedule(exec.sched_), hpx::execution::par,
222+
#endif
219223
hpx::util::size(shape),
220224
[func = std::decay_t<F>(HPX_FORWARD(F, f)), shape_begin,
221225
args_tuple = HPX_MOVE(args_tuple)](auto idx) mutable {
@@ -254,14 +258,22 @@ namespace hpx::execution::experimental {
254258
return just(HPX_MOVE(result_vector), shape, HPX_FORWARD(F, f),
255259
HPX_FORWARD(Ts, ts)...) |
256260
continues_on(exec.sched_) |
261+
#if defined(HPX_HAVE_STDEXEC)
257262
bulk(hpx::execution::experimental::par, shape_size, HPX_MOVE(f_wrapper)) |
263+
#else
264+
bulk(hpx::execution::par, shape_size, HPX_MOVE(f_wrapper)) |
265+
#endif
258266
then(HPX_MOVE(get_result));
259267
#else
260268
// When stdexec is not available, use HPX's original bulk implementation
261269
return just(HPX_MOVE(result_vector), shape, HPX_FORWARD(F, f),
262270
HPX_FORWARD(Ts, ts)...) |
263271
continues_on(exec.sched_) |
272+
#if defined(HPX_HAVE_STDEXEC)
264273
bulk(hpx::execution::experimental::par, shape_size, HPX_MOVE(f_wrapper)) |
274+
#else
275+
bulk(hpx::execution::par, shape_size, HPX_MOVE(f_wrapper)) |
276+
#endif
265277
then(HPX_MOVE(get_result));
266278
#endif
267279
}

libs/core/executors/include/hpx/executors/scheduler_executor.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ namespace hpx::execution::experimental {
217217
{
218218
auto shape_begin = hpx::util::begin(shape);
219219
auto args_tuple = hpx::make_tuple(HPX_FORWARD(Ts, ts)...);
220+
#if defined(HPX_HAVE_STDEXEC)
220221
return make_future(bulk(schedule(exec.sched_), hpx::execution::experimental::par,
222+
#else
223+
return make_future(bulk(schedule(exec.sched_), hpx::execution::par,
224+
#endif
221225
hpx::util::size(shape),
222226
[func = std::decay_t<F>(HPX_FORWARD(F, f)), shape_begin,
223227
args_tuple = HPX_MOVE(args_tuple)](auto idx) mutable {
@@ -267,7 +271,11 @@ namespace hpx::execution::experimental {
267271
start_detached(
268272
bulk(transfer_just(exec.sched_, HPX_MOVE(promises),
269273
HPX_FORWARD(F, f), shape, HPX_FORWARD(Ts, ts)...),
274+
#if defined(HPX_HAVE_STDEXEC)
270275
hpx::execution::experimental::par, n, HPX_MOVE(f_helper)));
276+
#else
277+
hpx::execution::par, n, HPX_MOVE(f_helper)));
278+
#endif
271279

272280
return results;
273281
}
@@ -287,7 +295,11 @@ namespace hpx::execution::experimental {
287295
auto shape_begin = hpx::util::begin(shape);
288296
auto args_tuple = hpx::make_tuple(HPX_FORWARD(Ts, ts)...);
289297
hpx::this_thread::experimental::sync_wait(bulk(
298+
#if defined(HPX_HAVE_STDEXEC)
290299
schedule(exec.sched_), hpx::execution::experimental::par, hpx::util::size(shape),
300+
#else
301+
schedule(exec.sched_), hpx::execution::par, hpx::util::size(shape),
302+
#endif
291303
[func = std::decay_t<F>(HPX_FORWARD(F, f)), shape_begin,
292304
args_tuple = HPX_MOVE(args_tuple)](auto idx) mutable {
293305
auto it = shape_begin;
@@ -325,7 +337,11 @@ namespace hpx::execution::experimental {
325337
auto shape_begin = hpx::util::begin(shape);
326338
auto args_tuple = hpx::make_tuple(HPX_FORWARD(Ts, ts)...);
327339
auto loop = bulk(transfer(HPX_MOVE(pre_req), exec.sched_),
340+
#if defined(HPX_HAVE_STDEXEC)
328341
hpx::execution::experimental::par, hpx::util::size(shape),
342+
#else
343+
hpx::execution::par, hpx::util::size(shape),
344+
#endif
329345
[func = std::decay_t<F>(HPX_FORWARD(F, f)), shape_begin,
330346
args_tuple = HPX_MOVE(args_tuple)](auto idx) mutable {
331347
auto it = shape_begin;
@@ -350,7 +366,11 @@ namespace hpx::execution::experimental {
350366
auto shape_begin = hpx::util::begin(shape);
351367
auto args_tuple = hpx::make_tuple(HPX_FORWARD(Ts, ts)...);
352368
auto loop = bulk(transfer(HPX_MOVE(pre_req), exec.sched_),
369+
#if defined(HPX_HAVE_STDEXEC)
353370
hpx::execution::experimental::par, hpx::util::size(shape),
371+
#else
372+
hpx::execution::par, hpx::util::size(shape),
373+
#endif
354374
[func = std::decay_t<F>(HPX_FORWARD(F, f)), shape_begin,
355375
args_tuple = HPX_MOVE(args_tuple)](
356376
auto idx, std::vector<result_type>& results) mutable {

0 commit comments

Comments
 (0)