pmap vs map for DArray?

未關閉
#7 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
35/100
Issue 類型
文件
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
julia

研究方向

先重現 issue 中的 drand、map 和 pmap 範例,然後在儲存庫中搜尋 DArray、map 和 pmap 的文件或進入點。確定 pmap 在 DArray 上的預期行為,並記錄其與 map 的差異,包括一個簡潔的範例或限制(如果現有行為支援這一點)。

由索引模型根據 Issue 內容生成。

描述

documentation

Searching through the source for DistributedArray, it seems I'm supposed to use map instead of pmap on a DArray. Indeed, when I try to use pmap, strange things happen:

julia> testa = drand(36)
36-element DistributedArrays.DArray{Float64,1,Array{Float64,1}}:
 0.636737
 0.275769
 0.961624
 0.427848
 0.668537
 0.0215699
 0.292591
 0.487622
 0.54222
 0.579438
 0.299413
 0.0699156
 0.985861
 0.642223
 0.0108336
 0.466572
 0.134984
 0.0718047
 0.600704
 0.367337
 0.722101
 0.96763
 0.427482
 0.963513
 0.467348
 0.987774
 0.773584
 0.531576
 0.0155698
 0.383172
 0.0347603
 0.299581
 0.0226568
 0.687901
 0.22271
 0.238291

julia> testb = drand(36)
36-element DistributedArrays.DArray{Float64,1,Array{Float64,1}}:
 0.933919
 0.445692
 0.0028197
 0.722083
 0.088373
 0.820338
 0.71782
 0.972424
 0.623399
 0.157076
 0.657007
 0.0753378
 0.712683
 0.303925
 0.591726
 0.320129
 0.5457
 0.00830437
 0.0753483
 0.973917
 0.171903
 0.291315
 0.875653
 0.0619788
 0.53868
 0.069952
 0.534305
 0.798335
 0.923633
 0.239445
 0.748613
 0.00554521
 0.650063
 0.770877
 0.237519
 0.414616

julia> pmap( (x) -> (x*x), testa)
175-element Array{Any,1}:
 0.405433
 0.405433
 0.405433
 0.405433
 0.405433
 0.405433
 0.0760486
 0.0760486
 0.0760486
 0.0760486
 0.0760486
 0.0760486
 0.92472
 0.92472
 0.92472
 0.183054
 0.183054
 0.183054
 0.92472
 0.183054
 0.183054
 0.183054
 0.446942
 0.446942
 0.446942
 0.446942
 0.000465259
 0.446942
 ⋮
 0.00120828
 0.00120828
 0.00120828
 0.00120828
 0.00120828
 0.00120828
 0.0897485
 0.0897485
 0.0897485
 0.0897485
 0.0897485
 0.000513332
 0.000513332
 0.473207
 0.000513332
 0.000513332
 0.473207
 0.473207
 0.473207
 0.0495998
 0.473207
 0.0495998
 0.0495998
 0.0495998
 0.0567826
 0.0567826
 0.0567826
 0.0567826

julia> map( (x) -> (x*x), testb)
36-element DistributedArrays.DArray{Float64,1,Array{Float64,1}}:
 0.872205
 0.198641
 7.95072e-6
 0.521403
 0.00780978
 0.672954
 0.515266
 0.945609
 0.388626
 0.0246728
 0.431658
 0.00567578
 0.507917
 0.0923703
 0.35014
 0.102483
 0.297789
 6.89625e-5
 0.00567737
 0.948514
 0.0295506
 0.0848642
 0.766769
 0.00384137
 0.290177
 0.00489328
 0.285482
 0.637339
 0.853098
 0.0573337
 0.560421
 3.07494e-5
 0.422581
 0.594251
 0.0564152
 0.171907

(Sorry for how long that was!)

Yet intuitively, I would have expected pmap to work like map does on a distributed array. I'm fine with my intuition being wrong here, but should there be a note in the documentation to use map, and not pmap? What is the expected behaviour of pmap on a DArray?

主要語言
Julia
星號
205
分支
34
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

JuliaParallel/DistributedArrays.jl 的其他 Issue

查看 JuliaParallel/DistributedArrays.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。