Skip to content

Commit

Permalink
fix: issue with addprocs function undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Aug 13, 2024
1 parent 5e9b679 commit 09c2db5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pysr/julia_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ def _escape_filename(filename):

def _load_cluster_manager(cluster_manager: str):
if cluster_manager == "mpi":
jl.seval("using Distributed: addprocs")
jl.seval("using MPIClusterManagers: MPIWorkerManager")

return jl.seval(
"__pysr_mpi_addprocs(np; exeflags=``, kws...) = "
"(np; exeflags=``, kws...) -> "
+ "addprocs(MPIWorkerManager(np); exeflags=`$exeflags --project=$(Base.active_project())`, kws...)"
)
else:
Expand Down
1 change: 1 addition & 0 deletions pysr/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def _multiprocessing_turbo_custom_objective(self, cluster_manager):
unary_operators=["sqrt"],
procs=2,
multithreading=False,
cluster_manager=cluster_manager,
turbo=True,
early_stop_condition="stop_if(loss, complexity) = loss < 1e-10 && complexity == 1",
loss_function="""
Expand Down

0 comments on commit 09c2db5

Please sign in to comment.