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

distribute that takes procs #6

Closed
denizyuret opened this issue Mar 14, 2015 · 1 comment
Closed

distribute that takes procs #6

denizyuret opened this issue Mar 14, 2015 · 1 comment

Comments

@denizyuret
Copy link

I recommend making the interface for distribute more consistent with DArray by adding an optional procs argument. This will allow for an array distributed to a subset of the workers. A common use case is testing the performance of different numbers of workers on a task.

function distribute(a::AbstractArray, procs=workers()[1:min(nworkers(), maximum(size(a)))])
    owner = myid()
    rr = RemoteRef()
    put!(rr, a)
    d = DArray(size(a), procs) do I
        remotecall_fetch(owner, ()->fetch(rr)[I...])
    end
    # Ensure that all workers have fetched their localparts.                                                               
    # Else a gc in between can recover the RemoteRef rr                                                                    
    for chunk in d.chunks
        wait(chunk)
    end
    d
end
@jakebolewski
Copy link
Member

Thanks @denizyuret, I added your suggested improvement.

vtjnash added a commit to JuliaLang/julia that referenced this issue Nov 1, 2015
vtjnash added a commit to JuliaLang/julia that referenced this issue Nov 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants