Juliaでの分散コンピューティングの方法
概要
Juliaでは、複数のデバイスに計算タスクをスケジューリングする方法を紹介する1。正直、自分もよくわからない。
コード
using Distributed
ip_ = []
for last in [160,161,162,163,164,32,33,34,35,36,43,44,45,46,47]
    push!(ip_, join([155,230,211,last],'.'))
end
sort!(ip_)
for ip in ip_
    addprocs([("chaos@" * ip, 8)];  dir ="/home/chaos", exename = "julia") #add slave node\'s workers
    println("ip $ip" * " passed")
end
nworkers()
@everywhere function f(n)
    return n^2 - n 
end
A = pmap(f,1:20000)
X = []
@async @distributed for i in 1:200
    print(f(i))
    push!(X, f(i))
end
pmapはうまくいくけど、@distributedはダメだ。
環境
- OS: Windows
 - julia: v1.7.0
 
