Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/config/image/lambda/base-preview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image:
name: "lambda-base-preview"
description: "Lambda base GPU image with thread-mode RIC preview"
description: "Lambda base GPU image with multi-mode concurrency RIC"

metadata:
framework: "lambda"
Expand All @@ -19,6 +19,8 @@ build:
cuda_version: "12.9.1"
dlc_major_version: "1"
dlc_minor_version: "0"
awslambdaric_version: "3.1.1"
awslambdaric_release: "2.0.0.0"

release:
release: true
Expand Down
4 changes: 3 additions & 1 deletion .github/config/image/lambda/cupy-preview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image:
name: "lambda-cupy-preview"
description: "Lambda CuPy GPU image with thread-mode RIC preview"
description: "Lambda CuPy GPU image with multi-mode concurrency RIC"

metadata:
framework: "lambda"
Expand All @@ -19,6 +19,8 @@ build:
cuda_version: "12.9.1"
dlc_major_version: "1"
dlc_minor_version: "0"
awslambdaric_version: "3.1.1"
awslambdaric_release: "2.0.0.0"

release:
release: true
Expand Down
4 changes: 3 additions & 1 deletion .github/config/image/lambda/pytorch-preview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image:
name: "lambda-pytorch-preview"
description: "Lambda PyTorch GPU image with thread-mode RIC preview"
description: "Lambda PyTorch GPU image with multi-mode concurrency RIC"

metadata:
framework: "lambda"
Expand All @@ -19,6 +19,8 @@ build:
cuda_version: "12.9.1"
dlc_major_version: "1"
dlc_minor_version: "0"
awslambdaric_version: "3.1.1"
awslambdaric_release: "2.0.0.0"

release:
release: true
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/lambda.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ jobs:
TESTS="$COMMON /test/unit/test_imports_base.py" ;;
esac
echo "tests=${TESTS}" >> $GITHUB_OUTPUT
# Multi-mode RIC targets carry a runtime concurrency-mode knob.
if [[ "$TARGET" == *preview* ]]; then
echo "multimode=true" >> $GITHUB_OUTPUT
else
echo "multimode=false" >> $GITHUB_OUTPUT
fi

- name: Run GPU validation tests
if: steps.check.outputs.exists == 'true'
Expand All @@ -167,9 +173,19 @@ jobs:
${{ steps.image.outputs.image-uri }} \
-m pytest ${{ steps.config.outputs.tests }} -v

- name: Skip notice
if: steps.check.outputs.exists != 'true'
run: echo "Image not found in ECR — skipping tests (first release scenario)"
- name: Verify runtime concurrency-mode override
if: steps.check.outputs.exists == 'true' && steps.config.outputs.multimode == 'true'
run: |
for mode in process thread hybrid; do
echo "::group::override AWS_LAMBDA_CONCURRENCY_MODE=${mode}"
docker run --rm --gpus all --entrypoint python \
-e AWS_LAMBDA_CONCURRENCY_MODE=${mode} \
-e EXPECTED_CONCURRENCY_MODE=${mode} \
-v $(pwd)/test/lambda:/test \
${{ steps.image.outputs.image-uri }} \
-m pytest /test/unit/test_lambda_runtime.py::test_ric_resolves_container_env -v
echo "::endgroup::"
done

release-gate:
if: >-
Expand Down
47 changes: 31 additions & 16 deletions docker/lambda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,21 @@ RUN --mount=type=cache,target=/root/.cache/uv \
# ============================================================
FROM nvidia/cuda:${CUDA_VERSION}-runtime-amzn2023 as oss-base-py3
COPY --from=builder-base-py3 /var/lang /var/lang
COPY ./scripts/common/setup_oss_compliance.sh /tmp/setup_oss_compliance.sh
COPY ./scripts/docker/common/setup_oss_compliance.sh /tmp/setup_oss_compliance.sh
RUN PATH="/var/lang/bin:$PATH" bash /tmp/setup_oss_compliance.sh python3 \
&& touch /root/THIRD_PARTY_SOURCE_CODE_URLS

FROM nvidia/cuda:${CUDA_VERSION}-runtime-amzn2023 as oss-cupy-py3
COPY --from=builder-cupy-py3 /var/lang /var/lang
COPY ./scripts/common/setup_oss_compliance.sh /tmp/setup_oss_compliance.sh
COPY ./scripts/docker/common/setup_oss_compliance.sh /tmp/setup_oss_compliance.sh
RUN PATH="/var/lang/bin:$PATH" bash /tmp/setup_oss_compliance.sh python3 \
&& touch /root/THIRD_PARTY_SOURCE_CODE_URLS

FROM nvidia/cuda:${CUDA_VERSION}-runtime-amzn2023 as oss-pytorch-py3
ARG FFMPEG_VERSION
COPY --from=builder-pytorch-py3 /var/lang /var/lang
COPY --from=lambda-python /lib64/libssl.so.3 /lib64/libcrypto.so.3 /lib64/
COPY ./scripts/common/setup_oss_compliance.sh /tmp/setup_oss_compliance.sh
COPY ./scripts/docker/common/setup_oss_compliance.sh /tmp/setup_oss_compliance.sh
RUN PATH="/var/lang/bin:$PATH" bash /tmp/setup_oss_compliance.sh python3 \
&& printf '\n** FFmpeg; version n%s -- https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n%s.tar.gz\n' "${FFMPEG_VERSION}" "${FFMPEG_VERSION}" >> /root/BUILD_FROM_SOURCE_PACKAGES_LICENCES \
&& printf '\nFFmpeg n%s https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n%s.tar.gz\n' "${FFMPEG_VERSION}" "${FFMPEG_VERSION}" >> /root/THIRD_PARTY_SOURCE_CODE_URLS \
Expand Down Expand Up @@ -192,8 +192,8 @@ ENV PATH="/var/lang/bin:$PATH" \
LAMBDA_RUNTIME_DIR=/var/runtime \
LANG=en_US.UTF-8 \
TZ=:/etc/localtime
COPY ./scripts/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
COPY ./scripts/telemetry/bash_telemetry.sh.template /tmp/bash_telemetry.sh.template
COPY ./scripts/docker/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
COPY ./scripts/docker/telemetry/bash_telemetry.sh.template /tmp/bash_telemetry.sh.template
ARG FRAMEWORK
ARG FRAMEWORK_VERSION
ARG CONTAINER_TYPE
Expand Down Expand Up @@ -244,8 +244,8 @@ ENV PATH="/var/lang/bin:$PATH" \
LAMBDA_RUNTIME_DIR=/var/runtime \
LANG=en_US.UTF-8 \
TZ=:/etc/localtime
COPY ./scripts/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
COPY ./scripts/telemetry/bash_telemetry.sh.template /tmp/bash_telemetry.sh.template
COPY ./scripts/docker/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
COPY ./scripts/docker/telemetry/bash_telemetry.sh.template /tmp/bash_telemetry.sh.template
ARG FRAMEWORK

ARG FRAMEWORK_VERSION
Expand Down Expand Up @@ -304,8 +304,8 @@ ENV PATH="/var/lang/bin:/usr/local/bin:$PATH" \
LAMBDA_RUNTIME_DIR=/var/runtime \
LANG=en_US.UTF-8 \
TZ=:/etc/localtime
COPY ./scripts/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
COPY ./scripts/telemetry/bash_telemetry.sh.template /tmp/bash_telemetry.sh.template
COPY ./scripts/docker/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
COPY ./scripts/docker/telemetry/bash_telemetry.sh.template /tmp/bash_telemetry.sh.template
ARG FRAMEWORK
ARG FRAMEWORK_VERSION
ARG CONTAINER_TYPE
Expand All @@ -330,7 +330,7 @@ ENTRYPOINT ["/lambda_entrypoint.sh", "python", "-m", "awslambdaric"]
CMD ["handler.handler"]

# ============================================================
# RIC preview builder (compile thread-mode RIC with C extensions)
# RIC builder (compile multi-mode concurrency RIC with C extensions)
# ============================================================
FROM builder-base as builder-ric-preview
ARG PYTHON_VERSION
Expand All @@ -349,31 +349,46 @@ RUN uv pip install --python /var/lang/bin/python${PYTHON_VERSION} --no-deps /tmp
&& rm /tmp/awslambdaric-${AWSLAMBDARIC_VERSION}.tar.gz

# ============================================================
# Preview: Base Python 3.13 (+ thread-mode RIC)
# Base Python 3.13 (+ multi-mode concurrency RIC)
# ============================================================
FROM base-py3 as base-preview-py3
ARG PYTHON_VERSION
RUN rm -rf /var/lang/lib/python${PYTHON_VERSION}/site-packages/awslambdaric* \
&& rm -f /var/lang/lib/python${PYTHON_VERSION}/site-packages/runtime_client*.so
COPY --from=builder-ric-preview /var/lang/lib/python${PYTHON_VERSION}/site-packages/ /var/lang/lib/python${PYTHON_VERSION}/site-packages/
ENV AWS_LAMBDA_CONCURRENCY_MODE=thread
# Default: process mode (RIC-native). Customers override per function at runtime
# to thread (one shared model copy in GPU VRAM) or hybrid; function-config env
# vars take precedence over this image default. In process/hybrid, VRAM scales
# with worker count (one model copy + CUDA context per process) — size function
# concurrency to the model's VRAM footprint.
ENV AWS_LAMBDA_CONCURRENCY_MODE=process

# ============================================================
# Preview: CuPy Python 3.13 (+ thread-mode RIC)
# CuPy Python 3.13 (+ multi-mode concurrency RIC)
# ============================================================
FROM cupy-py3 as cupy-preview-py3
ARG PYTHON_VERSION
RUN rm -rf /var/lang/lib/python${PYTHON_VERSION}/site-packages/awslambdaric* \
&& rm -f /var/lang/lib/python${PYTHON_VERSION}/site-packages/runtime_client*.so
COPY --from=builder-ric-preview /var/lang/lib/python${PYTHON_VERSION}/site-packages/ /var/lang/lib/python${PYTHON_VERSION}/site-packages/
ENV AWS_LAMBDA_CONCURRENCY_MODE=thread
# Default: process mode (RIC-native). Customers override per function at runtime
# to thread (one shared model copy in GPU VRAM) or hybrid; function-config env
# vars take precedence over this image default. In process/hybrid, VRAM scales
# with worker count (one model copy + CUDA context per process) — size function
# concurrency to the model's VRAM footprint.
ENV AWS_LAMBDA_CONCURRENCY_MODE=process

# ============================================================
# Preview: PyTorch Python 3.13 (+ thread-mode RIC)
# PyTorch Python 3.13 (+ multi-mode concurrency RIC)
# ============================================================
FROM pytorch-py3 as pytorch-preview-py3
ARG PYTHON_VERSION
RUN rm -rf /var/lang/lib/python${PYTHON_VERSION}/site-packages/awslambdaric* \
&& rm -f /var/lang/lib/python${PYTHON_VERSION}/site-packages/runtime_client*.so
COPY --from=builder-ric-preview /var/lang/lib/python${PYTHON_VERSION}/site-packages/ /var/lang/lib/python${PYTHON_VERSION}/site-packages/
ENV AWS_LAMBDA_CONCURRENCY_MODE=thread
# Default: process mode (RIC-native). Customers override per function at runtime
# to thread (one shared model copy in GPU VRAM) or hybrid; function-config env
# vars take precedence over this image default. In process/hybrid, VRAM scales
# with worker count (one model copy + CUDA context per process) — size function
# concurrency to the model's VRAM footprint.
ENV AWS_LAMBDA_CONCURRENCY_MODE=process
6 changes: 4 additions & 2 deletions docker/lambda/pytorch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ dependencies = [
"av==16.1.0",
"awslambdaric==4.0.0",
"boto3==1.40.4",
"click==8.3.3",
"diffusers==0.38.0",
"librosa==0.11.0",
"msgpack==1.2.1",
"numpy==2.4.2",
"opencv-python-headless==4.13.0.92",
"pillow==12.2.0",
"pillow==12.3.0",
"pip==26.0.1",
"pip-licenses==5.5.1",
"requests==2.33.0",
Expand All @@ -24,7 +26,7 @@ dependencies = [
"torch==2.10.0",
"torchaudio==2.10.0",
"torchvision==0.25.0",
"transformers==5.2.0",
"transformers==5.5.0",
"urllib3==2.7.0",
"pytest==8.4.1",
]
Expand Down
Loading
Loading