From 9c9d9d11958a07665f620ab15ba3640d5cda4c01 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Wed, 4 Dec 2024 16:10:08 -0800 Subject: [PATCH 1/8] Cache storage change: gz->xz, 5->4GB Test XCode 16.3 (XCode 14 is not available on github) XCode 15 causes errors with embree. --- .github/workflows/macos.yml | 4 ++-- .github/workflows/ubuntu-cuda.yml | 2 +- docker/Dockerfile.ci | 8 ++++---- docker/Dockerfile.wheel | 8 ++++---- docker/docker_build.sh | 6 +++--- util/ci_utils.sh | 12 +++++++----- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 9ae3b3bfce5..5169e842f0a 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -76,7 +76,7 @@ jobs: # Newer Xcode versions work, but embree recommends Apple clang <= 14 on # arm64 to avoid possible "EXEC_BAD_INSTRUCTION" runtime exceptions: # https://github.com/embree/embree/releases/tag/v4.3.1 - sudo xcode-select -switch /Applications/Xcode_14.3.1.app + sudo xcode-select -switch /Applications/Xcode_16.1.0.app fi # Install libomp 11.1.0 from old brew bottle for x64 catalina (10.15) @@ -260,7 +260,7 @@ jobs: # Fix macos-14 arm64 runner image issues, see comments in MacOS job. if [[ ${{ runner.arch}} == "ARM64" ]]; then ln -s $(which gfortran-13) /usr/local/bin/gfortran - sudo xcode-select -switch /Applications/Xcode_14.3.1.app + sudo xcode-select -switch /Applications/Xcode_16.1.0.app fi # Install libomp 11.1.0. See comment above. diff --git a/.github/workflows/ubuntu-cuda.yml b/.github/workflows/ubuntu-cuda.yml index daab8f7af61..00dd303dcf1 100644 --- a/.github/workflows/ubuntu-cuda.yml +++ b/.github/workflows/ubuntu-cuda.yml @@ -180,7 +180,7 @@ jobs: gcloud compute ssh "${INSTANCE_NAME}" \ --zone="${GCE_ZONE}" \ --command="ls -alh \ - && gsutil cp ${CCACHE_TAR_NAME}.tar.gz gs://open3d-ci-cache/" + && gsutil cp ${CCACHE_TAR_NAME}.tar.xz gs://open3d-ci-cache/" - name: VM delete if: always() diff --git a/docker/Dockerfile.ci b/docker/Dockerfile.ci index ac98e50236f..189fa6c50b0 100755 --- a/docker/Dockerfile.ci +++ b/docker/Dockerfile.ci @@ -141,10 +141,10 @@ RUN CCACHE_DIR=$(ccache -p | grep cache_dir | grep -oE "[^ ]+$") \ && CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \ && mkdir -p ${CCACHE_DIR_PARENT} \ && cd ${CCACHE_DIR_PARENT} \ - && (wget -q https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.gz || true) \ - && if [ -f ${CCACHE_TAR_NAME}.tar.gz ]; then tar -xf ${CCACHE_TAR_NAME}.tar.gz; fi \ + && (wget -q https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.xz https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.gz || true) \ + && if [ -f ${CCACHE_TAR_NAME}.tar.?z ]; then tar -xf ${CCACHE_TAR_NAME}.tar.?z; fi \ && mkdir -p ${CCACHE_DIR} \ - && ccache -M 5G \ + && ccache -M 4G \ && ccache -s # Checkout Open3D-ML main branch @@ -235,7 +235,7 @@ RUN ccache -s \ && CCACHE_DIR_NAME=$(basename ${CCACHE_DIR}) \ && CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \ && cd ${CCACHE_DIR_PARENT} \ - && tar -czf /${CCACHE_TAR_NAME}.tar.gz ${CCACHE_DIR_NAME} \ + && 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 \ && ls -alh / diff --git a/docker/Dockerfile.wheel b/docker/Dockerfile.wheel index 25372da258d..eb60286b620 100644 --- a/docker/Dockerfile.wheel +++ b/docker/Dockerfile.wheel @@ -76,11 +76,11 @@ RUN CCACHE_DIR=$(ccache -p | grep cache_dir | grep -oE "[^ ]+$") \ && CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \ && mkdir -p ${CCACHE_DIR_PARENT} \ && cd ${CCACHE_DIR_PARENT} \ - && (wget -q https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.gz || true) \ - && if [ -f ${CCACHE_TAR_NAME}.tar.gz ]; then tar -xf ${CCACHE_TAR_NAME}.tar.gz; fi + && (wget -q https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.xz https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.gz || true) \ + && if [ -f ${CCACHE_TAR_NAME}.tar.?z ]; then tar -xf ${CCACHE_TAR_NAME}.tar.?z; fi # We need to set ccache size explicitly with -M, otherwise the default size is # *not* determined by ccache's default, but the downloaded ccache file's config. -RUN ccache -M 5G \ +RUN ccache -M 4G \ && ccache -s # Miniconda @@ -141,6 +141,6 @@ RUN ccache -s \ && CCACHE_DIR_NAME=$(basename ${CCACHE_DIR}) \ && CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \ && cd ${CCACHE_DIR_PARENT} \ - && tar -czf /${CCACHE_TAR_NAME}.tar.gz ${CCACHE_DIR_NAME} + && tar -caf /${CCACHE_TAR_NAME}.tar.xz ${CCACHE_DIR_NAME} RUN echo "Docker build done." diff --git a/docker/docker_build.sh b/docker/docker_build.sh index 56cc75fb030..e6c22bb10df 100755 --- a/docker/docker_build.sh +++ b/docker/docker_build.sh @@ -225,9 +225,9 @@ cuda_wheel_build() { python_package_dir=/root/Open3D/build/lib/python_package docker run -v "${PWD}:/opt/mount" --rm open3d-ci:wheel \ bash -c "cp ${python_package_dir}/pip_package/open3d*.whl /opt/mount \ - && cp /${CCACHE_TAR_NAME}.tar.gz /opt/mount \ + && cp /${CCACHE_TAR_NAME}.tar.xz /opt/mount \ && chown $(id -u):$(id -g) /opt/mount/open3d*.whl \ - && chown $(id -u):$(id -g) /opt/mount/${CCACHE_TAR_NAME}.tar.gz" + && chown $(id -u):$(id -g) /opt/mount/${CCACHE_TAR_NAME}.tar.xz" } ci_build() { @@ -417,7 +417,7 @@ cpu-shared-release_export_env() { export BASE_IMAGE=ubuntu:20.04 export DEVELOPER_BUILD=OFF export CCACHE_TAR_NAME=open3d-ci-cpu - export PYTHON_VERSION=3.12 # no TF versions after 2.13.2 for Python 3.8 + export PYTHON_VERSION=3.12 # no TF versions after 2.13.2 for Python 3.8 export BUILD_SHARED_LIBS=ON export BUILD_CUDA_MODULE=OFF # TODO: tensorflow tests moved here till PyTorch supports cxx11_abi diff --git a/util/ci_utils.sh b/util/ci_utils.sh index 5ba30b071dc..1adb4b7d8c5 100644 --- a/util/ci_utils.sh +++ b/util/ci_utils.sh @@ -50,7 +50,7 @@ install_python_dependencies() { if [[ "with-cuda" =~ ^($options)$ ]]; then TF_ARCH_NAME=tensorflow TF_ARCH_DISABLE_NAME=tensorflow-cpu - CUDA_VER=$(nvcc --version | grep "release " | cut -c33-37 | sed 's|[^0-9]||g') # e.g.: 117, 118, 121, ... + CUDA_VER=$(nvcc --version | grep "release " | cut -c33-37 | sed 's|[^0-9]||g') # e.g.: 117, 118, 121, ... TORCH_GLNX="torch==${TORCH_VER}+cu${CUDA_VER}" else # tensorflow-cpu wheels for macOS arm64 are not available @@ -260,14 +260,16 @@ test_wheel() { # find "$DLL_PATH"/cpu/ -type f -execdir otool -L {} \; # fi echo - if [ "$BUILD_PYTORCH_OPS" == ON ]; then + if python -c "import sys, open3d; sys.exit(not open3d._build_config['BUILD_PYTORCH_OPS'])"; then + BUILD_PYTORCH_OPS=ON python -m pip install -r "$OPEN3D_ML_ROOT/requirements-torch.txt" - python -W default -c \ + python -W default -c \ "import open3d.ml.torch; print('PyTorch Ops library loaded:', open3d.ml.torch._loaded)" fi - if [ "$BUILD_TENSORFLOW_OPS" == ON ]; then + if python -c "import sys, open3d; sys.exit(not open3d._build_config['BUILD_TENSORFLOW_OPS'])"; then + BUILD_TENSORFLOW_OPS=ON python -m pip install -r "$OPEN3D_ML_ROOT/requirements-tensorflow.txt" - python -W default -c \ + python -W default -c \ "import open3d.ml.tf.ops; print('TensorFlow Ops library loaded:', open3d.ml.tf.ops)" fi if [ "$BUILD_TENSORFLOW_OPS" == ON ] && [ "$BUILD_PYTORCH_OPS" == ON ]; then From 6523a112a6cc62d379cbcda6edea59e06a6a575e Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Wed, 4 Dec 2024 23:35:56 -0800 Subject: [PATCH 2/8] Use default xcode versions Each macOS version now comes with a single xcode version. Disable github sycl raycasting tests (no GPU available there). --- .github/workflows/macos.yml | 20 +++++------ .../test/t/geometry/test_raycasting_scene.py | 33 ++++++++++++++----- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5169e842f0a..0a6af734868 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -32,9 +32,9 @@ jobs: strategy: fail-fast: false matrix: - # macos-12 is Intel runner, macos-14 is Apple Silicon + # macos-13 is Intel runner, macos-14 is Apple Silicon # https://github.com/actions/runner-images - os: [macos-12, macos-14] + os: [macos-13, macos-14] CONFIG: [ON, OFF] env: BUILD_SHARED_LIBS: ${{ matrix.CONFIG }} @@ -68,7 +68,7 @@ jobs: run: | brew install ccache pkg-config - if [[ ${{ runner.arch}} == "ARM64" ]]; then + if [[ ${{ runner.arch }} == "ARM64" ]]; then # Fix gfortran not found issue ln -s $(which gfortran-13) /usr/local/bin/gfortran @@ -76,7 +76,7 @@ jobs: # Newer Xcode versions work, but embree recommends Apple clang <= 14 on # arm64 to avoid possible "EXEC_BAD_INSTRUCTION" runtime exceptions: # https://github.com/embree/embree/releases/tag/v4.3.1 - sudo xcode-select -switch /Applications/Xcode_16.1.0.app + # sudo xcode-select -switch /Applications/Xcode_16.1.0.app fi # Install libomp 11.1.0 from old brew bottle for x64 catalina (10.15) @@ -142,7 +142,7 @@ jobs: permissions: contents: write # Release upload name: Fuse x64 and ARM64 viewer app - runs-on: [macos-12] + runs-on: [macos-13] needs: [MacOS] steps: - name: Checkout source code # for gh release upload @@ -191,9 +191,9 @@ jobs: fail-fast: false # https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 matrix: - # macos-12 is Intel runner, macos-14 is Apple Silicon + # macos-13 is Intel runner, macos-14 is Apple Silicon # https://github.com/actions/runner-images - os: [macos-12, macos-14] + os: [macos-13, macos-14] python_version: ['3.8', '3.9', '3.10', '3.11', '3.12'] is_main: - ${{ github.ref == 'refs/heads/main' }} @@ -260,7 +260,7 @@ jobs: # Fix macos-14 arm64 runner image issues, see comments in MacOS job. if [[ ${{ runner.arch}} == "ARM64" ]]; then ln -s $(which gfortran-13) /usr/local/bin/gfortran - sudo xcode-select -switch /Applications/Xcode_16.1.0.app + # sudo xcode-select -switch /Applications/Xcode_16.1.0.app fi # Install libomp 11.1.0. See comment above. @@ -308,7 +308,7 @@ jobs: name: Fuse universal2 wheel permissions: contents: write # Release upload - runs-on: [macos-12] + runs-on: [macos-13] needs: [build-wheel] strategy: fail-fast: false @@ -379,7 +379,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-12, macos-14] + os: [macos-13, macos-14] python_version: ['3.8', '3.9', '3.10', '3.11', '3.12'] is_main: - ${{ github.ref == 'refs/heads/main' }} diff --git a/python/test/t/geometry/test_raycasting_scene.py b/python/test/t/geometry/test_raycasting_scene.py index 7820ff3e31c..9374a2cdb8a 100755 --- a/python/test/t/geometry/test_raycasting_scene.py +++ b/python/test/t/geometry/test_raycasting_scene.py @@ -15,10 +15,17 @@ sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..") from open3d_test import list_devices +# RayCastingScene SYCL tests require a GPU with HW raytracing support. We don't +# detect this automatically. +# Do not enable SYCL devices on GIthub - GPU is not available and we don't +# distinguish between SYCL CPU and SYCL GPU. +enable_sycl = os.environ.get("CI", "") == "" + # test intersection with a single triangle @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_cast_rays(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -50,7 +57,8 @@ def test_cast_rays(device): # cast lots of random rays to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_cast_lots_of_rays(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -71,7 +79,8 @@ def test_cast_lots_of_rays(device): # test occlusion with a single triangle @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_test_occlusions(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -108,7 +117,8 @@ def test_test_occlusions(device): # test lots of random rays for occlusions to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_test_lots_of_occlusions(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -128,7 +138,8 @@ def test_test_lots_of_occlusions(device): @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_add_triangle_mesh(device): cube = o3d.t.geometry.TriangleMesh.create_box() cube = cube.to(device) @@ -148,7 +159,8 @@ def test_add_triangle_mesh(device): @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_count_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -174,7 +186,8 @@ def test_count_intersections(device): # count lots of random ray intersections to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_count_lots_of_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -194,7 +207,8 @@ def test_count_lots_of_intersections(device): @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_list_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -223,7 +237,8 @@ def test_list_intersections(device): # list lots of random ray intersections to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, enable_sycl=True)) + list_devices(enable_cuda=False, + enable_sycl=enable_sycl)) def test_list_lots_of_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions From c928b2ae9d5644eb06d8c8cccdf6e1d064436d82 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Thu, 5 Dec 2024 14:29:04 -0800 Subject: [PATCH 3/8] No need to unlink libomp in macOS-13 --- .github/workflows/macos.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 0a6af734868..a184df2ec42 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -71,12 +71,6 @@ jobs: if [[ ${{ runner.arch }} == "ARM64" ]]; then # Fix gfortran not found issue ln -s $(which gfortran-13) /usr/local/bin/gfortran - - # Default macos-14 image Xcode (version 15.0.1) linker causes build issues. - # Newer Xcode versions work, but embree recommends Apple clang <= 14 on - # arm64 to avoid possible "EXEC_BAD_INSTRUCTION" runtime exceptions: - # https://github.com/embree/embree/releases/tag/v4.3.1 - # sudo xcode-select -switch /Applications/Xcode_16.1.0.app fi # Install libomp 11.1.0 from old brew bottle for x64 catalina (10.15) @@ -84,7 +78,6 @@ jobs: # install for the current OS. # https://github.com/microsoft/LightGBM/issues/4229 if [[ ${{ runner.arch}} == "X64" ]]; then - brew unlink libomp # x64 catalina (10.15) bottle export LIBOMP_BOTTLE_HASH=45a5aa653bd45bd5ff5858580b1a4670c4b5a51ea29d68d45a53f72f56010e05 else # ARM64 @@ -260,12 +253,10 @@ jobs: # Fix macos-14 arm64 runner image issues, see comments in MacOS job. if [[ ${{ runner.arch}} == "ARM64" ]]; then ln -s $(which gfortran-13) /usr/local/bin/gfortran - # sudo xcode-select -switch /Applications/Xcode_16.1.0.app fi # Install libomp 11.1.0. See comment above. if [[ ${{ runner.arch}} == "X64" ]]; then - brew unlink libomp # x64 catalina (10.15) bottle export LIBOMP_BOTTLE_HASH=45a5aa653bd45bd5ff5858580b1a4670c4b5a51ea29d68d45a53f72f56010e05 else # ARM64 From 61fade0c1f80484a88b1f798784a510a679ff4e3 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Thu, 5 Dec 2024 22:14:47 -0800 Subject: [PATCH 4/8] Check for GITHUB_ACTIONS instead of CI --- cpp/pybind/core/sycl_utils.cpp | 6 ++++++ python/test/t/geometry/test_raycasting_scene.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp/pybind/core/sycl_utils.cpp b/cpp/pybind/core/sycl_utils.cpp index ea37e0b3961..9a28dcb5072 100644 --- a/cpp/pybind/core/sycl_utils.cpp +++ b/cpp/pybind/core/sycl_utils.cpp @@ -23,6 +23,12 @@ void pybind_sycl_utils_definitions(py::module& m) { m_sycl.def("get_available_devices", sy::GetAvailableSYCLDevices, "Return a list of available SYCL devices."); + m_sycl.def("print_sycl_devices", sy::PrintSYCLDevices, + "print_all"_a = false, + "Print SYCL device available to Open3D (either the best " + "available GPU, or a fallback CPU device). If `print_all` is " + "specified, also print SYCL devices of other types."); + m_sycl.def("enable_persistent_jit_cache", sy::enablePersistentJITCache, "Enables the JIT cache for SYCL. This sets an environment " "variable and " diff --git a/python/test/t/geometry/test_raycasting_scene.py b/python/test/t/geometry/test_raycasting_scene.py index 9374a2cdb8a..4907a84e5ea 100755 --- a/python/test/t/geometry/test_raycasting_scene.py +++ b/python/test/t/geometry/test_raycasting_scene.py @@ -19,7 +19,7 @@ # detect this automatically. # Do not enable SYCL devices on GIthub - GPU is not available and we don't # distinguish between SYCL CPU and SYCL GPU. -enable_sycl = os.environ.get("CI", "") == "" +enable_sycl = os.environ.get("GITHUB_ACTION", "") == "" # test intersection with a single triangle From 773f7653bb8cdd8e132592c4d3ab58901c581814 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Fri, 6 Dec 2024 14:03:39 -0800 Subject: [PATCH 5/8] Add SYCL fallback CPU device as last SYCL device to allow distinguishing CPU and GPU devices. --- cpp/open3d/core/SYCLContext.cpp | 24 +++++------ cpp/open3d/core/SYCLUtils.cpp | 42 +++++++++---------- cpp/tests/core/CoreTest.cpp | 3 +- .../test/t/geometry/test_raycasting_scene.py | 25 ++++------- 4 files changed, 44 insertions(+), 50 deletions(-) diff --git a/cpp/open3d/core/SYCLContext.cpp b/cpp/open3d/core/SYCLContext.cpp index b7ac71d1045..30c5f6f6afc 100644 --- a/cpp/open3d/core/SYCLContext.cpp +++ b/cpp/open3d/core/SYCLContext.cpp @@ -54,22 +54,22 @@ SYCLContext::SYCLContext() { } catch (const sycl::exception &e) { } - if (devices_.size() == 0) { - // SYCL CPU fallback. - // This could happen if the Intel GPGPU driver is not installed or if - // your CPU does not have integrated GPU. - try { - const sycl::device &sycl_device = - sycl::device(sycl::cpu_selector_v); - const Device open3d_device = Device("SYCL:0"); + // SYCL CPU fallback. + // This could happen if the Intel GPGPU driver is not installed or if + // your CPU does not have integrated GPU. + try { + if (devices_.size() == 0) { utility::LogWarning( "SYCL GPU device is not available, falling back to SYCL " "host device."); - devices_.push_back(open3d_device); - device_to_sycl_device_[open3d_device] = sycl_device; - device_to_default_queue_[open3d_device] = sycl::queue(sycl_device); - } catch (const sycl::exception &e) { } + const sycl::device &sycl_device = sycl::device(sycl::cpu_selector_v); + const Device open3d_device = + Device("SYCL:" + std::to_string(devices_.size())); + devices_.push_back(open3d_device); + device_to_sycl_device_[open3d_device] = sycl_device; + device_to_default_queue_[open3d_device] = sycl::queue(sycl_device); + } catch (const sycl::exception &e) { } if (devices_.size() == 0) { diff --git a/cpp/open3d/core/SYCLUtils.cpp b/cpp/open3d/core/SYCLUtils.cpp index d92e44fe509..011ee5eb653 100644 --- a/cpp/open3d/core/SYCLUtils.cpp +++ b/cpp/open3d/core/SYCLUtils.cpp @@ -118,14 +118,32 @@ static std::string SYCLDeviceToString(const sycl::device &device) { void PrintSYCLDevices(bool print_all) { #ifdef BUILD_SYCL_MODULE - const char *filter = std::getenv("SYCL_DEVICE_FILTER"); + const char *filter = std::getenv("ONEAPI_DEVICE_SELECTOR"); if (filter) { utility::LogWarning( - "SYCL_DEVICE_FILTER environment variable is set to {}. To see " - "the correct device id, please unset SYCL_DEVICE_FILTER.", + "ONEAPI_DEVICE_SELECTOR environment variable is set to {}. To " + "see the correct device id, please unset " + "ONEAPI_DEVICE_SELECTOR.", filter); } + int nd = 0; + utility::LogInfo("# Open3D SYCL device"); + try { + utility::LogInfo( + "- Device(\"SYCL:{}\"): {}", nd, + SYCLDeviceToString(sycl::device(sycl::gpu_selector_v))); + ++nd; + } catch (const sycl::exception &e) { + } + try { + utility::LogInfo("# Open3D SYCL device (CPU fallback)"); + utility::LogInfo( + "- Device(\"SYCL:{}\"): {}", nd, + SYCLDeviceToString(sycl::device(sycl::cpu_selector_v))); + } catch (const sycl::exception &e) { + if (nd == 0) utility::LogInfo("- Device(\"SYCL:0\"): N/A"); + } if (print_all) { utility::LogInfo("# All SYCL devices"); const std::vector &platforms = @@ -168,24 +186,6 @@ void PrintSYCLDevices(bool print_all) { } catch (const sycl::exception &e) { utility::LogInfo("- sycl::accelerator_selector_v: N/A"); } - - utility::LogInfo("# Open3D SYCL device"); - try { - const sycl::device &device = sycl::device(sycl::gpu_selector_v); - utility::LogInfo("- Device(\"SYCL:0\"): {}", - SYCLDeviceToString(device)); - } catch (const sycl::exception &e) { - utility::LogInfo("- Device(\"SYCL:0\"): N/A"); - } - } else { - utility::LogInfo("# Open3D SYCL device"); - try { - const sycl::device &device = sycl::device(sycl::gpu_selector_v); - utility::LogInfo("- Device(\"SYCL:0\"): {}", - SYCLDeviceToString(device)); - } catch (const sycl::exception &e) { - utility::LogInfo("- Device(\"SYCL:0\"): N/A"); - } } #else diff --git a/cpp/tests/core/CoreTest.cpp b/cpp/tests/core/CoreTest.cpp index babfc30a0e3..3c06295ae7e 100644 --- a/cpp/tests/core/CoreTest.cpp +++ b/cpp/tests/core/CoreTest.cpp @@ -105,7 +105,8 @@ PermuteDevicePairsWithSYCL::TestCases() { std::vector devices; devices.insert(devices.end(), cpu_devices.begin(), cpu_devices.end()); devices.insert(devices.end(), cuda_devices.begin(), cuda_devices.end()); - devices.insert(devices.end(), sycl_devices.begin(), sycl_devices.end()); + // Skip the last SYCL device - this is the CPU fallback + devices.insert(devices.end(), sycl_devices.begin(), sycl_devices.end() - 1); // Self-pairs and cross pairs (bidirectional). std::vector> device_pairs; diff --git a/python/test/t/geometry/test_raycasting_scene.py b/python/test/t/geometry/test_raycasting_scene.py index 4907a84e5ea..c94c66071d9 100755 --- a/python/test/t/geometry/test_raycasting_scene.py +++ b/python/test/t/geometry/test_raycasting_scene.py @@ -15,17 +15,10 @@ sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..") from open3d_test import list_devices -# RayCastingScene SYCL tests require a GPU with HW raytracing support. We don't -# detect this automatically. -# Do not enable SYCL devices on GIthub - GPU is not available and we don't -# distinguish between SYCL CPU and SYCL GPU. -enable_sycl = os.environ.get("GITHUB_ACTION", "") == "" - - # test intersection with a single triangle @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_cast_rays(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -58,7 +51,7 @@ def test_cast_rays(device): # we expect no errors for this test @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_cast_lots_of_rays(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -80,7 +73,7 @@ def test_cast_lots_of_rays(device): # test occlusion with a single triangle @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_test_occlusions(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -118,7 +111,7 @@ def test_test_occlusions(device): # we expect no errors for this test @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_test_lots_of_occlusions(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -139,7 +132,7 @@ def test_test_lots_of_occlusions(device): @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_add_triangle_mesh(device): cube = o3d.t.geometry.TriangleMesh.create_box() cube = cube.to(device) @@ -160,7 +153,7 @@ def test_add_triangle_mesh(device): @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_count_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -187,7 +180,7 @@ def test_count_intersections(device): # we expect no errors for this test @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_count_lots_of_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -208,7 +201,7 @@ def test_count_lots_of_intersections(device): @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_list_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -238,7 +231,7 @@ def test_list_intersections(device): # we expect no errors for this test @pytest.mark.parametrize("device", list_devices(enable_cuda=False, - enable_sycl=enable_sycl)) + enable_sycl=True)) def test_list_lots_of_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions From d9ae3082c15acf3c9a2385e6b13ac8bf83666ad4 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Tue, 10 Dec 2024 16:25:57 -0800 Subject: [PATCH 6/8] Hide symbols from core and visualization to reduce Windows DLL size. --- CMakeLists.txt | 1 + cpp/open3d/CMakeLists.txt | 2 + cpp/open3d/core/CMakeLists.txt | 47 ++++++++++++------- .../SurfaceReconstructionBallPivoting.cpp | 2 + .../geometry/SurfaceReconstructionPoisson.cpp | 13 +++-- cpp/open3d/visualization/CMakeLists.txt | 18 +++++-- 6 files changed, 55 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b047cd0b82..16a2e5bf94c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -476,6 +476,7 @@ if(WIN32) # Then, we could use -fvisibility=hidden for Linux as well SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) if(MSVC) + add_compile_options("/permissive-") # MSVC standards-compliant mode # Make sure we don't hit the 65535 object member limit with MSVC # # /bigobj allows object files with more than 65535 members diff --git a/cpp/open3d/CMakeLists.txt b/cpp/open3d/CMakeLists.txt index e31bb2b83f3..00b04684b2c 100644 --- a/cpp/open3d/CMakeLists.txt +++ b/cpp/open3d/CMakeLists.txt @@ -89,6 +89,7 @@ target_sources(Open3D PRIVATE open3d_ispc_target_sources_TARGET_OBJECTS(Open3D PRIVATE camera core + core_impl data geometry tgeometry @@ -101,6 +102,7 @@ open3d_ispc_target_sources_TARGET_OBJECTS(Open3D PRIVATE tpipelines_kernel utility visualization + visualization_impl ) if (BUILD_GUI) diff --git a/cpp/open3d/core/CMakeLists.txt b/cpp/open3d/core/CMakeLists.txt index 7926d3fbcc6..c34cea3fc6d 100644 --- a/cpp/open3d/core/CMakeLists.txt +++ b/cpp/open3d/core/CMakeLists.txt @@ -41,22 +41,7 @@ target_sources(core PRIVATE hashmap/HashBackendBuffer.cpp hashmap/HashMap.cpp hashmap/HashSet.cpp - kernel/Arange.cpp - kernel/ArangeCPU.cpp - kernel/BinaryEW.cpp - kernel/BinaryEWCPU.cpp - kernel/IndexGetSet.cpp - kernel/IndexGetSetCPU.cpp - kernel/IndexReduction.cpp - kernel/IndexReductionCPU.cpp kernel/Kernel.cpp - kernel/NonZero.cpp - kernel/NonZeroCPU.cpp - kernel/Reduction.cpp - kernel/ReductionCPU.cpp - kernel/UnaryEW.cpp - kernel/UnaryEWCPU.cpp - kernel/UnaryEWSYCL.cpp linalg/AddMM.cpp linalg/AddMMCPU.cpp linalg/Det.cpp @@ -82,11 +67,33 @@ target_sources(core PRIVATE nns/NNSIndex.cpp ) +# core_impl contains the implementation of core functions that are not exposed in the public API +open3d_ispc_add_library(core_impl OBJECT) +set_target_properties(core_impl PROPERTIES CXX_VISIBILITY_PRESET "hidden") + +target_sources(core_impl PRIVATE + kernel/Arange.cpp + kernel/ArangeCPU.cpp + kernel/BinaryEW.cpp + kernel/BinaryEWCPU.cpp + kernel/IndexGetSet.cpp + kernel/IndexGetSetCPU.cpp + kernel/IndexReduction.cpp + kernel/IndexReductionCPU.cpp + kernel/NonZero.cpp + kernel/NonZeroCPU.cpp + kernel/Reduction.cpp + kernel/ReductionCPU.cpp + kernel/UnaryEW.cpp + kernel/UnaryEWCPU.cpp + kernel/UnaryEWSYCL.cpp +) + if (BUILD_CUDA_MODULE) target_sources(core PRIVATE MemoryManagerCUDA.cpp ) - target_sources(core PRIVATE + target_sources(core_impl PRIVATE hashmap/CUDA/CreateCUDAHashBackend.cu hashmap/CUDA/CUDAHashBackendBuffer.cu hashmap/CUDA/SlabNodeManager.cu @@ -116,6 +123,8 @@ endif() if (BUILD_ISPC_MODULE) target_sources(core PRIVATE Indexer.ispc + ) + target_sources(core_impl PRIVATE kernel/BinaryEWCPU.ispc kernel/UnaryEWCPU.ispc ) @@ -126,6 +135,12 @@ open3d_set_global_properties(core) open3d_set_open3d_lib_properties(core) open3d_link_3rdparty_libraries(core) +open3d_show_and_abort_on_warning(core_impl) +open3d_set_global_properties(core_impl) +open3d_set_open3d_lib_properties(core_impl) +open3d_link_3rdparty_libraries(core_impl) + if(BUILD_CUDA_MODULE) target_include_directories(core SYSTEM PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) + target_include_directories(core_impl SYSTEM PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) endif() diff --git a/cpp/open3d/geometry/SurfaceReconstructionBallPivoting.cpp b/cpp/open3d/geometry/SurfaceReconstructionBallPivoting.cpp index 994dbc6e8c8..2774b314364 100644 --- a/cpp/open3d/geometry/SurfaceReconstructionBallPivoting.cpp +++ b/cpp/open3d/geometry/SurfaceReconstructionBallPivoting.cpp @@ -17,6 +17,7 @@ namespace open3d { namespace geometry { +namespace { class BallPivotingVertex; class BallPivotingEdge; @@ -733,6 +734,7 @@ class BallPivoting { std::vector vertices; std::shared_ptr mesh_; }; +} // namespace std::shared_ptr TriangleMesh::CreateFromPointCloudBallPivoting( const PointCloud& pcd, const std::vector& radii) { diff --git a/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp b/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp index a1553d6a653..7195166701f 100644 --- a/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp +++ b/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp @@ -39,7 +39,7 @@ namespace open3d { namespace geometry { -namespace poisson { +namespace { // The order of the B-Spline used to splat in data for color interpolation static const int DATA_DEGREE = 0; @@ -713,7 +713,7 @@ void Execute(const open3d::geometry::PointCloud& pcd, Time() - startTime, FEMTree::MaxMemoryUsage()); } -} // namespace poisson +} // namespace std::tuple, std::vector> TriangleMesh::CreateFromPointCloudPoisson(const PointCloud& pcd, @@ -722,10 +722,9 @@ TriangleMesh::CreateFromPointCloudPoisson(const PointCloud& pcd, float scale, bool linear_fit, int n_threads) { - static const BoundaryType BType = poisson::DEFAULT_FEM_BOUNDARY; + static const BoundaryType BType = DEFAULT_FEM_BOUNDARY; typedef IsotropicUIntPack< - poisson::DIMENSION, - FEMDegreeAndBType::Signature> + DIMENSION, FEMDegreeAndBType::Signature> FEMSigs; if (!pcd.HasNormals()) { @@ -746,8 +745,8 @@ TriangleMesh::CreateFromPointCloudPoisson(const PointCloud& pcd, auto mesh = std::make_shared(); std::vector densities; - poisson::Execute(pcd, mesh, densities, static_cast(depth), - width, scale, linear_fit, FEMSigs()); + Execute(pcd, mesh, densities, static_cast(depth), width, scale, + linear_fit, FEMSigs()); ThreadPool::Terminate(); diff --git a/cpp/open3d/visualization/CMakeLists.txt b/cpp/open3d/visualization/CMakeLists.txt index fd794dcea24..8cf18c2088c 100644 --- a/cpp/open3d/visualization/CMakeLists.txt +++ b/cpp/open3d/visualization/CMakeLists.txt @@ -1,6 +1,9 @@ open3d_ispc_add_library(visualization OBJECT) -target_sources(visualization PRIVATE +open3d_ispc_add_library(visualization_impl OBJECT) +set_target_properties(visualization_impl PROPERTIES CXX_VISIBILITY_PRESET hidden) + +target_sources(visualization_impl PRIVATE shader/GeometryRenderer.cpp shader/ImageMaskShader.cpp shader/ImageShader.cpp @@ -62,14 +65,14 @@ if (BUILD_GUI) rendering/Renderer.cpp rendering/RendererHandle.cpp rendering/RotationInteractorLogic.cpp + rendering/filament/FilamentEngine.cpp + rendering/filament/FilamentRenderer.cpp ) - target_sources(visualization PRIVATE + target_sources(visualization_impl PRIVATE rendering/filament/FilamentCamera.cpp - rendering/filament/FilamentEngine.cpp rendering/filament/FilamentEntitiesMods.cpp rendering/filament/FilamentGeometryBuffersBuilder.cpp - rendering/filament/FilamentRenderer.cpp rendering/filament/FilamentRenderToBuffer.cpp rendering/filament/FilamentResourceManager.cpp rendering/filament/FilamentScene.cpp @@ -131,7 +134,7 @@ open3d_add_encoded_shader(shader # Source group for Visual Studio add_source_group(shader/glsl) -add_dependencies(visualization shader) +add_dependencies(visualization_impl shader) open3d_show_and_abort_on_warning(visualization) @@ -139,6 +142,11 @@ open3d_set_global_properties(visualization) open3d_set_open3d_lib_properties(visualization) open3d_link_3rdparty_libraries(visualization) +open3d_show_and_abort_on_warning(visualization_impl) +open3d_set_global_properties(visualization_impl) +open3d_set_open3d_lib_properties(visualization_impl) +open3d_link_3rdparty_libraries(visualization_impl) + # export GUI_RESOURCE_DIR to parent scope if (BUILD_GUI) set(GUI_RESOURCE_DIR ${GUI_RESOURCE_DIR} PARENT_SCOPE) From e0ee30c2c98d591fd095180312ef4c8ebbce229e Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Tue, 10 Dec 2024 16:28:27 -0800 Subject: [PATCH 7/8] Skip last SYCL device (CPU fallback) in testing --- cpp/tests/core/CoreTest.cpp | 5 +- python/test/open3d_test.py | 5 +- .../test/t/geometry/test_raycasting_scene.py | 99 ++++++++++++------- 3 files changed, 69 insertions(+), 40 deletions(-) diff --git a/cpp/tests/core/CoreTest.cpp b/cpp/tests/core/CoreTest.cpp index 3c06295ae7e..8f1486ce4c6 100644 --- a/cpp/tests/core/CoreTest.cpp +++ b/cpp/tests/core/CoreTest.cpp @@ -106,7 +106,10 @@ PermuteDevicePairsWithSYCL::TestCases() { devices.insert(devices.end(), cpu_devices.begin(), cpu_devices.end()); devices.insert(devices.end(), cuda_devices.begin(), cuda_devices.end()); // Skip the last SYCL device - this is the CPU fallback - devices.insert(devices.end(), sycl_devices.begin(), sycl_devices.end() - 1); + if (sycl_devices.size() > 1) { + devices.insert(devices.end(), sycl_devices.begin(), + sycl_devices.end() - 1); + } // Self-pairs and cross pairs (bidirectional). std::vector> device_pairs; diff --git a/python/test/open3d_test.py b/python/test/open3d_test.py index f72a14ec58d..21fb7bf9c51 100755 --- a/python/test/open3d_test.py +++ b/python/test/open3d_test.py @@ -20,14 +20,15 @@ def list_devices(enable_cuda=True, enable_sycl=False): Returns a list of devices that are available for Open3D to use: - Device("CPU:0") - Device("CUDA:0") if built with CUDA support and a CUDA device is available. - - Device("SYCL:0") if built with SYCL support and a SYCL device is available. + - Device("SYCL:0") if built with SYCL support and a SYCL GPU device is available. """ import open3d as o3d devices = [o3d.core.Device("CPU:0")] if enable_cuda and o3d.core.cuda.device_count() > 0: devices.append(o3d.core.Device("CUDA:0")) - if enable_sycl and o3d.core.sycl.is_available(): + # Ignore fallback SYCL CPU device + if enable_sycl and len(o3d.core.sycl.get_available_devices()) > 1: devices.append(o3d.core.Device("SYCL:0")) return devices diff --git a/python/test/t/geometry/test_raycasting_scene.py b/python/test/t/geometry/test_raycasting_scene.py index c94c66071d9..2164f96d6fe 100755 --- a/python/test/t/geometry/test_raycasting_scene.py +++ b/python/test/t/geometry/test_raycasting_scene.py @@ -15,10 +15,10 @@ sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..") from open3d_test import list_devices + # test intersection with a single triangle @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_cast_rays(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -50,8 +50,7 @@ def test_cast_rays(device): # cast lots of random rays to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_cast_lots_of_rays(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -72,8 +71,7 @@ def test_cast_lots_of_rays(device): # test occlusion with a single triangle @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_test_occlusions(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -110,8 +108,7 @@ def test_test_occlusions(device): # test lots of random rays for occlusions to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_test_lots_of_occlusions(device): vertices = o3d.core.Tensor([[0, 0, 0], [1, 0, 0], [1, 1, 0]], dtype=o3d.core.float32, @@ -131,8 +128,7 @@ def test_test_lots_of_occlusions(device): @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_add_triangle_mesh(device): cube = o3d.t.geometry.TriangleMesh.create_box() cube = cube.to(device) @@ -152,8 +148,7 @@ def test_add_triangle_mesh(device): @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_count_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -179,8 +174,7 @@ def test_count_intersections(device): # count lots of random ray intersections to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_count_lots_of_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -200,8 +194,7 @@ def test_count_lots_of_intersections(device): @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_list_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -230,8 +223,7 @@ def test_list_intersections(device): # list lots of random ray intersections to test the internal batching # we expect no errors for this test @pytest.mark.parametrize("device", - list_devices(enable_cuda=False, - enable_sycl=True)) + list_devices(enable_cuda=False, enable_sycl=True)) def test_list_lots_of_intersections(device): cube = o3d.t.geometry.TriangleMesh.create_box() vertex_positions = cube.vertex.positions @@ -411,25 +403,58 @@ def test_sphere_wrong_occupancy(): occupancy = scene.compute_occupancy(query_points) expected = np.array( - [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], - [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], - [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], - [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], - [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], - [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], - [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], - [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], - [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], - [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], - [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], - [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], - [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], - [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]], - dtype=np.float32) + [ + [ + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ], + [ + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ], + [ + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ], + [ + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ], + [ + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 0.0, 1.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ], + [ + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ], + ], + dtype=np.float32, + ) np.testing.assert_equal(occupancy.numpy(), expected) # we should get the same result with more samples From 8112ff87069edce3e5d0c08337785d8560153de7 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Tue, 10 Dec 2024 22:37:14 -0800 Subject: [PATCH 8/8] Disable MSVC std compliance due to PoissonRecon header error --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16a2e5bf94c..08a49c5476c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -476,7 +476,8 @@ if(WIN32) # Then, we could use -fvisibility=hidden for Linux as well SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) if(MSVC) - add_compile_options("/permissive-") # MSVC standards-compliant mode + # MSVC standards-compliant mode: Error in PoissonRecon 3rd party header + # add_compile_options($<$:"/permissive-">) # Make sure we don't hit the 65535 object member limit with MSVC # # /bigobj allows object files with more than 65535 members