Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To change the default node assigned by SBATCH in SLURM, you can include the --nodelist option followed by the desired node(s) in your sbatch command. For example:

sbatch --nodelist=node2 script.sh

This will submit script.sh and assign it to run on node2 instead of the default node chosen by SLURM.

To transfer variables to the newly assigned node, you can use environment variables or file transfers.

One way to transfer variables as environment variables is to set them in your job submission script and use the export command to make them available to the job. For example:

#!/bin/bash
#SBATCH --nodelist=node2
#SBATCH --export=VAR1=value1,VAR2=value2

# Run your job here

In this example, VAR1 and VAR2 are set to value1 and value2 respectively and are exported to the job on node2.

Another way is to transfer variables through file transfers. You can use sbatch's --export-file option to define a file containing the environment variables you want to transfer. For example:

#!/bin/bash
#SBATCH --nodelist=node2
#SBATCH --export-file=myvars.txt

# Run your job here

In this example, myvars.txt contains the environment variables you want to transfer and they are made available to the job on node2.