mpi - Parallel programming in Julia -


i have been following docs parallel programming in julia , mind, thinks openmp or mpi, find design choice quite strange.

i have application want data distributed among processes, , want tell each process apply operation whatever data assigned, yet not see way of doing in julia. here example

julia> r = remotecall(2, rand, 2) remoteref{channel{any}}(2,1,30)  julia> fetch(r) 2-element array{float64,1}:  0.733308  0.45227  

so on process 2 lives random array 2 elements. can apply function array via

julia> remotecall_fetch(2, getindex, r, 1) 0.7333080770447185 

but why not work if apply function should change vector, like:

julia> remotecall_fetch(2, setindex!, r, 1,1) error: on worker 2: methoderror: `setindex!` has no method matching setindex!(::remoteref{channel{any}}, ::int64, ::int64)  in anonymous @ multi.jl:892  in run_work_thunk @ multi.jl:645  [inlined code] multi.jl:892  in anonymous @ task.jl:63  in remotecall_fetch @ multi.jl:731  in remotecall_fetch @ multi.jl:734 

i don't quite know how describe it, seems workers can return "new" things. don't see how can send variables , function worker , have function modify variables in place. in above example, i'd array live on single process , ideally i'd able tell process perform operations on array. after operations finished fetch results etc.

i think can achive macro @spawnat:

julia> addprocs(2) 2-element array{int64,1}:  2  3  julia> r = remotecall(2, rand, 2) remoteref{channel{any}}(2,1,3)  julia> fetch(r) 2-element array{float64,1}:  0.149753  0.687653  julia> remotecall_fetch(2, getindex, r, 1) 0.14975250913699378  julia> @spawnat 2 setindex!(fetch(r), 320.0, 1) remoteref{channel{any}}(2,1,6)  julia> fetch(r) 2-element array{float64,1}:  320.0    0.687653  julia> @spawnat 2 setindex!(fetch(r), 950.0, 2) remoteref{channel{any}}(2,1,8)  julia> fetch(r) 2-element array{float64,1}:  320.0  950.0 

but remotecall_fetch, looks returned array copy:

julia> remotecall_fetch(2, setindex!, fetch(r), 878.99, 1) 2-element array{float64,1}:  878.99  950.0  julia> remotecall_fetch(2, setindex!, fetch(r), 232.99, 2) 2-element array{float64,1}:  320.0  232.99  julia> fetch(r) 2-element array{float64,1}:  320.0  950.0 

with: julia version 0.4.3


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -