xnn.common.benchmark.runner.run_parallel#

xnn.common.benchmark.runner.run_parallel(raw, workers=None)[source]#

Score the models of a benchmark concurrently, one worker process per model.

The in-node counterpart of a Slurm job array: the effective config is written to <output.dir>/parts/config.yaml, and xnn benchmark --models <label> is spawned for each entry, at most workers at a time. With GPUs available each worker is pinned to one of them through CUDA_VISIBLE_DEVICES (worker k takes the k-th visible GPU, cycling), so the default of one worker per GPU scores the models in parallel without sharing devices. Each worker’s output goes to parts/<label>.log. When all workers have finished the parts are merged into the final table with merge_parts().

Parameters:
  • raw (dict) – The benchmark config as a plain dict (after any command-line overrides), as from_dict() takes it.

  • workers (int or None, optional) – How many models to score at once. Defaults to the number of visible GPUs; on a machine without GPUs it must be given.

Returns:

The merged rows, in config order.

Return type:

list of dict

Raises:
  • ValueError – If run inside a distributed launch (the two fan-outs are exclusive at this level; combine them through a job array instead), or if no worker count can be inferred.

  • RuntimeError – If any worker fails; the message names its log file.