# Parallel Parameter Scan This page uses a local daemon resource to run the radius scan from [Parameter Scan](parameter_scan.md). The daemon schedules {term}`project` solves on the declared resource. The example allows two project solves to run at the same time. ## Declare A Local Resource The script creates a {func}`daemon handler ` and adds one local workstation resource: ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/run.py :language: python :lines: 11-16 ``` `multiplicity=2` allows two concurrent project solves. `n_threads=1` assigns one solver thread to each project solve. The `with handler:` block starts and connects the daemon: ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/run.py :language: python :lines: 18-20 ``` When the block ends, JCMsuite disconnects the handler and stops the daemon. ```{note} Set `multiplicity` and `n_threads` to values supported by the local computer and the available JCMsuite licenses. ``` ## Run The Parallel Scan ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/run.py :language: python ``` The script uses the daemon handler as the context for {func}`solve `. While the daemon handler is active, the script passes {term}`batched project keys` to {func}`solve `. The active handler selects the daemon backend. The call returns a {class}`BatchSolveResult ` after all project solves finish. The rest of the script is identical to the one in [Parameter Scan](parameter_scan.md). ## Use A Remote Workstation Use a remote workstation when the local computer does not provide sufficient compute capacity. Create a {class}`Workstation ` and add it with {meth}`add() `. Replace `` with the remote host name or address. Set `jcm_root` to the JCMsuite installation directory on the remote host. The `multiplicity` value sets the number of concurrent project solves. The `n_threads` value sets the number of solver threads for each project solve. ```python remote_workstation = jcmsuite.daemon.Workstation( hostname="", multiplicity=20, n_threads=1, jcm_root="" ) handler.resources.add(remote_workstation) ``` The Python process must connect to the remote host without an interactive password prompt. JCMsuite and a valid license must be available on the remote host. The daemon transfers the project and required {term}`project support files ` to the remote workstation automatically. The returned {class}`BatchSolveResult ` contains the result data. For additional remote files, plan a separate collection method. Use [Resources And Queues](../runtime/daemon/resources.md) to configure scheduler queues. When you submit solve work without waiting, use [Submit And Wait](../runtime/daemon/submit_wait.md) to collect the {term}`submission`. ## Project Files
run.py ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/run.py :language: python ```
layout.jcmt ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/layout.jcmt :language: jcm ```
materials.jcm ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/materials.jcm :language: jcm ```
mie2D.jcmp ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/mie2D.jcmp :language: jcm ```
sources.jcm ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parallel_parameter_scan/sources.jcm :language: jcm ```
## Next Step Continue to [Persistent Parameter Scan](persistent_parameter_scan.md) to store and reuse solve results.