Skip to content

Commit

Permalink
fix use of array in macro for Nim devel
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Oct 3, 2024
1 parent 2c6b34f commit 77a5fbd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/comms/commsUtils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,18 @@ macro rankSumN*(comm:Comm, a:varargs[typed]):auto =
i0 = i
break
if i0<0:
let b = newNimNode(nnkBracket)
var s = newNimNode(nnkStmtList)
let t = ident("t")
for i in 0..<a.len:
b.add a[i]
let ai = a[i]
let x = quote do:
`ai` = `t`[`i`]
s.add x
result = quote do:
if threadNum==0:
var `t` = `a`
var `t` = `b`
`comm`.sum(`t`)
`s`
else:
Expand Down

0 comments on commit 77a5fbd

Please sign in to comment.