Skip to content

Commit

Permalink
Check if user already set JULIA_NUM_THREADS
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Feb 4, 2024
1 parent 4803d41 commit 4a5693e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pysr/julia_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@
+ "You will experience segfaults if running with multithreading."
)

os.environ["PYTHON_JULIACALL_HANDLE_SIGNALS"] = "yes"
if os.environ.get("JULIA_NUM_THREADS", "auto") != "auto":
warnings.warn(
"JULIA_NUM_THREADS environment variable is set to something other than 'auto', "
"so PySR was not able to set it. You may wish to set it to `'auto'` for full use "
"of your CPU."
)

os.environ["PYTHON_JULIACALL_HANDLE_SIGNALS"] = os.environ.get(
"PYTHON_JULIACALL_HANDLE_SIGNALS", "yes"
)
os.environ["JULIA_NUM_THREADS"] = os.environ.get("JULIA_NUM_THREADS", "auto")

import juliapkg
Expand Down

0 comments on commit 4a5693e

Please sign in to comment.