Skip to content

Commit 8da9d41

Browse files
committed
additional zrw removal adjustments
1 parent 79b219e commit 8da9d41

13 files changed

Lines changed: 14 additions & 58 deletions

docs/resource_manager/zero_resource_workers.rst

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,3 @@ may be multiple nodes or a partition of a node in each resource set. If the spli
6767
is uneven, resource sets are not split between nodes. For example, if there are
6868
two nodes and five resource sets, one node will have three resource sets, and
6969
the other will have two.
70-
71-
Placing zero-resource functions on a fixed worker
72-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73-
74-
If the generator must always be on worker one, then instead of using
75-
``num_resource_sets``, use the ``zero_resource_workers`` *libE_specs* option:
76-
77-
.. code-block:: python
78-
79-
libE_specs["zero_resource_workers"] = [1]
80-
81-
in the calling script and worker one will not be allocated resources. In general,
82-
set the parameter ``zero_resource_workers`` to a list of worker IDs that should not
83-
have resources assigned.
84-
85-
This approach can be useful if running in
86-
:doc:`distributed mode<../platforms/platforms_index>`.
87-
88-
The use of the ``zero_resource_workers`` *libE_specs* option must be supported by
89-
the allocation function, see :ref:`start_only_persistent<start_only_persistent_label>`)

libensemble/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def _set_resources(self, Work: dict, w: int) -> None:
396396

397397
if rset_req is None:
398398
rset_team = []
399-
default_rset = resource_manager.index_list[w - 1] # type: ignore
399+
default_rset = resource_manager.index_list[w] # type: ignore
400400
if default_rset is not None:
401401
rset_team.append(default_rset)
402402
Work["libE_info"]["rset_team"] = rset_team

libensemble/resources/rset_resources.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ def __init__(self, num_workers: int, resources: GlobalResources):
4141
4242
Determines the compute resources available for each resource set.
4343
44-
Unless resource sets is set explicitly, the number of resource sets is the number of workers,
45-
excluding any workers defined as zero resource workers.
44+
Unless resource sets is set explicitly, the number of resource sets is the number of workers.
4645
4746
Parameters
4847
----------
4948
5049
num_workers: int
5150
The total number of workers
5251
53-
resources: Resources
54-
A Resources object containing global nodelist and intranode information
52+
resources: GlobalResources
53+
A GlobalResources object containing global nodelist and intranode information
5554
5655
"""
5756
self.num_workers = num_workers

libensemble/resources/worker_resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def get_index_list(num_workers: int, num_rsets: int) -> list[int | None]:
111111
index_list.append(None)
112112
else:
113113
index_list.append(index)
114-
index += 1
114+
index += 1
115115
return index_list
116116

117117

libensemble/tests/functionality_tests/test_GPU_gen_resources.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
# reset
9797
libE_specs = base_libE_specs.copy()
9898
libE_specs["gen_on_worker"] = gen_on_worker
99-
libE_specs["zero_resource_workers"] = [] # perhaps the generator needs GPUs
10099

101100
resourced_workers = (
102101
nworkers if gen_on_worker else nworkers + 1

libensemble/tests/functionality_tests/test_mpi_runners.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
libE_specs["dedicated_mode"] = True
3838
libE_specs["enforce_worker_core_bounds"] = True
39+
libE_specs["gen_on_worker"] = True
3940

4041
# To allow visual checking - log file not used in test
4142
log_file = "ensemble_mpi_runners_comms_" + str(comms) + "_wrks_" + str(nworkers) + ".log"

libensemble/tests/functionality_tests/test_persistent_uniform_gen_decides_stop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# Do not change these lines - they are parsed by run-tests.sh
1515
# TESTSUITE_COMMS: mpi local
16-
# TESTSUITE_NPROCS: 3 5
16+
# TESTSUITE_NPROCS: 4 6
1717
# TESTSUITE_OS_SKIP: WIN
1818

1919
import sys

libensemble/tests/functionality_tests/test_runlines_adaptive_workers_persistent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Runs libEnsemble run-lines for adaptive workers with persistent gen.
33
44
Default setup is designed to run on 4*N + 1 workers - to modify, change total_nodes.
5-
where one worker is a zero-resource persistent gen.
5+
where one worker is a persistent gen without assigned resources.
66
77
Execute via one of the following commands (e.g. 9 workers):
88
mpiexec -np 10 python test_runlines_adaptive_workers_persistent.py

libensemble/tests/functionality_tests/test_runlines_adaptive_workers_persistent_oversubscribe_rsets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Runs libEnsemble run-lines for adaptive workers with persistent gen.
33
44
Default setup is designed to run on 2*N + 1 workers - to modify, change total_nodes.
5-
where one worker is a zero-resource persistent gen.
5+
where one worker is a persistent gen without assigned resources.
66
77
Execute via one of the following commands (e.g. 5 workers):
88
mpiexec -np 6 python test_runlines_adaptive_workers_persistent_oversubscribe_rsets.py

libensemble/tests/unit_tests/test_allocation_funcs_and_support.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@
3535

3636
W_gen_mgr = np.array(
3737
[
38-
(0, True, 0, 0, False, False),
39-
(1, False, 0, 0, False, False),
40-
(2, False, 0, 0, False, False),
41-
(3, False, 0, 0, False, False),
42-
(4, False, 0, 0, False, False),
38+
(0, True, 0, 0, False),
39+
(1, False, 0, 0, False),
40+
(2, False, 0, 0, False),
41+
(3, False, 0, 0, False),
42+
(4, False, 0, 0, False),
4343
],
4444
dtype=[
4545
("worker_id", "<i8"),
4646
("gen_worker", "?"),
4747
("active", "<i8"),
4848
("persis_state", "<i8"),
4949
("active_recv", "?"),
50-
("zero_resource_worker", "?"),
5150
],
5251
)
5352

@@ -173,13 +172,6 @@ def test_als_worker_ids_with_gen_mgr():
173172
flag = 0
174173
assert flag == 0, "AllocSupport didn't error on invalid options for avail_worker_ids()"
175174

176-
W_zrw = W_gen_mgr.copy()
177-
W_zrw["zero_resource_worker"] = np.array([True, 0, 0, 0, 0])
178-
als = AllocSupport(W_zrw, True)
179-
assert als.avail_worker_ids(zero_resource_workers=True) == [
180-
0
181-
], "avail_worker_ids() didn't return expected zero resource worker list."
182-
183175

184176
def test_als_evaluate_gens():
185177
W_gens = W.copy()

0 commit comments

Comments
 (0)