Christopher Bottoms
Christopher Bottoms

Reputation: 11158

How can I configure SLURM at the user level (e.g. with something like a ".slurmrc")?

Is there something like .slurmrc for SLURM that would allow each user to set their own defaults for parameters that they would normally specify on the command line.

For example, I run 95% of my jobs on what I'll call our HighMem partition. Since my routine jobs can easily go over the default of 1GB, I almost always request 10GB of RAM. To make the best use of my time, I would like to put the partition and RAM requests in a configuration file so that I don't have to type them in all the time. So, instead of typing the following:

sbatch --partition=HighMem --mem=10G script.sh

I could just type this:

sbatch script.sh

I tried searching for multiple variations on "SLURM user-level configuration" and it seemed that all SLURM-related hits dealt with slurm.conf (a global-level configuration file).

I even tried creating slurm.conf and .slurmrc in my home directory, just in case that worked, but they didn't have any effect on the partition used.


update 1 Yes, I thought about scontrol, but the only configuration file it deals with is global and most parameters in it aren't even relevant for a normal user.


update 2

My supervisor pointed out the SLURM Perl API to me. The last time I looked at it, it seemed too complicated to me, but this time upon looking at the code for https://github.com/SchedMD/slurm/blob/master/contribs/perlapi/libslurm/perl/t/06-complete.t, it would seem that it wouldn't too be hard to create a script that behaves similar to sbatch that reads in a default configuration file and sets the desired parameters. However, I haven't had any success in setting the 'std_out' to a file name that gets written to.

Upvotes: 2

Views: 953

Answers (1)

damienfrancois
damienfrancois

Reputation: 59072

If your example is representative, defining an alias

alias sbatch='sbatch --partition=HighMem --mem=10G'

could be the easiest way. Alternatively, a Bash function could also be used

sbatch() {
command sbatch --partition=HighMem --mem=10G "$@" 
}

Put any of these in your .bash_profile for persistence.

Upvotes: 1

Related Questions