Problems with distributed package

I have been having troubles using the Distributed package. I have one function that returns a 100 x 4 array. This array is produced by averaging over some dimensions of a SharedArray that is constructed with a distributed for, the code looks something like

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>@everywhere function GenerateMatrix(H::sparsearray, indices::Array{Int}, a::Float64)
Gavg = SharedArray{Float64}(100, length(indices))
Z = Array{Float64}(undef, 100, 4)
G = lu(a*sparse(I, size(H)) - H) #new array, same size as H
@sync @distributed for i=1:length(indices)
main_ind = indices[i]
Gmain = G[:, main_ind]
...
#Other for operations that fill the matrix Gavg
end
Z[:,1] = mean(G_avg, dims=2)
#And other operations up to Z[:,4]
return Z
end
</code>
<code>@everywhere function GenerateMatrix(H::sparsearray, indices::Array{Int}, a::Float64) Gavg = SharedArray{Float64}(100, length(indices)) Z = Array{Float64}(undef, 100, 4) G = lu(a*sparse(I, size(H)) - H) #new array, same size as H @sync @distributed for i=1:length(indices) main_ind = indices[i] Gmain = G[:, main_ind] ... #Other for operations that fill the matrix Gavg end Z[:,1] = mean(G_avg, dims=2) #And other operations up to Z[:,4] return Z end </code>
@everywhere function GenerateMatrix(H::sparsearray, indices::Array{Int}, a::Float64)
   Gavg = SharedArray{Float64}(100, length(indices))
   Z = Array{Float64}(undef, 100, 4)
   G = lu(a*sparse(I, size(H)) - H) #new array, same size as H
   @sync @distributed for i=1:length(indices)
          main_ind = indices[i]
          Gmain = G[:, main_ind]
           ...
          #Other for operations that fill the matrix Gavg
    end
    Z[:,1] = mean(G_avg, dims=2)
    #And other operations up to Z[:,4]
    return Z
 end

This function has no problems whatsover by itself, the problem comes when I try to generate several of these Z arrays and average them over and over, rewriting the same file and saving as checkpoints every factor of 1000, as follows

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>using DelimitedFiles
function IterateFiles(a::Float64, N)
for j=1:N
...
#Create H and the respective indices vector
Z = GenerateMatrix(H, indices, a)
if j==1
writedlm("Z_sample"*string(j), Z)
else
Zprev = readdlm("Z_sample"*string(j-1))
Ztemp = (Zprev *(j-1)+ Z)/j
writedlm("Z_sample"*string(j), Ztemp)
if (j-1)%1000 != 0 #this deletes the previous file unless it corresponds to a checkpoint
rm("Z_sample"*string(j-1))
end
end
</code>
<code>using DelimitedFiles function IterateFiles(a::Float64, N) for j=1:N ... #Create H and the respective indices vector Z = GenerateMatrix(H, indices, a) if j==1 writedlm("Z_sample"*string(j), Z) else Zprev = readdlm("Z_sample"*string(j-1)) Ztemp = (Zprev *(j-1)+ Z)/j writedlm("Z_sample"*string(j), Ztemp) if (j-1)%1000 != 0 #this deletes the previous file unless it corresponds to a checkpoint rm("Z_sample"*string(j-1)) end end </code>
using DelimitedFiles
function IterateFiles(a::Float64, N)
        for j=1:N
             ...
             #Create H and the respective indices vector
             Z = GenerateMatrix(H, indices, a)
             if j==1
                 writedlm("Z_sample"*string(j), Z)
             else
                Zprev = readdlm("Z_sample"*string(j-1))
                Ztemp = (Zprev *(j-1)+ Z)/j  
                writedlm("Z_sample"*string(j), Ztemp)
                if (j-1)%1000 != 0 #this deletes the previous file unless it corresponds to a checkpoint
                   rm("Z_sample"*string(j-1)) 
                end
        end

This code excutes just fine and produce files as expected, however it stops producing files after (a random number) of several iterations of the function IterateFiles. It does not produce an error message. When I check the workers with ps auxr in the terminal, at the beginning shows that the program is working just fine and the selected number of processors with the distributed are being used, but a bit after ps auxr just displays the original instruction sent but no other workers from the distributed, and after this happens no new files are produced.

I though it was an memory error but that doesn’t seem to be the problem. There’s no error message nor the main instruction to run the code stops, julia -p 8 code.jl still appears as an outgoing work but is no longer producing results.

I have no clue of what can be going on. I’d greatly appreciate any insight or help you can provide to this.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật