You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SMAC supports multiple workers natively via Dask. Just specify ``n_workers`` in the scenario and you are ready to go.
4
-
3
+
To facilitate parallel execution, SMAC supports executing multiple workers simultaneously via [Dask](https://www.dask.org/). Using this functionality, splits SMAC into a main process, and DASK workers which handle the execution.
4
+
The main job handles the optimization process, and coordinates the executor jobs. The executors are queried with the target function and hyperparameter configurations, execute them, and return their result. The executors remain open between different executions.
5
5
6
6
!!! note
7
7
8
8
Please keep in mind that additional workers are only used to evaluate trials. The main thread still orchestrates the
9
9
optimization process, including training the surrogate model.
10
10
11
-
12
11
!!! warning
13
12
14
-
Using high number of workers when the target function evaluation is fast might be counterproductive due to the
15
-
overhead of communcation. Consider using only one worker in this case.
16
-
13
+
When using multiple workers, SMAC is not reproducible anymore.
17
14
18
-
!!! warning
19
15
20
-
When using multiple workers, SMAC is not reproducible anymore.
16
+
## Parallelizing Locally
21
17
18
+
To utilize parallelism locally, that means running workers on the same machine as the main jobs, specify the ``n_workers`` keyword when creating the scenario.
19
+
```python
20
+
Scenario(model.configspace, n_workers=5)
21
+
```
22
22
23
-
## Running on a Cluster
24
23
25
-
You can also pass a custom dask client, e.g. to run on a slurm cluster.
26
-
See our [parallelism example](../examples/1%20Basics/7_parallelization_cluster.md).
24
+
## Parallelizing on SLURM
27
25
28
-
!!! warning
26
+
To utilize this split of main and execution jobs on a [SLURM cluster](https://slurm.schedmd.com/), SMAC supports manually specifying a [Dask](https://www.dask.org/) client.
27
+
This allows executing the target function on dedicated SLURM jobs that are necessarily configured with the same hardware requirements,.
29
28
30
-
On some clusters you cannot spawn new jobs when running a SLURMCluster inside a
31
-
job instead of on the login node. No obvious errors might be raised but it can hang silently.
29
+
!!! note
32
30
33
-
!!! warning
31
+
While most SLURM clusters behave similarly, the example DASK client might not work for every cluster. For example, some clusters only allow spawning new jobs
32
+
from the login node.
34
33
35
-
Sometimes you need to modify your launch command which can be done with
36
-
`SLURMCluster.job_class.submit_command`.
34
+
To configure SMAC properly for each cluster, you need to know the ports which allow communication between main and worker jobs. The dask client is then created as follows:
37
35
38
36
```python
39
-
cluster.job_cls.submit_command = submit_command
40
-
cluster.job_cls.cancel_command = cancel_command
41
-
```
37
+
...
38
+
from smac import BlackBoxFacade, Scenario
39
+
from dask_jobqueue import SLURMCluster
40
+
41
+
cluster = SLURMCluster(
42
+
queue="partition_name", # Name of the partition
43
+
cores=4, # CPU cores requested
44
+
memory="4 GB", # RAM requested
45
+
walltime="00:10:00", # Walltime limit for a runner job.
0 commit comments