How to Limit User Resources on the Login Node

An HPC cluster is a multi-user operating environment, which means that, under normal circumstances, all users can allocate resources via the login node.

However, since the login node is not under the control of the workload manager, some unwarranted behaviors could use large amount of CPU, bandwidth, or memory resources and impede usages of the HPC cluster from other users. These behaviors include long time usage of multi-core compiling and running MPI software on the login node.

In this article, we will introduce some of the features of the Linux operating system and help HPC cluster managers to understand how to limit user resources on the login node.

Operating System Requirements

Set Limitations to Resources on all Users

Assume that we have a 20-core node and 20 users (a total of 2000% CPU resources), and we want to limit each user's CPU usage to be less than 100%.

  1. Under the directory /usr/lib/systemd/system/user-.slice.d/, add the config file 11-limit-cpu.conf
  1. Reload the configuration
  1. Check if 11-limit-cpu.conf is indeed loaded

We can see that 11-limit-cpu.conf is indeed loaded

Set Limitations to Specific Users

Assume that hpcadmin has uid 1000, and we want to limit hpcadmin's CPU resources to 400%

  1. Under the directory /usr/lib/systemd/system/user-1000.slice.d/, add the config file limit-cpu.conf.conf
  1. Reload the configuration
  1. Check if 11-limit-cpu.conf is indeed loaded

Common Configurations

For more information, access the man page by man systemd.resource-control