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

feature/interactive-threadpool-warning #213

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using Dates
using Reexport
using RelocatableFolders
using DataStructures: CircularDeque
import Base.Threads: lock
import Base.Threads: lock, nthreads

include("util.jl"); @reexport using .Util
include("types.jl"); @reexport using .Types
Expand Down Expand Up @@ -51,6 +51,16 @@ function serverwelcome(host::String, port::Int, docs::Bool, metrics::Bool, paral
end
if parallel
@info "🚀 Running in parallel mode with $(Threads.nthreads()) threads"
# Check if the current julia version supports interactive threadpools
if hasmethod(getfield(Threads, Symbol("@spawn")), Tuple{LineNumberNode, Module, Symbol, Expr})
# Add a warnign if the interactive threadpool is empty when running in parallel mode
if nthreads(:interactive) == 0
@warn """
🚨 Interactive threadpool is empty. This can hurt performance when running in parallel mode.
Try launching julia like \"julia --threads 3,1\" to add 1 thread to the interactive threadpool.
"""
end
end
end
end

Expand Down
Loading