Resources And Queues

Use daemon.resources.add() to add a resource to a daemon handler. Each resource declaration specifies where and how the daemon can run submitted solve work.

Remote execution prerequisites

Before you use a remote host or scheduler, confirm the following prerequisites:

  • The local machine can reach the remote host or scheduler login host.

  • The configured login chain provides authentication for every host in the path.

  • The remote hosts have a valid JCMsuite installation and a valid license.

  • The daemon transfers the project and required project support files to the remote resource automatically.

  • The workflow has a method to collect the returned result data.

jcmsuite does not provide general remote file copying. Plan how to collect files that are not part of the returned result data.

A remote host is not the machine that starts the Python process. A login chain is the ordered sequence of hosts that reaches a resource host. A GPU is a graphics processing unit that a resource can assign to a solve. An MPI-style cluster is a group of nodes that one solve uses as a coordinated resource.

Resource installation paths (jcm_root), working directories, and out-of-core directories belong to the resource host. Pass remote paths as strings, for example jcm_root="/scratch/JCMsuite/7.4.0". The daemon request preserves their spelling; the client does not expand a remote home directory or resolve a remote path using its own filesystem. SSH private-key paths (pem_file) remain client-side paths.

The default SSH client is ssh. A single hostname can be an alias configured in that SSH client’s configuration, including its proxy/jump settings. Alternatively, declare an ordered hostname/login chain explicitly. Native remote connectivity still depends on the selected daemon executable, SSH client and authentication.

Add A Workstation

Use Workstation for one host. The hostname can contain a login chain. multiplicity sets the number of parallel solves. n_threads sets the number of threads for each submitted solve:

import jcmsuite
from jcmsuite.daemon import Workstation

workstation = Workstation(
    hostname="localhost",
    multiplicity=2,
    n_threads=8,
    gpus="no",
)

daemon = jcmsuite.daemon.handler()
daemon.resources.add(workstation)

Set gpus="all" to use all available GPUs. Set gpus="no" to disable GPU use. Set gpus to an integer or a sequence of integers to select GPU device identifiers.

Add A Queue

Use Queue for scheduler-backed execution. The supported queue_type is "slurm":

from jcmsuite.daemon import Queue

queue = Queue(
    hostname="cluster-login",
    account="project-account",
    partition_name="compute",
    n_nodes=2,
    n_tasks_per_node=1,
    time_minutes=30,
)

daemon.resources.add(queue)

The daemon forwards account, partition_name, n_nodes, n_tasks, node_list, exclude_node, time_minutes, and GPU fields as scheduler resource settings. The configured SLURM environment determines the scheduler behavior.

The account, partition, allocation limits, and license access are controlled by the configured SLURM environment. Confirm these settings with the system administrator before you submit remote work.

Use Nodes From A SLURM Allocation

Use SlurmNodes from an interactive SLURM session. A SLURM allocation is the set of compute nodes assigned to the session. For example, start an interactive shell on an allocation with 12 nodes:

srun --nodes 12 --pty bash

The shell runs on one allocated node. The daemon uses the allocation information to register all allocated nodes. You do not need to specify the hostnames or IP addresses of the other nodes.

To register all tasks in the current allocation, add SlurmNodes without any arguments:

from jcmsuite.daemon import SlurmNodes

daemon.resources.add(SlurmNodes())

To register selected execution entries only, pass their identifiers to task_ids:

daemon.resources.add(SlurmNodes(task_ids=[0, 2, 4]))

When an allocation has nNodes physical nodes, the daemon maps execution identifier i to node i % nNodes.

By default, the daemon treats registered tasks as a worker pool. Set cluster=True when the selected tasks must form one MPI-style cluster resource for one solve:

daemon.resources.add(SlurmNodes(task_ids=[0, 1], cluster=True))

Add A Cluster

Use Cluster with one or more ClusterNode declarations:

from jcmsuite.daemon import Cluster, ClusterNode

cluster = Cluster(
    hostname="cluster-login",
    nodes=(
        ClusterNode(hostname="node-01", memory_limit_mb=64000),
        ClusterNode(hostname="node-02", gpu=0),
    ),
    n_threads=8,
)

daemon.resources.add(cluster)

Each Cluster must contain at least one ClusterNode. A ClusterNode can declare a JCMsuite root, a memory limit, and one GPU identifier. To select multiple GPUs on one host, add multiple ClusterNode declarations with the same hostname.

List And Delete Resources

Use list() to inspect local resource declarations. Pass kind or hostname to filter the resource declarations:

resources = daemon.resources.list(kind="workstation", hostname="localhost")

Use info() to request resource information from the daemon. A running daemon can return backend-defined status data.

Use delete() to remove one matching resource. If the filters intentionally match more than one resource, set allow_many=True:

daemon.resources.delete(kind="workstation", hostname="localhost")
daemon.resources.delete(kind="queue", allow_many=True)

Resource hostnames must not be empty. Resource multiplicity must be at least 1. Workstation and cluster thread counts must be at least 1.

Use Daemon Lifecycle for lifecycle and Submit and Wait for submission collection. See the Declare Daemon Resources tutorial for a runnable workstation declaration. See the Submit To A Remote SLURM Queue tutorial for a remote queue configuration and collection workflow.