From c50449c414c5fae4106b19d18574917766c8b942 Mon Sep 17 00:00:00 2001 From: Ahmad Alawneh Date: Sat, 22 Feb 2025 21:22:40 -0500 Subject: [PATCH] AI generated with staging --- Dockerfile | 82 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index e9b2300..f5c82e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,71 @@ -FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu24.04 +# =========================== +# Base Stage: Install System Dependencies +# =========================== +FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu24.04 AS base SHELL ["/bin/bash", "-c"] - WORKDIR /accel-sim -ENV CUDA_INSTALL_PATH=/usr/local/cuda -ENV PTXAS_CUDA_INSTALL_PATH=/usr/local/cuda -ENV BOOST_ROOT=/usr/include/boost -ENV PATH=$CUDA_INSTALL_PATH/bin:$PATH - -ENV GPUAPPS_ROOT=/accel-sim/gpu-app-collection +# Set up environment variables +ENV CUDA_INSTALL_PATH=/usr/local/cuda \ + PTXAS_CUDA_INSTALL_PATH=/usr/local/cuda \ + BOOST_ROOT=/usr/include/boost \ + PATH=/usr/local/cuda/bin:$PATH \ + GPUAPPS_ROOT=/accel-sim/gpu-app-collection -RUN apt-get update && apt-get install -y wget build-essential xutils-dev bison zlib1g-dev flex \ - libglu1-mesa-dev git g++ libssl-dev libxml2-dev libboost-all-dev git g++ \ - libxml2-dev vim python3-setuptools python3-pip python3-venv cmake \ - libfreeimage3 libfreeimage-dev freeglut3-dev pkg-config \ - python3-doc python3-tk python3.12-venv python3.12-doc binfmt-support psmisc apt-utils && apt-get clean +# Install essential dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + wget build-essential xutils-dev bison zlib1g-dev flex \ + libglu1-mesa-dev git g++ libssl-dev libxml2-dev libboost-all-dev \ + vim python3-setuptools python3-pip python3-venv cmake \ + libfreeimage3 libfreeimage-dev freeglut3-dev pkg-config \ + python3-doc python3-tk python3.12-venv python3.12-doc \ + binfmt-support psmisc apt-utils && \ + apt-get clean && rm -rf /var/lib/apt/lists/* +# =========================== +# Python Stage: Setup Virtual Environment +# =========================== +FROM base AS python-env -# Create and activate a virtual environment, venv is needed because of PEP 668 +# Create and activate a virtual environment (PEP 668 compliant) RUN python3 -m venv /venv ENV PATH="/venv/bin:$PATH" -RUN pip3 install --upgrade pip -RUN pip3 install pyyaml plotly psutil -RUN git clone --recurse-submodules https://github.com/accel-sim/gpu-app-collection.git && cd gpu-app-collection && bash test-build.sh && bash get_regression_data.sh +# Upgrade pip and install required Python packages +RUN pip install --upgrade pip && \ + pip install pyyaml plotly psutil + +# =========================== +# App Stage: Clone and Build Accel-Sim GPU App Collection +# =========================== +FROM python-env AS app -#get Nsys +# Clone the repository and build +RUN git clone --recurse-submodules https://github.com/accel-sim/gpu-app-collection.git && \ + cd gpu-app-collection && \ + bash test-build.sh && \ + bash get_regression_data.sh + +# =========================== +# Nsight Compute Stage: Install Nsight CLI +# =========================== +FROM python-env AS nsight + +# Set non-interactive mode for apt ENV DEBIAN_FRONTEND=noninteractive -RUN apt update --allow-insecure-repositories && apt update && apt install -y --no-install-recommends gnupg wget \ - && mkdir -p /etc/apt/keyrings -RUN wget -qO - https://developer.download.nvidia.com/devtools/repos/ubuntu2404/amd64/7fa2af80.pub | tee /etc/apt/keyrings/nvidia.asc -RUN echo "deb [signed-by=/etc/apt/keyrings/nvidia.asc] http://developer.download.nvidia.com/devtools/repos/ubuntu2404/amd64 /" | tee /etc/apt/sources.list.d/nvidia.list -RUN apt-get update --allow-insecure-repositories -RUN apt install -y nsight-systems-cli --allow-unauthenticated +# Add NVIDIA repository and install Nsight CLI +RUN apt-get update --allow-insecure-repositories && \ + apt-get install -y --no-install-recommends gnupg wget && \ + mkdir -p /etc/apt/keyrings && \ + wget -qO - https://developer.download.nvidia.com/devtools/repos/ubuntu2404/amd64/7fa2af80.pub | tee /etc/apt/keyrings/nvidia.asc && \ + echo "deb [signed-by=/etc/apt/keyrings/nvidia.asc] http://developer.download.nvidia.com/devtools/repos/ubuntu2404/amd64 /" | tee /etc/apt/sources.list.d/nvidia.list && \ + apt-get update --allow-insecure-repositories && \ + apt-get install -y nsight-systems-cli --allow-unauthenticated && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +# =========================== +# Final Stage: Define Entry Point +# =========================== +CMD ["/bin/bash"]