-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Surprising behavior for default/interactive thread pools #53217
Comments
That is expected behavior the root task is an interactive task. This is necessary since currently it processes all IO (outside of |
That's what I thought but
So it isn't always an interactive task. In fact, assuming that most people don't start Julia with explicit interactive threads, it typically isn't. |
And what the OP forgot to mention, the documentation here is simply wrong:
This certainly needs to be corrected. |
I think someone was working on a docfix for that in a PR recently |
I can't find a PR for this. I think you might be confusing it with #53117. Apart from the docs, what about my first point? Seems at least a bit confusing to me that the root thread is in different thread pools depending on how I start Julia. |
From my point of view (a simple user), it is confusing that by default code does not use a thread from the default thread pool (assuming that I started Julia with at least one interactive thread). In other words, the statement "by default code does not use a thread from the default thread pool" sounds wrong by virtue of its construction. Not sure if that feed-back can help with the eventual change to the docs, but hope it helps :) |
The fact that the main thread is sometimes in What can (and should) be done right away is to fix the documentation and document things accurately (I might be able to make a PR tonight). But I'm still curious what's the reasoning behind this behavior. Why not make the main thread always |
I must be misunderstanding something here. This is what I get when running as a batch and also as interactive:
Now I start julia with two thread pools configured explicitly:
|
@PetrKryslUCSD, I'll try to answer your three questions, but I'm guessing we should move this type of discussion to the discourse thread.
|
Hey Sam, for reference. |
See #53217 (comment) (cherry picked from commit 8425b0e)
See #53217 (comment) (cherry picked from commit 8425b0e)
See #53217 (comment) (cherry picked from commit 8425b0e)
See JuliaLang#53217 (comment) (cherry picked from commit 8425b0e)
By default, it appears that work is assigned to the interactive thread pool (if it exists) rather than the default thread pool. The expected behavior is that, by default, work gets assigned to the default thread pool, and assignment to the interactive thread pool requires either appropriate use of the interactive REPL, or use of
Threads.@spawn :interactive
. Please also see a corresponding discourse post.Here are some examples that reproduce the problem:
Example 1
julia -t 1,1 -e 'print(stdout, "$(Threads.threadpool())\n")'
outputs:
Example 3
julia -t 1,1 -e 'Threads.threadid() in Threads.threadpooltids(:interactive) ? println("interactive") : println("default"); println(isinteractive())'
outputs
Example 4
The text was updated successfully, but these errors were encountered: