This document shows you how to tướng mix soft limits using the ulimit command.

The ulimit command sets or reports user process resource limits. The mặc định limits are defined and applied when a new user is added to tướng the system. Limits are categorized as either soft or hard. With the ulimit command, you can change your soft limits for the current shell environment, up to tướng the maximum mix by the hard limits. You must have root user authority to tướng change resource hard limits.

Syntax

ulimit [-HSTabcdefilmnpqrstuvx [Limit]]
flags description
-H Specifies that the hard limit for the given resource is mix. If you have root user authority, you can increase the hard limit. Anyone can decrease it
-S Specifies that the soft limit for the given resource is mix. A soft limit can be increased up to tướng the value of the hard limit. If neither the -H nor -S flags are specified, the limit applies to tướng both
-a Lists all of the current resource limits
-b The maximum socket buffer size
-c The maximum size of core files created
-d The maximum size of a process's data segment
-e The maximum scheduling priority ("nice")
-f The maximum size of files written by the shell and its children
-i The maximum number of pending signals
-l The maximum size that may be locked into memory
-m The maximum resident mix size (many systems vì thế not honor this limit)
-n The maximum number of open tệp tin descriptors (most systems vì thế not allow this value to tướng be set)
-p The pipe size in 512-byte blocks (this may not be set)
-q The maximum number of bytes in POSIX message queues
-r The maximum real-time scheduling priority
-s The maximum stack size
-t The maximum amount of cpu time in seconds
-u The maximum number of processes available to tướng a single user
-v The maximum amount of virtual memory available to tướng the shell and, on some systems, to tướng its children
-x The maximum number of tệp tin locks
-T The maximum number of threads

The limit for a specified resource is mix when the Limit parameter is specified. The value of the Limit parameter can be a number in the unit specified with each resource, or the value "unlimited." For example, to set the tệp tin size limit to tướng 51,200 bytes, use:

ulimit -f 100

To mix the size of core dumps to tướng unlimited, use:

ulimit –c unlimited

How to tướng change ulimit for a MPI program

The ulimit command affects the current shell environment. When a MPI program is started, it does not spawn in the current shell. You have to tướng use srun to start a wrapper script that sets the limit if you want to tướng mix the limit for each process. Below is how you set the limit for each shell (We use  ulimit –c unlimited to tướng allow unlimited core dumps, as an example): 

  1. Prepare your batch job script named "myjob" as below (Here, we request a job with 5-hour 2-cores):
#!/bin/bash
#SBATCH --ntasks=2
#SBATCH --time=5:00:00
#SBATCH ...


...
srun ./test1
...
  1. Prepare the wrapper script named "test1" as below:
#!/bin/bash
ulimit –c unlimited
.....(your own program)
  1. sbatch myjob