This is a work in progress. Currently the format specifiers are only working on the dmrg-ee branch.
For long-running calculations such as DMRG, it is possible to write data to a file during the calculation. This can be used for benchmarking or for tracking convergence.
To write benchmarking output to a file, you need to set an environment variable prior to running the calculation. For example, in bash, use
$ export MP_BENCHFILE="bench.out"
$ mp-dmrg [.....]
Currently the tools that support this are:
Tool | Environment variables |
mp-dmrg | MP_BENCHFILE |
mp-dmrg-2site | MP_BENCHFILE |
Set the environment variable to the name of the file that you want to write. In addition, the following format specifiers are allowed:
- If the environment variable starts with a '+' sign, then append to the file. The default is to truncate (erase) if the file already exists.
- If the environment variable starts with ++, then append to the file and additionally insert a blank line before writing new data.
- If the environment variable contains some date/time format specifiers, then these are inserted into the filename. The supported specifiers are listed below.
- If the environment variable contains
%n
, then this is replaced by the smallest integer such that the filename is different to any existing file. For example, if you set the environment variable to "bench-%n.out"
then the actual filename will be bench-1.out
, unless there is already a file named bench-1.out
, in which case it will be named bench-2.out
, and so on.
- As an extension to the above, if you want to specify a minimum number of digits of the
%n
specifier, you can use an integer number. For example "bench-%3n.out"
will result in filenames bench-001.out
, bench-002.out
etc. This is useful because it will result in filenames that appear in the proper numerical sort order in a directory listing.
The currently supported date/time format specifiers are:
Specifier | Format |
%D | Date/time in ISO format YYYY-MM-DD-HH:MM:SS |
%T | Time in ISO format HH:MM:SS |
%F | Date in ISO format YYYY-MM-DD |
%C | Compact timestamp YYYYMMDD_HHMMSS |
%z | Timezone +hhmm or -hhmm |
%Z | Timezone name |
It is very easy to add additional such format specifiers based on the strftime
function, if desired.
The output format of the file depends on the specific tool, but in all cases it starts with a comment block containing the command line, the date, and column headings for the remainder of the file. For example, mp-dmrg
produces a file similar to
#mp-dmrg -w test -m 10x10
#Date: Thu, 05 Sep 2024 14:27:07 +0800
#Time #SweepNum #Site #States #Energy #Trunc #Fidelity #Iter #Tol
0.04803204536438 1 39 4 -52.02892127476533 0 2.0558672764182e-08 4 1.2454675551909e-15
0.0504150390625 1 38 10 -52.02893019311779 0 1.7461800709273e-05 5 0.00013751235373796
...