Open Wajihulhassan opened 8 years ago
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 bbd8796a36e6db0bd24040190b040f5d732349a8. 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.