Skip to content

Commit

Permalink
Post v0.19 fixes (#7134)
Browse files Browse the repository at this point in the history
release mode app build
Fix Linux desktop app path
glew symbols sohuld be hidden
update version table
Build sycl on Ubuntu 22.04
Add -xpu to setup.py
Build docs in docker
Update rpath for to use python venv libs.
PYTHON_VERSION is settable with an env var in docker_build for sycl.
Add sycl wheel links to docs.
  • Loading branch information
ssheorey authored Feb 13, 2025
1 parent c6d474b commit da4d8fc
Show file tree
Hide file tree
Showing 17 changed files with 216 additions and 111 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ docs/_out
3rdparty_downloads
.python-version
cmake-build-*
.git
67 changes: 15 additions & 52 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ jobs:
headless-docs: # Build headless and docs
permissions:
contents: write # Artifact upload and release upload
# Pinning to 22.04 instead of ubuntu-latest until 24.04 is supported
# (see https://github.com/isl-org/Open3D/pull/7105)
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
OPEN3D_ML_ROOT: ${{ github.workspace }}/Open3D-ML
DEVELOPER_BUILD: ${{ github.event.inputs.developer_build || 'ON' }}
steps:
- name: Checkout Open3D source code
Expand All @@ -36,60 +33,26 @@ jobs:
run: |
source util/ci_utils.sh
maximize_ubuntu_github_actions_build_space
# Pinning to 22.04 instead of ubuntu-latest until 24.04 is supported
# (see https://github.com/isl-org/Open3D/pull/7105)
- name: Docker build
run: |
docker build --build-arg BASE_IMAGE=ubuntu:22.04 \
--build-arg DEVELOPER_BUILD=${DEVELOPER_BUILD} \
-t open3d-ci:docs -f docker/Dockerfile.docs .
- name: Checkout Open3D-ML source code
uses: actions/checkout@v4
with:
repository: isl-org/Open3D-ML
path: ${{ env.OPEN3D_ML_ROOT }}
docker run -v "${GITHUB_WORKSPACE}:/opt/mount" --rm open3d-ci:docs \
bash -c "cp /root/Open3D/open3d-*-docs.tar.gz /opt/mount \
&& chown $(id -u):$(id -g) /opt/mount/open3d-*-docs.tar.gz"
- name: Setup cache
uses: actions/cache@v4
with:
# Ref: https://github.com/apache/incubator-mxnet/pull/18459/files
path: ~/.ccache
# We include the commit sha in the cache key, as new cache entries are
# only created if there is no existing entry for the key yet.
key: ${{ runner.os }}-ccache-${{ github.sha }}
# Restore any ccache cache entry, if none for
# ${{ runner.os }}-ccache-${{ github.sha }} exists.
# Common prefix will be used so that ccache can be used across commits.
restore-keys: |
${{ runner.os }}-ccache
- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
# the build system of the main repo expects a main branch. make sure
# main exists
pushd "${OPEN3D_ML_ROOT}"
git checkout -b main || true
popd
source util/ci_utils.sh
install_docs_dependencies "${OPEN3D_ML_ROOT}"
- name: Build docs
run: |
PATH=/usr/lib/ccache:$PATH
ccache -M 2G # See .github/workflows/readme.md for ccache strategy.
ccache -s
source util/ci_utils.sh
build_docs "$DEVELOPER_BUILD"
# PWD: Open3D/docs
ccache -s
tar_file="open3d-${GITHUB_SHA}-docs.tar.gz"
rm -rf "${GITHUB_WORKSPACE}/${tar_file}"
# Docs in docs/_out/html
tar -C _out -cvzf "${GITHUB_WORKSPACE}/${tar_file}" html
# Rename from Github PR branch SHA to original branch SHA, if needed.
mv open3d-*-docs.tar.gz open3d-${GITHUB_SHA}-docs.tar.gz
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: open3d-${{ github.sha }}-docs.tar.gz
name: open3d-${{ github.sha }}-docs
path: open3d-${{ github.sha }}-docs.tar.gz
if-no-files-found: error
compression-level: 0 # no compression
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ jobs:
maximize_ubuntu_github_actions_build_space
- name: Docker build
run: |
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ]; then
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then
docker/docker_build.sh cpu-static
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then
docker/docker_build.sh cpu-static-release
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then
docker/docker_build.sh cpu-shared
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then
Expand All @@ -61,8 +63,10 @@ jobs:
fi
- name: Docker test
run: |
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ]; then
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then
docker/docker_test.sh cpu-static
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then
docker/docker_test.sh cpu-static-release
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then
docker/docker_test.sh cpu-shared
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/glew/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ add_library(${GLEW_LIBRARY} STATIC ${glew_sources} ${glew_headers})
set_target_properties(${GLEW_LIBRARY} PROPERTIES
OUTPUT_NAME ${GLEW_LIBRARY}
POSITION_INDEPENDENT_CODE ON
CXX_VISIBILITY_PRESET "hidden"
FOLDER "3rdparty"
)

Expand Down
31 changes: 20 additions & 11 deletions cmake/Open3DSetGlobalProperties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,8 @@ function(open3d_enable_strip target)
endif()
endfunction()

# RPATH handling (for TBB DSO). Check current folder, one folder above and the lib sibling folder.
# Also check the Python virtual env /lib folder for 3rd party dependency libraries installed with `pip install`
# RPATH handling (see below). We don't install targets such as pybind, so BUILD_RPATH must be relative as well.
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
if (APPLE)
# Add options to cover the various ways in which open3d shared lib or apps can be installed wrt TBB DSO
set(CMAKE_INSTALL_RPATH "@loader_path;@loader_path/../;@loader_path/../lib/;@loader_path/../../../../")
# pybind with open3d shared lib is copied, not cmake-installed, so we need to add .. to build rpath
set(CMAKE_BUILD_RPATH "@loader_path/../")
elseif(UNIX)
set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../;$ORIGIN/../lib/;$ORIGIN/../../../../")
set(CMAKE_BUILD_RPATH "$ORIGIN/../")
endif()

# open3d_set_global_properties(target)
#
Expand Down Expand Up @@ -204,4 +194,23 @@ function(open3d_set_global_properties target)
target_link_options(${target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${HARDENING_LDFLAGS}>")
target_compile_definitions(${target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${HARDENING_DEFINITIONS}>")

# RPATH handling. Check current folder, one folder above (cpu/pybind ->
# libtbb) and the lib sibling folder (bin/Open3D -> lib/libOpen3D). Also
# check the Python virtual env /lib folder for 3rd party dependency
# libraries installed with `pip install`
if (APPLE)
# Add options to cover the various ways in which open3d shared lib or apps can be installed wrt dependent DSOs
set_target_properties(${target} PROPERTIES
INSTALL_RPATH "@loader_path;@loader_path/../;@loader_path/../lib/:@loader_path/../../../../"
# pybind with open3d shared lib is copied, not cmake-installed, so we need to add .. to build rpath
BUILD_RPATH "@loader_path;@loader_path/../;@loader_path/../lib/:@loader_path/../../../../")
elseif(UNIX)
message(STATUS "Setting RPATH for ${target}")
# INSTALL_RPATH for C++ binaries.
set_target_properties(${target} PROPERTIES
INSTALL_RPATH "$ORIGIN;$ORIGIN/../;$ORIGIN/../lib/;$ORIGIN/../../../../"
# BUILD_RPATH for Python wheel libs and app.
BUILD_RPATH "$ORIGIN;$ORIGIN/../;$ORIGIN/../lib/;$ORIGIN/../../../../")
endif()

endfunction()
2 changes: 1 addition & 1 deletion cpp/apps/Open3DViewer/Open3DViewer.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type=Application
Name=Open3D
Icon=Open3D
Comment=Viewer for triangle meshes and point clouds
Exec=${CMAKE_INSTALL_PREFIX}/bin/Open3D/Open3D %f
Exec=${CMAKE_INSTALL_PREFIX}/bin/Open3D %f
Terminal=false
Categories=Graphics
MimeType=model/stl;model/obj;model/fbx;model/gltf-binary;model/gltf+json;model/x.stl-ascii;model/x.stl-binary;model/x-ply;application/x-off;application/x-xyz;application/x-xyzn;application/x-xyzrgb;application/x-pcd;application/x-pts
8 changes: 6 additions & 2 deletions cpp/open3d/core/SYCLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ SYCLDevice::SYCLDevice(const sycl::device &sycl_device) {
aspects.end();
if (!fp64) {
utility::LogWarning(
"SYCL device {} does not support double precision. Using "
"emulation.",
"SYCL device {} does not support double precision. Use env "
"vars 'OverrideDefaultFP64Settings=1' "
"'IGC_EnableDPEmulation=1' to enable double precision "
"emulation on Intel GPUs.",
name);
}
usm_device_allocations =
Expand All @@ -78,6 +80,7 @@ SYCLContext::SYCLContext() {
const Device open3d_device = Device("SYCL:0");
devices_.emplace(open3d_device, sycl_device);
} catch (const sycl::exception &e) {
utility::LogWarning("SYCL GPU unavailable: {}", e.what());
}

// SYCL CPU fallback.
Expand All @@ -94,6 +97,7 @@ SYCLContext::SYCLContext() {
Device("SYCL:" + std::to_string(devices_.size()));
devices_.emplace(open3d_device, sycl_device);
} catch (const sycl::exception &e) {
utility::LogWarning("SYCL CPU unavailable: {}", e.what());
}

if (devices_.size() == 0) {
Expand Down
16 changes: 8 additions & 8 deletions cpp/open3d/core/SYCLUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ void PrintSYCLDevices(bool print_all) {
int nd = 0;
utility::LogInfo("# Open3D SYCL device");
try {
utility::LogInfo(
"- Device(\"SYCL:{}\"): {}", nd,
SYCLDeviceToString(sycl::device(sycl::gpu_selector_v)));
auto dev = sycl::device(sycl::gpu_selector_v);
utility::LogInfo("- Device(\"SYCL:{}\"): {}", nd,
SYCLDeviceToString(dev));
++nd;
} catch (const sycl::exception &e) {
} catch (const sycl::exception &e) { // No SYCL GPU available.
}
try {
auto dev = sycl::device(sycl::cpu_selector_v);
utility::LogInfo("# Open3D SYCL device (CPU fallback)");
utility::LogInfo(
"- Device(\"SYCL:{}\"): {}", nd,
SYCLDeviceToString(sycl::device(sycl::cpu_selector_v)));
} catch (const sycl::exception &e) {
utility::LogInfo("- Device(\"SYCL:{}\"): {}", nd,
SYCLDeviceToString(dev));
} catch (const sycl::exception &e) { // No SYCL CPU available.
if (nd == 0) utility::LogInfo("- Device(\"SYCL:0\"): N/A");
}
if (print_all) {
Expand Down
6 changes: 1 addition & 5 deletions cpp/pybind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,10 @@ endif()
set(PYTHON_COMPILED_MODULE_DIR
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Python/$<IF:$<BOOL:${BUILD_CUDA_MODULE}>,cuda,cpu>")

# Set BUILD_RPATH to find tbb (and a shared libOpen3D). We don't install through cmake.
if (APPLE)
set_target_properties(pybind PROPERTIES BUILD_RPATH "@loader_path;@loader_path/..")
elseif (UNIX)
if (UNIX AND NOT APPLE)
# Use RPATH instead of RUNPATH in pybind so that needed libc++.so can find child dependant libc++abi.so in RPATH
# https://stackoverflow.com/questions/69662319/managing-secondary-dependencies-of-shared-libraries
target_link_options(pybind PRIVATE "LINKER:--disable-new-dtags")
set_target_properties(pybind PROPERTIES BUILD_RPATH "$ORIGIN;$ORIGIN/..")
endif()
set_target_properties(pybind PROPERTIES
FOLDER "Python"
Expand Down
11 changes: 2 additions & 9 deletions docker/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,8 @@ RUN apt-get update && apt-get install -y \
libxmlsec1-dev \
libffi-dev \
liblzma-dev \
&& if [ "${BUILD_SYCL_MODULE}" = "ON" ]; then \
add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& apt-get install -y g++-11 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11 \
&& update-alternatives --set g++ /usr/bin/g++-11 \
&& c++ -v; \
fi \
&& if [ $BUILD_SYCL_MODULE = "ON" ]; then apt-get install -y intel-level-zero-gpu-raytracing ; fi \
&& rm -rf /var/lib/apt/lists/*
# OneDPL TBB backend requires libstdc++ >= v11. This makes the created wheel Ubuntu 22.04+ only.

# pyenv
# The pyenv python paths are used during docker run, in this way docker run
Expand Down Expand Up @@ -251,7 +244,7 @@ RUN ccache -s \
&& tar -caf /${CCACHE_TAR_NAME}.tar.xz ${CCACHE_DIR_NAME} \
&& if [[ "${PACKAGE}" = "ON" ]]; then mv /root/Open3D/build/package/open3d-devel*.tar.xz /; fi \
&& if [[ "${PACKAGE}" = "VIEWER" ]]; then mv /root/Open3D/build/package-Open3DViewer-deb/open3d-viewer-*-Linux.deb /; fi \
&& if [[ "${BUILD_SYCL_MODULE}" = "ON" && "${BUILD_SHARED_LIBS}" = "ON" ]]; then mv /root/Open3D/build/lib/python_package/pip_package/open3d-*.whl /; fi \
&& if [[ "${BUILD_SYCL_MODULE}" = "ON" && "${BUILD_SHARED_LIBS}" = "ON" ]]; then mv /root/Open3D/build/lib/python_package/pip_package/open3d*.whl /; fi \
&& ls -alh /

RUN echo "Docker build done."
86 changes: 86 additions & 0 deletions docker/Dockerfile.docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# FROM must be called before other ARGS except for ARG BASE_IMAGE
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# For bash-specific commands
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Required build args, should be specified in docker_build.sh
ARG DEVELOPER_BUILD

RUN if [[ -z "${DEVELOPER_BUILD}" ]]; then echo "Error: ARG DEVELOPER_BUILD not specified."; exit 1; fi

# Forward all ARG to ENV
# ci_utils.sh may require these environment variables
ENV DEVELOPER_BUILD=${DEVELOPER_BUILD}
# Non-interactive notebook rendering
ENV CI=true

# Prevent interactive inputs when installing packages
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles
ENV SUDO=command
ENV OPEN3D_ML_ROOT=/root/Open3D-ML

# Always keep /root/Open3D as the WORKDIR
WORKDIR /root/Open3D
COPY util/ci_utils.sh util/install_deps_ubuntu.sh util/
COPY python/requirements*.txt python/
COPY docs/requirements.txt docs/

# Dependencies: basic and python-build
RUN apt-get update && apt-get install -y \
git \
curl \
build-essential \
pkg-config \
zlib1g \
zlib1g-dev \
libssl-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
libffi-dev \
liblzma-dev \
&& rm -rf /var/lib/apt/lists/*

# Checkout Open3D-ML main branch
RUN git clone --depth 1 https://github.com/isl-org/Open3D-ML.git ${OPEN3D_ML_ROOT}
# Open3D docs dependencies
RUN source util/ci_utils.sh && install_docs_dependencies "${OPEN3D_ML_ROOT}"

# Download ccache from GCS bucket. We reuse the cpu ccache for docs. No need to upload back.
# If it doesn't exist on the cloud, an empty ${CCACHE_DIR} will be created.
# Example directory structure:
# - CCACHE_DIR = ~/.cache/ccache
# - CCACHE_DIR_NAME = ccache
# - CCACHE_DIR_PARENT = ~/.cache
# We need to set ccache size explicitly with -M, otherwise the defualt size is
# *not* determined by ccache's default, but the downloaded ccache file's config.
RUN CCACHE_DIR=$(ccache -p | grep cache_dir | grep -oE "[^ ]+$") \
&& CCACHE_DIR_NAME=$(basename ${CCACHE_DIR}) \
&& CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \
&& CCACHE_TAR_NAME="open3d-ci-cpu" \
&& mkdir -p ${CCACHE_DIR_PARENT} \
&& cd ${CCACHE_DIR_PARENT} \
&& (curl -s -O https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.xz || true) \
&& if [ -f ${CCACHE_TAR_NAME}.tar.xz ]; then tar -xf ${CCACHE_TAR_NAME}.tar.xz || true; fi \
&& mkdir -p ${CCACHE_DIR} \
&& ccache -M 4G \
&& ccache -s

# Open3D repo
COPY . /root/Open3D

# PWD: Open3D/docs after build_docs
# Docs in docs/_out/html
RUN source util/ci_utils.sh && build_docs "$DEVELOPER_BUILD" \
&& ccache -s \
&& tar -C _out -cvzf "/root/Open3D/open3d-$(git rev-parse HEAD)-docs.tar.gz" html

RUN echo "Docker documentation build done."
Loading

0 comments on commit da4d8fc

Please sign in to comment.