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

Shared array example needs fixing #9841

Closed
mbeltagy opened this issue Jan 19, 2015 · 2 comments
Closed

Shared array example needs fixing #9841

mbeltagy opened this issue Jan 19, 2015 · 2 comments
Labels
parallelism Parallel or distributed computation

Comments

@mbeltagy
Copy link
Contributor

In https://github.com/JuliaLang/julia/blob/master/doc/manual/parallel-computing.rst

The example provided

S = SharedArray(Int, (3,4), init = S -> S[myid()-1:nworkers():length(S)] = myid())

produces an exception in 0.3.5

exception on 1: ERROR: BoundsError()
 in setindex! at array.jl:323
 in setindex! at sharedarray.jl:215
 in anonymous at none:1
 in anonymous at multi.jl:660
 in run_work_thunk at multi.jl:621
 in run_work_thunk at multi.jl:630
 in anonymous at task.jl:6

It seems that in the latest implementation myid() could start at 1 and hence a bounds error happens.
This could be a possible fix.

 S = SharedArray(Int, (3,4), init = S -> S[myid():nworkers():length(S)] = myid())
@ViralBShah
Copy link
Member

Cc: @amitmurthy

@ViralBShah ViralBShah added the parallelism Parallel or distributed computation label Jan 19, 2015
amitmurthy added a commit that referenced this issue Jan 26, 2015
@amitmurthy
Copy link
Contributor

Thanks @mbeltagy . Fixed in master, should be backported in the next 0.3 release.

amitmurthy added a commit that referenced this issue Feb 1, 2015
(cherry picked from commit baba413)
ref PR #9929
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parallelism Parallel or distributed computation
Projects
None yet
Development

No branches or pull requests

5 participants