Skip to content

Commit

Permalink
process ids are independent of nprocs()
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmurthy committed Jun 15, 2013
1 parent 36cd5e6 commit 68256c1
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 97 deletions.
9 changes: 4 additions & 5 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,10 @@ function init_head_sched()
# start in "head node" mode
global const Scheduler = Task(()->event_loop(true), 1024*1024)
global PGRP
PGRP.myid = 1
assert(PGRP.np == 0)
push!(PGRP.workers,LocalProcess())
push!(PGRP.locs,("",0))
PGRP.np = 1
global LPROC
LPROC.id = 1
assert(length(PGRP.workers) == 0)
register_worker(LPROC)
# make scheduler aware of current (root) task
unshift!(Workqueue, roottask)
yield()
Expand Down
2 changes: 1 addition & 1 deletion base/darray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function DArray(init, dims, procs)
end
DArray(init, dims, procs, defaultdist(dims,procs))
end
DArray(init, dims) = DArray(init, dims, [1:min(nprocs(),max(dims))])
DArray(init, dims) = DArray(init, dims, list_allprocs()[1:min(nprocs(),max(dims))])

size(d::DArray) = d.dims
procs(d::DArray) = d.pmap
Expand Down
4 changes: 4 additions & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,10 @@ export
yield,
myid,
nprocs,
nworkers,
list_allprocs,
list_workers,
rmprocs,
pmap,
put,
remotecall,
Expand Down
4 changes: 2 additions & 2 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require(f::String, fs::String...) = (require(f); for x in fs require(x); end)

function require(name::ByteString)
if myid() == 1
@sync for p = 2:nprocs()
@sync for p in list_workers()
@spawnat p require(name)
end
end
Expand All @@ -52,7 +52,7 @@ end

function reload(name::String)
if myid() == 1
@sync for p = 2:nprocs()
@sync for p in list_workers()
@spawnat p reload(name)
end
end
Expand Down
Loading

0 comments on commit 68256c1

Please sign in to comment.