FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
remote_lambda.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
9#include <kernel/util/dist.hpp>
10#include <kernel/util/math.hpp>
11#include <kernel/util/string.hpp>
12
13#include <array>
14#include <numeric>
15#include <tuple>
16#include <type_traits>
17#include <vector>
18
19namespace FEAT::Global
20{
21 namespace Intern
22 {
34 template<typename T_>
35 int pack_size(const Dist::Comm& comm)
36 {
37 int size(0);
38 comm.pack_size<T_>(1, &size);
39 return size;
40 }
41
51 template<typename... Ts_>
52 int tuple_pack_size(const Dist::Comm& comm)
53 {
54 // NOTE: std::decay_t and std::remove_reference_t don't seem to work in fold expressions
55 return (pack_size<typename std::decay<typename std::remove_reference<Ts_>::type>::type>(comm) + ...);
56 }
57
58 template<typename... Ts_>
59 using TypeCache = std::array<const Dist::Datatype*, sizeof...(Ts_)>;
60
62 template<std::size_t i = 0, typename... Ts_>
63 void _fill_type_cache(TypeCache<Ts_...>& cache)
64 {
65 if constexpr(i < sizeof...(Ts_))
66 {
67 using T = std::decay_t<std::remove_reference_t<std::tuple_element_t<i, std::tuple<Ts_...>>>>;
68 cache[i] = &Dist::autotype<T>();
69 _fill_type_cache<i + 1, Ts_...>(cache);
70 }
71 }
72
80 template<typename... Ts_>
81 TypeCache<Ts_...> make_type_cache()
82 {
83 TypeCache<Ts_...> result;
84 _fill_type_cache<0, Ts_...>(result);
85 return result;
86 }
87
100 template<std::size_t i = 0, typename... Ts_>
101 void pack_tuple(
102 const Dist::Comm& comm,
103 const std::tuple<Ts_...>& tuple,
104 const TypeCache<Ts_...>& cache,
105 void* outbuf,
106 std::size_t outsize,
107 int* position)
108 {
109 using T = std::decay_t<std::remove_reference_t<decltype(std::get<i>(tuple))>>;
110
111 const T& t = std::get<i>(tuple);
112 comm.pack(&t, 1, *cache[i], outbuf, outsize, position);
113
114 if constexpr(i + 1 != sizeof...(Ts_))
115 {
116 pack_tuple<i + 1>(comm, tuple, cache, outbuf, outsize, position);
117 }
118 }
119
132 template<std::size_t i = 0, typename... Ts_>
133 void unpack_tuple(
134 const Dist::Comm& comm,
135 std::tuple<Ts_...>& tuple,
136 const TypeCache<Ts_...>& cache,
137 const void* inbuf,
138 std::size_t insize,
139 int* position)
140 {
141 using T = std::decay_t<std::remove_reference_t<decltype(std::get<i>(tuple))>>;
142
143 T& t = std::get<i>(tuple);
144 comm.unpack(inbuf, insize, position, &t, 1, *cache[i]);
145
146 if constexpr(i + 1 != sizeof...(Ts_))
147 {
148 unpack_tuple<i + 1>(comm, tuple, cache, inbuf, insize, position);
149 }
150 }
151
162 template<typename Range_>
163 auto nth_of_range(const Range_& r, Index n) -> decltype(*r.begin())&
164 {
165 auto it = r.begin();
166 std::advance(it, n);
167 return *it;
168 }
169
178 template<typename... T_>
179 using NormalizedTuple =
180 std::tuple<typename std::decay<typename std::remove_reference<T_>::type>::type...>; // NOLINT
181 } // namespace Intern
182
183#ifdef FEAT_HAVE_MPI
190 template<typename T_>
191 class ScalarRemoteLambda;
192
204 template<typename R_, typename... Args_>
205 class ScalarRemoteLambda<R_(Args_...)>
206 {
207 public:
209 using ReturnType = R_;
210
212 using ArgumentTuple = Intern::NormalizedTuple<Args_...>;
213
214 private:
216 static constexpr int tag_argument = 1;
218 static constexpr int tag_return = 2;
220 Dist::Comm _comm;
221
222 public:
224 explicit ScalarRemoteLambda(const Dist::Comm& comm) : _comm(comm.comm_dup())
225 {
226 }
227
265 template<typename RankRange_, typename IndexRange_, typename ArgsRange_, typename Lambda_>
266 std::vector<ReturnType>
267 call(const RankRange_& ranks, const IndexRange_& indices, const ArgsRange_& args, Lambda_ lambda)
268 {
269 XASSERTM(
270 std::distance(ranks.begin(), ranks.end()) == std::distance(indices.begin(), indices.end()),
271 "size mismatch between ranks and indices");
272
273 const auto num_ranks = (std::size_t)_comm.size();
274 const auto num_calls = (std::size_t)std::distance(ranks.begin(), ranks.end());
275 const auto pack_size = (std::size_t)Intern::tuple_pack_size<Args_...>(_comm);
276
278 // Phase 1 - Exchange number of calls
280
281 // NOTE: Arguments are batched. If rank A wants to (in total) perform
282 // three lambda calls on rank B, then a single message containing three
283 // argument tuples is sent. The number of calls is only relevant to
284 // allocate appropriate buffers.
285
286 // Number of incoming lambda calls
287 std::vector<int> calls_from(num_ranks, 0);
288 // Number of outgoing lambda calls
289 std::vector<int> calls_to(num_ranks, 0);
290 {
291 for(auto i : ranks)
292 {
293 calls_to[(std::size_t)i] += 1;
294 }
295
296 // Sync number of calls across all ranks
297 _comm.alltoall(calls_to.data(), 1, calls_from.data(), 1);
298 }
299
301 // Phase 2 - Create required buffers
303
304 // Buffer for sending arguments
305 std::vector<std::vector<char>> argument_s_buffers(num_ranks);
306 // Buffer for receiving arguments
307 std::vector<std::vector<char>> argument_r_buffers(num_ranks);
308 // Buffer for sending return values
309 std::vector<std::vector<ReturnType>> return_s_buffers(num_ranks);
310 // Buffer for receiving return values
311 std::vector<std::vector<ReturnType>> return_r_buffers(num_ranks);
312
313 for(Index rank(0); rank < num_ranks; rank++)
314 {
315 // We send as many arguments to rank r as our local sendcount for rank r
316 argument_s_buffers[rank].resize(std::size_t(calls_to[rank]) * pack_size);
317 // We receive as many arguments from rank r as our local receivecount for rank r
318 argument_r_buffers[rank].resize(std::size_t(calls_from[rank]) * pack_size);
319
320 // We send as many return values to rank r as we received arguments from rank r
321 return_s_buffers[rank] = std::vector<ReturnType>(std::size_t(calls_from[rank]));
322 // We receive as many return values from rank r as we sent arguments to rank r
323 return_r_buffers[rank] = std::vector<ReturnType>(std::size_t(calls_to[rank]));
324 }
325
327 // Phase 3 - Pack argument buffers
329
330 // Packing and unpacking tuples requires access to the Dist::Datatypes of the tuple elements.
331 // For non-standard types this requires looking them up in the TypeRegistry, which is behind a mutex.
332 // We cache the datatypes once and then re-use them for packing and unpacking each tuple.
333
334 Intern::TypeCache<Args_...> cache = Intern::make_type_cache<Args_...>();
335
336 // argument_buffer_pos[r] is the current offset into argument_r_buffer[r]
337 std::vector<int> argument_buffer_pos(num_ranks, 0);
338 {
339 auto rank_iter = ranks.begin();
340 auto index_iter = indices.begin();
341
342 while(rank_iter != ranks.end())
343 {
344 const Index idx = *index_iter++;
345 const Index rank = Index(*rank_iter++);
346 const ArgumentTuple& arg = Intern::nth_of_range(args, idx);
347
348 // Pack tuple for sending arg, appends to current buffer
349 Intern::pack_tuple(_comm, arg, cache, argument_s_buffers[rank].data(), argument_s_buffers[rank].size(), &argument_buffer_pos[rank]);
350 }
351 }
352
354 // Phase 4 - Send args and receive results
356
357 Dist::RequestVector arg_sends;
358 Dist::RequestVector result_receives;
359 {
360 for(Index rank(0); rank < num_ranks; rank++)
361 {
362 // Send packed argument buffer to intended rank
363 arg_sends.push_back(_comm.isend(argument_s_buffers[rank].data(), (std::size_t)argument_buffer_pos[rank], (int)rank, tag_argument));
364
365 // Post receive for results from this rank
366 result_receives.push_back(_comm.irecv(return_r_buffers[rank].data(), return_r_buffers[rank].size(), (int)rank, tag_return));
367 }
368 }
369
371 // Phase 5 - Receive args and send results
373
374 Dist::RequestVector arg_receives;
375 for(Index rank(0); rank < num_ranks; rank++)
376 {
377 // Post receive for incoming arguments
378 arg_receives.push_back(_comm.irecv(argument_r_buffers[rank].data(), argument_r_buffers[rank].size(), (int)rank, tag_argument));
379 }
380
381 // For all incoming arguments, handle them in order and write their results into the appropriate send buffer
382 Dist::RequestVector result_sends;
383 {
384 std::size_t idx(0);
385 Dist::Status status;
386
387 while(arg_receives.wait_any(idx, status))
388 {
389 auto rank = Index(status.source());
390
391 int pos(0);
392 for(Index arg(0); arg < Index(calls_from[rank]); arg++)
393 {
394 ArgumentTuple t;
395 Intern::unpack_tuple(_comm, t, cache, argument_r_buffers[rank].data(), argument_r_buffers[rank].size(), &pos);
396
397 return_s_buffers[rank][arg] = std::apply(lambda, t);
398 }
399 }
400 }
401
402 // Post sends for return values
403 for(Index rank(0); rank < num_ranks; rank++)
404 {
405 result_sends.push_back(_comm.isend(return_s_buffers[rank].data(), return_s_buffers[rank].size(), (int)rank, tag_return));
406 }
407
409 // Phase 6 - Merge batches back into final result
411
412 arg_sends.wait_all();
413 arg_receives.wait_all();
414 result_sends.wait_all();
415 result_receives.wait_all();
416
417 // We now have the results of all lambda calls, sorted by rank We need to
418 // remap these into the order of lambda calls originally given by the
419 // user, so that the user knows which return value belongs to which call
420 std::vector<ReturnType> result(num_calls);
421 std::vector<Index> result_pos(num_ranks, 0);
422 {
423 auto rank_iter = ranks.begin();
424
425 Index idx(0);
426 while(rank_iter != ranks.end())
427 {
428 const Index rank = Index(*rank_iter++);
429
430 result[idx++] = return_r_buffers[rank][result_pos[rank]++];
431 }
432 }
433
434 return result;
435 }
436 };
437
438 // NOTE(mmuegge): Originally both ScalarRemoteLambda and VectorRemoteLambda were
439 // just specialization of RemoteLambda:
440 // RemoteLambda<R(Args...)> and RemoteLambda<Range<R>(Args...)>
441 // But icx < 2025 is unable to properly choose the Range specialization for lambdas returning
442 // e.g. std::vectors.
443 // Thus the two cases were split into separate classes, both taking a simple function type parameter.
444
451 template<typename T_>
452 class VectorRemoteLambda;
453
467 template<typename R_, typename... Args_>
468 class VectorRemoteLambda<R_(Args_...)>
469 {
470 public:
472 using ReturnType = R_;
474 using ArgumentTuple = Intern::NormalizedTuple<Args_...>;
475
476 private:
478 static constexpr int tag_argument = 1;
480 static constexpr int tag_return = 2;
482 static constexpr int tag_size = 3;
484 Dist::Comm _comm;
485
486 public:
488 explicit VectorRemoteLambda(const Dist::Comm& comm) : _comm(comm.comm_dup())
489 {
490 }
491
530 template<typename RankRange_, typename IndexRange_, typename ArgsRange_, typename Lambda_>
531 std::vector<ReturnType>
532 call(const RankRange_& ranks, const IndexRange_& indices, const ArgsRange_& args, Lambda_ lambda)
533 {
534 // Inner type of ranges returned by lambda
535 using ValueType = std::decay_t<std::remove_reference_t<decltype(*std::declval<ReturnType>().begin())>>;
536
537 XASSERTM(
538 std::distance(ranks.begin(), ranks.end()) == std::distance(indices.begin(), indices.end()),
539 "size mismatch between ranks and indices");
540
541 const auto num_ranks = (std::size_t)_comm.size();
542 const auto num_calls = (std::size_t)std::distance(ranks.begin(), ranks.end());
543 const auto pack_size = (std::size_t)Intern::tuple_pack_size<Args_...>(_comm);
544
546 // Phase 1 - Exchange number of calls
548
549 // NOTE: Arguments are batched. If rank A wants to (in total) perform
550 // three lambda calls on rank B, then a single message containing three
551 // argument tuples is sent. The number of calls is only relevant to
552 // allocate appropriate buffers.
553
554 // Number of incoming lambda calls
555 std::vector<int> calls_from(num_ranks, 0);
556 // Number of outgoing lambda calls
557 std::vector<int> calls_to(num_ranks, 0);
558 {
559 for(auto i : ranks)
560 {
561 calls_to[(std::size_t)i] += 1;
562 }
563
564 // Sync number of calls across all ranks
565 _comm.alltoall(calls_to.data(), 1, calls_from.data(), 1);
566 }
567
569 // Phase 2 - Create required buffers
571
572 std::vector<std::vector<char>> argument_s_buffers(num_ranks);
573 std::vector<std::vector<char>> argument_r_buffers(num_ranks);
574 std::vector<std::vector<std::size_t>> range_size_s_buffers(num_ranks);
575 std::vector<std::vector<std::size_t>> range_size_r_buffers(num_ranks);
576 for(Index rank(0); rank < num_ranks; rank++)
577 {
578 // We send as many arguments to rank r as our local sendcount for rank r
579 argument_s_buffers[rank].resize(std::size_t(calls_to[rank]) * pack_size);
580 // We receive as many arguments from rank r as our local receivecount for rank r
581 argument_r_buffers[rank].resize(std::size_t(calls_from[rank]) * pack_size);
582
583 // We send as many range sizes to rank r as we received arguments from rank r
584 range_size_s_buffers[rank].resize(std::size_t(calls_from[rank]));
585 // We receive as many range sizes from rank r as we sent argument to rank r
586 range_size_r_buffers[rank].resize(std::size_t(calls_to[rank]));
587 }
588
590 // Phase 3 - Pack argument buffers
592
593 // Packing and unpacking tuples requires access to the Dist::Datatypes of the tuple elements.
594 // For non-standard types this requires looking them up in the TypeRegistry, which is behind a mutex.
595 // We cache the datatypes once and then re-use them for packing and unpacking each tuple.
596
597 Intern::TypeCache<Args_...> cache = Intern::make_type_cache<Args_...>();
598
599 // argument_buffer_pos[r] is the current offset into argument_r_buffer[r]
600 std::vector<int> argument_buffer_pos(num_ranks, 0);
601 {
602 auto rank_iter = ranks.begin();
603 auto index_iter = indices.begin();
604
605 while(rank_iter != ranks.end())
606 {
607 const Index idx = *index_iter++;
608 const Index rank = Index(*rank_iter++);
609 const ArgumentTuple& arg = Intern::nth_of_range(args, idx);
610
611 // Pack tuple for sending arg
612 Intern::pack_tuple(_comm, arg, cache, argument_s_buffers[rank].data(), argument_s_buffers[rank].size(), &argument_buffer_pos[rank]);
613 }
614 }
615
617 // Phase 4 - Send args and receive sizes of ranges
619
620 Dist::RequestVector arg_sends;
621 Dist::RequestVector size_receives;
622 {
623 for(Index rank(0); rank < num_ranks; rank++)
624 {
625 // Send packed argument buffer to intended rank
626 arg_sends.push_back(_comm.isend(argument_s_buffers[rank].data(), (std::size_t)argument_buffer_pos[rank], (int)rank, tag_argument));
627
628 // Post receive for range sizes from this rank
629 size_receives.push_back(_comm.irecv(range_size_r_buffers[rank].data(), range_size_r_buffers[rank].size(), (int)rank, tag_size));
630 }
631 }
632
634 // Phase 5 - Receive args and send range sizes and ranges
636
637 Dist::RequestVector arg_receives;
638 for(Index rank(0); rank < num_ranks; rank++)
639 {
640 // Post receive for argument buffer
641 arg_receives.push_back(_comm.irecv(argument_r_buffers[rank].data(), argument_r_buffers[rank].size(), (int)rank, tag_argument));
642 }
643
644 Dist::RequestVector range_sends;
645 Dist::RequestVector size_sends;
646
647 std::vector<std::vector<ValueType>> return_s_buffers(num_ranks);
648 {
649 std::size_t idx(0);
650 Dist::Status status;
651
652 while(arg_receives.wait_any(idx, status))
653 {
654 auto rank = Index(status.source());
655
656 int pos(0);
657 for(Index arg(0); arg < Index(calls_from[rank]); arg++)
658 {
659 // Unpack argument
660 ArgumentTuple t;
661 Intern::unpack_tuple(_comm, t, cache, argument_r_buffers[rank].data(), argument_r_buffers[rank].size(), &pos);
662
663 // Create result range
664 auto range = std::apply(lambda, t);
665
666 // Record range size so that range can be reconstructed after sending
667 range_size_s_buffers[rank][arg] = (std::size_t)std::distance(range.begin(), range.end());
668
669 // Append range values to sendbuffer for that rank
670 return_s_buffers[rank].insert(return_s_buffers[rank].end(), range.begin(), range.end());
671 }
672 }
673 }
674
675 for(Index rank(0); rank < num_ranks; rank++)
676 {
677 // Post sends for range sizes
678 size_sends.push_back(_comm.isend(range_size_s_buffers[rank].data(), range_size_s_buffers[rank].size(), (int)rank, tag_size));
679
680 // Post sends for ranges
681 range_sends.push_back(_comm.isend(return_s_buffers[rank].data(), return_s_buffers[rank].size(), (int)rank, tag_return));
682 }
683
685 // Phase 5 - Receive range sizes and ranges
687
688 size_sends.wait_all();
689 size_receives.wait_all();
690
691 // Allocate return values buffer for each rank
692 // Each buffer must be large enough to receive all values of all generated ranges
693 std::vector<std::vector<ValueType>> return_r_buffers(num_ranks);
694 for(Index rank(0); rank < num_ranks; rank++)
695 {
696 return_r_buffers[rank].resize(std::accumulate(range_size_r_buffers[rank].begin(), range_size_r_buffers[rank].end(), 0ULL));
697 }
698
699 Dist::RequestVector range_receives;
700 for(Index rank(0); rank < num_ranks; rank++)
701 {
702 // Post receives for ranges
703 range_receives.push_back(_comm.irecv(return_r_buffers[rank].data(), return_r_buffers[rank].size(), (int)rank, tag_return));
704 }
705
707 // Phase 6 - Reconstruct ranges
709
710 arg_sends.wait_all();
711 arg_receives.wait_all();
712 range_receives.wait_all();
713 range_sends.wait_all();
714
715 // We now have the returned ranges from each rank as one long array, plus the sizes of the individual ranges
716 // We now reconstruct the original ranges, by taking subranges according to the range sizes.
717 std::vector<std::vector<ReturnType>> ranges(num_ranks);
718
719 for(Index rank(0); rank < num_ranks; rank++)
720 {
721 Index start(0);
722
723 for(Index arg(0); arg < Index(calls_to[rank]); arg++)
724 {
725 auto size = range_size_r_buffers[rank][arg];
726 auto begin = return_r_buffers[rank].data() + start;
727 auto end = return_r_buffers[rank].data() + start + size;
728 ranges[rank].emplace_back(begin, end);
729 start += size;
730 }
731 }
732
733 // Same as in the scalar case, we now have the returned ranges sorted by rank
734 // We need to reorder them so that they match the order of the original lambda calls,
735 // so that the user knows which range belongs to which call.
736 std::vector<ReturnType> result(num_calls);
737 std::vector<Index> result_pos(num_ranks, 0);
738 {
739 auto rank_iter = ranks.begin();
740
741 Index idx(0);
742 while(rank_iter != ranks.end())
743 {
744 const Index rank = Index(*rank_iter++);
745
746 result[idx++] = std::move(ranges[rank][result_pos[rank]++]);
747 }
748 }
749
750 return result;
751 }
752 };
753#else // FEAT_HAVE_MPI
760 template<typename T_>
762
774 template<typename R_, typename... Args_>
775 class ScalarRemoteLambda<R_(Args_...)>
776 {
777 public:
779 using ReturnType = R_;
780
782 using ArgumentTuple = Intern::NormalizedTuple<Args_...>;
783
784 private:
786 static constexpr int tag_argument = 1;
788 static constexpr int tag_return = 2;
791
792 public:
794 explicit ScalarRemoteLambda(const Dist::Comm& comm) : _comm(comm.comm_dup())
795 {
796 }
797
827 template<typename RankRange_, typename IndexRange_, typename ArgsRange_, typename Lambda_>
828 std::vector<ReturnType>
829 call(const RankRange_& ranks, const IndexRange_& indices, const ArgsRange_& args, Lambda_ lambda)
830 {
831 XASSERTM(
832 std::distance(ranks.begin(), ranks.end()) == std::distance(indices.begin(), indices.end()),
833 "size mismatch between ranks and indices");
834
835 const auto num_calls = (std::size_t)std::distance(ranks.begin(), ranks.end());
836
837 std::vector<ReturnType> result;
838 result.reserve(num_calls);
839
840 auto rank_iter = ranks.begin();
841 auto index_iter = indices.begin();
842 while(rank_iter != ranks.end())
843 {
844 const Index idx = *index_iter++;
845 const int rank = *rank_iter++;
846 const ArgumentTuple& arg = Intern::nth_of_range(args, idx);
847
848 XASSERTM(rank == 0, "invalid rank for non-mpi RemoteLambda");
849
850 result.push_back(std::apply(lambda, arg));
851 }
852
853 return result;
854 }
855 };
856
863 template<typename T_>
865
881 template<typename R_, typename... Args_>
882 class VectorRemoteLambda<R_(Args_...)>
883 {
884 public:
886 using ReturnType = R_;
888 using ArgumentTuple = Intern::NormalizedTuple<Args_...>;
889
890 private:
892 static constexpr int tag_argument = 1;
894 static constexpr int tag_return = 2;
896 static constexpr int tag_size = 3;
899
900 public:
902 explicit VectorRemoteLambda(const Dist::Comm& comm) : _comm(comm.comm_dup())
903 {
904 }
905
935 template<typename RankRange_, typename IndexRange_, typename ArgsRange_, typename Lambda_>
936 std::vector<ReturnType>
937 call(const RankRange_& ranks, const IndexRange_& indices, const ArgsRange_& args, Lambda_ lambda)
938 {
939 XASSERTM(
940 std::distance(ranks.begin(), ranks.end()) == std::distance(indices.begin(), indices.end()),
941 "size mismatch between ranks and indices");
942
943 const auto num_calls = (std::size_t)std::distance(ranks.begin(), ranks.end());
944
945 std::vector<ReturnType> result;
946 result.reserve(num_calls);
947
948 auto rank_iter = ranks.begin();
949 auto index_iter = indices.begin();
950 while(rank_iter != ranks.end())
951 {
952 const Index idx = *index_iter++;
953 const int rank = *rank_iter++;
954 const ArgumentTuple& arg = Intern::nth_of_range(args, idx);
955
956 XASSERTM(rank == 0, "invalid rank for non-mpi RemoteLambda");
957
958 result.push_back(std::apply(lambda, arg));
959 }
960
961 return result;
962 }
963 };
964#endif
965} // namespace FEAT::Global
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Definition: assertion.hpp:263
FEAT Kernel base header.
Communicator class.
Definition: dist.hpp:1657
R_ ReturnType
Return type of the lambda function.
Intern::NormalizedTuple< Args_... > ArgumentTuple
Tuple of arguments for the lambda function.
Dist::Comm _comm
The communicator used by the remote lambda.
std::vector< ReturnType > call(const RankRange_ &ranks, const IndexRange_ &indices, const ArgsRange_ &args, Lambda_ lambda)
Remote lambda call.
ScalarRemoteLambda(const Dist::Comm &comm)
Constructor.
MPI-abstraction for running scalar lambdas on other ranks.
Intern::NormalizedTuple< Args_... > ArgumentTuple
Argument tuple type for lambda.
R_ ReturnType
Range type returned by lambda.
std::vector< ReturnType > call(const RankRange_ &ranks, const IndexRange_ &indices, const ArgsRange_ &args, Lambda_ lambda)
Remote lambda call.
VectorRemoteLambda(const Dist::Comm &comm)
Constructor.
Dist::Comm _comm
Communicator used by this remote lambda.
MPI-abstraction for running vector-valued lambdas on other ranks.
Global linear algebra namespace.
std::uint64_t Index
Index data type.