diff --git a/docker/Dockerfile.nvidia b/docker/Dockerfile.nvidia index 27e31c4783..bc455d0218 100644 --- a/docker/Dockerfile.nvidia +++ b/docker/Dockerfile.nvidia @@ -1,38 +1,48 @@ ############################################################## -# README with base system requirements -# https://ngc.nvidia.com/catalog/containers/hpc:pgi-compilers +# This Dockerfile contains the additional NVIDIA compilers, +# libraries, and plugins to enable OpenACC and NVIDIA GPU +# acceleration of Devito codes. # -# BUILD: docker build --file docker/Dockerfile.nvidia --tag devito:nvidia.pgi . -# RUN: docker run --runtime=nvidia --gpus all --rm -it -p 8888:8888 -p 8787:8787 -p 8786:8786 devito:nvidia.pgi +# BUILD: docker build --file docker/Dockerfile.nvidia --tag devito:nvidia . +# RUN: docker run --runtime=nvidia --gpus all --rm -it -p 8888:8888 -p 8787:8787 -p 8786:8786 devito:nvidia ############################################################## -FROM nvcr.io/hpc/pgi-compilers:ce +FROM python:3.8 ENV DEBIAN_FRONTEND noninteractive -# The NGC PGI container has the C, C++, and MPI set to compile using the PGI compilers and libraries. The -# libraries and tools needed during the install of Devito require the gcc libraries, compilers, and tools. -# Setting the environment for gcc here at the top of the dockerfile and resets the environment to -# PGI at the end of the dockerfile. -ENV CC="/usr/bin/gcc" -ENV CXX="/usr/bin/g++" -RUN mv '/opt/pgi/linux86-64/19.10/mpi/openmpi-3.1.3/bin/mpicc' '/opt/pgi/linux86-64/19.10/mpi/openmpi-3.1.3/bin/mpicc.devito' - # nodesource: nvdashboard requires nodejs>=10 RUN apt-get update -y && \ apt-get install -y -q \ apt-utils \ curl \ - mpich libmpich-dev && \ + mpich libmpich-dev && \ curl -sL https://deb.nodesource.com/setup_12.x | bash - && \ apt-get install -y -q \ - nvidia-cuda-toolkit \ - python3.6 \ - python3-pip python3-setuptools python3-dev python3-multidict python3-venv \ nodejs \ texlive-latex-extra texlive-fonts-recommended dvipng cm-super && \ + wget -q -P /app/\ + https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7_20.7_amd64.deb \ + https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020_20.7_amd64.deb && \ + apt-get install -y -q \ + /app/nvhpc-20-7_20.7_amd64.deb \ + /app/nvhpc-2020_20.7_amd64.deb && \ apt-get update -y && \ + rm -rf /app/nvhpc* && \ rm -rf /var/lib/apt/lists/* +# nvidia-container-runtime +ENV NVIDIA_VISIBLE_DEVICES all +ENV NVIDIA_DRIVER_CAPABILITIES compute,utility + +# required for nvidia-docker v1 +RUN echo "/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ + echo "/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/lib64" >> /etc/ld.so.conf.d/nvidia.conf && \ + echo "/opt/nvidia/hpc_sdk/Linux_x86_64/20.7/compilers/lib" >> /etc/ld.so.conf.d/nvidia.conf + +# Compiler, CUDA, and Library paths +ENV CUDA_ROOT /opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda +ENV PATH /opt/nvidia/hpc_sdk/Linux_x86_64/20.7/compilers/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/bin:${PATH} +ENV LD_LIBRARY_PATH /opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/lib:/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/20.7/compilers/lib:/opt/nvidia/hpc_sdk/Linux_x86_64/20.7/math_libs/11.0/lib64:${LD_LIBRARY_PATH} ADD ./requirements.txt /app/requirements.txt ADD ./requirements-optional.txt /app/requirements-optional.txt @@ -43,8 +53,9 @@ RUN python3 -m venv /venv && \ /venv/bin/pip install --no-cache-dir wheel && \ /venv/bin/pip install --no-cache-dir -r /app/requirements.txt && \ /venv/bin/pip install --no-cache-dir -r /app/requirements-optional.txt && \ - /venv/bin/pip install --no-cache-dir -r /app/requirements-nvidia.txt - + /venv/bin/pip install --no-cache-dir -r /app/requirements-nvidia.txt && \ + rm -rf ~/.cache/pip + ADD ./devito /app/devito ADD ./tests /app/tests ADD ./scripts /app/scripts @@ -77,11 +88,6 @@ ENV DEVITO_PLATFORM=nvidiaX ENV DEVITO_LOGGING=DEBUG ENV PGI_ACC_TIME=1 -# Resetting the environment to PGI after finishing the install of the requirements for Devito and tools. -ENV CC="/opt/pgi/linux86-64-llvm/19.10/bin/pgcc" -ENV CXX="/opt/pgi/linux86-64-llvm/19.10/bin/pgc++" -RUN mv '/opt/pgi/linux86-64/19.10/mpi/openmpi-3.1.3/bin/mpicc.devito' '/opt/pgi/linux86-64/19.10/mpi/openmpi-3.1.3/bin/mpicc' - WORKDIR /app EXPOSE 8888 ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/requirements-nvidia.txt b/requirements-nvidia.txt index 8f21f38dd3..8c3d7fee54 100644 --- a/requirements-nvidia.txt +++ b/requirements-nvidia.txt @@ -1,4 +1,4 @@ -cupy>=6 +cupy-cuda102 dask-cuda jupyterlab==1.2.1 jupyterlab-nvdashboard