Skip to content

Commit

Permalink
remove master branch from installNim
Browse files Browse the repository at this point in the history
add norm2diff for fields
  • Loading branch information
jcosborn committed Jun 4, 2024
1 parent fd5f611 commit 02b69c8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build/installNim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ usage() {
echo " -h (this help message)"
echo " stable (install latest stable version)"
echo " <version> (install named version, e.g. 0.16.0)"
echo " master (install master branch tracking version)"
#echo " master (install master branch tracking version)"
echo " devel (install devel branch tracking version)"
echo " default stable|<version>|master|devel"
echo " (set default version)"
Expand All @@ -35,11 +35,11 @@ if [ "X$1" = "Xdefault" ]; then
fi

ver="stable"
branch="master"
branch="version-2-0"
if [ "X$1" != "X" ]; then
case "$1" in
stable) ver="stable";;
master) ver="master";;
#master) ver="master";;
devel) ver="devel"; branch="devel";;
-h) usage;;
*) ver="$1"; branch="v$1";;
Expand Down
33 changes: 33 additions & 0 deletions src/field/fieldET.nim
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,39 @@ proc norm2subtract*(x: Field, y: float): float =
result = s.simdReduce
x.l.threadRankSum(result)

proc norm2diffP*(f,g:SomeField):auto =
tic()
mixin norm2, inorm2, simdSum, items, toDouble
#var n2:type(norm2(f[0]))
var n2: evalType(norm2(toDouble(f[0])))
#echo n2
#let t = f
for x in items(f):
let t = toDouble(f[x]) - toDouble(g[x])
inorm2(n2, t)
toc("norm2 local")
#echoAll n2
result = simdSum(n2)
toc("norm2 simd sum")
#echoAll myRank, ",", threadNum, ": ", result
#threadSum(result)
#toc("norm2 thread sum")
#rankSum(result)
#toc("norm2 rank sum")
f.l.threadRankSum(result)
#echo result
toc("norm2 thread rank sum")
template norm2diff*(f,g:SomeAllField):auto =
when declared(subsetObject):
#echo "subsetObj" & s
norm2diffP(f[subsetObject], g[subsetObject])
elif declared(subsetString):
#echo "subset norm2"
norm2diffP(f[subsetString], g[subsetString])
else:
norm2diffP(f, g)
template norm2diff*(f,g:Subsetted):auto = norm2diffP(f,g)

proc dotP*(f1:SomeField; f2:SomeField2):auto =
tic()
mixin dot, idot, simdSum, items, toDouble, eval
Expand Down
1 change: 1 addition & 0 deletions src/solvers/cg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type
proc reset*(cgs: var CgState) =
cgs.b2 = -1
cgs.iterations = 0
cgs.r2 = 1.0
cgs.r2old = 1.0
cgs.rzold = 1.0
cgs.r2stop = 0.0
Expand Down

0 comments on commit 02b69c8

Please sign in to comment.