From 5a2bf53691b4f2e614f07b2b1cee3895dddae41e Mon Sep 17 00:00:00 2001 From: jlnav Date: Mon, 29 Apr 2024 15:35:12 -0500 Subject: [PATCH 01/15] tentatively deprecate safe_mode, zero_resource_workers, AllocSpecs.out --- libensemble/manager.py | 4 ++++ libensemble/resources/resources.py | 8 ++++++++ libensemble/utils/specs_checkers.py | 2 ++ 3 files changed, 14 insertions(+) diff --git a/libensemble/manager.py b/libensemble/manager.py index aa9c53b0cf..7aa8d1b55f 100644 --- a/libensemble/manager.py +++ b/libensemble/manager.py @@ -12,6 +12,7 @@ import sys import time import traceback +import warnings from typing import Any, Union import numpy as np @@ -204,9 +205,12 @@ def __init__( timer.start() self.date_start = timer.date_start.replace(" ", "_") self.safe_mode = libE_specs.get("safe_mode") + self.kill_canceled_sims = libE_specs.get("kill_canceled_sims") self.hist = hist self.hist.safe_mode = self.safe_mode + if self.safe_mode: + warnings.warn("LibeSpecs.safe_mode is deprecated, to be removed in v1.4.0", DeprecationWarning) self.libE_specs = libE_specs self.alloc_specs = alloc_specs self.sim_specs = sim_specs diff --git a/libensemble/resources/resources.py b/libensemble/resources/resources.py index bfc2390247..cf8728bcd7 100644 --- a/libensemble/resources/resources.py +++ b/libensemble/resources/resources.py @@ -6,6 +6,7 @@ import logging import os import socket +import warnings from libensemble.resources import node_resources from libensemble.resources.env_resources import EnvResources @@ -166,6 +167,13 @@ def __init__(self, libE_specs: dict, platform_info: dict = {}, top_level_dir: st self.top_level_dir = top_level_dir self.dedicated_mode = libE_specs.get("dedicated_mode", False) self.zero_resource_workers = libE_specs.get("zero_resource_workers", []) + if len(self.zero_resource_workers): + warnings.warn( + "libE_specs.zero_resource_workers is deprecated, to be removed in v1.4.0." + + "Set libE_specs.gen_workers instead for generator-workers that require no resources.", + DeprecationWarning, + 2, + ) self.num_resource_sets = libE_specs.get("num_resource_sets", None) self.enforce_worker_core_bounds = libE_specs.get("enforce_worker_core_bounds", False) resource_info = libE_specs.get("resource_info", {}) diff --git a/libensemble/utils/specs_checkers.py b/libensemble/utils/specs_checkers.py index cf33d359f7..be2cfcb2c1 100644 --- a/libensemble/utils/specs_checkers.py +++ b/libensemble/utils/specs_checkers.py @@ -5,6 +5,7 @@ import logging import secrets +import warnings from pathlib import Path import numpy as np @@ -33,6 +34,7 @@ def _check_output_fields(values): if scg(values, "gen_specs"): out_names += [e[0] for e in scg(values, "gen_specs").outputs] if scg(values, "alloc_specs"): + warnings.warn('AllocSpecs.out / alloc_specs["out"] is deprecated, to be removed in v1.4.0.', DeprecationWarning) out_names += [e[0] for e in scg(values, "alloc_specs").outputs] for name in scg(values, "sim_specs").inputs: From f2ce82a3c32678471745c9659c122a1795b25dbc Mon Sep 17 00:00:00 2001 From: jlnav Date: Thu, 2 May 2024 15:21:46 -0500 Subject: [PATCH 02/15] add DeprecationWarning messages for use_persis_return_gen and use_persis_return_sim --- libensemble/manager.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libensemble/manager.py b/libensemble/manager.py index 7aa8d1b55f..cb05603d9a 100644 --- a/libensemble/manager.py +++ b/libensemble/manager.py @@ -484,8 +484,18 @@ def _update_state_on_worker_msg(self, persis_info: dict, D_recv: dict, w: int) - final_data = D_recv.get("calc_out", None) if isinstance(final_data, np.ndarray): if calc_status is FINISHED_PERSISTENT_GEN_TAG and self.libE_specs.get("use_persis_return_gen", False): + warnings.warn( + "LibeSpecs.use_persis_return_gen is deprecated, to be removed in v1.4.0. From v1.4.0 onward, " + + "libEnsemble will honor all data returned on completion of a persistent generator.", + DeprecationWarning, + ) self.hist.update_history_x_in(w, final_data, self.W[w]["gen_started_time"]) elif calc_status is FINISHED_PERSISTENT_SIM_TAG and self.libE_specs.get("use_persis_return_sim", False): + warnings.warn( + "LibeSpecs.use_persis_return_sim is deprecated, to be removed in v1.4.0. From v1.4.0 onward, " + + " libEnsemble will honor all data returned on completion of a persistent simulator function.", + DeprecationWarning, + ) self.hist.update_history_f(D_recv, self.kill_canceled_sims) else: logger.info(_PERSIS_RETURN_WARNING) From 9ad86f9306116b5c4ecf1ec035a4ea9518730819 Mon Sep 17 00:00:00 2001 From: jlnav Date: Thu, 16 May 2024 15:29:39 -0500 Subject: [PATCH 03/15] un-tentatively-deprecate safe_mode --- libensemble/manager.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/libensemble/manager.py b/libensemble/manager.py index cb05603d9a..4f2887bed6 100644 --- a/libensemble/manager.py +++ b/libensemble/manager.py @@ -209,8 +209,6 @@ def __init__( self.kill_canceled_sims = libE_specs.get("kill_canceled_sims") self.hist = hist self.hist.safe_mode = self.safe_mode - if self.safe_mode: - warnings.warn("LibeSpecs.safe_mode is deprecated, to be removed in v1.4.0", DeprecationWarning) self.libE_specs = libE_specs self.alloc_specs = alloc_specs self.sim_specs = sim_specs From a0eed6aeb63d37b8b946d31d2d7bed399a4af92f Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 17 May 2024 12:33:18 -0500 Subject: [PATCH 04/15] only raise DeprecationWarning for AllocSpecs.out if that attribute's list is actually populated --- libensemble/utils/specs_checkers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libensemble/utils/specs_checkers.py b/libensemble/utils/specs_checkers.py index be2cfcb2c1..06476ddd30 100644 --- a/libensemble/utils/specs_checkers.py +++ b/libensemble/utils/specs_checkers.py @@ -34,7 +34,10 @@ def _check_output_fields(values): if scg(values, "gen_specs"): out_names += [e[0] for e in scg(values, "gen_specs").outputs] if scg(values, "alloc_specs"): - warnings.warn('AllocSpecs.out / alloc_specs["out"] is deprecated, to be removed in v1.4.0.', DeprecationWarning) + if len(scg(values, "alloc_specs")): + warnings.warn( + 'AllocSpecs.out / alloc_specs["out"] is deprecated, to be removed in v1.4.0.', DeprecationWarning + ) out_names += [e[0] for e in scg(values, "alloc_specs").outputs] for name in scg(values, "sim_specs").inputs: From 36e2574294706231a3cbc4708a8b94fae23e1028 Mon Sep 17 00:00:00 2001 From: jlnav Date: Fri, 9 Aug 2024 11:36:55 -0500 Subject: [PATCH 05/15] adjust target deprecation version --- libensemble/manager.py | 4 ++-- libensemble/resources/resources.py | 2 +- libensemble/utils/specs_checkers.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libensemble/manager.py b/libensemble/manager.py index 30edc2c770..82daf40973 100644 --- a/libensemble/manager.py +++ b/libensemble/manager.py @@ -486,14 +486,14 @@ def _update_state_on_worker_msg(self, persis_info: dict, D_recv: dict, w: int) - if isinstance(final_data, np.ndarray): if calc_status is FINISHED_PERSISTENT_GEN_TAG and self.libE_specs.get("use_persis_return_gen", False): warnings.warn( - "LibeSpecs.use_persis_return_gen is deprecated, to be removed in v1.4.0. From v1.4.0 onward, " + "LibeSpecs.use_persis_return_gen is deprecated, to be removed in v2.0. From v2.0 onward, " + "libEnsemble will honor all data returned on completion of a persistent generator.", DeprecationWarning, ) self.hist.update_history_x_in(w, final_data, self.W[w]["gen_started_time"]) elif calc_status is FINISHED_PERSISTENT_SIM_TAG and self.libE_specs.get("use_persis_return_sim", False): warnings.warn( - "LibeSpecs.use_persis_return_sim is deprecated, to be removed in v1.4.0. From v1.4.0 onward, " + "LibeSpecs.use_persis_return_sim is deprecated, to be removed in v2.0. From v2.0 onward, " + " libEnsemble will honor all data returned on completion of a persistent simulator function.", DeprecationWarning, ) diff --git a/libensemble/resources/resources.py b/libensemble/resources/resources.py index 92e7958392..58b759f271 100644 --- a/libensemble/resources/resources.py +++ b/libensemble/resources/resources.py @@ -169,7 +169,7 @@ def __init__(self, libE_specs: dict, platform_info: dict = {}, top_level_dir: st self.zero_resource_workers = libE_specs.get("zero_resource_workers", []) if len(self.zero_resource_workers): warnings.warn( - "libE_specs.zero_resource_workers is deprecated, to be removed in v1.4.0." + "libE_specs.zero_resource_workers is deprecated, to be removed in v2.0." + "Set libE_specs.gen_workers instead for generator-workers that require no resources.", DeprecationWarning, 2, diff --git a/libensemble/utils/specs_checkers.py b/libensemble/utils/specs_checkers.py index 06476ddd30..1c1666ef77 100644 --- a/libensemble/utils/specs_checkers.py +++ b/libensemble/utils/specs_checkers.py @@ -36,7 +36,7 @@ def _check_output_fields(values): if scg(values, "alloc_specs"): if len(scg(values, "alloc_specs")): warnings.warn( - 'AllocSpecs.out / alloc_specs["out"] is deprecated, to be removed in v1.4.0.', DeprecationWarning + 'AllocSpecs.out / alloc_specs["out"] is deprecated, to be removed in v2.0.', DeprecationWarning ) out_names += [e[0] for e in scg(values, "alloc_specs").outputs] From 716b70ce4cebcb629a0a61f74c18abe0da4d451c Mon Sep 17 00:00:00 2001 From: jlnav Date: Thu, 15 Aug 2024 13:52:47 -0500 Subject: [PATCH 06/15] deprecation warnings within persistent_aposmm and persistent_gpCAM --- libensemble/gen_funcs/persistent_aposmm.py | 6 ++++++ libensemble/gen_funcs/persistent_gpCAM.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/libensemble/gen_funcs/persistent_aposmm.py b/libensemble/gen_funcs/persistent_aposmm.py index c5c3aa5e65..f2c8f41b38 100644 --- a/libensemble/gen_funcs/persistent_aposmm.py +++ b/libensemble/gen_funcs/persistent_aposmm.py @@ -9,6 +9,7 @@ __all__ = ["aposmm", "initialize_APOSMM", "decide_where_to_start_localopt", "update_history_dist"] +import warnings from math import log, pi, sqrt import numpy as np @@ -163,6 +164,11 @@ def aposmm(H, persis_info, gen_specs, libE_info): """ try: + warnings.warn( + "Use of persistent_aposmm as a persistent generator function is deprecated. " + + "From libEnsemble v2.0 onward, Use the libensemble.gen_classes.aposmm ask/tell generator. See the docs for more information.", + FutureWarning, + ) user_specs = gen_specs["user"] ps = PersistentSupport(libE_info, EVAL_GEN_TAG) n, n_s, rk_const, ld, mu, nu, comm, local_H = initialize_APOSMM(H, user_specs, libE_info) diff --git a/libensemble/gen_funcs/persistent_gpCAM.py b/libensemble/gen_funcs/persistent_gpCAM.py index 953cf33cf8..a48663c724 100644 --- a/libensemble/gen_funcs/persistent_gpCAM.py +++ b/libensemble/gen_funcs/persistent_gpCAM.py @@ -1,6 +1,7 @@ """Persistent generator exposing gpCAM functionality""" import time +import warnings import numpy as np from gpcam import GPOptimizer as GP @@ -17,6 +18,12 @@ def _initialize_gpcAM(user_specs, libE_info): """Extract user params""" + warnings.warn( + "Use of persistent_gpCAM as a persistent generator function is deprecated. " + + "From libEnsemble v2.0 onward, Use the libensemble.gen_classes.gpcam ask/tell generator. " + + "See the docs for more information.", + FutureWarning, + ) b = user_specs["batch_size"] lb = np.array(user_specs["lb"]) ub = np.array(user_specs["ub"]) From 8a101a2c3b7c62606650f366ab5a67ecbc507005 Mon Sep 17 00:00:00 2001 From: jlnav Date: Thu, 15 Aug 2024 13:58:05 -0500 Subject: [PATCH 07/15] fix --- libensemble/utils/specs_checkers.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libensemble/utils/specs_checkers.py b/libensemble/utils/specs_checkers.py index 1c1666ef77..0bf148cb04 100644 --- a/libensemble/utils/specs_checkers.py +++ b/libensemble/utils/specs_checkers.py @@ -34,10 +34,7 @@ def _check_output_fields(values): if scg(values, "gen_specs"): out_names += [e[0] for e in scg(values, "gen_specs").outputs] if scg(values, "alloc_specs"): - if len(scg(values, "alloc_specs")): - warnings.warn( - 'AllocSpecs.out / alloc_specs["out"] is deprecated, to be removed in v2.0.', DeprecationWarning - ) + warnings.warn('AllocSpecs.out / alloc_specs["out"] is deprecated, to be removed in v2.0.', DeprecationWarning) out_names += [e[0] for e in scg(values, "alloc_specs").outputs] for name in scg(values, "sim_specs").inputs: From 6370548a305f65deb14238d5ef954ea2aed124f8 Mon Sep 17 00:00:00 2001 From: jlnav Date: Wed, 11 Sep 2024 14:06:42 -0500 Subject: [PATCH 08/15] tentatively deprecate directly specifying num_resource_sets --- libensemble/manager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libensemble/manager.py b/libensemble/manager.py index 82daf40973..e31c40a394 100644 --- a/libensemble/manager.py +++ b/libensemble/manager.py @@ -223,6 +223,12 @@ def __init__( dyn_keys = ("resource_sets", "num_procs", "num_gpus") dyn_keys_in_H = any(k in self.hist.H.dtype.names for k in dyn_keys) self.use_resource_sets = dyn_keys_in_H or self.libE_specs.get("num_resource_sets") + if self.libE_specs.get("num_resource_sets", 0): + warnings.warn( + "Direct-specification of number of resource sets is deprecated, to be removed in v2.0. " + + "From v2.0 onward, Generators should specify `num_procs` or `num_gpus` instead.", + DeprecationWarning, + ) self.gen_num_procs = libE_specs.get("gen_num_procs", 0) self.gen_num_gpus = libE_specs.get("gen_num_gpus", 0) From 3805b6efd028b381b162cc5b9bb0e15681524ac1 Mon Sep 17 00:00:00 2001 From: jlnav Date: Wed, 11 Sep 2024 14:11:02 -0500 Subject: [PATCH 09/15] tentatively deprecate final_gen_send --- libensemble/manager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libensemble/manager.py b/libensemble/manager.py index e31c40a394..cd834a3d37 100644 --- a/libensemble/manager.py +++ b/libensemble/manager.py @@ -595,6 +595,12 @@ def _final_receive_and_kill(self, persis_info: dict) -> (dict, int, int): for w in self.W["worker_id"][self.W["persis_state"] > 0]: logger.debug(f"Manager sending PERSIS_STOP to worker {w}") if self.libE_specs.get("final_gen_send", False): + warnings.warn( + "LibeSpecs.final_gen_send is deprecated, to be removed in v2.0. From v2.0 onward, " + + "upon a workflow completing, libEnsemble will automatically send any outstanding " + + "finished simulations to the generator.", + DeprecationWarning, + ) rows_to_send = np.where(self.hist.H["sim_ended"] & ~self.hist.H["gen_informed"])[0] work = { "H_fields": self.gen_specs["persis_in"], From 4354fffbec58d3a0106d5b013b51233e6db294f9 Mon Sep 17 00:00:00 2001 From: jlnav Date: Wed, 11 Sep 2024 14:14:30 -0500 Subject: [PATCH 10/15] warn that libE_specs["workers"], a setting used only for tcp, will be renamed for clarity in 2.0 --- libensemble/libE.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libensemble/libE.py b/libensemble/libE.py index 2762890bc3..4677887202 100644 --- a/libensemble/libE.py +++ b/libensemble/libE.py @@ -120,6 +120,7 @@ import socket import sys import traceback +import warnings from pathlib import Path from typing import Callable, Dict @@ -590,6 +591,7 @@ def libE_tcp_mgr(sim_specs, gen_specs, exit_criteria, persis_info, alloc_specs, workers = None nworkers = libE_specs["nworkers"] elif libE_specs.get("workers"): + warnings.warn("LibeSpecs.workers will be renamed to LibeSpecs.worker_hosts in v2.0", FutureWarning) workers = libE_specs["workers"] nworkers = len(workers) ip = libE_specs["ip"] or get_ip() From d11c30c893e5cefc6d3e6d3d63043e7d26db064d Mon Sep 17 00:00:00 2001 From: jlnav Date: Wed, 11 Sep 2024 15:29:07 -0500 Subject: [PATCH 11/15] actually document a libE_specs feature that already exists!! --- docs/data_structures/libE_specs.rst | 4 ++++ libensemble/specs.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/data_structures/libE_specs.rst b/docs/data_structures/libE_specs.rst index 2a9195cea5..ff8c20767e 100644 --- a/docs/data_structures/libE_specs.rst +++ b/docs/data_structures/libE_specs.rst @@ -195,6 +195,10 @@ libEnsemble is primarily customized by setting options within a ``LibeSpecs`` cl a local Python path, calling script, and manager/server format-fields for ``manager_ip``, ``manager_port``, ``authkey``, and ``workerID``. ``nworkers`` is specified normally. + **worker_launcher** [Callable]: + TCP Only: Worker launcher function. Accepts ``libE_specs``. An alternative to + ``worker_cmd`` for initiating workers via third-party launchers. + .. tab-item:: History **save_every_k_sims** [int]: diff --git a/libensemble/specs.py b/libensemble/specs.py index e8779f930d..5fc0ddff5f 100644 --- a/libensemble/specs.py +++ b/libensemble/specs.py @@ -397,7 +397,13 @@ class LibeSpecs(BaseModel): """ TCP Only: Split string corresponding to worker/client Python process invocation. Contains a local Python path, calling script, and manager/server format-fields for ``manager_ip``, - ``manager_port``, ``authkey``, and ``workerID``. ``nworkers`` is specified normally. + ``manager_port``, ``authkey``, and ``workerID``. ``nworkers`` is specified normally. Launched + locally for each worker. + """ + + worker_launcher: Optional[Callable] = None + """ TCP Only: Worker launcher function. Accepts ``libE_specs``. An alternative to + ``worker_cmd`` for initiating workers via third-party launchers. """ use_persis_return_gen: Optional[bool] = False From 695ee2900bb1dc64bb75147e32c92eef64c60aeb Mon Sep 17 00:00:00 2001 From: Stefan M Wild Date: Tue, 17 Sep 2024 13:23:56 -0700 Subject: [PATCH 12/15] Update manager.py Minor cleanup --- libensemble/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libensemble/manager.py b/libensemble/manager.py index cd834a3d37..b7fce38f60 100644 --- a/libensemble/manager.py +++ b/libensemble/manager.py @@ -225,8 +225,8 @@ def __init__( self.use_resource_sets = dyn_keys_in_H or self.libE_specs.get("num_resource_sets") if self.libE_specs.get("num_resource_sets", 0): warnings.warn( - "Direct-specification of number of resource sets is deprecated, to be removed in v2.0. " - + "From v2.0 onward, Generators should specify `num_procs` or `num_gpus` instead.", + "Direct specification of number of resource sets is deprecated, to be removed in v2.0. " + + "From v2.0 onward, generators should specify `num_procs` or `num_gpus` instead.", DeprecationWarning, ) self.gen_num_procs = libE_specs.get("gen_num_procs", 0) From 939f8689b744b5c7b13ec8d8d706834c4d3117b5 Mon Sep 17 00:00:00 2001 From: Stefan M Wild Date: Tue, 17 Sep 2024 13:26:08 -0700 Subject: [PATCH 13/15] Update persistent_aposmm.py capitalization --- libensemble/gen_funcs/persistent_aposmm.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libensemble/gen_funcs/persistent_aposmm.py b/libensemble/gen_funcs/persistent_aposmm.py index f2c8f41b38..9bf7eaae98 100644 --- a/libensemble/gen_funcs/persistent_aposmm.py +++ b/libensemble/gen_funcs/persistent_aposmm.py @@ -40,7 +40,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): """ APOSMM coordinates multiple local optimization runs, starting from points which do not have a better point nearby (within a distance ``r_k``). This - generation function uses a ``local_H`` (serving a similar purpose as ``H`` + generation function s a ``local_H`` (serving a similar purpose as ``H`` in libEnsemble) containing the fields: - ``'x' [n floats]``: Parameters being optimized over @@ -71,14 +71,14 @@ def aposmm(H, persis_info, gen_specs, libE_info): ``gen_specs['in']`` (and, of course, include them in the H0 array given to libensemble). - Necessary quantities in ``gen_specs['user']`` are: + Necessary quantities in ``gen_specs['r']`` are: - ``'lb' [n floats]``: Lower bound on search domain - ``'ub' [n floats]``: Upper bound on search domain - ``'localopt_method' [str]``: Name of an NLopt, PETSc/TAO, or SciPy method (see 'advance_local_run' below for supported methods). When using a SciPy method, must supply ``'opt_return_codes'``, a list of integers that will - be used to determine if the x produced by the localopt method should be + be d to determine if the x produced by the localopt method should be ruled a local minimum. (For example, SciPy's COBYLA has a 'status' of 1 if at an optimum, but SciPy's Nelder-Mead and BFGS have a 'status' of 0 if at an optimum.) @@ -87,7 +87,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): zero if no additional sampling is desired, but if zero there must be past sim_f values given to libEnsemble in H0. - Optional ``gen_specs['user']`` entries are: + Optional ``gen_specs['r']`` entries are: - ``'sample_points' [numpy array]``: Points to be sampled (original domain). If more sample points are needed by APOSMM during the course of the @@ -114,7 +114,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): If the rules in ``decide_where_to_start_localopt`` produces more than ``'max_active_runs'`` in some iteration, then existing runs are prioritized. - And ``gen_specs['user']`` must also contain fields for the given + And ``gen_specs['r']`` must also contain fields for the given localopt_method's convergence tolerances (e.g., gatol/grtol for PETSC/TAO or ftol_rel for NLopt) @@ -152,11 +152,11 @@ def aposmm(H, persis_info, gen_specs, libE_info): x_opt: the reported minimum from a localopt run (disregarded unless opt_flag is 1) opt_flag: 1 if the run ended with an optimal point (x_opt) or - 0 if it ended because e.g., maxiters/maxevals were reached + 0 if it ended beca e.g., maxiters/maxevals were reached num_samples: Number of additional uniformly drawn samples needed - Description of persistent variables used to maintain the state of APOSMM + Description of persistent variables d to maintain the state of APOSMM persis_info['total_runs']: Running count of started/completed localopt runs persis_info['run_order']: Sequence of indices of points in unfinished runs @@ -166,7 +166,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): try: warnings.warn( "Use of persistent_aposmm as a persistent generator function is deprecated. " - + "From libEnsemble v2.0 onward, Use the libensemble.gen_classes.aposmm ask/tell generator. See the docs for more information.", + + "From libEnsemble v2.0 onward, use the libensemble.gen_classes.aposmm ask/tell generator. See the docs for more information.", FutureWarning, ) user_specs = gen_specs["user"] From baa2761f2a3af620daaab81162e67814a263e117 Mon Sep 17 00:00:00 2001 From: Stefan Wild Date: Tue, 17 Sep 2024 13:36:43 -0700 Subject: [PATCH 14/15] Revert "Update persistent_aposmm.py" This reverts commit 939f8689b744b5c7b13ec8d8d706834c4d3117b5. --- libensemble/gen_funcs/persistent_aposmm.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libensemble/gen_funcs/persistent_aposmm.py b/libensemble/gen_funcs/persistent_aposmm.py index 9bf7eaae98..f2c8f41b38 100644 --- a/libensemble/gen_funcs/persistent_aposmm.py +++ b/libensemble/gen_funcs/persistent_aposmm.py @@ -40,7 +40,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): """ APOSMM coordinates multiple local optimization runs, starting from points which do not have a better point nearby (within a distance ``r_k``). This - generation function s a ``local_H`` (serving a similar purpose as ``H`` + generation function uses a ``local_H`` (serving a similar purpose as ``H`` in libEnsemble) containing the fields: - ``'x' [n floats]``: Parameters being optimized over @@ -71,14 +71,14 @@ def aposmm(H, persis_info, gen_specs, libE_info): ``gen_specs['in']`` (and, of course, include them in the H0 array given to libensemble). - Necessary quantities in ``gen_specs['r']`` are: + Necessary quantities in ``gen_specs['user']`` are: - ``'lb' [n floats]``: Lower bound on search domain - ``'ub' [n floats]``: Upper bound on search domain - ``'localopt_method' [str]``: Name of an NLopt, PETSc/TAO, or SciPy method (see 'advance_local_run' below for supported methods). When using a SciPy method, must supply ``'opt_return_codes'``, a list of integers that will - be d to determine if the x produced by the localopt method should be + be used to determine if the x produced by the localopt method should be ruled a local minimum. (For example, SciPy's COBYLA has a 'status' of 1 if at an optimum, but SciPy's Nelder-Mead and BFGS have a 'status' of 0 if at an optimum.) @@ -87,7 +87,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): zero if no additional sampling is desired, but if zero there must be past sim_f values given to libEnsemble in H0. - Optional ``gen_specs['r']`` entries are: + Optional ``gen_specs['user']`` entries are: - ``'sample_points' [numpy array]``: Points to be sampled (original domain). If more sample points are needed by APOSMM during the course of the @@ -114,7 +114,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): If the rules in ``decide_where_to_start_localopt`` produces more than ``'max_active_runs'`` in some iteration, then existing runs are prioritized. - And ``gen_specs['r']`` must also contain fields for the given + And ``gen_specs['user']`` must also contain fields for the given localopt_method's convergence tolerances (e.g., gatol/grtol for PETSC/TAO or ftol_rel for NLopt) @@ -152,11 +152,11 @@ def aposmm(H, persis_info, gen_specs, libE_info): x_opt: the reported minimum from a localopt run (disregarded unless opt_flag is 1) opt_flag: 1 if the run ended with an optimal point (x_opt) or - 0 if it ended beca e.g., maxiters/maxevals were reached + 0 if it ended because e.g., maxiters/maxevals were reached num_samples: Number of additional uniformly drawn samples needed - Description of persistent variables d to maintain the state of APOSMM + Description of persistent variables used to maintain the state of APOSMM persis_info['total_runs']: Running count of started/completed localopt runs persis_info['run_order']: Sequence of indices of points in unfinished runs @@ -166,7 +166,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): try: warnings.warn( "Use of persistent_aposmm as a persistent generator function is deprecated. " - + "From libEnsemble v2.0 onward, use the libensemble.gen_classes.aposmm ask/tell generator. See the docs for more information.", + + "From libEnsemble v2.0 onward, Use the libensemble.gen_classes.aposmm ask/tell generator. See the docs for more information.", FutureWarning, ) user_specs = gen_specs["user"] From 7fef7b691163a2efe444aad69bb9f2e47fce02d3 Mon Sep 17 00:00:00 2001 From: Stefan M Wild Date: Tue, 17 Sep 2024 13:38:27 -0700 Subject: [PATCH 15/15] Update persistent_aposmm.py fixing a capitalization --- libensemble/gen_funcs/persistent_aposmm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libensemble/gen_funcs/persistent_aposmm.py b/libensemble/gen_funcs/persistent_aposmm.py index f2c8f41b38..13f8cbebcf 100644 --- a/libensemble/gen_funcs/persistent_aposmm.py +++ b/libensemble/gen_funcs/persistent_aposmm.py @@ -166,7 +166,7 @@ def aposmm(H, persis_info, gen_specs, libE_info): try: warnings.warn( "Use of persistent_aposmm as a persistent generator function is deprecated. " - + "From libEnsemble v2.0 onward, Use the libensemble.gen_classes.aposmm ask/tell generator. See the docs for more information.", + + "From libEnsemble v2.0 onward, use the libensemble.gen_classes.aposmm ask/tell generator. See the docs for more information.", FutureWarning, ) user_specs = gen_specs["user"]