-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from Kashu7100/feat-docker
Feat docker
- Loading branch information
Showing
7 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"file_format_version" : "1.0.0", | ||
"ICD" : { | ||
"library_path" : "libEGL_nvidia.so.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
ARG CUDA_VERSION=12.1 | ||
|
||
# =============================================================== | ||
# Stage 1: Build LuisaRender | ||
# =============================================================== | ||
FROM pytorch/pytorch:2.5.1-cuda${CUDA_VERSION}-cudnn9-devel AS builder | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ARG PYTHON_VERSION=3.11 | ||
|
||
# Install necessary packages | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
manpages-dev \ | ||
libvulkan-dev \ | ||
zlib1g-dev \ | ||
xorg-dev libglu1-mesa-dev \ | ||
libsnappy-dev \ | ||
software-properties-common \ | ||
git \ | ||
curl \ | ||
wget | ||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \ | ||
apt update && \ | ||
apt install -y --no-install-recommends \ | ||
gcc-11 \ | ||
g++-11 \ | ||
gcc-11 g++-11 patchelf && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Set GCC-11 and G++-11 as the default | ||
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 && \ | ||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 110 | ||
|
||
# Install Rust for build requirements | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
|
||
RUN pip install "pybind11[global]" | ||
|
||
# Install CMake | ||
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.0-rc2/cmake-3.31.0-rc2-linux-x86_64.sh && \ | ||
chmod +x cmake-3.31.0-rc2-linux-x86_64.sh && \ | ||
./cmake-3.31.0-rc2-linux-x86_64.sh --skip-license --prefix=/usr/local && \ | ||
rm cmake-3.31.0-rc2-linux-x86_64.sh | ||
|
||
# Build LuisaRender | ||
WORKDIR /workspace | ||
RUN git clone https://github.com/Genesis-Embodied-AI/Genesis.git && \ | ||
cd Genesis && \ | ||
git submodule update --init --recursive | ||
COPY build_luisa.sh /workspace/build_luisa.sh | ||
RUN chmod +x ./build_luisa.sh && ./build_luisa.sh ${PYTHON_VERSION} | ||
|
||
# =============================================================== | ||
# Stage 2: Runtime Environment | ||
# =============================================================== | ||
FROM pytorch/pytorch:2.5.1-cuda${CUDA_VERSION}-cudnn9-devel | ||
|
||
ARG PYTHON_VERSION=3.11 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV NVIDIA_DRIVER_CAPABILITIES=all | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
tmux \ | ||
git \ | ||
curl \ | ||
wget \ | ||
bash-completion \ | ||
libgl1 \ | ||
libgl1-mesa-glx \ | ||
libegl-dev \ | ||
libegl1 \ | ||
libxrender1 \ | ||
libglib2.0-0 \ | ||
ffmpeg \ | ||
libgtk2.0-dev \ | ||
pkg-config \ | ||
libvulkan-dev \ | ||
libgles2 \ | ||
libglvnd0 \ | ||
libglx0 \ | ||
&& apt clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /workspace | ||
|
||
# --------------------------- Genesis ---------------------------- | ||
RUN pip install --no-cache-dir open3d | ||
RUN git clone https://github.com/Genesis-Embodied-AI/Genesis.git && \ | ||
cd Genesis && \ | ||
pip install . && \ | ||
pip install --no-cache-dir PyOpenGL==3.1.5 | ||
|
||
# ------------------------ Motion planning ----------------------- | ||
RUN PYTHON_MAJOR_MINOR=$(echo ${PYTHON_VERSION} | tr -d '.') && \ | ||
wget https://github.com/ompl/ompl/releases/download/prerelease/ompl-1.6.0-cp${PYTHON_MAJOR_MINOR}-cp${PYTHON_MAJOR_MINOR}-manylinux_2_28_x86_64.whl && \ | ||
pip install ompl-1.6.0-cp${PYTHON_MAJOR_MINOR}-cp${PYTHON_MAJOR_MINOR}-manylinux_2_28_x86_64.whl && \ | ||
rm ompl-1.6.0-cp${PYTHON_MAJOR_MINOR}-cp${PYTHON_MAJOR_MINOR}-manylinux_2_28_x86_64.whl | ||
|
||
# -------------------- Surface Reconstruction -------------------- | ||
# Set the LD_LIBRARY_PATH directly in the environment | ||
COPY --from=builder /workspace/Genesis/genesis/ext/ParticleMesher/ParticleMesherPy /opt/conda/lib/python3.1/site-packages/genesis/ext/ParticleMesher/ParticleMesherPy | ||
ENV LD_LIBRARY_PATH=/opt/conda/lib/python3.1/site-packages/genesis/ext/ParticleMesher/ParticleMesherPy:$LD_LIBRARY_PATH | ||
|
||
# --------------------- Ray Tracing Renderer --------------------- | ||
# Copy LuisaRender build artifacts from the builder stage | ||
COPY --from=builder /workspace/Genesis/genesis/ext/LuisaRender/build/bin /opt/conda/lib/python3.1/site-packages/genesis/ext/LuisaRender/build/bin | ||
# fix GLIBCXX_3.4.30 not found | ||
RUN cd /opt/conda/lib && \ | ||
mv libstdc++.so.6 libstdc++.so.6.old && \ | ||
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6 | ||
|
||
COPY 10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json | ||
COPY nvidia_icd.json /usr/share/vulkan/icd.d/nvidia_icd.json | ||
COPY nvidia_layers.json /etc/vulkan/implicit_layer.d/nvidia_layers.json | ||
|
||
ENTRYPOINT ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Check if Python version is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <PYTHON_VERSION>" | ||
exit 1 | ||
fi | ||
|
||
PYTHON_VERSION=$1 | ||
|
||
cd Genesis/genesis/ext/LuisaRender && \ | ||
git submodule update --init --recursive && \ | ||
mkdir -p build && \ | ||
cmake -S . -B build \ | ||
-D CMAKE_BUILD_TYPE=Release \ | ||
-D PYTHON_VERSIONS=$PYTHON_VERSION \ | ||
-D LUISA_COMPUTE_DOWNLOAD_NVCOMP=ON \ | ||
-D LUISA_COMPUTE_DOWNLOAD_OIDN=ON \ | ||
-D LUISA_COMPUTE_ENABLE_GUI=OFF \ | ||
-D LUISA_COMPUTE_ENABLE_CUDA=ON \ | ||
-Dpybind11_DIR=$(python3 -c "import pybind11; print(pybind11.get_cmake_dir())") && \ | ||
cmake --build build -j $(nproc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"file_format_version" : "1.0.0", | ||
"ICD": { | ||
"library_path": "libGLX_nvidia.so.0", | ||
"api_version" : "1.2.155" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
{ | ||
"file_format_version" : "1.0.0", | ||
"layer": { | ||
"name": "VK_LAYER_NV_optimus", | ||
"type": "INSTANCE", | ||
"library_path": "libGLX_nvidia.so.0", | ||
"api_version" : "1.2.155", | ||
"implementation_version" : "1", | ||
"description" : "NVIDIA Optimus layer", | ||
"functions": { | ||
"vkGetInstanceProcAddr": "vk_optimusGetInstanceProcAddr", | ||
"vkGetDeviceProcAddr": "vk_optimusGetDeviceProcAddr" | ||
}, | ||
"enable_environment": { | ||
"__NV_PRIME_RENDER_OFFLOAD": "1" | ||
}, | ||
"disable_environment": { | ||
"DISABLE_LAYER_NV_OPTIMUS_1": "" | ||
} | ||
} | ||
} |