.. _cs-command-line-pattern: Cerebras Command Line Pattern ============================= .. Note:: This applies only to the pipeline models in both Slurm/Singularity and Kubernetes. Cerebras provides the following Bash scripts: - ``csrun_cpu`` for compiling. - ``cs_input_analyzer`` for determining optimal Slurm resources, and - ``csrun_wse`` for running on the Cerebras system. This section describes the command line pattern you must follow to use these scripts. Compile on a CPU node --------------------- For example, to compile a model for training on a CPU node in a ``validate_only`` mode, here is an example ``csrun_cpu`` command: .. code-block:: bash csrun_cpu --mount_dirs="/data/ml,/lab/ml" \ python run.py --mode=train --validate_only In the above example: - The ``python run.py --mode=train --validate_only`` is a full Python command passed in as an argument for the ``csrun_cpu`` script. The other argument for the ``csrun_cpu`` is ``--mount_dirs="/data/ml,/lab/ml"``. - Note that ``--mode=train --validate_only`` is the argument for the ``run.py`` script. The ``csrun_cpu`` will use the data located in ``--mount_dirs="/data/ml,/lab/ml"`` and launches a Python session to execute the ``run.py`` code in the ``--mode=train --validate_only`` mode on the CPU node. Run on Cerebras system ---------------------- Similarly, to run the model on the Cerebras system located at the IP address ``10.255.253.0``, here is an example command: .. code-block:: bash csrun_wse --total-nodes=3 --tasks-per-node=5 --cpus-per-task=16 \ python run.py --mode=train --cs_ip=10.255.253.0 In the above example: - The ``python run.py --mode=train --cs_ip=10.255.253.0`` is a full Python command passed in as an argument for the ``csrun_wse`` script. The other arguments for the ``csrun_wse`` are ``--total-nodes=3 --tasks-per-node=5 --cpus-per-task=16``. - The ``csrun_wse`` will use the Slurm settings of 3 nodes, with 5 workers each and 16 cpus assigned per worker, and will launch a Python session to execute the ``run.py`` code in the ``--mode=train`` mode on the Cerebras system located at IP address ``10.255.253.0``. .. seealso:: In addition to the arguments such as ``--validate_only``, ``--mode=train`` and ``--cs_ip=10.255.253.0`` shown above, the ``run.py`` supports several command line arguments. See :ref:`run-py-template` for full details.