12. Environment variables

There are several environment variables which you can use to control the behaviour of the Poplar SDK.

12.1. Logging

Logging messages can be generated when your program runs. This is controlled by the environment variables described below. For more detailed information about the execution of your program, see Section 12.2, Profiling output.

  • POPLAR_LOG_LEVEL: Enable logging for Poplar

  • POPLAR_MODULE_LOG_LEVEL: Enable logging for one Poplar module

  • POPLAR_LOG_DEST: Specify the destination for Poplar logging

  • POPLIBS_LOG_LEVEL: Enable logging for PopLibs

  • POPLIBS_MODULE_LOG_LEVEL: Enable logging for one PopLibs module

  • POPLIBS_LOG_DEST: Specify the destination for PopLibs logging

12.1.1. Logging level

The Poplar modules are:

  • CODELETS

  • ENGINE

  • GRAPH

  • PROFILER

  • PROGRAM

  • TARGET

  • TENSOR

The PopLibs modules are:

  • POPFLOAT

  • POPLIN

  • POPNN

  • POPOPS

  • POPRAND

  • POPSOLVER

  • POPSPARSE

  • POPUTIL

If not specified, each module uses the logging level specified by POPLAR_LOG_LEVEL or POPLIBS_LOG_LEVEL.

The following example runs a program with Engine logging messages at log level “TRACE”, all other Poplar modules at log level “INFO” and no PopLibs logging.

$ POPLAR_LOG_LEVEL=INFO POPLAR_ENGINE_LOG_LEVEL=TRACE ./my_poplar_program

The supported logging levels are shown in the table below.

Table 12.1 Poplar logging levels

“OFF”

No logging information. The default.

“ERR”

Only error conditions will be reported.

“WARN”

Warnings when, for example, the software cannot achieve what was requested (for example, if the convolution planner can’t keep to the memory budget, or Poplar has determined that the model won’t fit in memory but the debug.allowOutOfMemory option is enabled).

“INFO”

Very high level information, such as PopLibs function calls.

“DEBUG”

Useful per-graph information.

“TRACE”

The most verbose level. All useful per-tile information.

All Poplar log messages are prefixed with “PO”. Messages from PopLibs are prefixed with “PL”.

12.1.2. Logging destination

The logging information is sent to standard error (stderr) by default. This can be changed by setting the POPLAR_LOG_DEST or POPLIBS_LOG_DEST environment variables. The value can be “stdout”, “stderr” or a filename.

12.2. Profiling output

  • POPLAR_ENGINE_OPTIONS: Provide options to generate profiling data for use by the PopVision Graph Analyser.

In order to capture the reports needed for the PopVision Graph Analyser you only need to set POPLAR_ENGINE_OPTIONS='{"autoReport.all":"true"}' before you run a program.

For more information, and other options, see Section 11, Profiling and the PopVision Graph Analyser User Guide.

12.3. Setting options

The following environment variables can be used to override the option values specified in the program:

  • POPLAR_ENGINE_OPTIONS

  • POPLAR_RUNTIME_OPTIONS

  • POPLAR_SIMULATOR_OPTIONS

For more information about the available options, see the Poplar and PopLibs API Reference.