Thorn SystemStatistics collects information about the system on which a Cactus process is running and stores it in Cactus variables. These variables can then be output and reduced using the standard Cactus methods such as IOBasic and IOScalar.
When running a Cactus simulation, there are often features of the system on which it is running which can affect the simulation. For example, Cactus processes take a certain amount of memory, and if this exceeds the memory available on the system, the Cactus process will either start to swap, significantly reducing performance, or will terminate. It can be useful to determine quantities such as memory usage of a Cactus process, and that is the purpose of this thorn. The thorn currently provides grid arrays which are filled with memory-related information.
This thorn has no parameters.
IOBasic::outInfo_every = 256 IOBasic::outInfo_reductions = "minimum maximum" IOBasic::outInfo_vars = "SystemStatistics::maxrss_mb" IOScalar::outScalar_every = 256 IOScalar::outScalar_reductions = "minimum maximum average" IOScalar::outScalar_vars = "SystemStatistics::process_memory_mb"
The resulting screen output would look like this:
----------------------------------------- Iteration Time | *TISTICS::maxrss_mb | minimum maximum ----------------------------------------- 0 0.000 | 52 54 256 0.005 | 53 55 512 0.010 | 53 55 768 0.015 | 53 55 1024 0.020 | 53 55
and the reduced scalar output in systemstatistics::process_memory_mb.maximum.asc would look like this:
# SYSTEMSTATISTICS::maxrss_mb (systemstatistics::process_memory_mb) # 1:iteration 2:time 3:data # data columns: 3:maxrss_mb 4:majflt_mb 5:arena_mb 6:ordblks_mb 7:hblks_mb 8:hblkhd_mb 9:uordblks_mb 10:fordblks_mb 11:keepcost_mb 0 0 54 7 50 0 0 0 39 12 11 256 0.00498610682309355 55 7 51 0 0 0 39 12 11 512 0.0099722136461871 55 7 51 0 0 0 39 12 11 768 0.0149583204692806 55 7 51 0 0 0 39 12 11 1024 0.0199444272923742 55 7 51 0 0 0 39 12 11
There has been some discussion concerning whether it would be better to use Cactus clocks to store this information.
The current implementation stores memory usage in CCTK_INT variables. Since memory sizes of many gigabytes are common, this could lead to overflow. It would probably be better to use CCTK_REAL variables instead.
The thorn currently has variables for bytes, kilobytes and megabytes for each quantity. It might be better to remove these and let the output mechanism format the variables in an easy to understand form.
This thorn uses information from the /proc filesystem where it is available. The Resident Set Size (RSS) is also read correctly on Mac OS, where /proc is not available.
Implements:
systemstatistics
Group Names | Variable Names | Details | |
process_memory | compact | 0 | |
maxrss | description | Process memory statistics | |
majflt | dimensions | 1 | |
arena | distribution | CONSTANT | |
ordblks | group type | ARRAY | |
hblks | size | 1 | |
hblkhd | tags | Checkpoint=”no” | |
uordblks | timelevels | 1 | |
fordblks | variable type | REAL | |
process_memory_mb | compact | 0 | |
maxrss_mb | description | Run memory statistics in MB | |
majflt_mb | dimensions | 1 | |
arena_mb | distribution | CONSTANT | |
ordblks_mb | group type | ARRAY | |
hblks_mb | size | 1 | |
hblkhd_mb | tags | Checkpoint=”no” | |
uordblks_mb | timelevels | 1 | |
fordblks_mb | variable type | INT | |
process_memory_kb | compact | 0 | |
maxrss_kb | description | Run memory statistics in KB | |
majflt_kb | dimensions | 1 | |
arena_kb | distribution | CONSTANT | |
ordblks_kb | group type | ARRAY | |
hblks_kb | size | 1 | |
hblkhd_kb | tags | Checkpoint=”no” | |
uordblks_kb | timelevels | 1 | |
fordblks_kb | variable type | INT | |
This section lists all the variables which are assigned storage by thorn CactusUtils/SystemStatistics. Storage can either last for the duration of the run (Always means that if this thorn is activated storage will be assigned, Conditional means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.
Always: | |
process_memory process_memory_mb process_memory_kb | |
CCTK_ANALYSIS
systemstatistics_collect
collect system statistics
Language: | c | |
Options: | global | |
Type: | function | |
Writes: | systemstatistics::process_memory | |
process_memory_mb | ||
process_memory_kb | ||