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

Thread pool of main thread varies depending on how Julia is started #53389

Closed
carstenbauer opened this issue Feb 19, 2024 · 4 comments
Closed
Labels
multithreading Base.Threads and related functionality

Comments

@carstenbauer
Copy link
Member

carstenbauer commented Feb 19, 2024

Depending on whether Julia is started with or without interactive threads, the main thread is in either the interactive or default threadpool:

cb@mm ~
➜ julia -t 3 -E 'Threads.threadpool()'
:default

cb@mm ~
➜ julia -t 3,1 -E 'Threads.threadpool()'
:interactive

I find this surprising. Is this intentional? If so, what is the reasoning behind this?

Note that this is wrongly documented since 1.9 (I created a doc fix PR).

Came up in this issue and also seems to be causing problems (see discourse.julialang.org/t/what-is-julia-doing-with-your-threads/110052/20 and the related issue #53269).

@raminammour
Copy link
Contributor

This was implemented here, and the docfix came sometime after.

@carstenbauer
Copy link
Member Author

carstenbauer commented Feb 20, 2024

This was implemented here, and the docfix came sometime after.

Note that this docfix is orthogonal to what is discussed here. It was just fixing a statement about thread ids, specifically, their order. The relevant (yet to be merged) docfix for the present issue is #53388.

@JeffBezanson
Copy link
Sponsor Member

Yes this is intentional. Thanks for the doc fix. We will have the option of changing this at some point, but in the meantime I don't think it's so strange that if there are any interactive threads, then the main thread is one.

@carstenbauer
Copy link
Member Author

carstenbauer commented Feb 24, 2024

I don't think it's so strange that if there are any interactive threads, then the main thread is one.

The part that is a bit more surprising is that the main thread isn't always an interactive thread. (That's also what Valentin seemed to convey with his post here.)
But ok, I take it that this is not considered to be an issue (although it's still not obvious to me why this is intentional).

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
Projects
None yet
Development

No branches or pull requests

3 participants