Skip to content

Commit

Permalink
Merge pull request #135 from dave7895/patch-1
Browse files Browse the repository at this point in the history
Switch `warn_parallel` to look at number of available threads
  • Loading branch information
hexaeder authored Apr 25, 2024
2 parents 9a3c6aa + 7415db3 commit 38f4e39
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ using SparseArrays
"""
warn_parallel(b::Bool)
If `b=true` (run in parallel mode) give a warning if either
- `ENV["JULIA_NUM_THREADS"]` not found in ENV
- `ENV["JULIA_NUM_THREADS"] ≤ 1`, i.e. there is just a single thread
If `b=true` (run in parallel mode) give a warning if julia has access to only one thread.
"""
function warn_parallel(b::Bool)
if b
if !haskey(ENV, "JULIA_NUM_THREADS") || parse(Int, ENV["JULIA_NUM_THREADS"]) 1
if Threads.nthreads() 1
print("Warning: You are using multi-threading with only one thread ",
"available to Julia. Consider re-starting Julia with the environment ",
"variable JULIA_NUM_THREADS set to the number of physical cores of your CPU.")
Expand Down

0 comments on commit 38f4e39

Please sign in to comment.