I have a simple for-loop with a matrix, where I calculate a slice of the matrix via each step of the for-loop. e.g.
for ilat = 1 : nlat, ilon = 1 : nlon
for ip = 1 : np; esat[ip+1] = t2esat(Ta[ilon,ilat,ip],p[ip+1]) end
p[end] = ps[ilon,ilat]
esat[end] = t2esat(Ts[ilon,ilat],p[end])
swp[ilon,ilat,it] = calcswp(esat,p,ps[ilon,ilat])
end
I wish to parallelize the outer for-loop here. What packages should I use? Should I use DistributedArrays
, or is Distributed
enough? I’m not sure if I should use multi-threading, but I can use multiple cores. Do I need to specify the number of cores?