Dear David,

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

I added your command into my job file
#!/bin/sh
#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

echo $SLURM_CPUS_ON_NODE
echo $SLURM_JOB_CPUS_PER_NODE


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.

Appreciatively,
Leon


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

Hello,

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.:

echo $SLURM_CPUS_ON_NODE
echo $SLURM_JOB_CPUS_PER_NODE

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@beta-login ~]$ srun --cpus-per-task=1 --ntasks-per-node=1 
--partition=standard --mem=1G --pty bash
[drhey@bn19 ~]$ echo $SLURM_CPUS_ON_NODE
1

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

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

HTH!

David

On Wed, Feb 13, 2019 at 9:24 PM Wang, Liaoyuan 
<wan...@alfred.edu<mailto:wan...@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.

Appreciatively,
Leon
================================================
#!/bin/sh

#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

/home/scripts/wcnqn.auto.pl<http://wcnqn.auto.pl>
===========================================
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

Reply via email to