Advertisement
Guest User

Untitled

a guest
Feb 4th, 2023
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.97 KB | None | 0 0
  1. # FROM must be called before other ARGS except for ARG BASE_IMAGE
  2. ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r35.1.0
  3. FROM nvcr.io/nvidia/l4t-base:r35.1.0
  4.  
  5. # For the rest of this Dockerfile
  6. SHELL ["/bin/bash", "-c"]
  7.  
  8. # Required build args, should be specified in docker_build.sh
  9. ARG CONDA_SUFFIX
  10. ARG CMAKE_VERSION
  11. ARG PYTHON_VERSION
  12. ARG DEVELOPER_BUILD
  13. RUN if [ -z "${CONDA_SUFFIX}"    ]; then echo "Error: ARG CONDA_SUFFIX    not specified."; exit 1; fi \
  14.  && if [ -z "${CMAKE_VERSION}"   ]; then echo "Error: ARG CMAKE_VERSION   not specified."; exit 1; fi \
  15.  && if [ -z "${PYTHON_VERSION}"  ]; then echo "Error: ARG PYTHON_VERSION  not specified."; exit 1; fi \
  16.  && if [ -z "${DEVELOPER_BUILD}" ]; then echo "Error: ARG DEVELOPER_BUILD not specified."; exit 1; fi
  17.  
  18. # Prevent interactive inputs when installing packages
  19. ENV DEBIAN_FRONTEND=noninteractive
  20. ENV TZ=America/Los_Angeles
  21. ENV SUDO=command
  22.  
  23. RUN \
  24.     touch /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
  25.     echo "deb https://repo.download.nvidia.com/jetson/t194 r35.1 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
  26.     apt-key adv --fetch-key http://repo.download.nvidia.com/jetson/jetson-ota-public.asc && \
  27.     mkdir -p /opt/nvidia/l4t-packages/ && \
  28.     touch /opt/nvidia/l4t-packages/.nv-l4t-disable-boot-fw-update-in-preinstall
  29.  
  30. RUN \
  31.     apt-get update && apt-get install -y --assume-yes --verbose-versions --allow-change-held-packages -o Dpkg::Options::="--force-confdef" \
  32.     apt-utils \
  33.     nvidia-jetpack
  34.  
  35. ENV UDEV=1
  36. ENV CUDACXX=/usr/local/cuda/bin/nvcc
  37. ENV CUDA_HOME=/usr/local/cuda
  38. ENV PATH=$PATH:/usr/local/cuda/bin/:/opt/nvidia/
  39. ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  40. # Minimal dependencies for running Docker
  41. # wget    : for downloading
  42. # libgl1  : available on Ubuntu ARM desktop by default
  43. # libgomp1: available on Ubuntu ARM desktop by default
  44. RUN apt-get update && apt-get install -y -y --no-install-recommends --assume-yes --verbose-versions --allow-change-held-packages -o Dpkg::Options::="--force-confdef" \
  45.     wget \
  46.     libgl1 \
  47.     libgomp1 \
  48.  && rm -rf /var/lib/apt/lists/*
  49.  
  50. # Minimal dependencies for building
  51. RUN apt-get update && apt-get install -y --no-install-recommends --assume-yes --verbose-versions --allow-change-held-packages -o Dpkg::Options::="--force-confdef" \
  52.     build-essential \
  53.     cmake-gui \
  54.     git \
  55.  && rm -rf /var/lib/apt/lists/*
  56.  
  57. # Eigen
  58.  
  59. WORKDIR /root
  60. RUN wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz && tar -xvf eigen-3.4.0.tar.gz && mkdir /root/eigen-3.4.0/build
  61. WORKDIR /root/eigen-3.4.0
  62. RUN cd build && cmake \
  63.         -DEIGEN_CUDA_COMPUTE_ARCH=86 \
  64.         -DEIGEN_TEST_CUDA=ON \
  65.         -DEIGEN_TEST_CUDA_CLANG=ON \
  66.         -DEIGEN_TEST_NEON=ON \
  67.         -DEIGEN_TEST_NEON64=ON \
  68.         .. \
  69. && make install
  70. WORKDIR /root
  71.  
  72. # mininiconda
  73. ENV PATH="/root/miniconda3/bin:${PATH}"
  74. RUN wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${CONDA_SUFFIX}.sh \
  75.  && bash Miniconda3-latest-Linux-${CONDA_SUFFIX}.sh -b \
  76.  && rm Miniconda3-latest-Linux-${CONDA_SUFFIX}.sh \
  77.  && conda --version
  78. ENV PATH="/root/miniconda3/envs/open3d/bin:${PATH}"
  79. RUN conda create -y -n open3d python=${PYTHON_VERSION} \
  80.  && source activate open3d
  81. RUN which python \
  82.  && python --version
  83.  
  84. # CMake
  85. # PWD is /, cmake will be installed to /root/${CMAKE_VERSION}/bin/cmake
  86. RUN CMAKE_VER_NUMBERS=$(echo "${CMAKE_VERSION}" | cut -d"-" -f2) \
  87.  && wget -q https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER_NUMBERS}/${CMAKE_VERSION}.tar.gz \
  88.  && tar -xf ${CMAKE_VERSION}.tar.gz
  89. #  && cp -ar ${CMAKE_VERSION} ${HOME}
  90. ENV PATH=${HOME}/${CMAKE_VERSION}/bin:${PATH}
  91.  
  92. # Install dependencies before copying the full Open3D directory for better Docker caching
  93. # Open3D C++ dependencies
  94. COPY ./util/install_deps_ubuntu.sh /root/Open3D/util/
  95. RUN /root/Open3D/util/install_deps_ubuntu.sh assume-yes \
  96.  && rm -rf /var/lib/apt/lists/*
  97. RUN echo ${PATH} \
  98.  && echo "gcc=$(which gcc)" \
  99.  && gcc --version \
  100.  && echo "g++=$(which g++)" \
  101.  && g++ --version
  102.  
  103. # Python and dependencies
  104. COPY ./python/requirements*.txt /root/Open3D/python/
  105. RUN which python \
  106.  && python --version \
  107.  && python -m pip install -U -r /root/Open3D/python/requirements.txt \
  108.   -r /root/Open3D/python/requirements_build.txt \
  109.   -r /root/Open3D/python/requirements_test.txt
  110.  
  111. # Open3D repo
  112. # Always keep /root/Open3D as the WORKDIR
  113. COPY . /root/Open3D
  114. WORKDIR /root/Open3D
  115.  
  116. # Remove unsupported CUDA arches
  117.  
  118. RUN \
  119.         find . -name '*.cmake' -exec sed -i -e 's|60-real 70-real 72-real 75-real 80-real 86|75-real 80-real 86|g' {} \; && \
  120.         find . -name '*.cmake' -exec sed -i -e 's|60-real 70-real 72-real 75-real 80|75-real 80-real 86|g' {} \; && \
  121.         find . -name '*.cmake' -exec sed -i -e 's|30-real 50-real 60-real 70-real 72-real 75|75-real 80-real 86|g' {} \;
  122.  
  123. # Build
  124. # -DCPP_LIBRARY=/usr/lib/llvm-10/lib/libc++.so
  125. # -CPPABI_LIBRARY=/usr/lib/llvm-10/lib/libc++abi.so
  126.  
  127. RUN git submodule update --init --recursive \
  128.  && mkdir build \
  129.  && cd build \
  130.  && cmake \
  131.         -DCMAKE_BUILD_TYPE=Release \
  132.         -DBUILD_UNIT_TESTS=ON \
  133.         -DBUILD_CUDA_MODULE=ON \
  134.         -DCUDAToolkit_BIN_DIR=/usr/local/cuda/bin \
  135.         -DCUDAToolkit_CUPTI_INCLUDE_DIR=/usr/local/cuda/include \
  136.         -DCMAKE_BUILD_TYPE=Release \
  137.         -DCMAKE_INSTALL_PREFIX=~/open3d_install \
  138.         -DDEVELOPER_BUILD=${DEVELOPER_BUILD} \
  139.         -DUSE_SYSTEM_EIGEN3=ON \
  140.         -DEigen3_DIR=/usr/local/share/eigen3/cmake \
  141.         -DBUILD_SHARED_LIBS=ON \
  142.         -DBUILD_GUI=ON \
  143.         -DBUILD_TENSORFLOW_OPS=OFF \
  144.         -DBUILD_PYTORCH_OPS=OFF \
  145.         -DUSE_BLAS=ON \
  146.         -DBUILD_FILAMENT_FROM_SOURCE=ON \
  147.         -DCMAKE_CXX_FLAGS_RELEASE=ON \
  148.         -DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG -faligned-new" \
  149.         -DBUILD_LIBREALSENSE=OFF \
  150.         -DUSE_SYSTEM_LIBREALSENSE=OFF \
  151.     .. \
  152.  && make -j$(nproc) \
  153.  && make install-pip-package -j$(nproc) \
  154.  && make install -j$(nproc)
  155.  
  156.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement