Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC : process ids are independent of nprocs() and others #3394

Merged
merged 3 commits into from
Jun 17, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Changed names to procs() and workers()
  • Loading branch information
amitmurthy committed Jun 15, 2013
commit eeabbdffd7e9a3b71f5bbb64200ce48f2991e0cb
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, list_allprocs()[1:min(nprocs(),max(dims))])
DArray(init, dims) = DArray(init, dims, procs()[1:min(nprocs(),max(dims))])

size(d::DArray) = d.dims
procs(d::DArray) = d.pmap
Expand Down
4 changes: 2 additions & 2 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,8 @@ export
myid,
nprocs,
nworkers,
list_allprocs,
list_workers,
procs,
workers,
rmprocs,
pmap,
put,
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 in filter(x -> x != 1, list_allprocs())
@sync for p in filter(x -> x != 1, procs())
@spawnat p require(name)
end
end
Expand All @@ -52,7 +52,7 @@ end

function reload(name::String)
if myid() == 1
@sync for p in filter(x -> x != 1, list_allprocs())
@sync for p in filter(x -> x != 1, procs())
@spawnat p reload(name)
end
end
Expand Down
6 changes: 3 additions & 3 deletions base/multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ function nworkers()
n == 1 ? 1 : n-1
end

list_allprocs() = [x.id for x in PGRP.workers]
procs() = [x.id for x in PGRP.workers]

function list_workers()
allp = list_allprocs()
function workers()
allp = procs()
if nprocs() == 1
allp
else
Expand Down
2 changes: 1 addition & 1 deletion test/parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if nprocs() < 2
end

id_me = myid()
id_other = filter(x -> x != id_me, list_allprocs())[rand(1:(nprocs()-1))]
id_other = filter(x -> x != id_me, procs())[rand(1:(nprocs()-1))]

@test fetch(@spawnat id_other myid()) == id_other

Expand Down