picongpu.pypicongpu.runner

This file is part of the PIConGPU. Copyright 2021-2023 PIConGPU contributors Authors: Hannes Troepgen, Brian Edward Marre, Richard Pausch License: GPLv3+

Module Contents

Classes

Runner

Accepts a PyPIConGPU Simulation and runs it

Functions

runArgs(name, args)

get_tmpdir_with_name(name[, parent])

returns a not existing temporary directory path,

picongpu.pypicongpu.runner.runArgs(name, args)
picongpu.pypicongpu.runner.get_tmpdir_with_name(name, parent: str = None)

returns a not existing temporary directory path, which contains the given name :param name: part of the newly created directory name :param parent: if given: create the tmpdir there :return: not existing path to directory

class picongpu.pypicongpu.runner.Runner(sim, pypicongpu_template_dir: str | None = None, scratch_dir: str | None = None, setup_dir: str | None = None, run_dir: str | None = None)

Accepts a PyPIConGPU Simulation and runs it

Manages 2 basic parts:

  • where which data is stored (various ..._dir options)

  • what is done (generate, build, run)

Where:

  • scratch_dir: (optional) directory where many simulation results can be stored

  • run_dir: directory where data for an execution is stored

  • setup_dir: directory where data is generated to and the simulation executable is built

These dirs are either copied from params or guessed. See __init__() for a detailed description.

The initialization of the dirs happens only once (!) inside __init__(). Any changes performed after that will be accepted and might lead to broken builds.

What:

  • generate(): create a setup (directory) which represents the parameters given

  • build(): run pic-build

  • run(): run tbg

Typically these can only be performed in that order, and each once. Whether a step can be started is determined by some sanity checks: Are the inputs (e.g. the setup dir, the .build dir) ready, and is the output location empty (e.g. the run dir). If those sanity checks pass, the respective process is launched. If this launched program (e.g. pic-build) fails, the process output (stdout & stderr) is printed. While a process is running, all output is silenced (and collected into an internal buffer).

SCRATCH_ENV_NAME = 'SCRATCH'

name of the environment variable where the scratch dir defaults to

setup_dir

directory containing the experiment setup (scenario)

pic-build is called here

scratch_dir

directory where run directories can be store

run_dir

directory where run results (and a copy of the inputs) will be stored

sim

the picongpu simulation to be run

generate(printDirToConsole=False)

generate the picongpu-compatible input files

build()

build (compile) picongpu-compatible input files

run()

run compiled picongpu simulation