From 7df7e7eee102d48e501b5d3689ad4378a690f2a6 Mon Sep 17 00:00:00 2001 From: Nisu Date: Thu, 9 May 2024 16:25:27 +0300 Subject: [PATCH 1/2] Update dockerfile.gpu Create blank file --- docker/gpu/dockerfile.gpu | 123 +------------------------------------- 1 file changed, 1 insertion(+), 122 deletions(-) diff --git a/docker/gpu/dockerfile.gpu b/docker/gpu/dockerfile.gpu index 48d99dcd0859..d10724b79e98 100644 --- a/docker/gpu/dockerfile.gpu +++ b/docker/gpu/dockerfile.gpu @@ -1,122 +1 @@ -FROM nvidia/cuda:8.0-cudnn5-devel - -################################################################################################################# -# Global -################################################################################################################# -# apt-get to skip any interactive post-install configuration steps with DEBIAN_FRONTEND=noninteractive and apt-get install -y - -ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ARG DEBIAN_FRONTEND=noninteractive - -################################################################################################################# -# Global Path Setting -################################################################################################################# - -ENV CUDA_HOME /usr/local/cuda -ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64 -ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/local/lib - -ENV OPENCL_LIBRARIES /usr/local/cuda/lib64 -ENV OPENCL_INCLUDE_DIR /usr/local/cuda/include - -################################################################################################################# -# TINI -################################################################################################################# - -# Install tini -ENV TINI_VERSION v0.14.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini -RUN chmod +x /tini - -################################################################################################################# -# SYSTEM -################################################################################################################# -# update: downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their -# dependencies. It will do this for all repositories and PPAs. - -RUN apt-get update && \ -apt-get install -y --no-install-recommends \ -build-essential \ -curl \ -bzip2 \ -ca-certificates \ -libglib2.0-0 \ -libxext6 \ -libsm6 \ -libxrender1 \ -git \ -vim \ -mercurial \ -subversion \ -cmake \ -libboost-dev \ -libboost-system-dev \ -libboost-filesystem-dev \ -gcc \ -g++ - -# Add OpenCL ICD files for LightGBM -RUN mkdir -p /etc/OpenCL/vendors && \ - echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd - -################################################################################################################# -# CONDA -################################################################################################################# - -ARG CONDA_DIR=/opt/miniforge -# add to path -ENV PATH $CONDA_DIR/bin:$PATH - -# Install miniforge -RUN echo "export PATH=$CONDA_DIR/bin:"'$PATH' > /etc/profile.d/conda.sh && \ - curl -sL https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -o ~/miniforge.sh && \ - /bin/bash ~/miniforge.sh -b -p $CONDA_DIR && \ - rm ~/miniforge.sh - -RUN conda config --set always_yes yes --set changeps1 no && \ - conda create -y -q -n py3 numpy scipy scikit-learn jupyter notebook ipython pandas matplotlib - -################################################################################################################# -# LightGBM -################################################################################################################# - -RUN cd /usr/local/src && mkdir lightgbm && cd lightgbm && \ - git clone --recursive --branch stable --depth 1 https://github.com/microsoft/LightGBM && \ - cd LightGBM && \ - cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ && \ - OPENCL_HEADERS=/usr/local/cuda-8.0/targets/x86_64-linux/include LIBOPENCL=/usr/local/cuda-8.0/targets/x86_64-linux/lib cmake --build build - -ENV PATH /usr/local/src/lightgbm/LightGBM:${PATH} - -RUN /bin/bash -c "source activate py3 && cd /usr/local/src/lightgbm/LightGBM && sh ./build-python.sh install --precompile && source deactivate" - -################################################################################################################# -# System CleanUp -################################################################################################################# -# apt-get autoremove: used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed. -# apt-get clean: removes the aptitude cache in /var/cache/apt/archives. You'd be amazed how much is in there! the only drawback is that the packages -# have to be downloaded again if you reinstall them. - -RUN apt-get autoremove -y && apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - conda clean -a -y - -################################################################################################################# -# JUPYTER -################################################################################################################# - -# password: keras -# password key: --NotebookApp.password='sha1:98b767162d34:8da1bc3c75a0f29145769edc977375a373407824' - -# Add a notebook profile. -RUN mkdir -p -m 700 ~/.jupyter/ && \ - echo "c.NotebookApp.ip = '*'" >> ~/.jupyter/jupyter_notebook_config.py - -VOLUME /home -WORKDIR /home - -# IPython -EXPOSE 8888 - -ENTRYPOINT [ "/tini", "--" ] -CMD /bin/bash -c "source activate py3 && jupyter notebook --allow-root --no-browser --NotebookApp.password='sha1:98b767162d34:8da1bc3c75a0f29145769edc977375a373407824' && source deactivate" +# prepare to magic From 24dcd5633bff23885f1fbd80caed735621b21439 Mon Sep 17 00:00:00 2001 From: Nisu Date: Fri, 10 May 2024 11:08:28 +0300 Subject: [PATCH 2/2] Update dockerfile.gpu Change the base image, add missing driver and change the libnvidia-opencl.so.1 location (according to the new driver and new image) inside required file. --- docker/gpu/dockerfile.gpu | 124 +++++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 1 deletion(-) diff --git a/docker/gpu/dockerfile.gpu b/docker/gpu/dockerfile.gpu index d10724b79e98..b3edf5577e05 100644 --- a/docker/gpu/dockerfile.gpu +++ b/docker/gpu/dockerfile.gpu @@ -1 +1,123 @@ -# prepare to magic +FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 + +################################################################################################################# +# Global +################################################################################################################# +# apt-get to skip any interactive post-install configuration steps with DEBIAN_FRONTEND=noninteractive and apt-get install -y + +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ARG DEBIAN_FRONTEND=noninteractive + +################################################################################################################# +# Global Path Setting +################################################################################################################# + +ENV CUDA_HOME /usr/local/cuda +ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64 +ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/local/lib + +ENV OPENCL_LIBRARIES /usr/local/cuda/lib64 +ENV OPENCL_INCLUDE_DIR /usr/local/cuda/include + +################################################################################################################# +# TINI +################################################################################################################# + +# Install tini +ENV TINI_VERSION v0.14.0 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini +RUN chmod +x /tini + +################################################################################################################# +# SYSTEM +################################################################################################################# +# update: downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their +# dependencies. It will do this for all repositories and PPAs. + +RUN apt-get update && \ +apt-get install -y --no-install-recommends \ +build-essential \ +curl \ +bzip2 \ +ca-certificates \ +libglib2.0-0 \ +libxext6 \ +libsm6 \ +libxrender1 \ +git \ +vim \ +mercurial \ +subversion \ +cmake \ +libboost-dev \ +libboost-system-dev \ +libboost-filesystem-dev \ +gcc \ +g++ \ +nvidia-driver-550 + +# Add OpenCL ICD files for LightGBM (or you can use `find / -name libnvidia-opencl.so.1` command to get the actual path to the file) +RUN mkdir -p /etc/OpenCL/vendors && \ + echo "/usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd + +################################################################################################################# +# CONDA +################################################################################################################# + +ARG CONDA_DIR=/opt/miniforge +# add to path +ENV PATH $CONDA_DIR/bin:$PATH + +# Install miniforge +RUN echo "export PATH=$CONDA_DIR/bin:"'$PATH' > /etc/profile.d/conda.sh && \ + curl -sL https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -o ~/miniforge.sh && \ + /bin/bash ~/miniforge.sh -b -p $CONDA_DIR && \ + rm ~/miniforge.sh + +RUN conda config --set always_yes yes --set changeps1 no && \ + conda create -y -q -n py3 numpy scipy scikit-learn jupyter notebook ipython pandas matplotlib + +################################################################################################################# +# LightGBM +################################################################################################################# + +RUN cd /usr/local/src && mkdir lightgbm && cd lightgbm && \ + git clone --recursive --branch stable --depth 1 https://github.com/microsoft/LightGBM && \ + cd LightGBM && \ + cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ && \ + OPENCL_HEADERS=/usr/local/cuda-8.0/targets/x86_64-linux/include LIBOPENCL=/usr/local/cuda-8.0/targets/x86_64-linux/lib cmake --build build + +ENV PATH /usr/local/src/lightgbm/LightGBM:${PATH} + +RUN /bin/bash -c "source activate py3 && cd /usr/local/src/lightgbm/LightGBM && sh ./build-python.sh install --gpu && source deactivate" + +################################################################################################################# +# System CleanUp +################################################################################################################# +# apt-get autoremove: used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed. +# apt-get clean: removes the aptitude cache in /var/cache/apt/archives. You'd be amazed how much is in there! the only drawback is that the packages +# have to be downloaded again if you reinstall them. + +RUN apt-get autoremove -y && apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + conda clean -a -y + +################################################################################################################# +# JUPYTER +################################################################################################################# + +# password: keras +# password key: --NotebookApp.password='sha1:98b767162d34:8da1bc3c75a0f29145769edc977375a373407824' + +# Add a notebook profile. +RUN mkdir -p -m 700 ~/.jupyter/ && \ + echo "c.NotebookApp.ip = '*'" >> ~/.jupyter/jupyter_notebook_config.py + +VOLUME /home +WORKDIR /home + +# IPython +EXPOSE 8888 + +ENTRYPOINT [ "/tini", "--" ] +CMD /bin/bash -c "source activate py3 && jupyter notebook --allow-root --no-browser --NotebookApp.password='sha1:98b767162d34:8da1bc3c75a0f29145769edc977375a373407824' && source deactivate"