Dockerfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
  2. #
  3. # Permission is hereby granted, free of charge, to any person obtaining a
  4. # copy of this software and associated documentation files (the "Software"),
  5. # to deal in the Software without restriction, including without limitation
  6. # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7. # and/or sell copies of the Software, and to permit persons to whom the
  8. # Software is furnished to do so, subject to the following conditions:
  9. #
  10. # The above copyright notice and this permission notice shall be included in
  11. # all copies or substantial portions of the Software.
  12. #
  13. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  16. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18. # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  19. # DEALINGS IN THE SOFTWARE.
  20. #
  21. # SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES
  22. # SPDX-License-Identifier: MIT
  23. # run docker daemon with --default-runtime=nvidia for GPU detection during build
  24. # multistage build for DGL with CUDA and FP16
  25. ARG FROM_IMAGE_NAME=nvcr.io/nvidia/pytorch:23.01-py3
  26. FROM ${FROM_IMAGE_NAME} AS dgl_builder
  27. ENV DEBIAN_FRONTEND=noninteractive
  28. RUN apt-get update \
  29. && apt-get install -y git build-essential python3-dev make cmake \
  30. && rm -rf /var/lib/apt/lists/*
  31. WORKDIR /dgl
  32. RUN git clone --branch 1.0.0 --recurse-submodules --depth 1 https://github.com/dmlc/dgl.git .
  33. WORKDIR build
  34. RUN export NCCL_ROOT=/usr \
  35. && cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release \
  36. -DUSE_CUDA=ON -DCUDA_ARCH_BIN="60 70 80" -DCUDA_ARCH_PTX="80" \
  37. -DCUDA_ARCH_NAME="Manual" \
  38. -DUSE_FP16=ON \
  39. -DBUILD_TORCH=ON \
  40. -DUSE_NCCL=ON \
  41. -DUSE_SYSTEM_NCCL=ON \
  42. -DBUILD_WITH_SHARED_NCCL=ON \
  43. -DUSE_AVX=ON \
  44. && cmake --build .
  45. FROM ${FROM_IMAGE_NAME}
  46. WORKDIR /workspace/se3-transformer
  47. # copy built DGL and install it
  48. COPY --from=dgl_builder /dgl ./dgl
  49. RUN cd dgl/python && python setup.py install && cd ../.. && rm -rf dgl
  50. ADD requirements.txt .
  51. RUN pip install --no-cache-dir --upgrade --pre pip
  52. RUN pip install --no-cache-dir -r requirements.txt
  53. ADD . .
  54. ENV DGLBACKEND=pytorch
  55. ENV OMP_NUM_THREADS=1