The script does the following:
It initializes a main Task and spawns subprocesses, each for an instance of that Task.
The Task in each subprocess trains a neural network over a partitioned dataset (the torchvision built-in MNIST dataset), and reports the following to the main Task:
- Artifacts - A dictionary containing different key-value pairs is uploaded from the Task in each subprocess to the main Task.
- Scalars - Loss reported as a scalar during training in each subprocess Task is logged in the main Task.
- Hyperparameters - Hyperparameters created in each subprocess Task are added to the main Task's hyperparametersy.
Each Task in a subprocess references the main Task by calling Task.current_task, which always returns the main Task.
When the script runs, it creates an experiment named
test torch distributedwhich is associated with the
examplesproject in the ClearML Web UI.
The example uploads a dictionary as an artifact in the main Task by calling the Task.upload_artifact
Task.current_task (the main Task). The dictionary contains the
dist.rank of the subprocess, making each unique.
All of these artifacts appear in the main Task, ARTIFACTS > OTHER.
We report loss to the main Task by calling the Logger.report_scalar method on
Task.current_task().get_logger, which is the logger for the main Task. Since we call
Logger.report_scalar with the same title (
loss), but a different series name (containing the subprocess'
rank), all loss scalar series are logged together.
The single scalar plot for loss appears in RESULTS > SCALARS.
ClearML automatically logs the command line options defined using
A parameter dictionary is logged by connecting it to the Task using a call to the Task.connect method.
Command line options appear in CONFIGURATIONS > HYPER PARAMETERS > Args.
Parameter dictionaries appear in the General section of HYPER PARAMETERS.
Output to the console, including the text messages printed from the main Task object and each subprocess, appears in RESULTS > CONSOLE.