QUDA
v0.5.0
A library for QCD on GPUs
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
quda
lib
dirac_domain_wall.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <
dirac_quda.h
>
3
#include <
blas_quda.h
>
4
5
namespace
quda {
6
8
DiracDomainWall::DiracDomainWall
(
const
DiracParam
&
param
) :
9
DiracWilson
(param, 5), m5(param.m5),
kappa5
(0.5/(5.0 + m5)) { }
10
11
DiracDomainWall::DiracDomainWall
(
const
DiracDomainWall
&
dirac
) :
12
DiracWilson
(dirac), m5(dirac.m5),
kappa5
(0.5/(5.0 + m5)) { }
13
14
DiracDomainWall::~DiracDomainWall
() { }
15
16
DiracDomainWall
&
DiracDomainWall::operator=
(
const
DiracDomainWall
&
dirac
)
17
{
18
if
(&dirac !=
this
) {
19
DiracWilson::operator=
(dirac);
20
m5
= dirac.
m5
;
21
kappa5
= dirac.
kappa5
;
22
}
23
return
*
this
;
24
}
25
27
void
DiracDomainWall::Dslash
(
cudaColorSpinorField
&
out
,
const
cudaColorSpinorField
&
in
,
28
const
QudaParity
parity
)
const
29
{
30
if
( in.
Ndim
() != 5 || out.
Ndim
() != 5)
errorQuda
(
"Wrong number of dimensions\n"
);
31
checkParitySpinor
(in, out);
32
checkSpinorAlias
(in, out);
33
34
initSpinorConstants
(in);
35
setFace
(
face
);
// FIXME: temporary hack maintain C linkage for dslashCuda
36
domainWallDslashCuda
(&out,
gauge
, &in, parity,
dagger
, 0,
mass
, 0,
commDim
);
37
38
long
long
Ls
= in.
X
(4);
39
long
long
bulk = (Ls-2)*(in.
Volume
()/
Ls
);
40
long
long
wall = 2*in.
Volume
()/
Ls
;
41
flops
+= 1320LL*(
long
long)in.
Volume
() + 96LL*bulk + 120LL*wall;
42
}
43
45
void
DiracDomainWall::DslashXpay
(
cudaColorSpinorField
&
out
,
const
cudaColorSpinorField
&
in
,
46
const
QudaParity
parity
,
const
cudaColorSpinorField
&
x
,
47
const
double
&k)
const
48
{
49
if
( in.
Ndim
() != 5 || out.
Ndim
() != 5)
errorQuda
(
"Wrong number of dimensions\n"
);
50
checkParitySpinor
(in, out);
51
checkSpinorAlias
(in, out);
52
53
initSpinorConstants
(in);
54
setFace
(
face
);
// FIXME: temporary hack maintain C linkage for dslashCuda
55
domainWallDslashCuda
(&out,
gauge
, &in, parity,
dagger
, &x,
mass
, k,
commDim
);
56
57
long
long
Ls
= in.
X
(4);
58
long
long
bulk = (Ls-2)*(in.
Volume
()/
Ls
);
59
long
long
wall = 2*in.
Volume
()/
Ls
;
60
flops
+= (1320LL+48LL)*(
long
long
)in.
Volume
() + 96LL*bulk + 120LL*wall;
61
}
62
63
void
DiracDomainWall::M
(
cudaColorSpinorField
&
out
,
const
cudaColorSpinorField
&
in
)
const
64
{
65
checkFullSpinor
(out, in);
66
DslashXpay
(out.
Odd
(), in.
Even
(),
QUDA_ODD_PARITY
, in.
Odd
(), -
kappa5
);
67
DslashXpay
(out.
Even
(), in.
Odd
(),
QUDA_EVEN_PARITY
, in.
Even
(), -
kappa5
);
68
}
69
70
void
DiracDomainWall::MdagM
(
cudaColorSpinorField
&
out
,
const
cudaColorSpinorField
&
in
)
const
71
{
72
checkFullSpinor
(out, in);
73
74
bool
reset =
newTmp
(&
tmp1
, in);
75
76
M
(*
tmp1
, in);
77
Mdag
(out, *
tmp1
);
78
79
deleteTmp
(&
tmp1
, reset);
80
}
81
82
void
DiracDomainWall::prepare
(
cudaColorSpinorField
* &src,
cudaColorSpinorField
* &sol,
83
cudaColorSpinorField
&
x
,
cudaColorSpinorField
&b,
84
const
QudaSolutionType
solType)
const
85
{
86
if
(solType ==
QUDA_MATPC_SOLUTION
|| solType ==
QUDA_MATPCDAG_MATPC_SOLUTION
) {
87
errorQuda
(
"Preconditioned solution requires a preconditioned solve_type"
);
88
}
89
90
src = &b;
91
sol = &
x
;
92
}
93
94
void
DiracDomainWall::reconstruct
(
cudaColorSpinorField
&
x
,
const
cudaColorSpinorField
&b,
95
const
QudaSolutionType
solType)
const
96
{
97
// do nothing
98
}
99
100
DiracDomainWallPC::DiracDomainWallPC
(
const
DiracParam
&
param
)
101
:
DiracDomainWall
(param)
102
{
103
104
}
105
106
DiracDomainWallPC::DiracDomainWallPC
(
const
DiracDomainWallPC
&
dirac
)
107
:
DiracDomainWall
(dirac)
108
{
109
110
}
111
112
DiracDomainWallPC::~DiracDomainWallPC
()
113
{
114
115
}
116
117
DiracDomainWallPC
&
DiracDomainWallPC::operator=
(
const
DiracDomainWallPC
&
dirac
)
118
{
119
if
(&dirac !=
this
) {
120
DiracDomainWall::operator=
(dirac);
121
}
122
123
return
*
this
;
124
}
125
126
// Apply the even-odd preconditioned clover-improved Dirac operator
127
void
DiracDomainWallPC::M
(
cudaColorSpinorField
&
out
,
const
cudaColorSpinorField
&
in
)
const
128
{
129
if
( in.
Ndim
() != 5 || out.
Ndim
() != 5)
errorQuda
(
"Wrong number of dimensions\n"
);
130
double
kappa2 = -
kappa5
*
kappa5
;
131
132
bool
reset =
newTmp
(&
tmp1
, in);
133
134
if
(
matpcType
==
QUDA_MATPC_EVEN_EVEN
) {
135
Dslash
(*
tmp1
, in,
QUDA_ODD_PARITY
);
136
DslashXpay
(out, *
tmp1
,
QUDA_EVEN_PARITY
, in, kappa2);
137
}
else
if
(
matpcType
==
QUDA_MATPC_ODD_ODD
) {
138
Dslash
(*
tmp1
, in,
QUDA_EVEN_PARITY
);
139
DslashXpay
(out, *
tmp1
,
QUDA_ODD_PARITY
, in, kappa2);
140
}
else
{
141
errorQuda
(
"MatPCType %d not valid for DiracDomainWallPC"
,
matpcType
);
142
}
143
144
deleteTmp
(&
tmp1
, reset);
145
}
146
147
void
DiracDomainWallPC::MdagM
(
cudaColorSpinorField
&
out
,
const
cudaColorSpinorField
&
in
)
const
148
{
149
#ifdef MULTI_GPU
150
bool
reset =
newTmp
(&
tmp2
, in);
151
M
(*
tmp2
, in);
152
Mdag
(out, *
tmp2
);
153
deleteTmp
(&
tmp2
, reset);
154
#else
155
M
(out, in);
156
Mdag
(out, out);
157
#endif
158
}
159
160
void
DiracDomainWallPC::prepare
(
cudaColorSpinorField
* &src,
cudaColorSpinorField
* &sol,
161
cudaColorSpinorField
&
x
,
cudaColorSpinorField
&b,
162
const
QudaSolutionType
solType)
const
163
{
164
// we desire solution to preconditioned system
165
if
(solType ==
QUDA_MATPC_SOLUTION
|| solType ==
QUDA_MATPCDAG_MATPC_SOLUTION
) {
166
src = &b;
167
sol = &
x
;
168
}
else
{
169
// we desire solution to full system
170
if
(
matpcType
==
QUDA_MATPC_EVEN_EVEN
) {
171
// src = b_e + k D_eo b_o
172
DslashXpay
(x.
Odd
(), b.
Odd
(),
QUDA_EVEN_PARITY
, b.
Even
(),
kappa5
);
173
src = &(x.
Odd
());
174
sol = &(x.
Even
());
175
}
else
if
(
matpcType
==
QUDA_MATPC_ODD_ODD
) {
176
// src = b_o + k D_oe b_e
177
DslashXpay
(x.
Even
(), b.
Even
(),
QUDA_ODD_PARITY
, b.
Odd
(),
kappa5
);
178
src = &(x.
Even
());
179
sol = &(x.
Odd
());
180
}
else
{
181
errorQuda
(
"MatPCType %d not valid for DiracDomainWallPC"
,
matpcType
);
182
}
183
// here we use final solution to store parity solution and parity source
184
// b is now up for grabs if we want
185
}
186
187
}
188
189
void
DiracDomainWallPC::reconstruct
(
cudaColorSpinorField
&
x
,
const
cudaColorSpinorField
&b,
190
const
QudaSolutionType
solType)
const
191
{
192
if
(solType ==
QUDA_MATPC_SOLUTION
|| solType ==
QUDA_MATPCDAG_MATPC_SOLUTION
) {
193
return
;
194
}
195
196
// create full solution
197
198
checkFullSpinor
(x, b);
199
if
(
matpcType
==
QUDA_MATPC_EVEN_EVEN
) {
200
// x_o = b_o + k D_oe x_e
201
DslashXpay
(x.
Odd
(), x.
Even
(),
QUDA_ODD_PARITY
, b.
Odd
(),
kappa5
);
202
}
else
if
(
matpcType
==
QUDA_MATPC_ODD_ODD
) {
203
// x_e = b_e + k D_eo x_o
204
DslashXpay
(x.
Even
(), x.
Odd
(),
QUDA_EVEN_PARITY
, b.
Even
(),
kappa5
);
205
}
else
{
206
errorQuda
(
"MatPCType %d not valid for DiracDomainWallPC"
,
matpcType
);
207
}
208
}
209
210
}
// namespace quda
Generated on Wed Mar 20 2013 12:52:14 for QUDA by
1.8.2