Write DArray to HDF5/JLD without first converting to Array

Đang mở
#108 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
julia
Lĩnh vực
distributed-systems

Hướng nghiên cứu

Bắt đầu với các ví dụ write_darray và read_darray của issue, bao gồm jldopen, localindexes, localpart và remotecall_wait. Điều tra cách DistributedArrays và lớp HDF5/JLD có thể biểu diễn một biến phân tán thay vì các đối tượng theo từng tiến trình. Được xem là hoàn thành khi có một phương pháp được hỗ trợ có thể ghi và đọc một DArray mà không thu thập nó về cục bộ và không tạo ra 2n+2 biến tệp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

It would be useful to have a way to write DArrays to file without first collecting all of the data on the local process. I found a pretty hacky way of doing this that looks like this:

function write_darray{T<:AbstractFloat}(filepath::AbstractString, darr::DArray{T})
    function write_localpart(pid::Int)
        jldopen(filepath, "r+") do file
            write(file, "inds$pid", collect(localindexes(darr)))
            write(file, "arr$pid", localpart(darr))
        end
    end

    # Write DArray metadata
    jldopen(filepath, "w") do file
        write(file, "dims", darr.dims)
        write(file, "pids", collect(darr.pids))
    end

    # For each process, write the local indices and local part
    for pid in darr.pids
        remotecall_wait(pid, write_localpart, pid)
        sleep(0.001) # This is for some reason necessary, or else HDF5 complains that the new object already exists
    end
end

function read_darray(filepath::AbstractString)
    file = jldopen(filepath, "r")
    dims = read(file, "dims")
    pids = read(file, "pids")
    out = zeros(dims...)

    # Reassemble local parts
    for pid in pids
        inds = read(file, "inds$pid")
        out[inds...] = read(file, "arr$pid")
    end

    close(file)
    return out
end

However, there must be a better way than this, especially one that would create a single variable in the file filepath (rather than 2n+2 in my case, where n is the number of processes the DArray is stored on).

Ngôn ngữ chính
Julia
Star
205
Fork
34
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của JuliaParallel/DistributedArrays.jl

Tất cả issue của JuliaParallel/DistributedArrays.jl

Issue tương tự

Thêm issue về Julia

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.