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
cb5bb84b
Commit
cb5bb84b
authored
Nov 21, 2023
by
Fernando Pérez Panadero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small thingis
parent
3023f450
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
34 deletions
+32
-34
src/Dirac/Dirac.jl
src/Dirac/Dirac.jl
+23
-23
src/Solvers/CG.jl
src/Solvers/CG.jl
+5
-7
src/Solvers/Propagators.jl
src/Solvers/Propagators.jl
+1
-1
src/Spinors/Spinors.jl
src/Spinors/Spinors.jl
+3
-3
No files found.
src/Dirac/Dirac.jl
View file @
cb5bb84b
...
@@ -266,6 +266,7 @@ function clover(g1::SU3{T},g2::SU3{T},g3::SU3{T},g4::SU3{T}) where {T}
...
@@ -266,6 +266,7 @@ function clover(g1::SU3{T},g2::SU3{T},g3::SU3{T},g4::SU3{T}) where {T}
return
-
0.125
*
im
*
M3x3
{
T
}(
u11
-
conj
(
u11
),
u12
-
conj
(
u21
),
u13
-
conj
(
u31
),
u21
-
conj
(
u12
),
u22
-
conj
(
u22
),
u23
-
conj
(
u32
),
u31
-
conj
(
u13
),
u32
-
conj
(
u23
),
u33
-
conj
(
u33
))
return
-
0.125
*
im
*
M3x3
{
T
}(
u11
-
conj
(
u11
),
u12
-
conj
(
u21
),
u13
-
conj
(
u31
),
u21
-
conj
(
u12
),
u22
-
conj
(
u22
),
u23
-
conj
(
u32
),
u31
-
conj
(
u13
),
u32
-
conj
(
u23
),
u33
-
conj
(
u33
))
end
end
"""
"""
function Csw!(dws, U, gp, lp::SpaceParm)
function Csw!(dws, U, gp, lp::SpaceParm)
...
@@ -521,7 +522,7 @@ function krnl_Dw_new!(so, U, si, m0, th, lp::SpaceParm{4,6,B,D}) where {B,D}
...
@@ -521,7 +522,7 @@ function krnl_Dw_new!(so, U, si, m0, th, lp::SpaceParm{4,6,B,D}) where {B,D}
return
nothing
return
nothing
end
end
function
Dw_new
!
(
so
,
U
,
si
,
dpar
::
DiracParam
,
dws
::
DiracWorkspace
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
Dw_new
!
(
so
,
U
,
si
,
dpar
::
DiracParam
,
dws
::
DiracWorkspace
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
if
abs
(
dpar
.
csw
)
>
1.0E-10
if
abs
(
dpar
.
csw
)
>
1.0E-10
@timeit
"Dw_new"
begin
@timeit
"Dw_new"
begin
...
@@ -540,7 +541,7 @@ function Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpaceParm
...
@@ -540,7 +541,7 @@ function Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpaceParm
return
nothing
return
nothing
end
end
function
krnl_Dwimpr_new
!
(
so
,
U
,
si
,
Fcsw
,
m0
,
th
,
csw
,
ct
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
krnl_Dwimpr_new
!
(
so
,
U
,
si
,
Fcsw
,
m0
,
th
,
csw
,
ct
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
# The field si is assumed to be zero at t = 0
# The field si is assumed to be zero at t = 0
...
@@ -577,7 +578,7 @@ function krnl_Dwimpr_new!(so, U, si, Fcsw, m0, th, csw, ct, lp::SpaceParm{4,6,BC
...
@@ -577,7 +578,7 @@ function krnl_Dwimpr_new!(so, U, si, Fcsw, m0, th, csw, ct, lp::SpaceParm{4,6,BC
return
nothing
return
nothing
end
end
function
krnl_Dw_new
!
(
so
,
U
,
si
,
m0
,
th
,
ct
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
krnl_Dw_new
!
(
so
,
U
,
si
,
m0
,
th
,
ct
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
# The field si is assumed to be zero at t = 0
# The field si is assumed to be zero at t = 0
...
@@ -687,7 +688,7 @@ function krnl_g5Dw_new!(so, U, si, m0, th, lp::SpaceParm{4,6,B,D}) where {B,D}
...
@@ -687,7 +688,7 @@ function krnl_g5Dw_new!(so, U, si, m0, th, lp::SpaceParm{4,6,B,D}) where {B,D}
return
nothing
return
nothing
end
end
function
g5Dw_new
!
(
so
,
U
,
si
,
dpar
::
DiracParam
,
dws
::
DiracWorkspace
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
g5Dw_new
!
(
so
,
U
,
si
,
dpar
::
DiracParam
,
dws
::
DiracWorkspace
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
if
abs
(
dpar
.
csw
)
>
1.0E-10
if
abs
(
dpar
.
csw
)
>
1.0E-10
@timeit
"g5Dw_new"
begin
@timeit
"g5Dw_new"
begin
...
@@ -706,7 +707,7 @@ function g5Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpacePa
...
@@ -706,7 +707,7 @@ function g5Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpacePa
return
nothing
return
nothing
end
end
function
krnl_g5Dwimpr_new
!
(
so
,
U
,
si
,
Fcsw
,
m0
,
th
,
csw
,
ct
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
krnl_g5Dwimpr_new
!
(
so
,
U
,
si
,
Fcsw
,
m0
,
th
,
csw
,
ct
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
# The field si is assumed to be zero at t = 0
# The field si is assumed to be zero at t = 0
...
@@ -745,7 +746,7 @@ function krnl_g5Dwimpr_new!(so, U, si, Fcsw, m0, th, csw, ct, lp::SpaceParm{4,6,
...
@@ -745,7 +746,7 @@ function krnl_g5Dwimpr_new!(so, U, si, Fcsw, m0, th, csw, ct, lp::SpaceParm{4,6,
return
nothing
return
nothing
end
end
function
krnl_g5Dw_new
!
(
so
,
U
,
si
,
m0
,
th
,
ct
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
krnl_g5Dw_new
!
(
so
,
U
,
si
,
m0
,
th
,
ct
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
# The field si is assumed to be zero at t = 0
# The field si is assumed to be zero at t = 0
...
@@ -781,7 +782,7 @@ function krnl_g5Dw_new!(so, U, si, m0, th, ct, lp::SpaceParm{4,6,BC_SF_ORBI,D})
...
@@ -781,7 +782,7 @@ function krnl_g5Dw_new!(so, U, si, m0, th, ct, lp::SpaceParm{4,6,BC_SF_ORBI,D})
return
nothing
return
nothing
end
end
function
DwdagDw_new
!
(
so
,
U
,
si
,
dpar
::
DiracParam
,
dws
::
DiracWorkspace
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
DwdagDw_new
!
(
so
,
U
,
si
,
dpar
::
DiracParam
,
dws
::
DiracWorkspace
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
if
abs
(
dpar
.
csw
)
>
1.0E-10
if
abs
(
dpar
.
csw
)
>
1.0E-10
@timeit
"DwdagDw_new"
begin
@timeit
"DwdagDw_new"
begin
...
@@ -856,7 +857,7 @@ function DwdagDw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::Spac
...
@@ -856,7 +857,7 @@ function DwdagDw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::Spac
end
end
function
SF_bndfix
!
(
sp
,
lp
::
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
})
where
{
D
}
function
SF_bndfix
!
(
sp
,
lp
::
Union
{
SpaceParm
{
4
,
6
,
BC_SF_ORBI
,
D
},
SpaceParm
{
4
,
6
,
BC_SF_AFWB
,
D
}
})
where
{
D
}
CUDA
.
@sync
begin
CUDA
.
@sync
begin
CUDA
.
@cuda
threads
=
lp
.
bsz
blocks
=
lp
.
rsz
krnl_sfbndfix_new!
(
sp
,
lp
)
CUDA
.
@cuda
threads
=
lp
.
bsz
blocks
=
lp
.
rsz
krnl_sfbndfix_new!
(
sp
,
lp
)
end
end
...
@@ -923,28 +924,27 @@ function pfrandomize!(f::AbstractArray{Spinor{4, SU2fund{T}}},lp::SpaceParm,t::I
...
@@ -923,28 +924,27 @@ function pfrandomize!(f::AbstractArray{Spinor{4, SU2fund{T}}},lp::SpaceParm,t::I
end
end
end
end
return
nothing
return
nothing
end
end
function
krnl_assign_pf_su2
!
(
f
::
AbstractArray
,
p
,
lp
::
SpaceParm
,
t
::
Int64
)
function
krnl_assign_pf_su2
!
(
f
::
AbstractArray
,
p
,
lp
::
SpaceParm
,
t
::
Int64
)
@inbounds
begin
@inbounds
begin
b
=
Int64
(
CUDA
.
threadIdx
()
.
x
)
b
=
Int64
(
CUDA
.
threadIdx
()
.
x
)
r
=
Int64
(
CUDA
.
blockIdx
()
.
x
)
r
=
Int64
(
CUDA
.
blockIdx
()
.
x
)
if
t
==
0
f
[
b
,
r
]
=
Spinor
(
map
(
x
->
SU2fund
(
x
[
b
,
1
,
r
,
1
]
+
im
*
x
[
b
,
1
,
r
,
2
],
x
[
b
,
2
,
r
,
1
]
+
im
*
x
[
b
,
2
,
r
,
2
]),
p
))
elseif
point_time
((
b
,
r
),
lp
)
==
t
f
[
b
,
r
]
=
Spinor
(
map
(
x
->
SU2fund
(
x
[
b
,
1
,
r
,
1
]
+
im
*
x
[
b
,
1
,
r
,
2
],
x
[
b
,
2
,
r
,
1
]
+
im
*
x
[
b
,
2
,
r
,
2
]),
p
))
end
end
return
nothing
if
t
==
0
f
[
b
,
r
]
=
Spinor
(
map
(
x
->
SU2fund
(
x
[
b
,
1
,
r
,
1
]
+
im
*
x
[
b
,
1
,
r
,
2
],
x
[
b
,
2
,
r
,
1
]
+
im
*
x
[
b
,
2
,
r
,
2
]),
p
))
elseif
point_time
((
b
,
r
),
lp
)
==
t
f
[
b
,
r
]
=
Spinor
(
map
(
x
->
SU2fund
(
x
[
b
,
1
,
r
,
1
]
+
im
*
x
[
b
,
1
,
r
,
2
],
x
[
b
,
2
,
r
,
1
]
+
im
*
x
[
b
,
2
,
r
,
2
]),
p
))
end
end
return
nothing
end
end
export
Dw!
,
DwdagDw!
,
g5Dw!
,
pfrandomize!
,
Csw!
,
Dw_new!
,
g5Dw_new!
,
DwdagDw_new!
,
SF_bndfix!
export
Dw!
,
DwdagDw!
,
g5Dw!
,
pfrandomize!
,
Csw!
,
Dw_new!
,
g5Dw_new!
,
DwdagDw_new!
,
SF_bndfix!
...
...
src/Solvers/CG.jl
View file @
cb5bb84b
...
@@ -25,15 +25,14 @@ return nothing
...
@@ -25,15 +25,14 @@ return nothing
end
end
function
field_dot
(
fone
::
AbstractArray
,
ftwo
::
AbstractArray
,
sumf
,
lp
)
where
{
T
}
function
field_dot
(
fone
::
AbstractArray
,
ftwo
::
AbstractArray
,
sumf
,
lp
)
where
{
T
}
CUDA
.
@sync
begin
CUDA
.
@sync
begin
CUDA
.
@cuda
threads
=
lp
.
bsz
blocks
=
lp
.
rsz
krnl_dot!
(
sumf
,
fone
,
ftwo
)
CUDA
.
@cuda
threads
=
lp
.
bsz
blocks
=
lp
.
rsz
krnl_dot!
(
sumf
,
fone
,
ftwo
)
end
end
return
sum
(
sumf
)
return
sum
(
sumf
)
end
end
function
CG
!
(
si
,
U
,
A
,
dpar
::
DiracParam
,
lp
::
SpaceParm
,
dws
::
DiracWorkspace
{
T
},
maxiter
::
Int64
=
10
,
tol
=
1.0
)
where
{
T
}
function
CG
!
(
si
,
U
,
A
,
dpar
::
DiracParam
,
lp
::
SpaceParm
,
dws
::
DiracWorkspace
{
T
},
maxiter
::
Int64
=
10
,
tol
=
1.0
)
where
{
T
}
dws
.
sr
.=
si
dws
.
sr
.=
si
...
@@ -52,7 +51,6 @@ function CG!(si, U, A, dpar::DiracParam, lp::SpaceParm, dws::DiracWorkspace{T},
...
@@ -52,7 +51,6 @@ function CG!(si, U, A, dpar::DiracParam, lp::SpaceParm, dws::DiracWorkspace{T},
A
(
dws
.
sAp
,
U
,
dws
.
sp
,
dpar
,
dws
,
dws
.
st
,
lp
)
A
(
dws
.
sAp
,
U
,
dws
.
sp
,
dpar
,
dws
,
dws
.
st
,
lp
)
prod
=
field_dot
(
dws
.
sp
,
dws
.
sAp
,
sumf
,
lp
)
prod
=
field_dot
(
dws
.
sp
,
dws
.
sAp
,
sumf
,
lp
)
#prod = CUDA.mapreduce(x -> dot(x[1],x[2]), +, zip(dws.sp, dws.sAp))
alpha
=
norm
/
prod
alpha
=
norm
/
prod
...
...
src/Solvers/Propagators.jl
View file @
cb5bb84b
...
@@ -54,7 +54,7 @@ function propagator!(pro, U, dpar::DiracParam{T}, dws::DiracWorkspace, lp::Space
...
@@ -54,7 +54,7 @@ function propagator!(pro, U, dpar::DiracParam{T}, dws::DiracWorkspace, lp::Space
end
end
CG!
(
pro
,
U
,
DwdagDw!
,
dpar
,
lp
,
dws
,
maxiter
,
tol
)
CG!
(
pro
,
U
,
DwdagDw!
,
dpar
,
lp
,
dws
,
maxiter
,
tol
)
return
pro
return
nothing
end
end
"""
"""
...
...
src/Spinors/Spinors.jl
View file @
cb5bb84b
...
@@ -96,9 +96,9 @@ mimm(a::Spinor{NS,G}) where {NS,G} = Spinor{NS,G}(ntuple(i->m
...
@@ -96,9 +96,9 @@ mimm(a::Spinor{NS,G}) where {NS,G} = Spinor{NS,G}(ntuple(i->m
# Operations with numbers
# Operations with numbers
Base
.:*
(
a
::
Spinor
{
NS
,
G
},
b
::
Number
)
where
{
NS
,
G
}
=
Spinor
{
NS
,
G
}(
ntuple
(
i
->
b
*
a
.
s
[
i
],
NS
))
# For some reason, these are type instable(?)
Base
.:*
(
a
::
Spinor
{
NS
,
G
},
b
::
Number
)
where
{
NS
,
G
}
=
Spinor
{
NS
,
G
}(
ntuple
(
i
->
b
*
a
.
s
[
i
],
NS
))
Base
.:*
(
b
::
Number
,
a
::
Spinor
{
NS
,
G
})
where
{
NS
,
G
}
=
Spinor
{
NS
,
G
}(
ntuple
(
i
->
b
*
a
.
s
[
i
],
NS
))
# when the number is a ComplexF64 and I try to
Base
.:*
(
b
::
Number
,
a
::
Spinor
{
NS
,
G
})
where
{
NS
,
G
}
=
Spinor
{
NS
,
G
}(
ntuple
(
i
->
b
*
a
.
s
[
i
],
NS
))
Base
.:/
(
a
::
Spinor
{
NS
,
G
},
b
::
Number
)
where
{
NS
,
G
}
=
Spinor
{
NS
,
G
}(
ntuple
(
i
->
a
.
s
[
i
]
/
b
,
NS
))
# run .* with CuArray. Cannot get the length of th tuple.
Base
.:/
(
a
::
Spinor
{
NS
,
G
},
b
::
Number
)
where
{
NS
,
G
}
=
Spinor
{
NS
,
G
}(
ntuple
(
i
->
a
.
s
[
i
]
/
b
,
NS
))
##
##
...
...
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