Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LGPU FPP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fernando Pérez Panadero
LGPU FPP
Commits
f37325ef
Commit
f37325ef
authored
May 03, 2023
by
Fernando Pérez Panadero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fP and fA test for SF
parent
91e664c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
0 deletions
+150
-0
test/dirac/test_fp_fa.jl
test/dirac/test_fp_fa.jl
+149
-0
test/runtests.jl
test/runtests.jl
+1
-0
No files found.
test/dirac/test_fp_fa.jl
0 → 100644
View file @
f37325ef
using
LatticeGPU
using
CUDA
function
bndpropagator
(
U
,
dpar
::
DiracParam
{
T
},
dws
::
DiracWorkspace
,
lp
::
SpaceParm
{
4
,
6
,
1
,
D
},
maxiter
::
Int64
,
tol
::
Float64
,
c
::
Int64
,
s
::
Int64
)
where
{
T
,
D
}
function
krnlg5
!
(
src
)
b
=
Int64
(
CUDA
.
threadIdx
()
.
x
)
r
=
Int64
(
CUDA
.
blockIdx
()
.
x
)
src
[
b
,
r
]
=
dmul
(
Gamma
{
5
},
src
[
b
,
r
])
return
nothing
end
function
krnl_assign_bndsrc
!
(
src
,
U
,
lp
::
SpaceParm
,
c
::
Int64
,
s
::
Int64
)
b
=
Int64
(
CUDA
.
threadIdx
()
.
x
)
r
=
Int64
(
CUDA
.
blockIdx
()
.
x
)
if
(
point_time
((
b
,
r
),
lp
)
==
2
)
bd4
,
rd4
=
dw
((
b
,
r
),
4
,
lp
)
src
[
b
,
r
]
=
gdagpmul
(
Pgamma
{
4
,
1
},
U
[
bd4
,
4
,
rd4
],
Spinor
{
4
,
SU3fund
{
Float64
}}(
ntuple
(
i
->
(
i
==
s
)
*
SU3fund
{
Float64
}(
ntuple
(
j
->
(
j
==
c
)
*
1.0
,
3
)
...
),
4
)))
/
2
end
return
nothing
end
pro
=
scalar_field
(
Spinor
{
4
,
SU3fund
{
Float64
}},
lp
)
src
=
fill!
(
scalar_field
(
Spinor
{
4
,
SU3fund
{
Float64
}},
lp
),
zero
(
eltype
(
scalar_field
(
Spinor
{
4
,
SU3fund
{
Float64
}},
lp
))))
CUDA
.
@sync
begin
CUDA
.
@cuda
threads
=
lp
.
bsz
blocks
=
lp
.
rsz
krnl_assign_bndsrc!
(
src
,
U
,
lp
,
c
,
s
)
end
CUDA
.
@sync
begin
CUDA
.
@cuda
threads
=
lp
.
bsz
blocks
=
lp
.
rsz
krnlg5!
(
src
)
end
g5Dw!
(
pro
,
U
,
src
,
dpar
,
lp
)
CG!
(
pro
,
U
,
DwdagDw!
,
dpar
,
lp
,
dws
,
maxiter
,
tol
)
return
pro
end
function
fP_test
(;
theta
=
(
0.5
,
0.7
,
1.0
,
0.0
),
m
=
1.3
,
size
=
(
8
,
8
,
8
,
16
),
prec
=
1.0e-16
)
lp
=
SpaceParm
{
4
}(
size
,(
4
,
4
,
4
,
4
),
1
,(
0
,
0
,
0
,
0
,
0
,
0
));
exptheta
=
exp
.
(
im
.*
theta
./
lp
.
iL
);
dpar
=
DiracParam
{
Float64
}(
SU3fund
,
m
,
1.0
,
exptheta
,
1.0
);
dws
=
DiracWorkspace
(
SU3fund
{
Float64
},
Float64
,
lp
);
U
=
fill!
(
vector_field
(
SU3
{
Float64
},
lp
),
one
(
SU3
{
Float64
}));
psi
=
scalar_field
(
Spinor
{
4
,
SU3fund
{
Float64
}},
lp
);
res
=
zeros
(
lp
.
iL
[
4
])
for
s
in
1
:
4
for
c
in
1
:
3
psi
=
bndpropagator
(
U
,
dpar
,
dws
,
lp
,
1000
,
prec
,
c
,
s
);
for
t
in
1
:
lp
.
iL
[
4
]
#for i in 1:lp.iL[1] for j in 1:lp.iL[2] for k in 1:lp.iL[3]
i
=
abs
(
rand
(
Int
))
%
lp
.
iL
[
1
]
+
1
;
j
=
abs
(
rand
(
Int
))
%
lp
.
iL
[
2
]
+
1
;
k
=
abs
(
rand
(
Int
))
%
lp
.
iL
[
3
]
+
1
;
CUDA
.
@allowscalar
(
res
[
t
]
+=
norm2
(
psi
[
point_index
(
CartesianIndex
{
lp
.
ndim
}((
i
,
j
,
k
,
t
)),
lp
)
...
])
/
2
)
#end end end
#res[t] = res[t]/(lp.iL[1]*lp.iL[2]*lp.iL[3])
end
end
end
#THEORETICAL SOLUTION: hep-lat/9606016 eq (2.33)
res_th
=
zeros
(
lp
.
iL
[
4
])
pp3
=
ntuple
(
i
->
theta
[
i
]
/
lp
.
iL
[
i
],
3
)
omega
=
2
*
asinh
(
0.5
*
sqrt
((
sum
((
sin
.
(
pp3
))
.^
2
)
+
(
m
+
2
*
(
sum
((
sin
.
(
pp3
./
2
))
.^
2
)
))
^
2
)
/
(
1
+
m
+
2
*
(
sum
((
sin
.
(
pp3
./
2
))
.^
2
)
))
)
)
pp
=
(
-
im
*
omega
,
pp3
...
)
Mpp
=
m
+
2
*
sum
((
sin
.
(
pp
./
2
))
.^
2
)
Rpp
=
Mpp
*
(
1
-
exp
(
-
2
*
omega
*
lp
.
iL
[
4
]))
+
sinh
(
omega
)
*
(
1
+
exp
(
-
2
*
omega
*
lp
.
iL
[
4
]))
for
i
in
2
:
lp
.
iL
[
4
]
res_th
[
i
]
=
(
2
*
3
*
sinh
(
omega
)
/
(
Rpp
^
2
))
*
(
(
Mpp
+
sinh
(
omega
))
*
exp
(
-
2
*
omega
*
(
i
-
1
))
-
(
Mpp
-
sinh
(
omega
))
*
exp
(
-
2
*
omega
*
(
2
*
lp
.
iL
[
4
]
-
(
i
-
1
)))
)
end
return
sum
(
abs
.
(
res
-
res_th
))
end
function
fA_test
(;
theta
=
(
0.5
,
0.7
,
1.0
,
0.0
),
m
=
1.3
,
size
=
(
8
,
8
,
8
,
16
),
prec
=
1.0e-16
)
lp
=
SpaceParm
{
4
}(
size
,(
4
,
4
,
4
,
4
),
1
,(
0
,
0
,
0
,
0
,
0
,
0
));
exptheta
=
exp
.
(
im
.*
theta
./
lp
.
iL
);
dpar
=
DiracParam
{
Float64
}(
SU3fund
,
m
,
1.0
,
exptheta
,
1.0
);
dws
=
DiracWorkspace
(
SU3fund
{
Float64
},
Float64
,
lp
);
U
=
fill!
(
vector_field
(
SU3
{
Float64
},
lp
),
one
(
SU3
{
Float64
}));
psi
=
scalar_field
(
Spinor
{
4
,
SU3fund
{
Float64
}},
lp
);
res
=
im
*
zeros
(
lp
.
iL
[
4
])
for
s
in
1
:
4
for
c
in
1
:
3
psi
=
bndpropagator
(
U
,
dpar
,
dws
,
lp
,
1000
,
prec
,
c
,
s
);
for
t
in
1
:
lp
.
iL
[
4
]
#for i in 1:lp.iL[1] for j in 1:lp.iL[2] for k in 1:lp.iL[3]
i
=
abs
(
rand
(
Int
))
%
lp
.
iL
[
1
]
+
1
;
j
=
abs
(
rand
(
Int
))
%
lp
.
iL
[
2
]
+
1
;
k
=
abs
(
rand
(
Int
))
%
lp
.
iL
[
3
]
+
1
;
CUDA
.
@allowscalar
(
res
[
t
]
+=
-
dot
(
psi
[
point_index
(
CartesianIndex
{
lp
.
ndim
}((
i
,
j
,
k
,
t
)),
lp
)
...
],
dmul
(
Gamma
{
4
},
psi
[
point_index
(
CartesianIndex
{
lp
.
ndim
}((
i
,
j
,
k
,
t
)),
lp
)
...
]))
/
2
)
#end end end
#res[t] = res[t]/(lp.iL[1]*lp.iL[2]*lp.iL[3])
end
end
end
#THEORETICAL SOLUTION: hep-lat/9606016 eq (2.33)
res_th
=
zeros
(
lp
.
iL
[
4
])
pp3
=
ntuple
(
i
->
theta
[
i
]
/
lp
.
iL
[
i
],
3
)
omega
=
2
*
asinh
(
0.5
*
sqrt
((
sum
((
sin
.
(
pp3
))
.^
2
)
+
(
m
+
2
*
(
sum
((
sin
.
(
pp3
./
2
))
.^
2
)
))
^
2
)
/
(
1
+
m
+
2
*
(
sum
((
sin
.
(
pp3
./
2
))
.^
2
)
))
)
)
pp
=
(
-
im
*
omega
,
pp3
...
)
Mpp
=
m
+
2
*
sum
((
sin
.
(
pp
./
2
))
.^
2
)
Rpp
=
Mpp
*
(
1
-
exp
(
-
2
*
omega
*
lp
.
iL
[
4
]))
+
sinh
(
omega
)
*
(
1
+
exp
(
-
2
*
omega
*
lp
.
iL
[
4
]))
for
i
in
2
:
lp
.
iL
[
4
]
res_th
[
i
]
=
(
6
/
(
Rpp
^
2
))
*
(
2
*
(
Mpp
-
sinh
(
omega
))
*
(
Mpp
+
sinh
(
omega
))
*
exp
(
-
2
*
omega
*
lp
.
iL
[
4
])
-
Mpp
*
((
Mpp
+
sinh
(
omega
))
*
exp
(
-
2
*
omega
*
(
i
-
1
))
+
(
Mpp
-
sinh
(
omega
))
*
exp
(
-
2
*
omega
*
(
2
*
lp
.
iL
[
4
]
-
(
i
-
1
)))))
end
return
sum
(
abs
.
(
res
-
res_th
))
end
difA
=
fA_test
();
difP
=
fP_test
();
if
difA
>
1.0e-15
error
(
"fA test failed with error "
,
difA
)
elseif
difP
>
1.0e-15
error
(
"fP test failed with error "
,
difP
)
else
print
(
"fA/fP test passes with errors: "
,
difA
,
" and "
,
difP
,
"
\n
"
)
elseif
end
test/runtests.jl
View file @
f37325ef
...
...
@@ -3,3 +3,4 @@
#include("flow/test_adapt.jl")
include
(
"dirac/test_solver_plw.jl"
)
include
(
"dirac/test_solver_rand.jl"
)
include
(
"dirac/test_fp_fa.jl"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment