PySR / pysr /julia_extensions.py
MilesCranmer's picture
Fix missing kwarg
b796812 unverified
raw
history blame
686 Bytes
"""This file installs and loads extensions for SymbolicRegression."""
from .julia_import import jl
def load_required_packages(*, turbo=False, enable_autodiff=False, cluster_manager=None):
if turbo:
load_package("LoopVectorization")
if enable_autodiff:
load_package("Zygote")
if cluster_manager is not None:
load_package("ClusterManagers")
def load_package(package_name):
jl.seval(
f"""
try
using {package_name}
catch e
isa(e, ArgumentError) || throw(e)
using Pkg: Pkg
Pkg.add("{package_name}")
using {package_name}
end
"""
)
return None