[SWDEV-479339/SWDEV-498804] Added AMDSMI Dockerfile (#35)
Updated AMDSMI Dockerfile Signed-off-by: Justin Williams <Justin.Williams@amd.com>
这个提交包含在:
+33
-25
@@ -1,31 +1,39 @@
|
||||
# Use ubuntu 20.04 base image
|
||||
FROM compute-artifactory.amd.com:5000/rocm-base-images/ubuntu-20.04-bld:2024112501
|
||||
# Use rocm/dev-ubuntu-22.04 as the base image
|
||||
FROM rocm/dev-ubuntu-22.04
|
||||
|
||||
# Set environment variables
|
||||
ENV BUILD_FOLDER=/src/build
|
||||
ENV DEB_BUILD="amd-smi-lib*99999-local_amd64.deb"
|
||||
ENV DEB_BUILD_TEST='amd-smi-lib-tests*99999-local_amd64.deb'
|
||||
# Set environment variables for build directories and package patterns
|
||||
ENV BUILD_FOLDER=/home/amdsmi/build
|
||||
ENV DEB_BUILD="amd-smi-lib*99999-local_amd64.deb"
|
||||
ENV DEB_BUILD_TEST="amd-smi-lib-tests*99999-local_amd64.deb"
|
||||
|
||||
# Set up the working directory
|
||||
WORKDIR /src
|
||||
# Set the working directory to /home
|
||||
WORKDIR /home
|
||||
|
||||
# Copy the source code into the container
|
||||
COPY . /src
|
||||
# Install necessary system packages
|
||||
RUN apt update && apt-get install -y git build-essential rpm pkg-config g++ python3 python3-pip python3-wheel python3-setuptools
|
||||
|
||||
# Run the build and install commands
|
||||
RUN rm -rf ${BUILD_FOLDER} && \
|
||||
mkdir -p ${BUILD_FOLDER} && \
|
||||
cd ${BUILD_FOLDER} && \
|
||||
cmake .. -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON && \
|
||||
make -j $(nproc) VERBOSE=1 && \
|
||||
make package && \
|
||||
sudo apt install -y ${BUILD_FOLDER}/${DEB_BUILD} && \
|
||||
sudo ln -s /opt/rocm/bin/amd-smi /usr/local/bin
|
||||
# Upgrade pip and install cmake and virtualenv using pip
|
||||
RUN python3 -m pip install --upgrade pip setuptools && \
|
||||
python3 -m pip install cmake virtualenv
|
||||
|
||||
# Verify installation
|
||||
RUN python3 -m pip list | grep amd && \
|
||||
python3 -m pip list | grep pip && \
|
||||
python3 -m pip list | grep setuptools
|
||||
# Clone the AMD SMI repository from GitHub
|
||||
RUN git clone -b amd-mainline https://github.com/ROCm/amdsmi.git
|
||||
|
||||
# Set the entrypoint
|
||||
ENTRYPOINT ["/bin/bash"]
|
||||
# Navigate to the amdsmi directory
|
||||
WORKDIR /home/amdsmi
|
||||
|
||||
# Build and Install AMDSMI
|
||||
RUN rm -rf ${BUILD_FOLDER} && \
|
||||
mkdir -p ${BUILD_FOLDER} && \
|
||||
cd ${BUILD_FOLDER} && \
|
||||
cmake .. -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON && \
|
||||
make -j $(nproc) VERBOSE=1 && \
|
||||
make package && \
|
||||
sudo apt install -y --allow-downgrades ${BUILD_FOLDER}/${DEB_BUILD} && \
|
||||
sudo ln -s /opt/rocm/bin/amd-smi /usr/local/bin
|
||||
|
||||
# Verify the installation of Python packages related to AMD SMI
|
||||
RUN python3 -m pip list | grep -E "amd|pip|setuptools"
|
||||
|
||||
# Set the entrypoint to bash for interactive use
|
||||
ENTRYPOINT ["/bin/bash"]
|
||||
|
||||
在新工单中引用
屏蔽一个用户