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

Multi-threading doesn't work on master #19876

Closed
giordano opened this issue Jan 5, 2017 · 11 comments
Closed

Multi-threading doesn't work on master #19876

giordano opened this issue Jan 5, 2017 · 11 comments
Assignees
Labels
multithreading Base.Threads and related functionality regression Regression in behavior compared to a previous version

Comments

@giordano
Copy link
Contributor

giordano commented Jan 5, 2017

I reported on discourse a problem, but didn't get any feedback, so I don't know if anyone else can reproduce it.

Currently, multi-threading doesn't seem to work on master branch (at least on my system). Using the example proposed in the manual:

julia> versioninfo()
Julia Version 0.6.0-dev.1928
Commit cbc6670 (2017-01-05 11:46 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

julia> Threads.nthreads()
4

julia> a = zeros(10);

julia> Threads.@threads for i = 1:10
           a[i] = Threads.threadid()
       end

julia> a
10-element Array{Float64,1}:
 1.0
 1.0
 1.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0

As show in the discourse message, the same example works on my system with Julia 0.5.

I could not find any reference to this problem in the bug tracker, I assume it's a new issue.

@tkelman tkelman added multithreading Base.Threads and related functionality regression Regression in behavior compared to a previous version labels Jan 5, 2017
@tkelman
Copy link
Contributor

tkelman commented Jan 5, 2017

Would you (or anyone else who can reproduce) be able to bisect?

@giordano
Copy link
Contributor Author

giordano commented Jan 5, 2017

I'd like to do that, but compiling Julia from scratch takes about half an hour on my box with make -j4, it may take a while (probably some days) to find the offending revision. If someone wants to undertake this task, please go ahead.

@tkelman Out of curiosity: can you reproduce it, is it just me?

@KristofferC
Copy link
Sponsor Member

I can reproduce. I'll try bisect.

@kpamnany
Copy link
Contributor

kpamnany commented Jan 5, 2017

From debug prints, I find that the threads are running, getting forked, and attempting to apply the generated function containing the loop body. However, every thread except the first is getting an exception on calling jl_apply() in ti_run_fun(). Not sure why. @yuyichao, any ideas?

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jan 5, 2017

They're all getting no-method errors from trying to run in world 0

@tkelman
Copy link
Contributor

tkelman commented Jan 5, 2017

Oh, then it's #17057 / #265. How did the threads test not catch this?

@kpamnany
Copy link
Contributor

kpamnany commented Jan 5, 2017

$ ./julia test/threads.jl
ERROR: LoadError: BoundsError: attempt to access 10000-element Array{Bool,1} at index [0]
Stacktrace:
 [1] test_threaded_loop_and_atomic_add() at /scratch/kpamnany/julia.intel/test/threads.jl:23
 [2] include_from_node1(::String) at ./loading.jl:532
 [3] include(::String) at ./sysimg.jl:14
 [4] process_options(::Base.JLOptions) at ./client.jl:298
 [5] _start() at ./client.jl:364
while loading /scratch/kpamnany/julia.intel/test/threads.jl, in expression starting on line 34

It should have? Is this test run with JULIA_NUM_THREADS set to >1?

@tkelman
Copy link
Contributor

tkelman commented Jan 5, 2017

Ah right, we still have JULIA_NUM_THREADS defaulting to 1. We have a threading buildbot but nobody was paying attention (apologies to @KristofferC that I forgot about it): https://build.julialang.org/builders/nightly_threading-x64/builds/579

@KristofferC
Copy link
Sponsor Member

I gave up on bisecting after LLVM wanted to rebuild for the fourth time ;)

@yuyichao yuyichao self-assigned this Jan 6, 2017
yuyichao added a commit that referenced this issue Jan 6, 2017
yuyichao added a commit that referenced this issue Jan 6, 2017
musm pushed a commit to musm/julia that referenced this issue Jan 8, 2017
musm pushed a commit to musm/julia that referenced this issue Jan 8, 2017
@sbromberger
Copy link
Contributor

sbromberger commented May 5, 2017

Sorry for the dense question here, but does this mean that threads don't work on master right now?

and @vtjnash -

They're all getting no-method errors from trying to run in world 0

How did you get diagnostics?

@yuyichao
Copy link
Contributor

yuyichao commented May 5, 2017

Does what mean that? This is an closed issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

7 participants