[slurm-users] How to request ONLY one CPU instead of one socket or one node?

Wang, Liaoyuan wangly at alfred.edu
Tue Feb 19 03:10:35 UTC 2019

Dear David,

Thank you for your reply. I did it. It did request one CPU.

I added your command into my job file
#SBATCH --partition=defq
#SBATCH --ntasks-per-node=2
#SBATCH -n 1
#SBATCH --mem-per-cpu=5gb
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH -t 45-00:00:00
#SBATCH -J 9673%j
#SBATCH -o 9673.out
#SBATCH -e 9673.err


time /home/scripts/wcnqn.auto.pl

Here is the results for
echo $SLURM_CPUS_ON_NODE   ==>       40
echo $SLURM_JOB_CPUS_PER_NODE      ==>          40

Here, the cluster has 8 nodes, each node has 2 sockets, each socket has 20 cores, and each core has 2 threads. Thus, the value is 40.

If I use your command “srun --cpus-per-task=1 --ntasks-per-node=1 --partition=standard --mem=1G wcnqn.auto.pl”, I cannot get any output.

I am wondering whether the configuration of the cluster is improper or not. Any further suggestion would be highly appreciated.


From: David Rhey <drhey at umich.edu>
Sent: Friday, February 15, 2019 07:54
To: Slurm User Community List <slurm-users at lists.schedmd.com>
Subject: Re: [slurm-users] How to request ONLY one CPU instead of one socket or one node?


Are you sure you're NOT getting 1 CPU when you run your job? You might want to put some echo logic into your job to look at Slurm env variables of the node your job lands on as a way of checking. E.g.:


I don't see anything wrong with your script. As a test I took the basic parameters you've outlined and ran an interactive `srun` session, requesting 1 CPU per task and 4 CPUs per task, and then looked at the aforementioned variable output within each session. For example, requesting 1 CPU per task:

[drhey at beta-login ~]$ srun --cpus-per-task=1 --ntasks-per-node=1 --partition=standard --mem=1G --pty bash
[drhey at bn19 ~]$ echo $SLURM_CPUS_ON_NODE

And again, running this command now asking for 4 CPUs per task and then echoing the env var:

[drhey at beta-login ~]$ srun --cpus-per-task=4 --ntasks-per-node=1 --partition=standard --mem=1G --pty bash
[drhey at bn19 ~]$ echo $SLURM_CPUS_ON_NODE



On Wed, Feb 13, 2019 at 9:24 PM Wang, Liaoyuan <wangly at alfred.edu<mailto:wangly at alfred.edu>> wrote:
Dear there,

I wrote an analytic program to analyze my data. The analysis costs around twenty days to analyze all data for one species. When I submit my job to the cluster, it always request one node instead of one CPU. I am wondering how I can ONLY request one CPU using “sbatch” command? Below is my batch file. Any comments and help would be highly appreciated.


#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH -t 45-00:00:00
#SBATCH -J 9625%j
#SBATCH -o 9625.out
#SBATCH -e 9625.err

Where wcnqn.auto.pl<http://wcnqn.auto.pl> is my program. 9625 denotes the species number.

David Rhey
Advanced Research Computing - Technology Services
University of Michigan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20190219/123d98af/attachment-0001.html>

More information about the slurm-users mailing list