Interface Documentation
Version: invalid
future.hh
Go to the documentation of this file.
1 /*
2  @@@@@@@@ @@ @@@@@@ @@@@@@@@ @@
3  /@@///// /@@ @@////@@ @@////// /@@
4  /@@ /@@ @@@@@ @@ // /@@ /@@
5  /@@@@@@@ /@@ @@///@@/@@ /@@@@@@@@@/@@
6  /@@//// /@@/@@@@@@@/@@ ////////@@/@@
7  /@@ /@@/@@//// //@@ @@ /@@/@@
8  /@@ @@@//@@@@@@ //@@@@@@ @@@@@@@@ /@@
9  // /// ////// ////// //////// //
10 
11  Copyright (c) 2016, Los Alamos National Security, LLC
12  All rights reserved.
13  */
14 #pragma once
15 
18 #include <flecsi-config.h>
19 
20 #if !defined(__FLECSI_PRIVATE__)
21 #error Do not include this file directly!
22 #endif
23 
24 #include "flecsi/exec/launch.hh"
25 
26 #if !defined(FLECSI_ENABLE_LEGION)
27 #error FLECSI_ENABLE_LEGION not defined! This file depends on Legion!
28 #endif
29 
30 #include <legion.h>
31 
32 namespace flecsi {
33 
34 template<typename Return>
35 struct future<Return> {
36 
40  void wait() const {
41  legion_future_.wait();
42  } // wait
43 
47  Return get(bool silence_warnings = false) const {
48  if constexpr(std::is_same_v<Return, void>)
49  return legion_future_.get_void_result(silence_warnings);
50  else
51  return legion_future_.get_result<Return>(silence_warnings);
52  } // get
53 
54  Legion::Future legion_future_;
55 };
56 
57 template<typename Return>
58 struct future<Return, exec::launch_type_t::index> {
62  void wait(bool silence_warnings = false) const {
63  legion_future_.wait_all_results(silence_warnings);
64  } // wait
65 
70  Return get(std::size_t index = 0, bool silence_warnings = false) const {
71  if constexpr(std::is_same_v<Return, void>)
72  return legion_future_.get_void_result(index, silence_warnings);
73  else
74  return legion_future_.get_result<Return>(index, silence_warnings);
75  } // get
76 
77  Legion::FutureMap legion_future_;
78 };
79 
80 } // namespace flecsi
void wait(bool silence_warnings=false) const
Definition: future.hh:62
void wait() const
Definition: future.hh:40
Definition: launch.hh:95
Definition: control.hh:31