<div dir="ltr">Hi,<br><br>I made a short script in python to test if slurm was correctly limiting the number of CPUs available to each partition. The script is as follows:<br><font face="monospace">import multiprocessing as mp<br>import time as t<br><br>def fibonacci(n):<br>    n = int(n)<br>    def fibon(a,b,n,result):<br>        c = a+b<br>        result.append(c)<br>        if c < n:<br>            fibon(b,c,n,result)<br>        return result<br>    return fibon(0,1,n,[])<br><br>def calcnfib(n):<br>    res = fibonacci(n)<br>    return res[-1]</font><div><font face="monospace"><br>def benchmark(pool):<br>    t0 = t.time()<br>    out = pool.map(calcnfib, range(1000000, 1000000000,1000))<br>    tf = t.time()<br>    return str(tf-t0)<br><br>pool = mp.Pool(4)<br>print("4: " + benchmark(pool))<br><br>pool = mp.Pool(32)<br>print("32: " + benchmark(pool))<br><br>pool = mp.Pool(64)<br>print("64: " + benchmark(pool))<br><br>pool = mp.Pool(128)<br>print("128: " + benchmark(pool))</font><br><br>It is called using the following submission script:<br><font face="monospace">#!/bin/bash<br>#SBATCH --partition=full<br>#SBATCH --job-name="Large"<br>source testenv1/bin/activate<br>python3 multithread_example.py</font><br><br>The slurm out file reads<br><font face="monospace">4: 5.660163640975952<br>32: 5.762076139450073<br>64: 5.8220226764678955<br>128: 5.85421347618103</font><br><br>However, if I run<br><font face="monospace">source testenv1/bin/activate<br>python3 multithread_example.py</font></div><div><br>I find faster and more expected behavior<br><font face="monospace">4: 1.5878620147705078<br>32: 0.34162330627441406<br>64: 0.24987316131591797<br>128: 0.2247719764709472</font><br><br>For reference my slurm configuration file is<br><font face="monospace"># slurm.conf file generated by configurator easy.html.<br># Put this file on all nodes of your cluster.<br># See the slurm.conf man page for more information.<br>#<br>#SlurmctldHost=localhost<br>ControlMachine=localhost<br><br>#MailProg=/bin/mail<br>MpiDefault=none<br>#MpiParams=ports=#-#<br>ProctrackType=proctrack/cgroup<br>ReturnToService=1<br>SlurmctldPidFile=/home/slurm/run/slurmctld.pid<br>#SlurmctldPort=6817<br>SlurmdPidFile=/home/slurm/run/slurmd.pid<br>#SlurmdPort=6818<br>SlurmdSpoolDir=/var/spool/slurm/slurmd/<br>SlurmUser=slurm<br>#SlurmdUser=root<br>StateSaveLocation=/home/slurm/spool/<br>SwitchType=switch/none<br>TaskPlugin=task/affinity<br><br># TIMERS<br>#KillWait=30<br>#MinJobAge=300<br>#SlurmctldTimeout=120<br>#SlurmdTimeout=300<br><br># SCHEDULING<br>SchedulerType=sched/backfill<br>SelectType=select/cons_tres<br>SelectTypeParameters=CR_Core<br><br># LOGGING AND ACCOUNTING<br>AccountingStorageType=accounting_storage/none<br>ClusterName=cluster<br>#JobAcctGatherFrequency=30<br>JobAcctGatherType=jobacct_gather/none<br>#SlurmctldDebug=info<br>SlurmctldLogFile=/home/slurm/log/slurmctld.log<br>#SlurmdDebug=info<br>#SlurmdLogFile=</font></div><div><font face="monospace"><br># COMPUTE NODES<br>NodeName=localhost CPUs=128 RealMemory=257682 Sockets=1 CoresPerSocket=64 ThreadsPerCore=2 State=UNKNOWN<br>PartitionName=full Nodes=localhost Default=YES MaxTime=INFINITE State=UP<br>PartitionName=half Nodes=localhost Default=NO MaxTime=INFINITE State=UP MaxNodes=1 MaxCPUsPerNode=64 MaxMemPerNode=128841<br></font></div><div><font face="monospace"><br></font></div><font face="arial, sans-serif">Here is my cgroup.conf file as well</font><br><font face="monospace">CgroupAutomount=yes</font><br><font face="monospace">ConstrainCores=no</font><br><font face="monospace">ConstrainRAMSpace=no</font><br><div><br></div><div>If anyone has any suggestions for what might be going wrong and why the script takes much longer when run with slurm, please let me know!</div><div><br></div><div>Best,</div><div>John</div></div>