Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
2abf017
1
Parent(s):
a4bb529
Set num threads before juliacall init
Browse files- pysr/julia_helpers.py +1 -0
- pysr/test/test.py +0 -17
pysr/julia_helpers.py
CHANGED
@@ -10,6 +10,7 @@ if os.environ.get("PYTHON_JULIACALL_HANDLE_SIGNALS", "yes") != "yes":
|
|
10 |
)
|
11 |
|
12 |
os.environ["PYTHON_JULIACALL_HANDLE_SIGNALS"] = "yes"
|
|
|
13 |
|
14 |
import juliapkg
|
15 |
from juliacall import Main as jl
|
|
|
10 |
)
|
11 |
|
12 |
os.environ["PYTHON_JULIACALL_HANDLE_SIGNALS"] = "yes"
|
13 |
+
os.environ["JULIA_NUM_THREADS"] = "auto"
|
14 |
|
15 |
import juliapkg
|
16 |
from juliacall import Main as jl
|
pysr/test/test.py
CHANGED
@@ -594,23 +594,6 @@ class TestMiscellaneous(unittest.TestCase):
|
|
594 |
with self.assertRaises(ValueError):
|
595 |
model.fit(X, y)
|
596 |
|
597 |
-
def test_changed_options_warning(self):
|
598 |
-
"""Check that a warning is given if Julia options are changed."""
|
599 |
-
if julia_helpers.julia_kwargs_at_initialization is None:
|
600 |
-
julia_helpers.init_julia(julia_kwargs={"threads": 2, "optimize": 3})
|
601 |
-
|
602 |
-
cur_init = julia_helpers.julia_kwargs_at_initialization
|
603 |
-
|
604 |
-
threads_to_change = cur_init["threads"] + 1
|
605 |
-
with warnings.catch_warnings():
|
606 |
-
warnings.simplefilter("error")
|
607 |
-
with self.assertRaises(Exception) as context:
|
608 |
-
julia_helpers.init_julia(
|
609 |
-
julia_kwargs={"threads": threads_to_change, "optimize": 3}
|
610 |
-
)
|
611 |
-
self.assertIn("Julia has already started", str(context.exception))
|
612 |
-
self.assertIn("threads", str(context.exception))
|
613 |
-
|
614 |
def test_extra_sympy_mappings_undefined(self):
|
615 |
"""extra_sympy_mappings=None errors for custom operators"""
|
616 |
model = PySRRegressor(unary_operators=["square2(x) = x^2"])
|
|
|
594 |
with self.assertRaises(ValueError):
|
595 |
model.fit(X, y)
|
596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
def test_extra_sympy_mappings_undefined(self):
|
598 |
"""extra_sympy_mappings=None errors for custom operators"""
|
599 |
model = PySRRegressor(unary_operators=["square2(x) = x^2"])
|