You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 8, 2022. It is now read-only.
I am trying out following example of Comprehensions with ParallelAccelerator but it is throwing error.
julia> @acc f(a,b)=[ x for x in a ]
f (generic function with 1 method)
julia> f([1,2,3],2)
OptFramework failed to optimize function ##f#11563 in optimization pass ParallelAccelerator.Driver.toDomainIR with error from_expr: unknown Expr head :static_typeof
ERROR: MethodError: `step` has no method matching step(::Array{Int64,1})
in anonymous at /home/whassan/.julia/v0.4/ParallelAccelerator/src/comprehension.jl:76
in cartesianarray at /home/whassan/.julia/v0.4/ParallelAccelerator/src/api.jl:174
[inlined code] from /home/whassan/.julia/v0.4/ParallelAccelerator/src/comprehension.jl:73
in ##f#11563 at none:1
in f at /home/whassan/.julia/v0.4/CompilerTools/src/OptFramework.jl:577
I also added type annotation like in black-scholes example but it didn't work either.
The text was updated successfully, but these errors were encountered:
Unfortunately I realized that our macro translation for comprehension does not yet support syntax such as [... for x in a] when a is an array. ParallelAccelerator only works when a is a range. I'm not even sure there is a simple fix to this, unless we move to using generators as in Julia's own implementation. But generators are sequential by nature, and hard to parallelize.
So I would suggest instead using map for situations like this. For example, map(x -> x, a) would be equivalent.
I also tried map(x -> x ? 1 : 0, (a .== b)), as you raised the question of converting bitarray to array of int in the other thread. This had a problem with Julia 0.4, and is now fixed by commit bbd8796. However, Julia 0.5 itself (not ParallelAccelerator) has trouble dealing with this expression. So the conversion is still best handed by multiplying Bool with Int.
I am trying out following example of Comprehensions with
ParallelAccelerator
but it is throwing error.I also added type annotation like in black-scholes example but it didn't work either.
The text was updated successfully, but these errors were encountered: