@spawnat with SlurmClusterManager

It seems the following works, though isn’t amazingly pretty. Thoughts appreciated.

@everywhere begin
    function return_id(x)
        return myid(), gethostname()
    end
end
nworkers = length(workers())
out = pmap(return_id,1:nworkers)
idlst = map(x->x[1],out)
hostlist = map(x->x[2],out)
df = DataFrame(id=idlst,host=hostlist)
gp = groupby(df, :host)
gvec = gp.groups
nodeworkers = [ ]
for i = 1:maximum(gvec)
    push!(nodeworkers,df.id[gvec.==i])
end

Then you can manually build the SharedArray across the groups of workers on the same node by iterating over the nodeworkers list made above.

for subworkers in nodeworkers
    x = SharedArray{Int64}((2,2), init=false, pids=subworkers)
    x .= [1 2; 3 4]
end