warsaga
warsaga

Reputation: 273

Profiling parallel code Julia

How can we profile parallel code in julia? This question has been asked before. In fact, following the advice to call profile on each node does not work.

function profileSlaveTask(param)
         @profile slaveTask(param)
        return Profile.retrieve()
end
rrefs=Array(RemoteRef,length(workers()))
machines=workers()

for i=1:length(machines)
    rrefs[i]= @spawnat machines[i] slaveTask(initdamp)
end
pres= fetch(rrefs[1])
using ProfileView
ProfileView(pres[1],lidict=pres[2])

Using ProfileView I obtain :enter image description here

Upvotes: 1

Views: 177

Answers (1)

tholy
tholy

Reputation: 12179

Works just fine for me (julia 0.4.0-dev, Ubuntu 14.04):

p = addprocs(1)[1]

@everywhere function profile_svd(A)
    println("starting profile_svd")
    @profile svd(sdata(A))
    println("done with svd")
    Profile.retrieve()
end

println("about to allocate SharedArray")
A = SharedArray(Float64,1000,1000)
println("about to fill SharedArray")
rand!(sdata(A))
println("about to call worker")
bt, lidict = remotecall_fetch(p, profile_svd, A)

Upvotes: 1

Related Questions