Skip to content

Commit

Permalink
Update docs, fix sycl, fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheorey committed Jan 3, 2025
1 parent be8dffe commit e1bde3b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 57 deletions.
34 changes: 17 additions & 17 deletions docker/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ ARG PACKAGE
ARG BUILD_SYCL_MODULE
ARG CI

RUN if [ -z "${DEVELOPER_BUILD}" ]; then echo "Error: ARG DEVELOPER_BUILD not specified."; exit 1; fi \
&& if [ -z "${CCACHE_TAR_NAME}" ]; then echo "Error: ARG CCACHE_TAR_NAME not specified."; exit 1; fi \
&& if [ -z "${CMAKE_VERSION}" ]; then echo "Error: ARG CMAKE_VERSION not specified."; exit 1; fi \
&& if [ -z "${CCACHE_VERSION}" ]; then echo "Error: ARG CCACHE_VERSION not specified."; exit 1; fi \
&& if [ -z "${PYTHON_VERSION}" ]; then echo "Error: ARG PYTHON_VERSION not specified."; exit 1; fi \
&& if [ -z "${BUILD_SHARED_LIBS}" ]; then echo "Error: ARG BUILD_SHARED_LIBS not specified."; exit 1; fi \
&& if [ -z "${BUILD_CUDA_MODULE}" ]; then echo "Error: ARG BUILD_CUDA_MODULE not specified."; exit 1; fi \
&& if [ -z "${BUILD_TENSORFLOW_OPS}" ]; then echo "Error: ARG BUILD_TENSORFLOW_OPS not specified."; exit 1; fi \
&& if [ -z "${BUILD_PYTORCH_OPS}" ]; then echo "Error: ARG BUILD_PYTORCH_OPS not specified."; exit 1; fi \
&& if [ -z "${PACKAGE}" ]; then echo "Error: ARG PACKAGE not specified."; exit 1; fi \
&& if [ -z "${BUILD_SYCL_MODULE}" ]; then echo "Error: ARG BUILD_SYCL_MODULE not specified."; exit 1; fi
RUN if [[ -z "${DEVELOPER_BUILD}" ]]; then echo "Error: ARG DEVELOPER_BUILD not specified."; exit 1; fi \
&& if [[ -z "${CCACHE_TAR_NAME}" ]]; then echo "Error: ARG CCACHE_TAR_NAME not specified."; exit 1; fi \
&& if [[ -z "${CMAKE_VERSION}" ]]; then echo "Error: ARG CMAKE_VERSION not specified."; exit 1; fi \
&& if [[ -z "${CCACHE_VERSION}" ]]; then echo "Error: ARG CCACHE_VERSION not specified."; exit 1; fi \
&& if [[ -z "${PYTHON_VERSION}" ]]; then echo "Error: ARG PYTHON_VERSION not specified."; exit 1; fi \
&& if [[ -z "${BUILD_SHARED_LIBS}" ]]; then echo "Error: ARG BUILD_SHARED_LIBS not specified."; exit 1; fi \
&& if [[ -z "${BUILD_CUDA_MODULE}" ]]; then echo "Error: ARG BUILD_CUDA_MODULE not specified."; exit 1; fi \
&& if [[ -z "${BUILD_TENSORFLOW_OPS}" ]]; then echo "Error: ARG BUILD_TENSORFLOW_OPS not specified."; exit 1; fi \
&& if [[ -z "${BUILD_PYTORCH_OPS}" ]]; then echo "Error: ARG BUILD_PYTORCH_OPS not specified."; exit 1; fi \
&& if [[ -z "${PACKAGE}" ]]; then echo "Error: ARG PACKAGE not specified."; exit 1; fi \
&& if [[ -z "${BUILD_SYCL_MODULE}" ]]; then echo "Error: ARG BUILD_SYCL_MODULE not specified."; exit 1; fi

# Fix Nvidia repo key rotation issue
# https://forums.developer.nvidia.com/t/notice-cuda-linux-repository-key-rotation/212771
Expand Down Expand Up @@ -232,9 +232,9 @@ RUN \
&& make VERBOSE=1 -j$(nproc) \
&& make install-pip-package -j$(nproc) \
&& make install -j$(nproc) \
&& if [ "${PACKAGE}" = "ON" ]; then make package; fi \
&& if [ "${PACKAGE}" = "VIEWER" ]; then make package-Open3DViewer-deb; fi \
&& if [ "${CI:-}a" != "a" ]; then rm -rf _deps assimp embree ipp mkl mkl_install webrtc librealsense; fi
&& if [[ "${PACKAGE}" = "ON" ]]; then make package; fi \
&& if [[ "${PACKAGE}" = "VIEWER" ]]; then make package-Open3DViewer-deb; fi \
&& if [[ "${CI:-}a" != "a" ]]; then rm -rf _deps assimp embree ipp mkl mkl_install webrtc librealsense; fi
# If CI is not null or unset, remove all large build folders to save disk space

# Compress ccache folder, move to / directory
Expand All @@ -244,9 +244,9 @@ RUN ccache -s \
&& CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \
&& cd ${CCACHE_DIR_PARENT} \
&& 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 [[ "${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 \
&& ls -alh /

RUN echo "Docker build done."
82 changes: 44 additions & 38 deletions docs/sycl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,22 @@ support. This backend allows Open3D operations to run on many different GPUs,
including integrated GPUs and discrete GPUs from Intel, Nvidia and AMD. We
provide pre-built C++ binaries and Python 3.10 wheels for Linux (Ubuntu 22.04+).

Note that the binaries only contain kernels compiled to SPIRV IR. At runtime,
they will be JIT compiled to the target device's native ISA. This means that the
first run of a kernel on a new device may be slower than subsequent runs. You
can cache the compiled kernels by setting the environment variable
`SYCL_CACHE_PERSISTENT=1` for subsequent runs. In addition, you can directly
compile for a specific target device using the OPEN3D_SYCL_TARGETS
(`-fsycl-target` compiler option) and OPEN3D_SYCL_TARGET_BACKEND_OPTIONS (`-Xs`
compiler option) CMake variables. See the `compiler documentation
<https://github.com/intel/llvm/blob/sycl/sycl/doc/UsersManual.md>`_ for
information about building for specific hardware.

Enabled features:
Enabled features
-----------------

Many Tensor API operations and Tensor Geometry operations without custom kernels
can now be offloaded to SYCL devices. In addition, HW accelerated raycasting
queries in :ref:`RayCastingScene` are also supported. You will get an error if
an operation is not supported. The implementation is tested on Linux on Intel
integrated and discrete GPUs. Currently, a single GPU (`SYCL:0`, if available)
and the CPU (`SYCL:1` if a GPU is available, else `SYCL:0`) are supported.
queries in :py:class:`open3d.t.geometry.RayCastingScene` are also supported. You
will get an error if an operation is not supported. The implementation is tested
on Linux on Intel integrated and discrete GPUs. Currently, a single GPU
(`SYCL:0`, if available) and the CPU (`SYCL:1` if a GPU is available, else
`SYCL:0`) are supported.

Installation:
Installation
-------------

Both C++ binaries and Python wheels can be downloaded from the Open3D GitHub
releases page. For C++, install the `OneAPI runtime
Both C++ binaries and Python wheels (Python 3.10 only for now) can be downloaded
from the Open3D GitHub releases page. For C++, install the `OneAPI runtime
<https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html>`_
and (optionally) SYCL runtime for your `Nvidia
<https://developer.codeplay.com/products/oneapi/nvidia/download>`_ or `AMD
Expand All @@ -46,26 +36,12 @@ libomp5-11`. Make sure to have the `correct drivers installed
raycasting on Intel GPUs, you will also need the
`intel-level-zero-gpu-raytracing` package.

Building from source:
---------------------

You can build the binaries from source as shown below. To build for a different
Python version, set the `PYTHON_VERSION` variable in `docker/docker_build.sh`.

.. code-block:: shell
cd docker
./docker_build.sh sycl-shared
This will create the Python wheel and C++ binary archive in the current
directory.


Usage:
Usage
------

The SYCL backend requires the new CXX11 ABI (Linux, gcc, libstdc++ only). If you
need to use Open3D PyTorch extension, you should use cxx11_abi wheels for PyTorch:
need to use the Open3D PyTorch extension, you should use cxx11_abi wheels for
PyTorch:

.. code-block:: shell
Expand All @@ -79,8 +55,10 @@ emulate support with these environment variables:
export IGC_EnableDPEmulation=1 # Enable float64 emulation during compilation
export OverrideDefaultFP64Settings=1 # Enable double precision emulation at runtime.
Use this environment variable to cache the JIT compiled kernels to your home
directory:
The binaries only contain kernels compiled to SPIR-V IR. At runtime, they will
be JIT compiled to your target GPU's native ISA. This means that the first run
of a kernel on a new device will be slower than subsequent runs. Use this
environment variable to cache the JIT compiled kernels to your home directory:

.. code-block:: shell
Expand Down Expand Up @@ -118,3 +96,31 @@ SYCL runtime are installed. You can select a specific device with the
# Check if a device is available
o3d.core.sycl.is_available(o3d.core.Device("SYCL:0"))
Building from source
---------------------

You can build the binaries from source as shown below. To build for a different
Python version, set the `PYTHON_VERSION` variable in `docker/docker_build.sh`.

.. code-block:: shell
cd docker
./docker_build.sh sycl-shared
This will create the Python wheel and C++ binary archive in the current
directory.

You can directly compile for a specific target device (i.e. ahead of time or AOT
compilation) using the OPEN3D_SYCL_TARGETS (`-fsycl-target` compiler option) and
OPEN3D_SYCL_TARGET_BACKEND_OPTIONS (`-Xs` compiler option) CMake variables in
Open3D. See the `compiler documentation
<https://github.com/intel/llvm/blob/sycl/sycl/doc/UsersManual.md>`_ for
information about building for specific hardware.

if you want to use different settings (e.g. AOT compilation for a specific
device, or build a wheel for a different Python version), you can update the
``docker_build.sh`` script, or build directly on host after installing the
``intel-basekit`` or ``intel-cpp-essentials`` Debian packages from the Intel
OneAPI repository.
8 changes: 6 additions & 2 deletions python/test/ml_ops/test_voxel_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def test_voxel_pooling(ml, pos_dtype, feat_dtype, position_fn, feature_fn):
else:
index = [1, 0]

np.testing.assert_allclose(ans.pooled_positions, expected_positions[index], rtol=1.1e-7)
np.testing.assert_allclose(ans.pooled_positions,
expected_positions[index],
rtol=1.1e-7)

if feature_fn == 'average':
if np.issubdtype(feat_dtype, np.integer):
Expand All @@ -99,7 +101,9 @@ def test_voxel_pooling(ml, pos_dtype, feat_dtype, position_fn, feature_fn):
elif feature_fn == 'nearest_neighbor':
expected_features = np.array([features[0], features[3]])

np.testing.assert_allclose(ans.pooled_features, expected_features[index], rtol=1.1e-7)
np.testing.assert_allclose(ans.pooled_features,
expected_features[index],
rtol=1.1e-7)


@mltest.parametrize.ml_cpu_only
Expand Down

0 comments on commit e1bde3b

Please sign in to comment.