LinuxGpuBuildImage

class aws_cdk.aws_codebuild.LinuxGpuBuildImage(*args: Any, **kwargs)

Bases: object

A CodeBuild GPU image running Linux.

This class has public constants that represent the most popular GPU images from AWS Deep Learning Containers.

See:

https://aws.amazon.com/releasenotes/available-deep-learning-containers-images

ExampleMetadata:

infused

Example:

codebuild.Project(self, "Project",
    environment=codebuild.BuildEnvironment(
        build_image=codebuild.LinuxGpuBuildImage.DLC_TENSORFLOW_2_1_0_INFERENCE
    )
)

Methods

bind(scope, project)

Function that allows the build image access to the construct tree.

Parameters:
Return type:

BuildImageConfig

run_script_buildspec(entrypoint)

Make a buildspec to run the indicated script.

Parameters:

entrypoint (str) –

Return type:

BuildSpec

validate(*, build_image=None, certificate=None, compute_type=None, environment_variables=None, privileged=None)

Allows the image a chance to validate whether the passed configuration is correct.

Parameters:
  • build_image (Optional[IBuildImage]) – The image used for the builds. Default: LinuxBuildImage.STANDARD_1_0

  • certificate (Union[BuildEnvironmentCertificate, Dict[str, Any], None]) – The location of the PEM-encoded certificate for the build project. Default: - No external certificate is added to the project

  • compute_type (Optional[ComputeType]) – The type of compute to use for this build. See the {@link ComputeType} enum for the possible values. Default: taken from {@link #buildImage#defaultComputeType}

  • environment_variables (Optional[Mapping[str, Union[BuildEnvironmentVariable, Dict[str, Any]]]]) – The environment variables that your builds can use.

  • privileged (Optional[bool]) – Indicates how the project builds Docker images. Specify true to enable running the Docker daemon inside a Docker container. This value must be set to true only if this build project will be used to build Docker images, and the specified build environment image is not one provided by AWS CodeBuild with Docker support. Otherwise, all associated builds that attempt to interact with the Docker daemon will fail. Default: false

Return type:

List[str]

Attributes

DLC_MXNET_1_4_1 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_MXNET_1_6_0 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_PYTORCH_1_2_0 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_PYTORCH_1_3_1 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_PYTORCH_1_4_0_INFERENCE = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_PYTORCH_1_4_0_TRAINING = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_PYTORCH_1_5_0_INFERENCE = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_PYTORCH_1_5_0_TRAINING = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_1_14_0 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_1_15_0 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_1_15_2_INFERENCE = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_1_15_2_TRAINING = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_2_0_0 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_2_0_1 = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_2_1_0_INFERENCE = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_2_1_0_TRAINING = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
DLC_TENSORFLOW_2_2_0_TRAINING = <aws_cdk.aws_codebuild.LinuxGpuBuildImage object>
default_compute_type

The default {@link ComputeType} to use with this image, if one was not specified in {@link BuildEnvironment#computeType} explicitly.

image_id

The Docker image identifier that the build environment uses.

image_pull_principal_type

The type of principal that CodeBuild will use to pull this build Docker image.

type

The type of build environment.

Static Methods

classmethod aws_deep_learning_containers_image(repository_name, tag, account=None)

Returns a Linux GPU build image from AWS Deep Learning Containers.

Parameters:
  • repository_name (str) – the name of the repository, for example “pytorch-inference”.

  • tag (str) – the tag of the image, for example “1.5.0-gpu-py36-cu101-ubuntu16.04”.

  • account (Optional[str]) – the AWS account ID where the DLC repository for this region is hosted in. In many cases, the CDK can infer that for you, but for some newer region our information might be out of date; in that case, you can specify the region explicitly using this optional parameter

See:

https://aws.amazon.com/releasenotes/available-deep-learning-containers-images

Return type:

IBuildImage

classmethod from_ecr_repository(repository, tag=None)

Returns a GPU image running Linux from an ECR repository.

NOTE: if the repository is external (i.e. imported), then we won’t be able to add a resource policy statement for it so CodeBuild can pull the image.

Parameters:
  • repository (IRepository) – The ECR repository.

  • tag (Optional[str]) – Image tag (default “latest”).

See:

https://docs.aws.amazon.com/codebuild/latest/userguide/sample-ecr.html

Return type:

IBuildImage