ddata doesn't work as intended when length(data) = length(pids)

オープン
#239 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
julia

調査の方向性

ddata エントリポイントから開始し、長さが worker 数と等しいデータ(データなしの ddata() を含む)について、文書化された動作と提供された再現例を比較します。Distributed と DistributedArrays を使って例を再実行します。完了とは、文書化された動作が正確なまま、両方のケースが表示された TypeError または MethodError なしで動作することを意味します。

索引モデルが issue の本文から書いたものです。

説明

The documentation says the following about ddata:

The function ddata(;T::Type=Any, init::Function=I->nothing, pids=workers(), data::Vector=[]) can be used to created a distributed vector whose localparts need not be Arrays.
...
Argument data if supplied is distributed over the pids. length(data) must be a multiple of length(pids). If the multiple is 1, returns a DArray{T,1,T} where T is eltype(data). If the multiple is greater than 1, returns a DArray{T,1,Array{T,1}}, i.e., it is equivalent to calling distribute(data).

The case when "the multiple is 1" is giving me trouble:

julia> using Distributed; addprocs(2)
julia> using DistributedArrays

julia> ddata(data=["foo", "bar"])

2-element DArray{String, 1, String}:
ERROR: TypeError: in typeassert, expected String, got a value of type Char
...
julia> ddata() 

ERROR: On worker 2:
MethodError: no method matching getindex(::Nothing, ::Int64)
...

Note that ddata works as intended for multiples greater than 1:

julia> ddata(data=["foo", "bar", "foo", "bar"]) 

4-element DArray{String, 1, Vector{String}}:
 "foo"
 "bar"
 "foo"
 "bar"
julia> ddata(;T=Any, init=I->nothing, pids=workers(), data=[nothing, nothing, nothing, nothing])

4-element DArray{Nothing, 1, Vector{Nothing}}:
 nothing
 nothing
 nothing
 nothing

First time posting an issue, hope I'm doing things right!

主要言語
Julia
スター
205
フォーク
34
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaParallel/DistributedArrays.jl のほかの issue

JuliaParallel/DistributedArrays.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。