Skip to content

Commit

Permalink
Merge branch 'devel' into wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Nov 14, 2024
2 parents c11c9bf + a3f51e2 commit 72f0edd
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 76 deletions.
1 change: 1 addition & 0 deletions src/base/basicOps.nim
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ template setUnopT*(op,fun,t1,t2: untyped) {.dirty.} =
rSetUnopT

template setBinopP*(op,fun,t1,t2,t3: untyped) {.dirty.} =
getOptimPragmas()
#template op*(x: typedesc[t1]; y: typedesc[t2]): typedesc = t3
proc op*(x: t1; y: t2): auto {.alwaysInline,noInit.} =
var r{.noInit.}: t3
Expand Down
2 changes: 1 addition & 1 deletion src/base/profile.nim
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ proc makeHotspotTable(lrti: List[RTInfoObj]): tuple[ns:int64,oh:int64] =
t.children.add ri.children[i]
do: # loc not found
hs[loc] = ri
let tot = makeHotSpotTable(List[RTInfoObj](ri.children))
#let tot = makeHotSpotTable(List[RTInfoObj](ri.children))
return (nstot, ohtot)

proc echoHotspots* =
Expand Down
10 changes: 5 additions & 5 deletions src/examples/heatbath2dclockt.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import qex
import gauge, physics/qcdTypes
import os, strutils, times

proc sumEnergy(fr,fi:any, J, h:any, g:any, p:seq[float], sf,sb:any) =
proc sumEnergy(fr,fi:auto, J, h:auto, g:auto, p:seq[float], sf,sb:auto) =
fr := 0
fi := 0
for nu in 0..<g.l.nDim:
Expand Down Expand Up @@ -48,7 +48,7 @@ type PhaseDiff[F,E] = object
cosd,sind:seq[float]
f: seq[Shifter[F,E]]

proc phaseDiff(del:var PhaseDiff,g:any,p:seq[float],tdir:seq[bool]):auto =
proc phaseDiff(del:var PhaseDiff,g:auto,p:seq[float],tdir:seq[bool]):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand Down Expand Up @@ -79,7 +79,7 @@ type HeatBath[F,E] = object
subs: array[2,Subset]
del: PhaseDiff[F,E]

proc newHeatBath(lo:any):auto =
proc newHeatBath(lo:auto):auto =
let
nd = lo.nDim
fr = lo.Real
Expand All @@ -104,7 +104,7 @@ proc newHeatBath(lo:any):auto =
r.del.f[i] = newShifter(fr, i, 1)
r

proc evolve(H:HeatBath, g:any, d:var seq[float], tdir:seq[bool], gc:any, r:any, R:var RngMilc6,
proc evolve(H:HeatBath, g:auto, d:var seq[float], tdir:seq[bool], gc:auto, r:auto, R:var RngMilc6,
sample = true, twistSample = true) =
tic("heatbath")
let
Expand Down Expand Up @@ -146,7 +146,7 @@ proc evolve(H:HeatBath, g:any, d:var seq[float], tdir:seq[bool], gc:any, r:any,
toc("twist sample")
toc("end")

proc magnet(g:any):auto =
proc magnet(g:auto):auto =
tic("magnet")
var mr,mi = 0.0
threads:
Expand Down
12 changes: 6 additions & 6 deletions src/examples/heatbath2dclocktb.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const
twistBoundaryIndex = 0
NMax = 8

proc sumEnergy(fr,fi:any, J, h:any, g,b:any, bb,sf,sb:any) =
proc sumEnergy(fr,fi:auto, J, h:auto, g,b:auto, bb,sf,sb:auto) =
fr := 0
fi := 0
for nu in 0..<g.l.nDim:
Expand Down Expand Up @@ -54,7 +54,7 @@ type PhaseDiff[F,E] = object
cosd,sind:seq[float]
f: seq[Shifter[F,E]]

proc phaseDiffB(del:var PhaseDiff,g:any):auto =
proc phaseDiffB(del:var PhaseDiff,g:auto):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand All @@ -75,7 +75,7 @@ proc phaseDiffB(del:var PhaseDiff,g:any):auto =
cosd[twistDir] = t
sind[twistDir] = s

proc phaseDiff(del:var PhaseDiff,g,b:any):auto =
proc phaseDiff(del:var PhaseDiff,g,b:auto):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand Down Expand Up @@ -107,7 +107,7 @@ type HeatBath[F,E] = object
subs: array[2,Subset]
del: PhaseDiff[F,E]

proc newHeatBath(lo:any):auto =
proc newHeatBath(lo:auto):auto =
let
nd = lo.nDim
fr = lo.Real
Expand All @@ -132,7 +132,7 @@ proc newHeatBath(lo:any):auto =
r.del.f[i] = newShifter(fr, i, 1)
r

proc evolve(H:HeatBath, g,b:any, bb:any, d:var float, gc:any, r:any, R:var RngMilc6,
proc evolve(H:HeatBath, g,b:auto, bb:auto, d:var float, gc:auto, r:auto, R:var RngMilc6,
sample = true, twistSample = true) =
tic("heatbath")
let
Expand Down Expand Up @@ -179,7 +179,7 @@ proc evolve(H:HeatBath, g,b:any, bb:any, d:var float, gc:any, r:any, R:var RngMi
toc("twist sample")
toc("end")

proc magnet(g:any):auto =
proc magnet(g:auto):auto =
tic("magnet")
var mr,mi = 0.0
threads:
Expand Down
12 changes: 6 additions & 6 deletions src/examples/heatbath2dxy.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import qex
import gauge, physics/qcdTypes
import os, strutils, times

proc sumEnergy(fr,fi:any, J, h:any, g:any, sf,sb:any) =
proc sumEnergy(fr,fi:auto, J, h:auto, g:auto, sf,sb:auto) =
fr := 0
fi := 0
for nu in 0..<g.l.nDim:
Expand All @@ -21,7 +21,7 @@ type HeatBath[F,E] = object
sf,sb: array[2,seq[Shifter[F,E]]]
subs: array[2,Subset]

proc newHeatBath(lo:any):auto =
proc newHeatBath(lo:auto):auto =
let
fr = lo.Real
fi = lo.Real
Expand All @@ -40,7 +40,7 @@ proc newHeatBath(lo:any):auto =
r.subs[1].layoutSubset(lo,"o")
r

proc evolve(H:HeatBath, g:any, gc:any, r:any, sample = true, jump = true) =
proc evolve(H:HeatBath, g:auto, gc:auto, r:auto, sample = true, jump = true) =
tic("heatbath")
let
lo = g.l
Expand Down Expand Up @@ -83,7 +83,7 @@ proc evolve(H:HeatBath, g:any, gc:any, r:any, sample = true, jump = true) =
toc("flip")
toc("end")

proc magnet(g:any):auto =
proc magnet(g:auto):auto =
tic("magnet")
var mr,mi = 0.0
threads:
Expand All @@ -106,7 +106,7 @@ type PhaseDiff[F,E] = object
cosd,sind:seq[float]
f: seq[Shifter[F,E]]

proc newPhaseDiff(g:any):auto =
proc newPhaseDiff(g:auto):auto =
type
F = typeof(g)
E = typeof(g[0])
Expand All @@ -119,7 +119,7 @@ proc newPhaseDiff(g:any):auto =
r.f[i] = newShifter(g, i, 1)
r

proc phaseDiff(del:var PhaseDiff,g:any):auto =
proc phaseDiff(del:var PhaseDiff,g:auto):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand Down
18 changes: 9 additions & 9 deletions src/examples/heatbath2dxyp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ template debugPut(n:untyped) =
when QEXDEBUG:
echo asttostr(n),": ",n

proc sumEnergy(fr,fi:any, J, h:any, g:any, sf,sb:any) =
proc sumEnergy(fr,fi:auto, J, h:auto, g:auto, sf,sb:auto) =
fr := 0
fi := 0
for nu in 0..<g.l.nDim:
Expand Down Expand Up @@ -394,7 +394,7 @@ proc pickRootCosCosN[D](rng:var RNG, x, phi, sigma:D): auto =
let r = int(floor(n * rng.uniform))
return ccn.xs[r]

proc probZN(ss:var openarray[float], g:any, betah:float) =
proc probZN(ss:var openarray[float], g:auto, betah:float) =
let
n = globalP.n
pidn = globalP.pidn
Expand All @@ -419,7 +419,7 @@ type HeatBath[F,E] = object
sf,sb: array[2,seq[Shifter[F,E]]]
subs: array[2,Subset]

proc newHeatBath(lo:any):auto =
proc newHeatBath(lo:auto):auto =
let
fr = lo.Real
fi = lo.Real
Expand All @@ -438,7 +438,7 @@ proc newHeatBath(lo:any):auto =
r.subs[1].layoutSubset(lo,"o")
r

proc evolve(H:HeatBath, g:any, gc:any, r:any, R:var RngMilc6, sample = true, jump = true, jumpZN = true) =
proc evolve(H:HeatBath, g:auto, gc:auto, r:auto, R:var RngMilc6, sample = true, jump = true, jumpZN = true) =
tic("heatbath")
let
lo = g.l
Expand Down Expand Up @@ -503,7 +503,7 @@ proc evolve(H:HeatBath, g:any, gc:any, r:any, R:var RngMilc6, sample = true, jum
toc("tryZN")
toc("end")

proc magnet(g:any):auto =
proc magnet(g:auto):auto =
tic("magnet")
var mr,mi = 0.0
threads:
Expand All @@ -522,7 +522,7 @@ proc magnet(g:any):auto =
toc("done")
(mr, mi)

proc magnet(g:any,k:int):auto =
proc magnet(g:auto,k:int):auto =
tic("magnetK")
let d = 2.0*globalP.pidn*k
var mr,mi = 0.0
Expand All @@ -547,7 +547,7 @@ type PhaseDiff[F,E] = object
cosd,sind:seq[float]
f: seq[Shifter[F,E]]

proc newPhaseDiff(g:any):auto =
proc newPhaseDiff(g:auto):auto =
type
F = typeof(g)
E = typeof(g[0])
Expand All @@ -560,7 +560,7 @@ proc newPhaseDiff(g:any):auto =
r.f[i] = newShifter(g, i, 1)
r

proc phaseDiff(del:var PhaseDiff,g:any):auto =
proc phaseDiff(del:var PhaseDiff,g:auto):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand All @@ -584,7 +584,7 @@ proc phaseDiff(del:var PhaseDiff,g:any):auto =
cosd[nu] = v
sind[nu] = u

proc showMeasure[F,E](del:var PhaseDiff[F,E],g:F,gc:any,label="") =
proc showMeasure[F,E](del:var PhaseDiff[F,E],g:F,gc:auto,label="") =
let
(beta, J, h, hn) = gc
(mr,mi) = g.magnet
Expand Down
2 changes: 1 addition & 1 deletion src/examples/heatbath2dxypt.nim
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ if twistAngle.len != twistDirs.len:
let
gc = (beta:beta, J:J, h:h, hn:hn)
lo = lat.newLayout
vol = lo.physVol
#vol = lo.physVol

var
r = lo.newRNGField(RngMilc6, seed)
Expand Down
16 changes: 8 additions & 8 deletions src/examples/heatbath2dxyptb.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import os, strutils, times

const twistDir = 0

proc isTwistBoundaryOf(i:int, b:any):bool = b.l.coords[twistDir][i] == 0
proc isTwistBoundaryOf(i:int, b:auto):bool = b.l.coords[twistDir][i] == 0

proc updateBoundary(b:any, d:any) =
proc updateBoundary(b:auto, d:auto) =
threads:
for i in b.sites:
if i.isTwistBoundaryOf b:
b{i} := d

proc sumEnergy(fr,fi:any, J, h:any, g,b:any, bb,sf,sb:any) =
proc sumEnergy(fr,fi:auto, J, h:auto, g,b:auto, bb,sf,sb:auto) =
fr := 0
fi := 0
for nu in 0..<g.l.nDim:
Expand Down Expand Up @@ -400,7 +400,7 @@ type PhaseDiff[F,E] = object
cosd,sind:seq[float]
f: seq[Shifter[F,E]]

proc phaseDiffB(del:var PhaseDiff,g:any):auto =
proc phaseDiffB(del:var PhaseDiff,g:auto):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand All @@ -421,7 +421,7 @@ proc phaseDiffB(del:var PhaseDiff,g:any):auto =
cosd[twistDir] = t
sind[twistDir] = s

proc phaseDiff(del:var PhaseDiff,g,b:any):auto =
proc phaseDiff(del:var PhaseDiff,g,b:auto):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand Down Expand Up @@ -453,7 +453,7 @@ type HeatBath[F,E] = object
subs: array[2,Subset]
del: PhaseDiff[F,E]

proc newHeatBath(lo:any):auto =
proc newHeatBath(lo:auto):auto =
let
nd = lo.nDim
fr = lo.Real
Expand All @@ -478,7 +478,7 @@ proc newHeatBath(lo:any):auto =
r.del.f[i] = newShifter(fr, i, 1)
r

proc evolve(H:HeatBath, g,b:any, bb:any, d:var float, gc:any, r:any, R:var RngMilc6,
proc evolve(H:HeatBath, g,b:auto, bb:auto, d:var float, gc:auto, r:auto, R:var RngMilc6,
sample = true, twistSample = true, jump = true, twistJump = true) =
tic("heatbath")
let
Expand Down Expand Up @@ -552,7 +552,7 @@ proc evolve(H:HeatBath, g,b:any, bb:any, d:var float, gc:any, r:any, R:var RngMi
toc("twist flip")
toc("end")

proc magnet(g:any):auto =
proc magnet(g:auto):auto =
tic("magnet")
var mr,mi = 0.0
threads:
Expand Down
10 changes: 5 additions & 5 deletions src/examples/heatbath2dxyt.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import qex
import gauge, physics/qcdTypes
import os, strutils, times

proc sumEnergy(fr,fi:any, J, h:any, g:any, p:seq[float], sf,sb:any) =
proc sumEnergy(fr,fi:auto, J, h:auto, g:auto, p:seq[float], sf,sb:auto) =
fr := 0
fi := 0
for nu in 0..<g.l.nDim:
Expand All @@ -26,7 +26,7 @@ type PhaseDiff[F,E] = object
cosd,sind:seq[float]
f: seq[Shifter[F,E]]

proc phaseDiff(del:var PhaseDiff,g:any,p:seq[float],tdir:seq[bool]):auto =
proc phaseDiff(del:var PhaseDiff,g:auto,p:seq[float],tdir:seq[bool]):auto =
let
# del cannot be captured by nim in threads
f = del.f
Expand Down Expand Up @@ -57,7 +57,7 @@ type HeatBath[F,E] = object
subs: array[2,Subset]
del: PhaseDiff[F,E]

proc newHeatBath(lo:any):auto =
proc newHeatBath(lo:auto):auto =
let
nd = lo.nDim
fr = lo.Real
Expand All @@ -82,7 +82,7 @@ proc newHeatBath(lo:any):auto =
r.del.f[i] = newShifter(fr, i, 1)
r

proc evolve(H:HeatBath, g:any, d:var seq[float], tdir:seq[bool], gc:any, r:any, R:var RngMilc6,
proc evolve(H:HeatBath, g:auto, d:var seq[float], tdir:seq[bool], gc:auto, r:auto, R:var RngMilc6,
sample = true, twistSample = true, jump = true, twistJump = true) =
tic("heatbath")
let
Expand Down Expand Up @@ -152,7 +152,7 @@ proc evolve(H:HeatBath, g:any, d:var seq[float], tdir:seq[bool], gc:any, r:any,
toc("twist flip")
toc("end")

proc magnet(g:any):auto =
proc magnet(g:auto):auto =
tic("magnet")
var mr,mi = 0.0
threads:
Expand Down
Loading

0 comments on commit 72f0edd

Please sign in to comment.