Skip to content

@threads (incorrectly?) using :interactive thread pool #50438

Closed
@robsmith11

Description

@robsmith11

My intuition is that Threads.@threads should always be using the default thread pool, even when run from the REPL without Threads.@spawn, but if I run the following, I can see Julia only using a single thread, which I presume is from the interactive pool.

$ julia -t8,1
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0-DEV.17 (2023-07-06)
 _/ |\__'_|_|_|\__'_|  |  Commit 2360140c9fd (0 days old master)
|__/                   |

julia> Threads.@threads for _ in 1:8
         while true
         end
       end

If I start julia with -t8, it uses all 8 cores because then there are no interactive threads, so I guess it decides to use the default pool instead. Starting julia with -t8,4 allows it to use 4 threads, so it clearly seems to be using interactive threads in that case.

If this is really the intended behavior, I think the docs should be more clear about that. But I think it would make more sense for it to always use the default pool.

Metadata

Metadata

Assignees

Labels

multithreadingBase.Threads and related functionality

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions