FRSS
Introduction
FRSS is a library for printing the resident set size (RSS) of a Fortran application at runtime. It is MPI-aware and displays the memory information for the corresponding MPI rank. It can also be used to measure the maximum values for the occupied memory and GPU device memory (if applicable) on a node.
Usage
Print the RSS of an MPI task
Anywhere in your Fortran code, you can trigger the output by calling the subroutine:
call frss_print()
It will print the following information to stdout:
Abbreviation | Description | Source |
---|---|---|
RSS | Current resident set size |
VmRSS in /proc/self/status
|
HWM | High water mark of the RSS |
VmHWM in /proc/self/status
|
OOM | Out-of-memory score | /proc/self/oom_score |
dt | Elapsed wall-clock time since last call |
If you want to display this information only for a specific MPI rank, call (e.g. for rank 0):
call frss_print_rank(0)
Monitor memory of a node
To determine the high water mark of the used memory per node, you need to start the measurement by providing the desired time sampling. For extracting the memory information every 1000 milliseconds, for example, set the following environment variable:
export FRSS_MONITOR_NODE=1000
This will start the measurement automatically and print the result to stdout when the application finishes:
Abbreviation | Description | Source |
---|---|---|
RAM | Maximum used memory on the node |
MemTotal and MemAvailable in /proc/meminfo
|
GPU | Maximum used GPU device memory on the node |
FB Memory Usage in output of nvidia-smi -q -d MEMORY
|
The RAM value is normalized to an initial offset measured before the application is loaded into memory. This normalization is most accurate if FRSS is the first shared library to be loaded. The GPU value is not normalized in this way.
The printed values may underestimate the actual peak memory usage, because (1) the time sampling may be too coarse or (2) the initial memory usage measured at startup may include previously loaded shared libraries.
Note that a highly resolved time sampling could slow down the application considerably and that meaningful results can only be achieved if the node is used exclusively by your application.
Building
Run make
to build the library libfrss.so
. The Makefile is prepared to build with Intel Fortran compiler.
Linking
In order to use FRSS, you need to link with the library, e.g. by using the following flags: -L/path/to/frss -lfrss
.