17. Environment variables
There are several environment variables which you can use to control the behaviour of PopXL. Most of these use the underlying PopART library.
17.1. Logging
PopART can output information about its activity as described in Turning on execution tracing. You can control the level of logging information using environment variables.
17.1.1. POPART_LOG_LEVEL
POPART_LOG_LEVEL
controls the amount of information written to the log output for all modules. Finer control
can be achieved with POPART_LOG_CONFIG.
17.1.2. POPART_LOG_DEST
POPART_LOG_DEST
defines the output for the logging information. The value can be stdout
, stderr
or a file name.
The default is stderr
.
17.1.3. POPART_LOG_CONFIG
If set, POPART_LOG_CONFIG
defines the name of a configuration file which specifies the logging level for each module.
This is a JSON format file with pairs of module:level strings.
For example, you can specify a file called conf.py
by setting the environment variable:
export POPART_LOG_CONFIG=conf.py
To set the logging level of the devicex
and session
modules, conf.py
would contain:
{
"devicex":"INFO",
"session":"WARN"
}
These values override the value specified in POPART_LOG_LEVEL.
17.2. Generating DOT files
You can ask PopXL to export DOT files of your graphs at different points during IR construction. This is done using dot_checkpoint()
. The following example shows this:
with g:
c = ops.add(a, b)
ir.dot_checkpoint("ADD")
d = ops.mul(a, c)
ir.dot_checkpoint("MULTIPLY")
popxl.transforms.autodiff(g)
ir.dot_checkpoint("BWD")
By default, PopXL will produce DOT files for all your checkpoints. You can, however, dynamically control which ones are produced using the POPART_DOT_CHECKS
environment variable. Multiple checkpoint names can be passed, separated `:
. For example, we can select only ADD
and BWD
like so:
$ export POPART_DOT_CHECKS=ADD:BWD
The special value ALL
will select all checkpoints. This is the default value.
The values in POPART_DOT_CHECKS
will be combined with any values
that are defined in the session options.
17.3. Caching of compiled executables
It can take a long time to compile a large graph into an executable for the IPU. You can enable caching of compiled executables to avoid re-compiling the same graph every time it is run.
To enable the cache, set the environment variable POPXL_CACHE_DIR
to the path where the compiled executables for the PopXL graph will be stored. For example:
$ export POPXL_CACHE_DIR="/tmp/cachedir"
An executable binary file with the extension .popef
will be saved for each Poplar graph required to execute the PopXL program.
The cache does not manage the files within the directory. It is your responsibility to delete out-of-date files. No index is kept of the files, so they can be deleted without risk.