Interface Documentation
Version: invalid
reduction_wrapper.hh
Go to the documentation of this file.
1 /*
2  @@@@@@@@ @@ @@@@@@ @@@@@@@@ @@
3  /@@///// /@@ @@////@@ @@////// /@@
4  /@@ /@@ @@@@@ @@ // /@@ /@@
5  /@@@@@@@ /@@ @@///@@/@@ /@@@@@@@@@/@@
6  /@@//// /@@/@@@@@@@/@@ ////////@@/@@
7  /@@ /@@/@@//// //@@ @@ /@@/@@
8  /@@ @@@//@@@@@@ //@@@@@@ @@@@@@@@ /@@
9  // /// ////// ////// //////// //
10 
11  Copyright (c) 2016, Triad National Security, LLC
12  All rights reserved.
13  */
14 #pragma once
15 
18 #if !defined(__FLECSI_PRIVATE__)
19 #error Do not include this file directly!
20 #endif
21 
22 #include "flecsi/exec/fold.hh"
23 #include "flecsi/run/backend.hh"
24 #include "flecsi/util/demangle.hh"
25 #include <flecsi/flog.hh>
26 
27 #include <legion.h>
28 
29 namespace flecsi {
30 
31 inline log::devel_tag reduction_wrapper_tag("reduction_wrapper");
32 
33 namespace exec {
34 
35 namespace detail {
40 template<class>
41 void register_reduction();
42 
43 inline Legion::ReductionOpID reduction_id;
44 } // namespace detail
45 
46 // NB: 0 is reserved by Legion.
47 template<class R>
48 inline const Legion::ReductionOpID reduction_op =
49  (run::context::instance().register_init(detail::register_reduction<R>),
50  ++detail::reduction_id);
51 
52 template<class TYPE>
53 void
54 detail::register_reduction() {
55  {
56  log::devel_guard guard(reduction_wrapper_tag);
57  flog_devel(info) << "registering reduction operation " << util::type<TYPE>()
58  << std::endl;
59  }
60 
61  // Register the operation with the Legion runtime
62  Legion::Runtime::register_reduction_op<TYPE>(reduction_op<TYPE>);
63 }
64 
65 } // namespace exec
66 } // namespace flecsi
Definition: flog.hh:82
void register_reduction()
Definition: reduction_wrapper.hh:54
Definition: control.hh:31