From 29aaf7b846cec1202d72516e7f755cd3632b6557 Mon Sep 17 00:00:00 2001 From: wangchen615 Date: Thu, 17 Apr 2025 21:49:48 +0000 Subject: [PATCH 1/4] Add Dockerfile and benchmark script for containerized GuideLLM benchmarking --- Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ run_benchmark.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 Dockerfile create mode 100755 run_benchmark.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..db452a1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM python:3.11-slim + +LABEL org.opencontainers.image.source="https://github.com/neuralmagic/guidellm" +LABEL org.opencontainers.image.description="GuideLLM Benchmark Container" + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Create non-root user +RUN useradd -m -u 1000 guidellm + +# Set working directory +WORKDIR /app + +# Install GuideLLM +RUN pip install git+https://github.com/neuralmagic/guidellm.git + +# Copy and set up the benchmark script +COPY run_benchmark.sh /app/ +RUN chmod +x /app/run_benchmark.sh + +# Set ownership to non-root user +RUN chown -R guidellm:guidellm /app + +# Switch to non-root user +USER guidellm + +# Healthcheck +HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:8000/health || exit 1 + +# Set the entrypoint +ENTRYPOINT ["/app/run_benchmark.sh"] \ No newline at end of file diff --git a/run_benchmark.sh b/run_benchmark.sh new file mode 100755 index 0000000..17606a4 --- /dev/null +++ b/run_benchmark.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Required environment variables +TARGET=${TARGET:-"http://localhost:8000"} +MODEL=${MODEL:-"neuralmagic/Meta-Llama-3.1-8B-Instruct-quantized.w4a16"} +RATE_TYPE=${RATE_TYPE:-"sweep"} +DATA=${DATA:-"prompt_tokens=256,output_tokens=128"} +MAX_REQUESTS=${MAX_REQUESTS:-"100"} +MAX_SECONDS=${MAX_SECONDS:-""} + +# Output configuration +OUTPUT_PATH=${OUTPUT_PATH:-"/results/guidellm_benchmark_results"} +OUTPUT_FORMAT=${OUTPUT_FORMAT:-"json"} # Can be json, yaml, or yml + +# Build the command +CMD="guidellm benchmark --target \"${TARGET}\" --model \"${MODEL}\" --rate-type \"${RATE_TYPE}\" --data \"${DATA}\"" + +# Add optional parameters +if [ ! -z "${MAX_REQUESTS}" ]; then + CMD="${CMD} --max-requests ${MAX_REQUESTS}" +fi + +if [ ! -z "${MAX_SECONDS}" ]; then + CMD="${CMD} --max-seconds ${MAX_SECONDS}" +fi + +# Add output path with appropriate extension +if [ ! -z "${OUTPUT_PATH}" ]; then + CMD="${CMD} --output-path \"${OUTPUT_PATH}.${OUTPUT_FORMAT}\"" +fi + +# Execute the command +echo "Running command: ${CMD}" +eval "${CMD}" From 9ca1e8f0359ad7c0a16d3b11584a364d05afde9f Mon Sep 17 00:00:00 2001 From: wangchen615 Date: Thu, 17 Apr 2025 22:06:44 +0000 Subject: [PATCH 2/4] fix pre-commit issue? --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index db452a1..77919ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,4 +33,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8000/health || exit 1 # Set the entrypoint -ENTRYPOINT ["/app/run_benchmark.sh"] \ No newline at end of file +ENTRYPOINT ["/app/run_benchmark.sh"] From 2fd8c0c0a514514e2be2ac64731b05b5da60a218 Mon Sep 17 00:00:00 2001 From: wangchen615 Date: Thu, 17 Apr 2025 21:49:48 +0000 Subject: [PATCH 3/4] Add Dockerfile and benchmark script for containerized GuideLLM benchmarking fix pre-commit issue? Add Docker build files and update .gitignore --- Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ build/Dockerfile | 32 ++++++++++++++++++++++++++++++++ build/run_benchmark.sh | 35 +++++++++++++++++++++++++++++++++++ run_benchmark.sh | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 Dockerfile create mode 100644 build/Dockerfile create mode 100755 build/run_benchmark.sh create mode 100755 run_benchmark.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..77919ae --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM python:3.11-slim + +LABEL org.opencontainers.image.source="https://github.com/neuralmagic/guidellm" +LABEL org.opencontainers.image.description="GuideLLM Benchmark Container" + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Create non-root user +RUN useradd -m -u 1000 guidellm + +# Set working directory +WORKDIR /app + +# Install GuideLLM +RUN pip install git+https://github.com/neuralmagic/guidellm.git + +# Copy and set up the benchmark script +COPY run_benchmark.sh /app/ +RUN chmod +x /app/run_benchmark.sh + +# Set ownership to non-root user +RUN chown -R guidellm:guidellm /app + +# Switch to non-root user +USER guidellm + +# Healthcheck +HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:8000/health || exit 1 + +# Set the entrypoint +ENTRYPOINT ["/app/run_benchmark.sh"] diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000..1654fe8 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,32 @@ +FROM python:3.12-slim + +LABEL org.opencontainers.image.source="https://github.com/neuralmagic/guidellm" +LABEL org.opencontainers.image.description="GuideLLM Benchmark Container" + +# Install dependencies and set up environment in a single layer +RUN apt-get update && apt-get install -y \ + git \ + curl \ + && pip install git+https://github.com/neuralmagic/guidellm.git \ + && useradd -m -u 1000 guidellm \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Copy and set up the benchmark script +COPY build/run_benchmark.sh /app/ + +# Set ownership to non-root user +RUN chown -R guidellm:guidellm /app + +# Switch to non-root user +USER guidellm + +# Healthcheck +HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:8000/health || exit 1 + +# Set the entrypoint +ENTRYPOINT ["/app/run_benchmark.sh"] diff --git a/build/run_benchmark.sh b/build/run_benchmark.sh new file mode 100755 index 0000000..1f4dd0c --- /dev/null +++ b/build/run_benchmark.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Required environment variables +TARGET=${TARGET:-"http://localhost:8000"} +MODEL=${MODEL:-"neuralmagic/Meta-Llama-3.1-8B-Instruct-quantized.w4a16"} +RATE_TYPE=${RATE_TYPE:-"sweep"} +DATA=${DATA:-"prompt_tokens=256,output_tokens=128"} +MAX_REQUESTS=${MAX_REQUESTS:-"100"} +MAX_SECONDS=${MAX_SECONDS:-""} + +# Output configuration +OUTPUT_PATH=${OUTPUT_PATH:-"/results/guidellm_benchmark_results"} +OUTPUT_FORMAT=${OUTPUT_FORMAT:-"json"} # Can be json, yaml, or yml + +# Build the command +CMD="guidellm benchmark --target \"${TARGET}\" --model \"${MODEL}\" --rate-type \"${RATE_TYPE}\" --data \"${DATA}\"" + +# Add optional parameters +if [ ! -z "${MAX_REQUESTS}" ]; then + CMD="${CMD} --max-requests ${MAX_REQUESTS}" +fi + +if [ ! -z "${MAX_SECONDS}" ]; then + CMD="${CMD} --max-seconds ${MAX_SECONDS}" +fi + +# Add output path with appropriate extension +if [ ! -z "${OUTPUT_PATH}" ]; then + CMD="${CMD} --output-path \"${OUTPUT_PATH}.${OUTPUT_FORMAT}\"" +fi + +# Execute the command +echo "Running command: ${CMD}" +eval "${CMD}" diff --git a/run_benchmark.sh b/run_benchmark.sh new file mode 100755 index 0000000..17606a4 --- /dev/null +++ b/run_benchmark.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Required environment variables +TARGET=${TARGET:-"http://localhost:8000"} +MODEL=${MODEL:-"neuralmagic/Meta-Llama-3.1-8B-Instruct-quantized.w4a16"} +RATE_TYPE=${RATE_TYPE:-"sweep"} +DATA=${DATA:-"prompt_tokens=256,output_tokens=128"} +MAX_REQUESTS=${MAX_REQUESTS:-"100"} +MAX_SECONDS=${MAX_SECONDS:-""} + +# Output configuration +OUTPUT_PATH=${OUTPUT_PATH:-"/results/guidellm_benchmark_results"} +OUTPUT_FORMAT=${OUTPUT_FORMAT:-"json"} # Can be json, yaml, or yml + +# Build the command +CMD="guidellm benchmark --target \"${TARGET}\" --model \"${MODEL}\" --rate-type \"${RATE_TYPE}\" --data \"${DATA}\"" + +# Add optional parameters +if [ ! -z "${MAX_REQUESTS}" ]; then + CMD="${CMD} --max-requests ${MAX_REQUESTS}" +fi + +if [ ! -z "${MAX_SECONDS}" ]; then + CMD="${CMD} --max-seconds ${MAX_SECONDS}" +fi + +# Add output path with appropriate extension +if [ ! -z "${OUTPUT_PATH}" ]; then + CMD="${CMD} --output-path \"${OUTPUT_PATH}.${OUTPUT_FORMAT}\"" +fi + +# Execute the command +echo "Running command: ${CMD}" +eval "${CMD}" From 661e8e4d20b08569b45afaf0461e03fd05de2b92 Mon Sep 17 00:00:00 2001 From: wangchen615 Date: Tue, 22 Apr 2025 04:03:46 +0000 Subject: [PATCH 4/4] remote original dockerfile and run_benchmark.sh --- Dockerfile | 36 ------------------------------------ run_benchmark.sh | 34 ---------------------------------- 2 files changed, 70 deletions(-) delete mode 100644 Dockerfile delete mode 100755 run_benchmark.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 77919ae..0000000 --- a/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM python:3.11-slim - -LABEL org.opencontainers.image.source="https://github.com/neuralmagic/guidellm" -LABEL org.opencontainers.image.description="GuideLLM Benchmark Container" - -# Install system dependencies -RUN apt-get update && apt-get install -y \ - git \ - curl \ - && rm -rf /var/lib/apt/lists/* - -# Create non-root user -RUN useradd -m -u 1000 guidellm - -# Set working directory -WORKDIR /app - -# Install GuideLLM -RUN pip install git+https://github.com/neuralmagic/guidellm.git - -# Copy and set up the benchmark script -COPY run_benchmark.sh /app/ -RUN chmod +x /app/run_benchmark.sh - -# Set ownership to non-root user -RUN chown -R guidellm:guidellm /app - -# Switch to non-root user -USER guidellm - -# Healthcheck -HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ - CMD curl -f http://localhost:8000/health || exit 1 - -# Set the entrypoint -ENTRYPOINT ["/app/run_benchmark.sh"] diff --git a/run_benchmark.sh b/run_benchmark.sh deleted file mode 100755 index 17606a4..0000000 --- a/run_benchmark.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Required environment variables -TARGET=${TARGET:-"http://localhost:8000"} -MODEL=${MODEL:-"neuralmagic/Meta-Llama-3.1-8B-Instruct-quantized.w4a16"} -RATE_TYPE=${RATE_TYPE:-"sweep"} -DATA=${DATA:-"prompt_tokens=256,output_tokens=128"} -MAX_REQUESTS=${MAX_REQUESTS:-"100"} -MAX_SECONDS=${MAX_SECONDS:-""} - -# Output configuration -OUTPUT_PATH=${OUTPUT_PATH:-"/results/guidellm_benchmark_results"} -OUTPUT_FORMAT=${OUTPUT_FORMAT:-"json"} # Can be json, yaml, or yml - -# Build the command -CMD="guidellm benchmark --target \"${TARGET}\" --model \"${MODEL}\" --rate-type \"${RATE_TYPE}\" --data \"${DATA}\"" - -# Add optional parameters -if [ ! -z "${MAX_REQUESTS}" ]; then - CMD="${CMD} --max-requests ${MAX_REQUESTS}" -fi - -if [ ! -z "${MAX_SECONDS}" ]; then - CMD="${CMD} --max-seconds ${MAX_SECONDS}" -fi - -# Add output path with appropriate extension -if [ ! -z "${OUTPUT_PATH}" ]; then - CMD="${CMD} --output-path \"${OUTPUT_PATH}.${OUTPUT_FORMAT}\"" -fi - -# Execute the command -echo "Running command: ${CMD}" -eval "${CMD}"