Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6dd7faf
cleanup additional files after running testsuite
jlnav May 27, 2026
744ed1f
introduce improved field-mapping logic from threadrunner Generator to…
jlnav May 27, 2026
ff9120f
bump sim_max and max_active_runs
jlnav May 27, 2026
aa9784e
trying to reduce time for test_cancel_in_alloc
jlnav May 27, 2026
4fa8582
decrement gen_max in test_asktell_sampling.py - since this test takes…
jlnav May 27, 2026
ca51775
using dry_run and smaller sim_max to decrease test_stats_output runtime
jlnav May 27, 2026
aac8054
cutting gen_max for test_asktell_sampling
jlnav May 27, 2026
20ccb03
cut sim_max for test_persistent_sampling_CUDA_variable_resources
jlnav May 27, 2026
6d6a0ce
cut test_persistent_uniform_sampling_async gen_max
jlnav May 27, 2026
57493c8
cut sim_max for test_GPU_variable_resources
jlnav May 27, 2026
f015c69
cut sim_max for test_GPU_variable_resources_multi_task
jlnav May 27, 2026
eebf58b
also bump sim_max for test_persistent_aposmm_nlopt
jlnav May 28, 2026
cdc40cb
num test case adjusts for various tests
jlnav May 28, 2026
19f4bea
tweaking cancel_in_alloc sim_max
jlnav May 28, 2026
23bee33
wowee
jlnav May 28, 2026
4d9682c
guarantee that cancels due to long runtimes actually happen in cancel…
jlnav May 28, 2026
eb11186
bump initial sample size
jlnav May 28, 2026
b48c36f
bump pixi versions
jlnav May 28, 2026
22f0f22
cut the default dist_to_bound_multiple from 0.5 to 0.05
jlnav May 28, 2026
bfcfc17
lets consistent run this with only the larger number of processes
jlnav May 28, 2026
4e1ab9e
hugely bump tol, since we're just testing allocs
jlnav May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.68.1
pixi-version: v0.69.0
frozen: true
environments: ${{ matrix.python-version }}
activate-environment: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.68.1
pixi-version: v0.69.0
cache: true
frozen: true
environments: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion libensemble/gen_classes/aposmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __init__(
opt_return_codes: list[int] = [0],
mu: float = 1e-8,
nu: float = 1e-8,
dist_to_bound_multiple: float = 0.5,
dist_to_bound_multiple: float = 0.05,
random_seed: int = 1,
**kwargs,
) -> None:
Expand Down
11 changes: 7 additions & 4 deletions libensemble/tests/functionality_tests/test_asktell_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def sim_f(In):
gen_specs = {
"persis_in": ["x", "f", "sim_id"],
"out": [("x", float, (2,))],
"initial_batch_size": 20,
"batch_size": 10,
"initial_batch_size": 2,
"batch_size": 1,
"user": {
"lb": np.array([-3, -2]),
"ub": np.array([3, 2]),
Expand All @@ -56,7 +56,7 @@ def sim_f(In):

vocs = VOCS(variables=variables, objectives=objectives)

exit_criteria = {"gen_max": 201}
exit_criteria = {"gen_max": 11}

for test in range(3):
if test == 0:
Expand Down Expand Up @@ -88,5 +88,8 @@ def sim_f(In):
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, libE_specs=libE_specs)

if is_manager:
# Basic sanity checks that we actually saved generated inputs/outputs.
assert len(H) >= 11, f"H has length {len(H)}"
assert np.any(np.linalg.norm(H["x"], axis=1) > 0.0), "All saved x values are zero"
assert np.any(H["f"] > 0.0), "All saved f values are zero"
print(H[["sim_id", "x", "f"]][:10])
assert len(H) >= 201, f"H has length {len(H)}"
20 changes: 13 additions & 7 deletions libensemble/tests/functionality_tests/test_cancel_in_alloc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Runs libEnsemble in order to test the ability of an allocation function to
cancel long-running simulations. In this case, the simulation has a run-time
in seconds that is drawn uniformly from [0,10] and any time the allocation
function is called and a sim_id has been evaluated for more than 5 seconds,
in seconds that is drawn uniformly from [0,60] and any time the allocation
function is called and a sim_id has been evaluated for more than 0.1 seconds,
it is cancelled.

Execute via one of the following commands (e.g. 3 workers):
Expand Down Expand Up @@ -36,14 +36,14 @@
"sim_f": sim_f,
"in": ["x"],
"out": [("f", float)],
"user": {"uniform_random_pause_ub": 10},
"user": {"uniform_random_pause_ub": 10}, # long sleep ensures sims are still running when cancel fires
}

gen_specs = {
"gen_f": gen_f,
"in": ["sim_id"],
"out": [("x", float, (2,))],
"batch_size": 5,
"batch_size": nworkers,
"num_active_gens": 1,
"user": {
"lb": np.array([-3, -2]),
Expand All @@ -54,15 +54,21 @@
alloc_specs = {
"alloc_f": give_sim_work_first,
"user": {
"cancel_sims_time": 3,
"cancel_sims_time": 0.1, # fires on first alloc call after dispatch, before any sim can return
"batch_mode": False,
},
}

exit_criteria = {"sim_max": 10, "wallclock_max": 300}
exit_criteria = {"sim_max": nworkers * 2, "wallclock_max": 30}

# Perform the run
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, libE_specs=libE_specs, alloc_specs=alloc_specs)
H, persis_info, flag = libE(
sim_specs,
gen_specs,
exit_criteria,
libE_specs=libE_specs,
alloc_specs=alloc_specs,
)

if is_manager:
test = np.any(H["cancel_requested"]) and np.any(H["kill_sent"])
Expand Down
10 changes: 8 additions & 2 deletions libensemble/tests/functionality_tests/test_new_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Do not change these lines - they are parsed by run-tests.sh
# TESTSUITE_COMMS: mpi local
# TESTSUITE_NPROCS: 2 4
# TESTSUITE_NPROCS: 4

import numpy as np

Expand Down Expand Up @@ -55,7 +55,13 @@ def sim_f(In):

exit_criteria = {"gen_max": 501}

H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, alloc_specs=alloc_specs, libE_specs=libE_specs)
H, persis_info, flag = libE(
sim_specs,
gen_specs,
exit_criteria,
alloc_specs=alloc_specs,
libE_specs=libE_specs,
)

if is_manager:
assert len(H) >= 501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
}

libE_specs["scheduler_opts"] = {"match_slots": True}
exit_criteria = {"sim_max": 40, "wallclock_max": 300}
exit_criteria = {"sim_max": 10, "wallclock_max": 300}

# Perform the run

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Do not change these lines - they are parsed by run-tests.sh
# TESTSUITE_COMMS: mpi local tcp
# TESTSUITE_NPROCS: 3 4
# TESTSUITE_NPROCS: 4
# TESTSUITE_OS_SKIP: WIN

import sys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Do not change these lines - they are parsed by run-tests.sh
# TESTSUITE_COMMS: mpi local
# TESTSUITE_NPROCS: 3 4
# TESTSUITE_NPROCS: 4

import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
}

exit_criteria = {"gen_max": 100, "wallclock_max": 300}
exit_criteria = {"gen_max": 10, "wallclock_max": 300}

# Perform the run
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, libE_specs=libE_specs)
Expand Down
9 changes: 6 additions & 3 deletions libensemble/tests/functionality_tests/test_stats_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
"sim_f": sim_f,
"in": ["x"],
"out": [("f", float)],
"user": {"app": "helloworld"}, # helloworld or six_hump_camel
"user": {
"app": "helloworld",
"dry_run": True,
}, # dry_run avoids real MPI launches; stats format still exercised
}

gen_specs = {
Expand Down Expand Up @@ -86,13 +89,13 @@
# This can improve scheduling when tasks may run across multiple nodes
libE_specs["scheduler_opts"] = {"match_slots": False}

exit_criteria = {"sim_max": 40, "wallclock_max": 300}
exit_criteria = {"sim_max": 12, "wallclock_max": 60}

iterations = 2

# Note that libE_stats.txt output will be appended across libE calls.
for prob_id in range(iterations):
sim_specs["user"]["app"] = "six_hump_camel"
sim_specs["user"]["app"] = "helloworld"

libE_specs["ensemble_dir_path"] = (
"./ensemble_test_stats" + str(nworkers) + "_" + libE_specs.get("comms") + "_" + str(prob_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Do not change these lines - they are parsed by run-tests.sh
# TESTSUITE_COMMS: mpi local
# TESTSUITE_NPROCS: 2 4
# TESTSUITE_NPROCS: 4

import gc

Expand All @@ -41,7 +41,15 @@ def create_H0(persis_info, gen_specs, sim_max):
n = len(lb)
b = sim_max

H0 = np.zeros(b, dtype=[("x", float, 2), ("sim_id", int), ("sim_started", bool), ("cancel_requested", bool)])
H0 = np.zeros(
b,
dtype=[
("x", float, 2),
("sim_id", int),
("sim_started", bool),
("cancel_requested", bool),
],
)
rng = get_rng(gen_specs, {})
H0["x"] = rng.uniform(lb, ub, (b, n))
H0["sim_id"] = range(b)
Expand Down Expand Up @@ -144,14 +152,20 @@ def create_H0(persis_info, gen_specs, sim_max):

# Perform the run - do not overwrite persis_info
H, persis_out, flag = libE(
sim_specs, gen_specs, exit_criteria, persis_info, alloc_specs=alloc_specs, libE_specs=libE_specs, H0=H0
sim_specs,
gen_specs,
exit_criteria,
persis_info,
alloc_specs=alloc_specs,
libE_specs=libE_specs,
H0=H0,
)

if is_manager:
assert flag == 0
assert np.all(H["cancel_requested"][::10]), "Some values should be cancelled but are not"
assert np.all(~H["sim_started"][::10]), "Some values are given that should not have been"
tol = 0.1
tol = 0.5
for m in minima:
assert np.min(np.sum((H["x"] - m) ** 2, 1)) < tol

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Do not change these lines - they are parsed by run-tests.sh
# TESTSUITE_COMMS: mpi local
# TESTSUITE_NPROCS: 2 4
# TESTSUITE_NPROCS: 4
# TESTSUITE_EXTRA: true

import sys
Expand Down Expand Up @@ -114,7 +114,12 @@

# Perform the run
H, persis_info, flag = libE(
sim_specs, gen_specs, exit_criteria, persis_info, libE_specs=libE_specs, alloc_specs=alloc_specs
sim_specs,
gen_specs,
exit_criteria,
persis_info,
libE_specs=libE_specs,
alloc_specs=alloc_specs,
)

if is_manager:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

# Run with random num_procs/num_gpus for each simulation
gpu_test.persis_info = {}
gpu_test.exit_criteria = ExitCriteria(sim_max=20)
gpu_test.exit_criteria = ExitCriteria(sim_max=10)

gpu_test.run()
if gpu_test.is_manager:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
},
)

gpu_test.exit_criteria = ExitCriteria(sim_max=40, wallclock_max=300)
gpu_test.exit_criteria = ExitCriteria(sim_max=10, wallclock_max=300)

if gpu_test.ready():
gpu_test.run()
Expand Down
20 changes: 14 additions & 6 deletions libensemble/tests/regression_tests/test_asktell_aposmm_nlopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def six_hump_camel_func(x):

# Main block is necessary only when using local comms with spawn start method (default on macOS and Windows).
if __name__ == "__main__":

workflow = Ensemble(parse_args=True)

if workflow.is_manager:
Expand All @@ -58,15 +57,24 @@ def six_hump_camel_func(x):
n = 2

vocs = VOCS(
variables={"core": [-3, 3], "edge": [-2, 2], "core_on_cube": [0, 1], "edge_on_cube": [0, 1]},
variables={
"core": [-3, 3],
"edge": [-2, 2],
"core_on_cube": [0, 1],
"edge_on_cube": [0, 1],
},
objectives={"energy": "MINIMIZE"},
)

aposmm = APOSMM(
vocs,
max_active_runs=max(1, workflow.nworkers - 1),
variables_mapping={"x": ["core", "edge"], "x_on_cube": ["core_on_cube", "edge_on_cube"], "f": ["energy"]},
initial_sample_size=100,
max_active_runs=6,
variables_mapping={
"x": ["core", "edge"],
"x_on_cube": ["core_on_cube", "edge_on_cube"],
"f": ["energy"],
},
initial_sample_size=200,
sample_points=np.round(minima, 1),
localopt_method="LN_BOBYQA",
rk_const=0.5 * ((gamma(1 + (n / 2)) * 5) ** (1 / n)) / sqrt(pi),
Expand All @@ -82,7 +90,7 @@ def six_hump_camel_func(x):
)

workflow.sim_specs = SimSpecs(simulator=six_hump_camel_func, vocs=vocs)
workflow.exit_criteria = ExitCriteria(sim_max=2000, wallclock_max=600)
workflow.exit_criteria = ExitCriteria(sim_max=3000, wallclock_max=600)

# Perform the run
H, _, _ = workflow.run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,16 @@

alloc_specs = {"alloc_f": alloc_f}

exit_criteria = {"sim_max": 2000}
exit_criteria = {"sim_max": 3000}

# Perform the run
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, alloc_specs=alloc_specs, libE_specs=libE_specs)
H, persis_info, flag = libE(
sim_specs,
gen_specs,
exit_criteria,
alloc_specs=alloc_specs,
libE_specs=libE_specs,
)

if is_manager:
print("[Manager]:", H[np.where(H["local_min"])]["x"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

# Do not change these lines - they are parsed by run-tests.sh
# TESTSUITE_COMMS: mpi local tcp
# TESTSUITE_NPROCS: 3 4
# TESTSUITE_NPROCS: 4
# TESTSUITE_EXTRA: true
# TESTSUITE_OS_SKIP: OSX

Expand Down
9 changes: 9 additions & 0 deletions libensemble/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ def cleanup(root_dir):
"opt_*.txt_flag",
"test_executor_forces_tutorial",
"test_executor_forces_tutorial_2",
# Coverage output generated by merge_coverage_reports
"coverage.xml",
# Cache files created by Ensemble/calling scripts
".libe_cache_*.meta.json",
# Artifacts from forces build step
"forces_app",
"scaling_tests/forces/forces_app/forces.x",
# Task output scripts in unit tests
"libe_task_*.sh",
]
dirs_to_clean = UNIT_TEST_DIRS + [REG_TEST_SUBDIR, FUNC_TEST_SUBDIR]
for dir_path in dirs_to_clean:
Expand Down
Loading