-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I wanted to run a parallel nested for loop. In the docs it shows how you can do a nested for loop into a single outer loop:
for i = 1:2, j = 3:4
println((i, j))
endand an example for parallel for loop:
nheads = @parallel (+) for i=1:200000000
int(rand(Bool))
endHow can I combine these concepts? I tried something along the lines of:
result = @parallel (hcat) for i=1:10,j=1:10
[i^2,j^2]
endbut I get:
ERROR: syntax: invalid assignment locationAlso tried with Iterators package:
julia> result = @parallel (hcat) for p in product(0:0.1:1,0:0.1:1)
[p[1]^2, p[2]^2]
end
exception on 1: ERROR: MethodError: `getindex` has no method matching getindex(::Iterators.Product, ::Int64)
Closest candidates are:
getindex(::(Any...,), ::Int64)
getindex(::(Any...,), ::Real)
getindex(::FloatRange{T}, ::Integer)
...
in anonymous at no file:1679
in anonymous at multi.jl:1528
in run_work_thunk at multi.jl:603
in run_work_thunk at multi.jl:612
in anonymous at task.jl:6
MethodError(getindex,(Iterators.Product(Any[0.0:0.1:1.0,0.0:0.1:1.0]),1))I am on:
julia> versioninfo()
Julia Version 0.4.0-dev+2684
Commit 8938e3a (2015-01-13 22:01 UTC)
Platform Info:
System: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
WORD_SIZE: 64
BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: liblapack.so.3
LIBM: libopenlibm
LLVM: libLLVM-3.3
Metadata
Metadata
Assignees
Labels
No labels