for completeness sake, a working version of the first example (helping the
proof engine a bit)
still gonna give weave a try I guess
import strutils
import threadpool
{.experimental: "parallel".}
proc main =
let
w = 16
h = 8
var s = "a".re
damn you globals! I feel like I should have smelled that...
thanks!
Fwiw this works fine :P
import threadpool
{.experimental: "parallel".}
proc main =
var s = newSeq[char](3)
parallel:
for i in 0..s.high:
s[i] = spawn chr(i)
echo s
main()
Run
thanks, I'll give weave a try :)
In my experience, I never managed to use the `parallel` construct.
One of the goals of 2020 is to introduce Z3 theorem prover in the compiler and
its first use-case would be to prove array accesses (it's not in the milestones
yet so hopefuly @Araq can confirm:
[https://github.com/nim-lang/RFCs/
neither with a seq?
> test.nim(8, 7) Error: (i)..(i) not disjoint from (i)..(i)
import threadpool
{.experimental: "parallel".}
var s = newSeq[char](3)
parallel:
for i in 0..s.high:
s[i] = spawn chr(i)
Run
I must be completely missing
okay, it doesn't seem to work for strings at all? i don't get it...
> test.nim(8, 7) Error: cannot prove: i <= len(s) + -1 (bounds check)
import threadpool
{.experimental: "parallel".}
var s = "abc"
for i in 0..s.high:
parallel:
s[i] = spawn chr(i)
trying to place the min into the range doesn't seem to do the trick either:
> test.nim(14, 12) Error: cannot prove: y * w + x <= len(s) + -1 (bounds check)
import strutils
import threadpool
{.experimental: "parallel".}
let
w = 3
h = 3
var s = 'a'
I've seen that already. But bounding the expression doesn't work that simple
because it (more or less obviously) breaks the disjoint check.
You may see Araq's reply in
[https://forum.nim-lang.org/t/4827#30222](https://forum.nim-lang.org/t/4827#30222)
how can i satisfy parallel bounds checker in this example?
it fails with
test.nim(18, 19) Error: cannot prove: y * w8 + x <= len(s) + -1 (bounds check)
strutils
import math
import threadpool
{.experimental: "parallel".}
proc getc() : char =
11 matches
Mail list logo