diff --git a/CMakeLists.txt b/CMakeLists.txt index c3d64e4b95d..b571248db47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,11 @@ option(BUILD_BENCHMARKS "Build the micro benchmarks" OFF option(BUILD_PYTHON_MODULE "Build the python module" ON ) option(BUILD_CUDA_MODULE "Build the CUDA module" OFF) option(BUILD_COMMON_CUDA_ARCHS "Build for common CUDA GPUs (for release)" OFF) -option(ENABLE_CACHED_CUDA_MANAGER "Enable cached CUDA memory manager" ON ) +if (WIN32) # Causes CUDA runtime error on Windows (See issue #6555) + option(ENABLE_CACHED_CUDA_MANAGER "Enable cached CUDA memory manager" OFF) +else() + option(ENABLE_CACHED_CUDA_MANAGER "Enable cached CUDA memory manager" ON ) +endif() if(NOT LINUX_AARCH64 AND NOT APPLE_AARCH64) option(BUILD_ISPC_MODULE "Build the ISPC module" ON ) else() diff --git a/cpp/open3d/t/geometry/TriangleMesh.cpp b/cpp/open3d/t/geometry/TriangleMesh.cpp index 907873d1520..6f33f8e44f7 100644 --- a/cpp/open3d/t/geometry/TriangleMesh.cpp +++ b/cpp/open3d/t/geometry/TriangleMesh.cpp @@ -1029,8 +1029,8 @@ int TriangleMesh::PCAPartition(int max_faces) { } /// A helper to compute new vertex indices out of vertex mask. -/// \param tris_cpu tensor with triangle indices to update. -/// \param vertex_mask tensor with the mask for vertices. +/// \param tris_cpu CPU tensor with triangle indices to update. +/// \param vertex_mask CPU tensor with the mask for vertices. template static void UpdateTriangleIndicesByVertexMask(core::Tensor &tris_cpu, const core::Tensor &vertex_mask) { @@ -1148,11 +1148,13 @@ static bool IsNegative(T val) { } TriangleMesh TriangleMesh::SelectByIndex(const core::Tensor &indices) const { - TriangleMesh result; core::AssertTensorShape(indices, {indices.GetLength()}); + if (indices.NumElements() == 0) { + return {}; + } if (!HasVertexPositions()) { utility::LogWarning("[SelectByIndex] TriangleMesh has no vertices."); - return result; + return {}; } GetVertexAttr().AssertSizeSynchronized(); @@ -1194,7 +1196,7 @@ TriangleMesh TriangleMesh::SelectByIndex(const core::Tensor &indices) const { scalar_tris_t *vertex_mask_ptr = vertex_mask.GetDataPtr(); const scalar_indices_t *indices_ptr = - indices.GetDataPtr(); + indices_cpu.GetDataPtr(); for (int64_t i = 0; i < indices.GetLength(); ++i) { if (IsNegative(indices_ptr[i]) || indices_ptr[i] >= @@ -1233,16 +1235,18 @@ TriangleMesh TriangleMesh::SelectByIndex(const core::Tensor &indices) const { }); }); - // send the vertex mask to original device and apply to vertices + // send the vertex mask and triangle mask to original device and apply to + // vertices vertex_mask = vertex_mask.To(GetDevice(), core::Bool); + if (tri_mask.NumElements() > 0) { // To() needs non-empty tensor + tri_mask = tri_mask.To(GetDevice()); + } core::Tensor new_vertices = GetVertexPositions().IndexGet({vertex_mask}); + TriangleMesh result(GetDevice()); result.SetVertexPositions(new_vertices); - - if (HasTriangleIndices()) { - // select triangles and send the selected ones to the original device + if (tris_cpu.NumElements() > 0) { // To() needs non-empty tensor result.SetTriangleIndices(tris_cpu.To(GetDevice())); } - CopyAttributesByMasks(result, *this, vertex_mask, tri_mask); return result; diff --git a/util/ci_utils.sh b/util/ci_utils.sh index 637cac44d32..1d48a8943aa 100644 --- a/util/ci_utils.sh +++ b/util/ci_utils.sh @@ -346,6 +346,7 @@ install_docs_dependencies() { sudo apt-add-repository --yes 'deb https://apt.kitware.com/ubuntu/ bionic main' ./util/install_deps_ubuntu.sh assume-yes sudo apt-get install --yes cmake + sudo apt-get install --yes libxml2-dev libxslt-dev python3-dev sudo apt-get install --yes doxygen sudo apt-get install --yes texlive sudo apt-get install --yes texlive-latex-extra