hpccm.Stage

source module hpccm.Stage

Container stage

Classes

  • Stage Class for container stages.

source class Stage(**kwargs)

Bases : object

Class for container stages.

Docker may have one or more stages, Singularity will always have a single stage.

Parameters

  • name Name to use when refering to the stage (Docker specific). The default is an empty string.

  • separator Separator to insert between stages. The default is '\n\n'.

Methods

  • baseimage Insert the baseimage as the first layer

  • runtime Generate the set of instructions to install the runtime specific components from a previous stage.

source method Stage.baseimage(image, _distro='')

Insert the baseimage as the first layer

Parameters

  • image : string The image identifier to use as the base image. The value is passed to the baseimage primitive.

  • _distro The underlying Linux distribution of the base image. The value is passed to the baseimage primitive.

source method Stage.runtime(_from=None, exclude=[])

Generate the set of instructions to install the runtime specific components from a previous stage.

This method invokes the runtime() method for every layer in the stage. If a layer does not have a runtime() method, then it is skipped.

Parameters

  • _from The name of the stage from which to copy the runtime. The default is 0.

  • exclude List of building blocks to exclude when generating the runtime. The default is an empty list.

Examples

Stage0 += baseimage(image='nvidia/cuda:9.0-devel')
Stage0 += gnu()
Stage0 += boost()
Stage0 += ofed()
Stage0 += openmpi()
...
Stage1 += baseimage(image='nvidia/cuda:9.0-base')
Stage1 += Stage0.runtime(exclude=['boost'])