cgroup.conf(5)
π cgroup.conf(5) β Slurm Configuration File π
okay so bestie, pull up a chair π«Ά this is cgroup.conf, the Slurm config file that handles all the cgroup support, and it's genuinely lowkey iconic. let's get into it β¨
π NAME π
cgroup.conf β the Slurm configuration file for the cgroup support π
π¦ DESCRIPTION π¦
cgroup.conf is an ASCII file that defines the parameters used by Slurm's Linux cgroup related plugins. and the way that it always lives in the same directory as the slurm.conf?? yeah, they're roommates, no cap π
Parameter names are case insensitive, bestie, so don't stress about the caps. Any text following a # in the configuration file is treated as a comment through the end of that line β so vent in the comments all you want, it's fine π
Changes to the configuration file take effect upon restart of Slurm daemons, daemon receipt of the SIGHUP signal, or execution of the command scontrol reconfigure β unless otherwise noted. so you've got options, pick your fave β
For general Slurm cgroups information, go check out the Cgroups Guide at https://slurm.schedmd.com/cgroups.html π§
The following cgroup.conf parameters are defined to control the general behavior of Slurm cgroup plugins. periodt π
β¨ THE PARAMETERS β¨
CgroupMountpoint=PATHβ okay so this one is only intended for development and testing, just so you know πΈ It specifies thePATHunder which cgroup controllers should be mounted. The defaultPATHis/sys/fs/cgroup.CgroupPlugin=<cgroup/v1|cgroup/v2|autodetect|disabled>β this is the main character right here π it specifies the plugin to be used when interacting with the cgroup subsystem. The supported values are:"disabled"β to completely disable any interaction with the cgroups π"cgroup/v1"β which supports the legacy interface of cgroup v1"cgroup/v2"β for the unified cgroup2 architecture π₯"autodetect"β which tries to determine which cgroup version does your system provide
"autodetect" is useful to have a single configuration in clusters where nodes can have different cgroup versions. The default value is "autodetect" on linux, otherwise the default is "disabled".
NOTE: thecgroup/v1plugin is deprecated and no new features will be added to it π It is recommended that you switch tocgroup/v2at your earliest convenience, fr fr.
CgroupSlice=SLICE_NAMEβ startslurmdand theslurmstepdscope in the specified slice. If you're startingslurmdwith systemd, you should also add theSlice=property under the[Service]section of theslurmd.servicefile β don't skip that step bestie, both places or it doesn't count π
Changing this parameter requires you to stop all the slurmstepd scopes in the node and restart slurmd. Applies only to cgroup v2. The default is system.slice.
CgroupJobIdPaths=<yes|no>β if configured to"yes"then job-level cgroup directories are named with the numeric job ID instead of with theSLUID, e.g./sys/fs/cgroup/system.slice/slurmstepd.scope/job_123/instead of/sys/fs/cgroup/system.slice/slurmstepd.scope/sEKNKTV3WPV500/π This restores the pre-26.05cgroup/v2path layout and may be useful for sites with external tooling keyed on job IDs. Only applies tocgroup/v2. The default value isno.SystemdTimeout=<number>β okay so on slow systems like virtual machines, or when systemd is busy, it can take a lot of time to initialize and prepare the scope forslurmdduring startup π Slurm will wait a maximum of this amount of time (in milliseconds) for the scope to be ready before failing. Only applies tocgroup/v2. The default is1000ms.IgnoreSystemd=<yes|no>β only forcgroup/v2, and only for development and testing π§ͺ It will avoid any call to dbus and contact with systemd, and instead will prepare all the cgroup hierarchy manually.
β οΈ This option is dangerous in systems with systemd, since the cgroup can be modified by systemd and cause issues to jobs. like, be careful bestie π
IgnoreSystemdOnFailure=<yes|no>β only forcgroup/v2, and only for development and testing. It has similar functionality toIgnoreSystemdbut only in the case that a dbus call does not succeed πEnableControllers=<yes|no>β only forcgroup/v2, and generally for development, testing, when running on old kernels and/or old systemd versions (e.g. RHEL8, systemd < 244) where not all the controllers are enabled in the cgroup tree πΈ With this parameter,slurmdgets the available controllers from root'scgroup.controllersfile (CgroupMountPoint, by default/sys/fs/cgroup/cgroup.controllers) and makes them available in all levels of the cgroup tree until it reaches Slurm's cgroup leaf. she's thorough, she said every level πEnableExtraControllers=<all|controller1[,controller2,...]>β this will enable extra controllers not natively used by Slurm in the job cgroup subtree β¨ If combined withEnableControllersit will enable them in all the levels of the cgroup tree from the OS root cgroup. The controllers that can be enabled areio,pids,rdma,hugetlbandmiscorall. If they do not exist in the system an error is logged. Only forcgroup/v2.
πΈ hold that thought bestie, we're only halfway through this fileβ¦ π
π TASK/CGROUP PLUGIN π
okay bestie, these are the cgroup.conf parameters that run the whole vibe for this specific plugin. like, this is the plugin's personal rules, no cap:
AllowedRAMSpace=<number>β caps the job/step cgroup RAM at this percentage of the memory that was actually allocated. you can totally write the percentage as a float, like101.5, she's flexible π . what it does: sets the cgroup soft memory limit at the allocated memory size, and then sets the job/step hard memory limit at(AllowedRAMSpace/100) *allocated memory. if the job/step blows past the hard limit, it might trigger Out Of Memory (OOM) events β including oom-kill β and those get logged to the kernel log ring buffer (dmesgon Linux). settingAllowedRAMSpaceabove 100 may cause system OOM events, because it lets a job/step allocate more memory than the nodes were configured with. the suggested move is to reduce the configured node available memory to avoid system OOM events. settingAllowedRAMSpacebelow 100 means jobs get less memory than allocated, and the soft memory limit gets set to the same value as the hard limit. also seeConstrainRAMSpace. the default value is100. π«ΆAllowedSwapSpace=<number>β constrains the job cgroup swap space to this percentage of the allocated memory. default is0, which means RAM+Swap gets limited toAllowedRAMSpace. float percentages are fine here too, e.g.50.5. if the limit gets exceeded, the job steps get killed and a warning message gets written to standard error. π also seeConstrainSwapSpace.
NOTE bestie: settingAllowedSwapSpaceto0does not stop the Linux kernel from using swap space. to control how the kernel uses swap space, seeMemorySwappiness.
ConstrainCores=<yes|no>β if it's"yes", it constrains the allowed cores to the subset of allocated resources. this one is powered by thecpusetsubsystem β¨. heads up tho: because of a bug that got fixed in version1.11.5of HWLOC, thetask/affinityplugin may be required in addition totask/cgroupfor this to work properly. default value is"no".ConstrainDevices=<yes|no>β if it's"yes", it constrains the job's allowed devices based on GRES allocated resources. it uses thedevicessubsystem for that. default value is"no".ConstrainRAMSpace=<yes|no>β if it's"yes", it constrains the job's RAM usage by setting the memory soft limit to the allocated memory and the hard limit to the allocated memory *AllowedRAMSpace. default value is"no", and in that case the job's RAM limit gets set to its swap space limit ifConstrainSwapSpaceis set to"yes".CR_*_Memorymust be set inslurm.conffor this parameter to do literally anything. also seeAllowedSwapSpace,AllowedRAMSpaceandConstrainSwapSpace.
NOTE: when you're usingConstrainRAMSpaceand the combined memory used by all processes in a step goes over the limit, the kernel will trigger an OOM event, killing one or more of the processes in that step. the step state gets marked as OOM, but here's the wild part β the step itself keeps running, and the other processes in the step may keep running too. this is different from the behavior ofOverMemoryKill, where the whole step gets killed/cancelled. π
NOTE: when enabled,ConstrainRAMSpacecan lead to a noticeable decline in per-node job throughout. sites with high-throughput requirements should carefully weigh the tradeoff between per-node throughput versus the potential problems that can arise from unconstrained memory usage on the node. see<https://slurm.schedmd.com/high_throughput.html>for further discussion.
ConstrainSwapSpace=<yes|no>β if it's"yes", it constrains the job's swap space usage. default is"no". now here's the tea π΅: when this is set to"yes"andConstrainRAMSpaceis set to"no",AllowedRAMSpaceis automatically set to100%β that's so the RAM+Swap amount gets limited to 100% of the job's requirement plus the percent of allowed swap space. this amount gets set to both the RAM and RAM+Swap limits. which means in that particular case,ConstrainRAMSpaceis automatically enabled with the same limit as the one used to constrain swap space.CR_*_Memorymust be set inslurm.conffor this parameter to take any effect. also seeAllowedSwapSpace.MaxRAMPercent=PERCENTβ sets an upper bound, in percent of total RAM (the configuredRealMemoryof the node), on the RAM constraint for a job. this is the memory constraint that gets applied to jobs that were not explicitly allocated memory by Slurm (i.e. Slurm's select plugin isn't configured to manage memory allocations).PERCENTcan be any arbitrary floating point number. default value is100.MaxSwapPercent=PERCENTβ sets an upper bound (in percent of total RAM, the configuredRealMemoryof the node) on the amount of RAM+Swap that may be used for a job. this is the swap limit applied to jobs on systems where memory isn't being explicitly allocated to the job.PERCENTcan be any arbitrary floating point number between0and100. default value is100.MemorySwappiness=<number>β only for cgroup/v1. configures the kernel's priority for swapping out anonymous pages (like, program data) verses file cache pages for the job cgroup. valid values are between0and100, inclusive. a value of0prevents the kernel from swapping out program data. a value of100gives equal priority to swapping out file cache or anonymous pages. if it's not set, the kernel's default swappiness value gets used.ConstrainSwapSpacemust be set toyesfor this parameter to be applied. β¨MinRAMSpace=<number>β sets a lower bound (in MiB) on the memory limits defined byAllowedRAMSpaceandAllowedSwapSpace. this one is the safety net π«Ά β it prevents accidentally creating a memory cgroup with such a low limit thatslurmstepdgets immediately killed due to lack of RAM. and if that happens? cleanup will not be performed, and temporary files, sockets and directories can remain in the node. the default limit is30M.
π§ PROCTRACK/CGROUP PLUGIN π§
these are the cgroup.conf parameters that control the behavior of this particular plugin, bestie:
SignalChildrenProcesses=<yes|no>β if it's"yes", then signals get sent (for cancelling, suspending, resuming, etc.) to all children processes in a job/step. otherwise, signals only go to the parent process of a job/step. the default setting is"no".
π DISTRIBUTION-SPECIFIC NOTES π
Debian and its derivatives (e.g. Ubuntu) usually exclude the memory and memsw (swap) cgroups by default. to include them, add the following parameters to the kernel command line:
cgroup_enable=memory swapaccount=1
this can usually be placed in /etc/default/grub inside the GRUB_CMDLINE_LINUX variable. a command such as update-grub must be run after updating the file. π
π EXAMPLE π
/etc/slurm/cgroup.conf
this example cgroup.conf file shows a configuration that enables the more commonly used cgroup enforcement mechanisms. iconic behavior, honestly:
###
# Slurm cgroup support configuration file.
###
ConstrainCores=yes
ConstrainDevices=yes
ConstrainRAMSpace=yes
ConstrainSwapSpace=yes
/etc/slurm/slurm.conf
these are the entries required in slurm.conf to activate the cgroup enforcement mechanisms. make sure the node definitions in your slurm.conf closely match the configuration as shown by slurmd -C. either MemSpecLimit should be set, or RealMemory should be defined with less than the actual amount of memory for a node β that's to ensure all system/non-job processes will have sufficient memory at all times. sites should also configure pam_slurm_adopt to ensure users can't escape the cgroups via ssh. π
###
# Slurm configuration entries for cgroups
###
ProctrackType=proctrack/cgroup
TaskPlugin=task/cgroup,task/affinity
JobAcctGatherType=jobacct_gather/cgroup #optional for gathering metrics
PrologFlags=Contain #X11 flag is also suggested
π COPYING π
Copyright (C) 2010-2012 Lawrence Livermore National Security. Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
Copyright (C) 2010-2022 SchedMD LLC.
this file is part of Slurm, a resource management program. for details, see <https://slurm.schedmd.com/>.
Slurm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Slurm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU General Public License for more details.
β SEE ALSO β
and that's the whole page, bestie, you ate it up π this was Slurm 26.05, the Slurm Configuration File, filed under cgroup.conf(5) β go forth and configure responsibly π
π¦ where this page comes from
- arch rolling: slurm-llnl 26.05.5.1-1 Β· GPL-2.0-or-later
- epel 10: slurm 26.05.5-1.el10_3 Β· GPL-2.0-or-later AND BSD-2-Clause AND BSD-1-Clause
- nixpkgs unstable: slurm 26-05-5-1
- ubuntu stonking: slurm-client 26.05.4-1ubuntu1 Β· GPL-2.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms