Ask Your Question
4

What is the process for changing the default node assigned by SBATCH in SLURM and transferring variables to the newly assigned node?

asked 2021-12-23 11:00:00 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-12-05 21:00:00 +0000

bukephalos gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-12-23 11:00:00 +0000

Seen: 10 times

Last updated: Dec 05 '21