logger

Classes

DistributedLogger

LogColors

Functions

aprint

All ranks from all nodes prints

lmprint

All local main ranks prints (rank 0 in each node)

lprint

Last rank prints only (rank -1 in node 0)

mprint

Master prints only (rank 0 in node 0)

class DistributedLogger

Bases: Logger

__init__(name, level=10)
dist_log(msg, ranks='main')

Log parameter msg with the given ranks.

Parameters:
  • msg (str) – The message to log.

  • ranks (str) – The ranks to log the message to. Choices are: “all”: log with all ranks “main”: log with only rank 0 in node 0 “last”: log with only rank -1 in node 0 “local_main”: log with only rank 0 in all nodes

static get_caller_location()
Return type:

str

verbosity = 40
class LogColors

Bases: object

BLUE = '\x1b[94m'
BOLD = '\x1b[1m'
CYAN = '\x1b[96m'
GREEN = '\x1b[92m'
RED = '\x1b[91m'
RESET = '\x1b[0m'
UNDERLINE = '\x1b[4m'
YELLOW = '\x1b[93m'
aprint(msg)

All ranks from all nodes prints

Parameters:

msg (str | None)

lmprint(msg)

All local main ranks prints (rank 0 in each node)

Parameters:

msg (str | None)

lprint(msg)

Last rank prints only (rank -1 in node 0)

Parameters:

msg (str | None)

mprint(msg)

Master prints only (rank 0 in node 0)

Parameters:

msg (str | None)