Bridge++  Ver.2.1.3
aindex_eo-inc.h
Go to the documentation of this file.
1 
11 
13 #include "lib_alt_Accel/BridgeACC/bridgeACC_Index_eo_alt.h"
14 
15 #include <assert.h>
16 
17 //====================================================================
18 template<typename REALTYPE>
19 template <typename AFIELD>
21  AFIELD& field_o,
22  const AFIELD& field_lex)
23 {
24  typedef REALTYPE real_t;
25 
26 #pragma omp barrier
27 
28  int ith = ThreadManager::get_thread_id();
29  if (ith == 0) {
30  int Nin = field_lex.nin();
31  int Nex = field_lex.nex();
32  int Nvol = field_lex.nvol();
33  int Nvol2 = Nvol/2;
34 
35  int Nvol_pad = field_lex.nvol_pad();
36  int Nvol2_pad = field_e.nvol_pad();
37  assert(field_o.nvol_pad() == Nvol2_pad);
38 
39  assert(field_e.check_size(Nin, Nvol2, Nex));
40  assert(field_o.check_size(Nin, Nvol2, Nex));
41 
42  int ieo_org = ieo_origin();
43 
44  for(int ex = 0; ex < Nex; ++ex){
45  int idx_lex = IDX2(Nin, 0, Nvol_pad * ex);
46  int idx_eo = IDX2(Nin, 0, Nvol2_pad * ex);
47 
48  real_t *w = const_cast<AFIELD*>(&field_lex)->ptr(idx_lex);
49  real_t *ve = field_e.ptr(idx_eo);
50  real_t *vo = field_o.ptr(idx_eo);
51 
52  BridgeACC::split(ve, vo, w, ieo_org, Nin, m_Nsize);
53  }
54 
55  }
56 #pragma omp barrier
57 }
58 
59 //====================================================================
60 template<typename REALTYPE>
61 template <typename AFIELD>
63  AFIELD& field_e, const int ex_e,
64  AFIELD& field_o, const int ex_o,
65  const AFIELD& field_lex, const int ex)
66 {
67  typedef REALTYPE real_t;
68 
69 #pragma omp barrier
70 
71  int ith = ThreadManager::get_thread_id();
72  if (ith == 0) {
73  int Nin = field_lex.nin();
74  int Nvol = field_lex.nvol();
75  int Nvol2 = Nvol/2;
76 
77  int ieo_org = ieo_origin();
78  int Nvol_pad = field_lex.nvol_pad();
79  int Nvol2_pad = field_e.nvol_pad();
80  assert(field_o.nvol_pad() == Nvol2_pad);
81 
83  int idx_lex = index_lex.idx(0, Nin, 0, ex);
84 
85  int idx_e = idxh(0, Nin, 0, ex_e);
86  int idx_o = idxh(0, Nin, 0, ex_o);
87 
88  real_t *w = const_cast<AFIELD*>(&field_lex)->ptr(idx_lex);
89  real_t *ve = field_e.ptr(idx_e);
90  real_t *vo = field_o.ptr(idx_o);
91 
92  BridgeACC::split(ve, vo, w, ieo_org, Nin, m_Nsize);
93  }
94 
95 #pragma omp barrier
96 }
97 
98 //====================================================================
99 template<typename REALTYPE>
100 template <typename AFIELD>
102  AFIELD& Ueo, const AFIELD& Ulex)
103 {
104  typedef REALTYPE real_t;
105 
106 #pragma omp barrier
107 
108  int ith = ThreadManager::get_thread_id();
109  if (ith == 0) {
110  int Ndf = NDF;
111  int Ndim = NDIM;
112 
114 
115  int nvol_pad = Ulex.nvol_pad();
116  int nvol2_pad = Ueo.nvol_pad();
117 
118  for(int mu = 0; mu < Ndim; ++mu){
119  real_t *ue = Ueo.ptr(idxh(0, Ndf, 0, 2*mu));
120  real_t *uo = Ueo.ptr(idxh(0, Ndf, 0, 2*mu+1));
121  real_t *ulex = const_cast<AFIELD*>(&Ulex)->ptr(
122  index_lex.idx(0, Ndf, 0, mu));
123 
124  BridgeACC::split(ue, uo, ulex, ieo_origin(), Ndf, m_Nsize);
125  }
126  }
127 
128 #pragma omp barrier
129 }
130 
131 //====================================================================
132 template<typename REALTYPE>
133 template <typename AFIELD>
135  const AFIELD& field_e, const AFIELD& field_o)
136 {
137  typedef REALTYPE real_t;
138 
139 #pragma omp barrier
140 
141  int ith = ThreadManager::get_thread_id();
142  if (ith == 0) {
143  int Nin = field_lex.nin();
144  int Nex = field_lex.nex();
145  int Nvol = field_lex.nvol();
146  int Nvol2 = Nvol/2;
147 
148  int Nvol2_pad = field_e.nvol_pad();
149  int Nvol_pad = field_lex.nvol_pad();
150  assert(field_o.nvol_pad() == Nvol2_pad);
151 
152  assert(field_e.check_size(Nin, Nvol2, Nex));
153  assert(field_o.check_size(Nin, Nvol2, Nex));
154 
155  int ieo_org = ieo_origin();
156 
157  for(int ex = 0; ex < Nex; ++ex){
158  int idx_lex = IDX2(Nin, 0, Nvol_pad * ex);
159  int idx_eo = IDX2(Nin, 0, Nvol2_pad * ex);
160 
161  real_t *v = field_lex.ptr(idx_lex);
162  real_t *we = const_cast<AFIELD*>(&field_e)->ptr(idx_eo);
163  real_t *wo = const_cast<AFIELD*>(&field_o)->ptr(idx_eo);
164 
165  BridgeACC::merge(v, we, wo, ieo_org, Nin, m_Nsize);
166  }
167  }
168 
169 #pragma omp barrier
170 }
171 
172 //============================================================END=====
merge
void merge(real_t *RESTRICT v, real_t *RESTRICT we, real_t *RESTRICT wo, int ieo_origin, int nin, int *Nsize)
Definition: index_eo_alt_openacc-inc.h:74
AIndex_lex< REALTYPE, ACCEL >::idx
int idx(const int in, const int Nin, const int ist, const int ex) const
Definition: aindex_lex.h:69
AIndex_lex
Definition: aindex_lex_base.h:17
Field::nex
int nex() const
Definition: field.h:128
Field::check_size
bool check_size(const int nin, const int nvol, const int nex) const
checking size parameters. [23 May 2016 H.Matsufuru]
Definition: field.h:135
NDF
#define NDF
Definition: field_F_imp_SU2-inc.h:17
aindex_eo.h
AIndex_eo_accel::idxh
int idxh(const int in, const int Nin, const int ist2, const int Nvol2, const int ex)
Definition: aindex_eo.h:37
Field::nin
int nin() const
Definition: field.h:126
AIndex_lex< REALTYPE, ACCEL >
Lexical site index.
Definition: aindex_lex.h:31
split
void split(real_t *RESTRICT ve, real_t *RESTRICT vo, real_t *RESTRICT w, int ieo_origin, int nin, int *Nsize)
Definition: index_eo_alt_openacc-inc.h:14
BridgeACC::merge
void merge(double *RESTRICT v, double *RESTRICT we, double *RESTRICT wo, int ieo_origin, int nin, int *Nsize)
Definition: index_eo_alt_openacc-inc.h:74
Field::nvol
int nvol() const
Definition: field.h:127
real_t
double real_t
Definition: bridgeACC_AField_double.cpp:14
IDX2
#define IDX2(nin, in, ist)
Definition: define_index.h:28
define_index.h
Field::ptr
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:153
NDIM
#define NDIM
Definition: contract_4spinor.cpp:18
Field
Container of Field-type object.
Definition: field.h:46
ThreadManager::get_thread_id
static int get_thread_id()
returns thread id.
Definition: threadManager.cpp:253
BridgeACC::split
void split(double *RESTRICT ve, double *RESTRICT vo, double *RESTRICT w, int ieo_origin, int nin, int *Nsize)
Definition: index_eo_alt_openacc-inc.h:14
AIndex_eo
Definition: aindex_eo_base.h:17