From ef8df4bf539d9383b56ae415c0605a01c6ac0437 Mon Sep 17 00:00:00 2001 From: "Murillo Rojas, Luis" Date: Fri, 17 Jan 2025 15:17:06 -0600 Subject: [PATCH 01/18] Solve PyTorch Ops compilation error in Windows --- cpp/open3d/ml/impl/continuous_conv/ContinuousConv.h | 6 ++++-- .../ml/impl/continuous_conv/ContinuousConvBackpropFilter.h | 6 ++++-- .../ml/impl/continuous_conv/ContinuousConvTranspose.h | 6 ++++-- .../continuous_conv/ContinuousConvTransposeBackpropFilter.h | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cpp/open3d/ml/impl/continuous_conv/ContinuousConv.h b/cpp/open3d/ml/impl/continuous_conv/ContinuousConv.h index 570cdd84730..a0f66ad9bea 100644 --- a/cpp/open3d/ml/impl/continuous_conv/ContinuousConv.h +++ b/cpp/open3d/ml/impl/continuous_conv/ContinuousConv.h @@ -59,6 +59,9 @@ void _CConvComputeFeaturesCPU(TOut* out_features, memset(out_features, 0, sizeof(TOut) * num_out * out_channels); + typedef Eigen::Array Matrix; + typedef Eigen::Array Matrix3C; + tbb::parallel_for( tbb::blocked_range(0, num_out, 32), [&](const tbb::blocked_range& r) { @@ -72,13 +75,12 @@ void _CConvComputeFeaturesCPU(TOut* out_features, in_channels * spatial_filter_size, range_length); B.setZero(); - typedef Eigen::Array Matrix; Matrix infeat(VECSIZE, in_channels); Eigen::Array offsets_(offsets[0], offsets[1], offsets[2]); - Eigen::Array inv_extents; + Matrix3C inv_extents; if (INDIVIDUAL_EXTENT == false) { if (ISOTROPIC_EXTENT) { inv_extents = 1 / extents[0]; diff --git a/cpp/open3d/ml/impl/continuous_conv/ContinuousConvBackpropFilter.h b/cpp/open3d/ml/impl/continuous_conv/ContinuousConvBackpropFilter.h index b75089cd889..42e427424a0 100644 --- a/cpp/open3d/ml/impl/continuous_conv/ContinuousConvBackpropFilter.h +++ b/cpp/open3d/ml/impl/continuous_conv/ContinuousConvBackpropFilter.h @@ -63,6 +63,9 @@ void _CConvBackropFilterCPU(TOut* filter_backprop, memset(filter_backprop, 0, sizeof(TOut) * total_filter_size); std::mutex filter_backprop_mutex; + typedef Eigen::Array Matrix; + typedef Eigen::Array Matrix3C; + tbb::parallel_for( tbb::blocked_range(0, num_out, 32), [&](const tbb::blocked_range& r) { @@ -74,13 +77,12 @@ void _CConvBackropFilterCPU(TOut* filter_backprop, Eigen::Matrix C( out_channels, range_length); - typedef Eigen::Array Matrix; Matrix infeat(VECSIZE, in_channels); Eigen::Array offsets_(offsets[0], offsets[1], offsets[2]); - Eigen::Array inv_extents; + Matrix3C inv_extents; if (INDIVIDUAL_EXTENT == false) { if (ISOTROPIC_EXTENT) { inv_extents = 1 / extents[0]; diff --git a/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTranspose.h b/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTranspose.h index 1a19cdc4034..2e997a747a5 100644 --- a/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTranspose.h +++ b/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTranspose.h @@ -61,6 +61,9 @@ void _CConvTransposeComputeFeaturesCPU( memset(out_features, 0, sizeof(TOut) * num_out * out_channels); + typedef Eigen::Array Matrix; + typedef Eigen::Array Matrix3C; + tbb::parallel_for( tbb::blocked_range(0, num_out, 32), [&](const tbb::blocked_range& r) { @@ -70,13 +73,12 @@ void _CConvTransposeComputeFeaturesCPU( in_channels * spatial_filter_size, range_length); B.setZero(); - typedef Eigen::Array Matrix; Matrix infeat(VECSIZE, in_channels); Eigen::Array offsets_(offsets[0], offsets[1], offsets[2]); - Eigen::Array inv_extents; + Matrix3C inv_extents; if (INDIVIDUAL_EXTENT == false) { if (ISOTROPIC_EXTENT) { inv_extents = 1 / extents[0]; diff --git a/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTransposeBackpropFilter.h b/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTransposeBackpropFilter.h index 296850f24a2..b1cb93c0949 100644 --- a/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTransposeBackpropFilter.h +++ b/cpp/open3d/ml/impl/continuous_conv/ContinuousConvTransposeBackpropFilter.h @@ -64,6 +64,9 @@ void _CConvTransposeBackpropFilterCPU(TOut* filter_backprop, sizeof(TOut) * spatial_filter_size * in_channels * out_channels); std::mutex filter_backprop_mutex; + typedef Eigen::Array Matrix; + typedef Eigen::Array Matrix3C; + tbb::parallel_for( tbb::blocked_range(0, num_out, 32), [&](const tbb::blocked_range& r) { @@ -75,13 +78,12 @@ void _CConvTransposeBackpropFilterCPU(TOut* filter_backprop, Eigen::Matrix C( out_channels, range_length); - typedef Eigen::Array Matrix; Matrix infeat(VECSIZE, in_channels); Eigen::Array offsets_(offsets[0], offsets[1], offsets[2]); - Eigen::Array inv_extents; + Matrix3C inv_extents; if (INDIVIDUAL_EXTENT == false) { if (ISOTROPIC_EXTENT) { inv_extents = 1 / extents[0]; From 57ff4a24ef7cc8c48e51c31383b8b700c26319a8 Mon Sep 17 00:00:00 2001 From: "Murillo Rojas, Luis" Date: Fri, 31 Jan 2025 16:12:16 -0600 Subject: [PATCH 02/18] Fix the python package generation with pytorch ops --- cpp/open3d/ml/pytorch/CMakeLists.txt | 3 ++- cpp/pybind/CMakeLists.txt | 3 ++- cpp/pybind/generate_torch_ops_wrapper.py | 10 ++++++++++ python/open3d/ml/tf/__init__.py | 2 +- python/open3d/ml/torch/__init__.py | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cpp/open3d/ml/pytorch/CMakeLists.txt b/cpp/open3d/ml/pytorch/CMakeLists.txt index 76e40b82791..8969e7d57bd 100644 --- a/cpp/open3d/ml/pytorch/CMakeLists.txt +++ b/cpp/open3d/ml/pytorch/CMakeLists.txt @@ -123,7 +123,8 @@ set(TORCH_OPS_ARCH_DIR "${TORCH_OPS_DIR}/$,cuda,cpu>") set_target_properties(open3d_torch_ops PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TORCH_OPS_ARCH_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${TORCH_OPS_ARCH_DIR}") + ARCHIVE_OUTPUT_DIRECTORY "${TORCH_OPS_ARCH_DIR}" + RUNTIME_OUTPUT_DIRECTORY "${TORCH_OPS_ARCH_DIR}") # Do not add "lib" prefix set_target_properties(open3d_torch_ops PROPERTIES PREFIX "") diff --git a/cpp/pybind/CMakeLists.txt b/cpp/pybind/CMakeLists.txt index 6efae9a17fd..faa5a11bfbf 100644 --- a/cpp/pybind/CMakeLists.txt +++ b/cpp/pybind/CMakeLists.txt @@ -169,8 +169,9 @@ endif() # add additional optional compiled modules if (BUILD_PYTORCH_OPS) list( APPEND COMPILED_MODULE_PATH_LIST $ ) + set(DEPENDENCIES_DIR "$") add_custom_command( OUTPUT "${CMAKE_BINARY_DIR}/lib/ml/torch/python/ops.py" "${CMAKE_BINARY_DIR}/lib/ml/torch/python/return_types.py" - COMMAND ${Python3_EXECUTABLE} generate_torch_ops_wrapper.py --input_ops_py_in "${PYTHON_PACKAGE_SRC_DIR}/open3d/ml/torch/python/ops.py.in" --input_return_types_py_in "${PYTHON_PACKAGE_SRC_DIR}/open3d/ml/torch/python/return_types.py.in" --output_dir "${CMAKE_BINARY_DIR}/lib/ml/torch/python/" --lib $ --tensorflow_ops_dir "${CMAKE_CURRENT_SOURCE_DIR}/../open3d/ml/tensorflow" + COMMAND ${Python3_EXECUTABLE} generate_torch_ops_wrapper.py --input_ops_py_in "${PYTHON_PACKAGE_SRC_DIR}/open3d/ml/torch/python/ops.py.in" --input_return_types_py_in "${PYTHON_PACKAGE_SRC_DIR}/open3d/ml/torch/python/return_types.py.in" --output_dir "${CMAKE_BINARY_DIR}/lib/ml/torch/python/" --lib $ --tensorflow_ops_dir "${CMAKE_CURRENT_SOURCE_DIR}/../open3d/ml/tensorflow" --dependencies_dir "${DEPENDENCIES_DIR}" DEPENDS open3d_torch_ops WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating python ops.py and return_types.py" ) diff --git a/cpp/pybind/generate_torch_ops_wrapper.py b/cpp/pybind/generate_torch_ops_wrapper.py index bda52b8fc83..fa3e948af73 100644 --- a/cpp/pybind/generate_torch_ops_wrapper.py +++ b/cpp/pybind/generate_torch_ops_wrapper.py @@ -130,12 +130,22 @@ def main(): type=str, required=True, help="This is cpp/open3d/ml/tensorflow") + parser.add_argument("--dependencies_dir", + type=str, + required=True, + help="PyTorch dependencies directory") args = parser.parse_args() print(args) + if sys.platform == "win32": + open3d_deps = os.add_dll_directory(args.dependencies_dir) + torch.ops.load_library(args.lib) + if sys.platform == "win32": + open3d_deps.close() + generated_function_strs = '' generated_namedtuple_strs = '' for schema in torch._C._jit_get_all_schemas(): diff --git a/python/open3d/ml/tf/__init__.py b/python/open3d/ml/tf/__init__.py index 86ce9dd38fa..f5069efa30f 100644 --- a/python/open3d/ml/tf/__init__.py +++ b/python/open3d/ml/tf/__init__.py @@ -11,7 +11,7 @@ from open3d import _build_config if not _build_config["Tensorflow_VERSION"]: - raise Exception('Open3D was not built with TensorFlow support!') + raise ImportError('Open3D was not built with TensorFlow support!') _o3d_tf_version = _build_config["Tensorflow_VERSION"].split('.') if _tf_version.split('.')[:2] != _o3d_tf_version[:2]: diff --git a/python/open3d/ml/torch/__init__.py b/python/open3d/ml/torch/__init__.py index 09a48b131aa..161420fbcb5 100644 --- a/python/open3d/ml/torch/__init__.py +++ b/python/open3d/ml/torch/__init__.py @@ -12,7 +12,7 @@ from open3d import _build_config if not _build_config["Pytorch_VERSION"]: - raise Exception('Open3D was not built with PyTorch support!') + raise ImportError('Open3D was not built with PyTorch support!') _o3d_torch_version = _verp(_build_config["Pytorch_VERSION"]) # Check match with PyTorch version, any patch level is OK if _verp(_torch.__version__).release[:2] != _o3d_torch_version.release[:2]: From 59d77b8cf4dff12640d44b6aa28622b197ac7490 Mon Sep 17 00:00:00 2001 From: "Murillo Rojas, Luis" Date: Wed, 12 Feb 2025 14:17:39 -0600 Subject: [PATCH 03/18] Enable pytorch in Windows CI --- .github/workflows/windows.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 04a408802d0..5d37c71b448 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -25,7 +25,7 @@ env: STOOLS_VER: "67.3.2" JEDI_VER: "0.17.2" # https://github.com/ipython/ipython/issues/12740 IDNA_VER: "2.8" # https://github.com/psf/requests/issues/5710 - CUDA_VERSION: "12.1.0" + CUDA_VERSION: "12.4.0" SRC_DIR: "D:\\a\\open3d\\open3d" BUILD_DIR: "C:\\Open3D\\build" NPROC: 2 @@ -35,7 +35,7 @@ jobs: windows: permissions: contents: write # upload - runs-on: windows-2019 + runs-on: windows-2022 strategy: fail-fast: false matrix: @@ -111,7 +111,7 @@ jobs: ${env:DEVELOPER_BUILD}="ON" } cmake --version - cmake -G "Visual Studio 16 2019" -A x64 ` + cmake -G "Visual Studio 17 2022" -A x64 ` -DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" ` -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_EXAMPLES=OFF ` @@ -274,6 +274,16 @@ jobs: $ErrorActionPreference = 'Stop' python -m pip install -r python/requirements.txt python -m pip install -r python/requirements_jupyter_build.txt + + - name: Checkout Open3D-ML + uses: actions/checkout@v4 + with: + repository: isl-org/Open3D-ML + path: open3d_ml + + - name: Install PyTorch requirements + run: | + python -m pip install -r open3d_ml/requirements-torch.txt - name: Config run: | @@ -294,6 +304,7 @@ jobs: -DBUILD_LIBREALSENSE=ON ` -DBUILD_WEBRTC=ON ` -DBUILD_JUPYTER_EXTENSION=ON ` + -DBUILD_PYTORCH_OPS=ON ` ${{ env.SRC_DIR }} - name: Build Python package From 15fe3d086e01cd3b9aa7357c8e226ca5acf95dda Mon Sep 17 00:00:00 2001 From: "Murillo Rojas, Luis" Date: Fri, 14 Feb 2025 14:07:22 -0600 Subject: [PATCH 04/18] CI fixes --- .github/workflows/windows.yml | 30 +++++++++++++++++------------- CMakeLists.txt | 1 + 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f817df85477..af9320495f9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -96,6 +96,20 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.8 + + - name: Checkout Open3D-ML + uses: actions/checkout@v4 + with: + repository: isl-org/Open3D-ML + path: open3d_ml + + - name: Install PyTorch requirements + run: | + if (${{ matrix.BUILD_CUDA_MODULE == 'ON' }}) { + python -m pip install -r open3d_ml/requirements-torch-cuda.txt + } else { + python -m pip install -r open3d_ml/requirements-torch.txt + } - name: Config # Move build directory to C: https://github.com/actions/virtual-environments/issues/1341 @@ -119,6 +133,7 @@ jobs: -DBUILD_WEBRTC=${{ env.BUILD_WEBRTC }} ` -DBUILD_UNIT_TESTS=ON ` -DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA_MODULE }} ` + -DBUILD_PYTORCH_OPS=ON ` ${{ env.SRC_DIR }} - name: Build @@ -202,7 +217,7 @@ jobs: $ErrorActionPreference = 'Stop' mkdir build cd build - cmake -G "Visual Studio 16 2019" -A x64 ` + cmake -G "Visual Studio 17 2022" -A x64 ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` -DSTATIC_WINDOWS_RUNTIME=${{ matrix.STATIC_RUNTIME }} ` .. @@ -214,7 +229,7 @@ jobs: run: | $ErrorActionPreference = 'Stop' python -m pip install -U pip==${{ env.PIP_VER }} - python -m pip install -U -c python/requirements_build.txt wheel setuptools + python -m pip install -U -r python/requirements_build.txt - name: Install Python package working-directory: ${{ env.BUILD_DIR }} run: | @@ -274,16 +289,6 @@ jobs: python -m pip install maturin==1.7.8 python -m pip install -r python/requirements.txt python -m pip install -r python/requirements_jupyter_build.txt - - - name: Checkout Open3D-ML - uses: actions/checkout@v4 - with: - repository: isl-org/Open3D-ML - path: open3d_ml - - - name: Install PyTorch requirements - run: | - python -m pip install -r open3d_ml/requirements-torch.txt - name: Config run: | @@ -304,7 +309,6 @@ jobs: -DBUILD_LIBREALSENSE=ON ` -DBUILD_WEBRTC=ON ` -DBUILD_JUPYTER_EXTENSION=ON ` - -DBUILD_PYTORCH_OPS=ON ` ${{ env.SRC_DIR }} - name: Install Open3D python build requirements diff --git a/CMakeLists.txt b/CMakeLists.txt index 354125dc01d..d8d69969794 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -395,6 +395,7 @@ if(BUILD_CUDA_MODULE) # https://forums.developer.nvidia.com/t/problems-with-latest-vs2022-update/294150/12 if (MSVC AND MSVC_VERSION VERSION_LESS_EQUAL "1949") # Set this before any CUDA checks + add_compile_definitions(_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) set(CMAKE_CUDA_FLAGS "--allow-unsupported-compiler" CACHE STRING "Additional flags for nvcc" FORCE) message(WARNING "Using --allow-unsupported-compiler flag for nvcc with MSVC 2022. " "Set $Env:NVCC_PREPEND_FLAGS='--allow-unsupported-compiler' if nvcc still fails.") From c2e48a5ac8d54480867768c32aa8dd49af49cfee Mon Sep 17 00:00:00 2001 From: "Murillo Rojas, Luis" Date: Mon, 24 Feb 2025 10:38:10 -0600 Subject: [PATCH 05/18] Upgrade CUDA version in Windows CI --- .github/workflows/windows.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index af9320495f9..10129662fb9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -21,7 +21,7 @@ concurrency: env: PIP_VER: "24.3.1" - CUDA_VERSION: "12.1.0" + CUDA_VERSION: "12.4.0" SRC_DIR: "D:\\a\\open3d\\open3d" BUILD_DIR: "C:\\Open3D\\build" NPROC: 2 @@ -106,7 +106,8 @@ jobs: - name: Install PyTorch requirements run: | if (${{ matrix.BUILD_CUDA_MODULE == 'ON' }}) { - python -m pip install -r open3d_ml/requirements-torch-cuda.txt + python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 + python -m pip install tensorboard } else { python -m pip install -r open3d_ml/requirements-torch.txt } From 5b1c0fb2fb9913f1ee07b39da1abb2389a599624 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Fri, 13 Jun 2025 17:03:51 -0700 Subject: [PATCH 06/18] cuda torch cmake fix --- 3rdparty/cmake/FindPytorch.cmake | 8 ++++++-- cmake/Open3DShowAndAbortOnWarning.cmake | 1 + cpp/open3d/ml/Helper.h | 4 ++-- cpp/open3d/ml/impl/misc/Voxelize.cuh | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/3rdparty/cmake/FindPytorch.cmake b/3rdparty/cmake/FindPytorch.cmake index 08bf18b001f..bbda03fa1be 100644 --- a/3rdparty/cmake/FindPytorch.cmake +++ b/3rdparty/cmake/FindPytorch.cmake @@ -92,8 +92,12 @@ if(NOT Pytorch_FOUND) # remove flags that nvcc does not understand get_target_property( iface_compile_options torch INTERFACE_COMPILE_OPTIONS ) set_target_properties( torch PROPERTIES INTERFACE_COMPILE_OPTIONS "" ) - set_target_properties( torch_cuda PROPERTIES INTERFACE_COMPILE_OPTIONS "" ) - set_target_properties( torch_cpu PROPERTIES INTERFACE_COMPILE_OPTIONS "" ) + if (TARGET torch_cuda) + set_target_properties( torch_cuda PROPERTIES INTERFACE_COMPILE_OPTIONS "" ) + endif() + if (TARGET torch_cpu) + set_target_properties( torch_cpu PROPERTIES INTERFACE_COMPILE_OPTIONS "" ) + endif() endif() # If MKL is installed in the system level (e.g. for oneAPI Toolkit), diff --git a/cmake/Open3DShowAndAbortOnWarning.cmake b/cmake/Open3DShowAndAbortOnWarning.cmake index c95bfa75ac0..90cc1b98244 100644 --- a/cmake/Open3DShowAndAbortOnWarning.cmake +++ b/cmake/Open3DShowAndAbortOnWarning.cmake @@ -20,6 +20,7 @@ function(open3d_show_and_abort_on_warning target) /wd4267 # conversion from size_t to smaller type (FixedRadiusSearchCUDA, tests) /wd4305 # conversion to smaller type in initialization or constructor argument (examples, tests) /wd4819 # suppress vs2019+ compiler build error C2220 (Windows) + /wd4996 # torch_ops with CUDA. Deprecated type will be removed in future versions ) set(DISABLE_GNU_CLANG_INTEL_WARNINGS -Wno-unused-parameter # (many places in Open3D code) diff --git a/cpp/open3d/ml/Helper.h b/cpp/open3d/ml/Helper.h index 4193cfac984..1bc224ba07f 100644 --- a/cpp/open3d/ml/Helper.h +++ b/cpp/open3d/ml/Helper.h @@ -17,7 +17,7 @@ // TODO: Disable fmt() macro defined in fmt<7.0.0. // TODO: Remove this line once Open3D upgrades its fmt dependency. -#define FMT_STRING_ALIAS 0 +// #define FMT_STRING_ALIAS 0 #include "open3d/core/CUDAUtils.h" #include "open3d/utility/Logging.h" @@ -49,7 +49,7 @@ inline void __OPEN3D_ML_CUDA_DRIVER_CHECK(CUresult err, } } -inline cudaStream_t GetDefaultStream() { (cudaStream_t)0; } +inline cudaStream_t GetDefaultStream() { return (cudaStream_t)0; } inline int GetDevice(cudaStream_t stream) { if (stream == GetDefaultStream()) { diff --git a/cpp/open3d/ml/impl/misc/Voxelize.cuh b/cpp/open3d/ml/impl/misc/Voxelize.cuh index 2258175cf84..00818355e76 100644 --- a/cpp/open3d/ml/impl/misc/Voxelize.cuh +++ b/cpp/open3d/ml/impl/misc/Voxelize.cuh @@ -474,7 +474,7 @@ __global__ void CopyPointIndicesKernel( } int64_t end_out = prefix_sum_out[linear_idx]; - int64_t num_points = end_out - begin_out; + // int64_t num_points = end_out - begin_out; int64_t in_idx = prefix_sum_in[linear_idx]; From 72aca461b9707fe2eba00a8e1334a1a7cc62c459 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Sat, 14 Jun 2025 14:06:11 -0700 Subject: [PATCH 07/18] disable realsense on Windows --- .github/workflows/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 10129662fb9..5a8abd8b109 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -130,7 +130,7 @@ jobs: -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ` -DSTATIC_WINDOWS_RUNTIME=${{ matrix.STATIC_RUNTIME }} ` -DBUILD_COMMON_ISPC_ISAS=ON ` - -DBUILD_LIBREALSENSE=ON ` + -DBUILD_LIBREALSENSE=OFF ` -DBUILD_WEBRTC=${{ env.BUILD_WEBRTC }} ` -DBUILD_UNIT_TESTS=ON ` -DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA_MODULE }} ` @@ -307,7 +307,7 @@ jobs: -DSTATIC_WINDOWS_RUNTIME=ON ` -DBUILD_COMMON_ISPC_ISAS=ON ` -DBUILD_AZURE_KINECT=ON ` - -DBUILD_LIBREALSENSE=ON ` + -DBUILD_LIBREALSENSE=OFF ` -DBUILD_WEBRTC=ON ` -DBUILD_JUPYTER_EXTENSION=ON ` ${{ env.SRC_DIR }} From 04e97174194e09f84c3cb22157e2acd1ae9c0199 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Sat, 14 Jun 2025 20:59:50 -0700 Subject: [PATCH 08/18] Install cusparse in Windows CI --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5a8abd8b109..7ab419ebd1a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -73,7 +73,7 @@ jobs: # Installer arguments $CUDA_INSTALL_ARGS = "-s" # Required packages - $CUDA_PACKAGES = "nvcc", "visual_studio_integration", "cublas", "cublas_dev", "cudart", "cusolver", "cusolver_dev", "npp", "npp_dev", "thrust" + $CUDA_PACKAGES = "nvcc", "visual_studio_integration", "cublas", "cublas_dev", "cudart", "cusolver", "cusolver_dev", "cusparse", "cusparse_dev", "npp", "npp_dev", "thrust" $CUDA_PACKAGES.ForEach({ $CUDA_INSTALL_ARGS += " $($_)_$($CUDA_VER)" }) # Download and install CUDA echo "Downloading CUDA installer from $CUDA_URL" From 8cac52ce41fccf789e276071d7893efa38889c55 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Sat, 14 Jun 2025 23:25:06 -0700 Subject: [PATCH 09/18] fmt 10.2.1 for all Don't build Pytorch ops in Debug mode due to unresolved error. --- .github/workflows/windows.yml | 17 +++++++++++++---- 3rdparty/fmt/fmt.cmake | 17 ++--------------- cpp/open3d/ml/Helper.h | 4 ---- cpp/open3d/ml/impl/misc/Voxelize.cuh | 4 ---- cpp/pybind/t/geometry/pointcloud.cpp | 7 ++++--- 5 files changed, 19 insertions(+), 30 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7ab419ebd1a..bad7e68dcd0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,3 +1,7 @@ +# FIXME: +# - MSVC 17 and CUDA 12.4+ error while building CreateCUDAHashBackend.cu +# - PyTorch Ops in debug mode - DLL initialization error while loading open3d_torch_ops.dll + name: Windows permissions: {} @@ -105,9 +109,9 @@ jobs: - name: Install PyTorch requirements run: | - if (${{ matrix.BUILD_CUDA_MODULE == 'ON' }}) { - python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 - python -m pip install tensorboard + if ( '${{ matrix.BUILD_CUDA_MODULE }}' -eq 'ON' ) { + # TODO: Replace with requirements-torch-cuda.txt when available + python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124 } else { python -m pip install -r open3d_ml/requirements-torch.txt } @@ -122,6 +126,10 @@ jobs: ${env:DEVELOPER_BUILD}="ON" } cmake --version + $Env:BUILD_PYTORCH_OPS = "ON" + if ${{ matrix.CONFIG }} -eq "Debug" { + $Env:BUILD_PYTORCH_OPS = "OFF" # DLL initialization error in Debug config + } cmake -G "Visual Studio 17 2022" -A x64 ` -DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" ` -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` @@ -134,7 +142,7 @@ jobs: -DBUILD_WEBRTC=${{ env.BUILD_WEBRTC }} ` -DBUILD_UNIT_TESTS=ON ` -DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA_MODULE }} ` - -DBUILD_PYTORCH_OPS=ON ` + -DBUILD_PYTORCH_OPS=${{ env.BUILD_PYTORCH_OPS }}` ${{ env.SRC_DIR }} - name: Build @@ -310,6 +318,7 @@ jobs: -DBUILD_LIBREALSENSE=OFF ` -DBUILD_WEBRTC=ON ` -DBUILD_JUPYTER_EXTENSION=ON ` + -DBUILD_PYTORCH_OPS=ON ` ${{ env.SRC_DIR }} - name: Install Open3D python build requirements diff --git a/3rdparty/fmt/fmt.cmake b/3rdparty/fmt/fmt.cmake index d7698e1a645..88c886b00b2 100644 --- a/3rdparty/fmt/fmt.cmake +++ b/3rdparty/fmt/fmt.cmake @@ -2,21 +2,8 @@ include(ExternalProject) set(FMT_LIB_NAME fmt) -if (MSVC AND BUILD_CUDA_MODULE) - if (MSVC_VERSION GREATER_EQUAL 1930) # v143 - set(FMT_VER "10.1.1") - set(FMT_SHA256 - "78b8c0a72b1c35e4443a7e308df52498252d1cefc2b08c9a97bc9ee6cfe61f8b") - else() - set(FMT_VER "6.0.0") - set(FMT_SHA256 - "f1907a58d5e86e6c382e51441d92ad9e23aea63827ba47fd647eacc0d3a16c78") - endif() -else() - set(FMT_VER "10.2.1") - set(FMT_SHA256 - "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811") -endif() +set(FMT_VER "10.2.1") +set(FMT_SHA256 "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811") ExternalProject_Add( ext_fmt diff --git a/cpp/open3d/ml/Helper.h b/cpp/open3d/ml/Helper.h index 1bc224ba07f..a36d0ac83b5 100644 --- a/cpp/open3d/ml/Helper.h +++ b/cpp/open3d/ml/Helper.h @@ -15,10 +15,6 @@ #include #include -// TODO: Disable fmt() macro defined in fmt<7.0.0. -// TODO: Remove this line once Open3D upgrades its fmt dependency. -// #define FMT_STRING_ALIAS 0 - #include "open3d/core/CUDAUtils.h" #include "open3d/utility/Logging.h" diff --git a/cpp/open3d/ml/impl/misc/Voxelize.cuh b/cpp/open3d/ml/impl/misc/Voxelize.cuh index 00818355e76..85158f9afc5 100644 --- a/cpp/open3d/ml/impl/misc/Voxelize.cuh +++ b/cpp/open3d/ml/impl/misc/Voxelize.cuh @@ -473,11 +473,7 @@ __global__ void CopyPointIndicesKernel( begin_out = prefix_sum_out[linear_idx - 1]; } int64_t end_out = prefix_sum_out[linear_idx]; - - // int64_t num_points = end_out - begin_out; - int64_t in_idx = prefix_sum_in[linear_idx]; - for (int64_t out_idx = begin_out; out_idx < end_out; ++out_idx, ++in_idx) { out[out_idx] = point_indices[in_idx]; } diff --git a/cpp/pybind/t/geometry/pointcloud.cpp b/cpp/pybind/t/geometry/pointcloud.cpp index 172f92c2356..2faf027a464 100644 --- a/cpp/pybind/t/geometry/pointcloud.cpp +++ b/cpp/pybind/t/geometry/pointcloud.cpp @@ -261,9 +261,10 @@ void pybind_pointcloud_definitions(py::module& m) { "non-negative number less than number of points in the " "input pointcloud.", "start_index"_a = 0); - pointcloud.def("remove_radius_outliers", &PointCloud::RemoveRadiusOutliers, - "nb_points"_a, "search_radius"_a, - R"(Remove points that have less than nb_points neighbors in a + pointcloud.def( + "remove_radius_outliers", &PointCloud::RemoveRadiusOutliers, + "nb_points"_a, "search_radius"_a, + R"(Remove points that have less than nb_points neighbors in a sphere of a given search radius. Args: From f7c52b4152de354bfd28087892dbb5b292e2a655 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Sun, 15 Jun 2025 22:50:39 -0700 Subject: [PATCH 10/18] fix Draw example. --- .github/workflows/windows.yml | 12 ++++++------ .../cmake/open3d-cmake-find-package/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index bad7e68dcd0..b10e06a50fd 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -120,15 +120,15 @@ jobs: # Move build directory to C: https://github.com/actions/virtual-environments/issues/1341 run: | $ErrorActionPreference = 'Stop' - New-Item -Path ${{ env.BUILD_DIR }} -ItemType Directory - cd ${{ env.BUILD_DIR }} + New-Item -Path '${{ env.BUILD_DIR }}' -ItemType Directory + cd '${{ env.BUILD_DIR }}' if (${env:DEVELOPER_BUILD} -ne "OFF") { ${env:DEVELOPER_BUILD}="ON" } cmake --version - $Env:BUILD_PYTORCH_OPS = "ON" - if ${{ matrix.CONFIG }} -eq "Debug" { - $Env:BUILD_PYTORCH_OPS = "OFF" # DLL initialization error in Debug config + $env:BUILD_PYTORCH_OPS = "ON" + if ('${{ matrix.CONFIG }}' -eq "Debug") { + $env:BUILD_PYTORCH_OPS = "OFF" # DLL initialization error in Debug config } cmake -G "Visual Studio 17 2022" -A x64 ` -DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" ` @@ -142,7 +142,7 @@ jobs: -DBUILD_WEBRTC=${{ env.BUILD_WEBRTC }} ` -DBUILD_UNIT_TESTS=ON ` -DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA_MODULE }} ` - -DBUILD_PYTORCH_OPS=${{ env.BUILD_PYTORCH_OPS }}` + -DBUILD_PYTORCH_OPS=$env:BUILD_PYTORCH_OPS ` ${{ env.SRC_DIR }} - name: Build diff --git a/examples/cmake/open3d-cmake-find-package/CMakeLists.txt b/examples/cmake/open3d-cmake-find-package/CMakeLists.txt index d7bb7a5cbe7..3ca108bb53f 100644 --- a/examples/cmake/open3d-cmake-find-package/CMakeLists.txt +++ b/examples/cmake/open3d-cmake-find-package/CMakeLists.txt @@ -15,14 +15,20 @@ endif() # Find installed Open3D, which exports Open3D::Open3D find_package(Open3D REQUIRED) +set(USE_CUDA FALSE) if (TARGET Open3D::3rdparty_cublas) + set(USE_CUDA TRUE) enable_language(CUDA) set(CMAKE_CUDA_STANDARD 17) + find_package(CUDAToolkit REQUIRED) endif() add_executable(Draw) target_sources(Draw PRIVATE Draw.cpp) target_link_libraries(Draw PRIVATE Open3D::Open3D) +if (USE_CUDA) + target_link_libraries(Draw PRIVATE CUDA::cudart_static) +endif() # On Windows if BUILD_SHARED_LIBS is enabled, copy .dll files to the executable directory if(WIN32) From 2c1a018594715ea65743f139056828db0b8c4a41 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Mon, 16 Jun 2025 00:07:19 -0700 Subject: [PATCH 11/18] install pytorch for Windows wheel --- .github/workflows/windows.yml | 23 +++++++++++++---------- util/ci_utils.sh | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b10e06a50fd..f78c26bebea 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -28,7 +28,7 @@ env: CUDA_VERSION: "12.4.0" SRC_DIR: "D:\\a\\open3d\\open3d" BUILD_DIR: "C:\\Open3D\\build" - NPROC: 2 + NPROC: 6 DEVELOPER_BUILD: ${{ github.event.inputs.developer_build || 'ON' }} jobs: @@ -77,7 +77,7 @@ jobs: # Installer arguments $CUDA_INSTALL_ARGS = "-s" # Required packages - $CUDA_PACKAGES = "nvcc", "visual_studio_integration", "cublas", "cublas_dev", "cudart", "cusolver", "cusolver_dev", "cusparse", "cusparse_dev", "npp", "npp_dev", "thrust" + $CUDA_PACKAGES = "nvcc", "visual_studio_integration", "cublas", "cublas_dev", "cudart", "cusolver", "cusolver_dev", "cusparse", "cusparse_dev", "npp", "npp_dev", "nvtx", "thrust" $CUDA_PACKAGES.ForEach({ $CUDA_INSTALL_ARGS += " $($_)_$($CUDA_VER)" }) # Download and install CUDA echo "Downloading CUDA installer from $CUDA_URL" @@ -278,7 +278,13 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 - + + - name: Checkout Open3D-ML + uses: actions/checkout@v4 + with: + repository: isl-org/Open3D-ML + path: open3d_ml + - name: Setup Windows SDK uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 with: @@ -293,11 +299,15 @@ jobs: working-directory: ${{ env.SRC_DIR }} run: | $ErrorActionPreference = 'Stop' + python -m pip install -U pip==${{ env.PIP_VER }} # maturin>1.7.8 breaks dependency y-py (Python 3.12) and pywinpty (Python 3.8) wheel building # https://github.com/MichaIng/DietPi/issues/7329#issuecomment-2565130837 python -m pip install maturin==1.7.8 python -m pip install -r python/requirements.txt + python -m pip install -U -c python/requirements_build.txt wheel setuptools python -m pip install -r python/requirements_jupyter_build.txt + python -m pip install -r ../open3d_ml/requirements-torch.txt + - name: Config run: | @@ -321,13 +331,6 @@ jobs: -DBUILD_PYTORCH_OPS=ON ` ${{ env.SRC_DIR }} - - name: Install Open3D python build requirements - working-directory: ${{ env.SOURCE_DIR }} - run: | - $ErrorActionPreference = 'Stop' - python -m pip install -U pip==${{ env.PIP_VER }} - python -m pip install -U -c python/requirements_build.txt wheel setuptools - - name: Build Python package working-directory: ${{ env.BUILD_DIR }} run: | diff --git a/util/ci_utils.sh b/util/ci_utils.sh index 2d0bab3fa3d..24f014fa3e9 100644 --- a/util/ci_utils.sh +++ b/util/ci_utils.sh @@ -11,6 +11,7 @@ if [[ "$DEVELOPER_BUILD" != "OFF" ]]; then # Validate input coming from GHA inpu fi BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} NPROC=${NPROC:-$(getconf _NPROCESSORS_ONLN)} # POSIX: MacOS + Linux +NPROC=$((NPROC+2)) # run nproc+2 jobs to speed up the build if [ -z "${BUILD_CUDA_MODULE:+x}" ]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then BUILD_CUDA_MODULE=ON @@ -378,7 +379,6 @@ install_docs_dependencies() { build_docs() { echo "Using cmake: $(command -v cmake)" cmake --version - NPROC=$(nproc) echo NPROC="$NPROC" mkdir -p build cd build From 935ad10ae9e9671297ee789176c56d0e6ded1320 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Mon, 16 Jun 2025 00:55:00 -0700 Subject: [PATCH 12/18] fix --- .github/workflows/windows.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f78c26bebea..af0378b5238 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -127,8 +127,9 @@ jobs: } cmake --version $env:BUILD_PYTORCH_OPS = "ON" - if ('${{ matrix.CONFIG }}' -eq "Debug") { - $env:BUILD_PYTORCH_OPS = "OFF" # DLL initialization error in Debug config + # DLL initialization error in Debug config, PyTorch + CUDA nvToolsExt not found error + if ('${{ matrix.CONFIG }}' -eq "Debug" -or '${{ matrix.BUILD_CUDA_MODULE }}' -eq "ON") { + $env:BUILD_PYTORCH_OPS = "OFF" } cmake -G "Visual Studio 17 2022" -A x64 ` -DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" ` @@ -306,7 +307,7 @@ jobs: python -m pip install -r python/requirements.txt python -m pip install -U -c python/requirements_build.txt wheel setuptools python -m pip install -r python/requirements_jupyter_build.txt - python -m pip install -r ../open3d_ml/requirements-torch.txt + python -m pip install -r open3d_ml/requirements-torch.txt - name: Config From 684230fce368556359a22caca51cf0947255061c Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Tue, 17 Jun 2025 10:20:36 -0700 Subject: [PATCH 13/18] fix --- .github/workflows/windows.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index af0378b5238..a1074b26419 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -89,9 +89,9 @@ jobs: } # Add CUDA environment variables. $CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$CUDA_VER" - echo "CUDA_PATH=$CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - echo "CUDA_PATH_V$CUDA_VER_ID=$CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - echo "$CUDA_PATH\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "CUDA_PATH=$CUDA_PATH" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + echo "CUDA_PATH_V$CUDA_VER_ID=$CUDA_PATH" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + echo "$CUDA_PATH\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append - name: Checkout source code uses: actions/checkout@v4 @@ -122,17 +122,18 @@ jobs: $ErrorActionPreference = 'Stop' New-Item -Path '${{ env.BUILD_DIR }}' -ItemType Directory cd '${{ env.BUILD_DIR }}' - if (${env:DEVELOPER_BUILD} -ne "OFF") { - ${env:DEVELOPER_BUILD}="ON" + if ($Env:DEVELOPER_BUILD -ne "OFF") { + $Env:DEVELOPER_BUILD = "ON" } cmake --version - $env:BUILD_PYTORCH_OPS = "ON" + $Env:BUILD_PYTORCH_OPS = "ON" # DLL initialization error in Debug config, PyTorch + CUDA nvToolsExt not found error if ('${{ matrix.CONFIG }}' -eq "Debug" -or '${{ matrix.BUILD_CUDA_MODULE }}' -eq "ON") { - $env:BUILD_PYTORCH_OPS = "OFF" + $Env:BUILD_PYTORCH_OPS = "OFF" } + echo "BUILD_PYTORCH_OPS=$Env:BUILD_PYTORCH_OPS" cmake -G "Visual Studio 17 2022" -A x64 ` - -DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" ` + -DDEVELOPER_BUILD=$Env:DEVELOPER_BUILD ` -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_EXAMPLES=OFF ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` @@ -143,7 +144,7 @@ jobs: -DBUILD_WEBRTC=${{ env.BUILD_WEBRTC }} ` -DBUILD_UNIT_TESTS=ON ` -DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA_MODULE }} ` - -DBUILD_PYTORCH_OPS=$env:BUILD_PYTORCH_OPS ` + -DBUILD_PYTORCH_OPS=$Env:BUILD_PYTORCH_OPS ` ${{ env.SRC_DIR }} - name: Build @@ -168,7 +169,7 @@ jobs: } $DEVEL_PKG_NAME=(Get-ChildItem package/open3d-devel-*.zip).Name echo "DEVEL_PKG_NAME=$DEVEL_PKG_NAME" | Out-File -FilePath ` - $env:GITHUB_ENV -Encoding utf8 -Append + $Env:GITHUB_ENV -Encoding utf8 -Append - name: Upload Package if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' && matrix.BUILD_CUDA_MODULE == 'OFF' }} @@ -315,12 +316,12 @@ jobs: $ErrorActionPreference = 'Stop' New-Item -Path ${{ env.BUILD_DIR }} -ItemType Directory cd ${{ env.BUILD_DIR }} - if (${env:DEVELOPER_BUILD} -ne "OFF") { - ${env:DEVELOPER_BUILD}="ON" + if ($Env:DEVELOPER_BUILD -ne "OFF") { + $Env:DEVELOPER_BUILD = "ON" } cmake -G "Visual Studio 16 2019" -A x64 ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` - -DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" ` + -DDEVELOPER_BUILD="$Env:DEVELOPER_BUILD" ` -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_SHARED_LIBS=OFF ` -DSTATIC_WINDOWS_RUNTIME=ON ` @@ -338,7 +339,7 @@ jobs: $ErrorActionPreference = 'Stop' cmake --build . --parallel ${{ env.NPROC }} --config Release --target pip-package $PIP_PKG_NAME=(Get-ChildItem lib/python_package/pip_package/open3d*.whl).Name - echo "PIP_PKG_NAME=$PIP_PKG_NAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "PIP_PKG_NAME=$PIP_PKG_NAME" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - name: Upload wheel uses: actions/upload-artifact@v4 From 6091ec46e6ac713bb0a71e8e3b5bb08b7b9c5891 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Wed, 18 Jun 2025 05:43:19 -0700 Subject: [PATCH 14/18] Remove specific WIn SDK, so that latest is used. Use preprocessor defines to target Win 10. --- .github/workflows/windows.yml | 25 ++++--------------------- CMakeLists.txt | 3 +++ 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a1074b26419..799b998467a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -50,16 +50,12 @@ jobs: - BUILD_CUDA_MODULE: ON env: BUILD_WEBRTC: ${{ ( matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' ) && 'ON' || 'OFF' }} + BUILD_PYTORCH_OPS: ${{ ( matrix.BUILD_CUDA_MODULE == 'ON' || matrix.CONFIG == 'Debug' ) && 'OFF' || 'ON' }} steps: - name: Disk space used run: Get-PSDrive - - name: Setup Windows SDK - uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 - with: - sdk-version: 19041 - - name: Install CUDA if: ${{ matrix.BUILD_CUDA_MODULE == 'ON' }} run: | @@ -126,15 +122,8 @@ jobs: $Env:DEVELOPER_BUILD = "ON" } cmake --version - $Env:BUILD_PYTORCH_OPS = "ON" - # DLL initialization error in Debug config, PyTorch + CUDA nvToolsExt not found error - if ('${{ matrix.CONFIG }}' -eq "Debug" -or '${{ matrix.BUILD_CUDA_MODULE }}' -eq "ON") { - $Env:BUILD_PYTORCH_OPS = "OFF" - } - echo "BUILD_PYTORCH_OPS=$Env:BUILD_PYTORCH_OPS" cmake -G "Visual Studio 17 2022" -A x64 ` -DDEVELOPER_BUILD=$Env:DEVELOPER_BUILD ` - -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_EXAMPLES=OFF ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ` @@ -144,7 +133,7 @@ jobs: -DBUILD_WEBRTC=${{ env.BUILD_WEBRTC }} ` -DBUILD_UNIT_TESTS=ON ` -DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA_MODULE }} ` - -DBUILD_PYTORCH_OPS=$Env:BUILD_PYTORCH_OPS ` + -DBUILD_PYTORCH_OPS=${{ env.BUILD_PYTORCH_OPS }} ` ${{ env.SRC_DIR }} - name: Build @@ -259,7 +248,7 @@ jobs: name: Build wheel permissions: contents: write # upload - runs-on: windows-2019 + runs-on: windows-2022 strategy: fail-fast: false # https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 @@ -287,11 +276,6 @@ jobs: repository: isl-org/Open3D-ML path: open3d_ml - - name: Setup Windows SDK - uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 - with: - sdk-version: 19041 - - name: Set up Python uses: actions/setup-python@v5 with: @@ -322,7 +306,6 @@ jobs: cmake -G "Visual Studio 16 2019" -A x64 ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` -DDEVELOPER_BUILD="$Env:DEVELOPER_BUILD" ` - -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_SHARED_LIBS=OFF ` -DSTATIC_WINDOWS_RUNTIME=ON ` -DBUILD_COMMON_ISPC_ISAS=ON ` @@ -360,7 +343,7 @@ jobs: name: Test wheel permissions: contents: read - runs-on: windows-2019 + runs-on: windows-2022 needs: [build-wheel] strategy: fail-fast: false diff --git a/CMakeLists.txt b/CMakeLists.txt index d8d69969794..96a671c96cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -476,6 +476,9 @@ endif() # OS specific settings if(WIN32) + # Set oldest supported Windows version to Windows 10 (10.0, 0x0A00) + # https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170 + add_compile_definitions(WINVER="0x0A00" _WIN32_WINNT="0x0A00") # Windows defaults to hidden symbol visibility, override that # TODO: It would be better to explicitly export symbols. # Then, we could use -fvisibility=hidden for Linux as well From 6e7e1ad1a837390abe6477a0bfe35986cb10f999 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Wed, 18 Jun 2025 06:27:38 -0700 Subject: [PATCH 15/18] Put back win sdk old version due to TBB errors. --- .github/workflows/windows.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 799b998467a..87d0d05d533 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -55,6 +55,11 @@ jobs: steps: - name: Disk space used run: Get-PSDrive + + - name: Setup Windows SDK + uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 + with: + sdk-version: 19041 - name: Install CUDA if: ${{ matrix.BUILD_CUDA_MODULE == 'ON' }} @@ -123,6 +128,7 @@ jobs: } cmake --version cmake -G "Visual Studio 17 2022" -A x64 ` + -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DDEVELOPER_BUILD=$Env:DEVELOPER_BUILD ` -DBUILD_EXAMPLES=OFF ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` @@ -276,6 +282,11 @@ jobs: repository: isl-org/Open3D-ML path: open3d_ml + - name: Setup Windows SDK + uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 + with: + sdk-version: 19041 + - name: Set up Python uses: actions/setup-python@v5 with: @@ -305,6 +316,7 @@ jobs: } cmake -G "Visual Studio 16 2019" -A x64 ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` + -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DDEVELOPER_BUILD="$Env:DEVELOPER_BUILD" ` -DBUILD_SHARED_LIBS=OFF ` -DSTATIC_WINDOWS_RUNTIME=ON ` From cd65f6e565843c2ce94d10b4d72b4a0fac431582 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Fri, 20 Jun 2025 15:37:42 -0700 Subject: [PATCH 16/18] Enable ml_ops python tests configure zlib early since it is used by others. do not define WINDOWS, WIN32 to avoid conflict with dependencies. Use compiler _WIN32 instead. --- .github/workflows/windows.yml | 8 +-- 3rdparty/assimp/assimp.cmake | 1 + 3rdparty/find_dependencies.cmake | 71 +++++++++---------- 3rdparty/libpng/libpng.cmake | 3 +- CMakeLists.txt | 2 +- cmake/Open3DSetGlobalProperties.cmake | 1 - cpp/open3d/utility/Download.cpp | 2 +- cpp/open3d/utility/FileSystem.cpp | 10 +-- .../rendering/filament/FilamentCamera.cpp | 2 +- .../visualizer/GuiVisualizer.cpp | 2 +- cpp/pybind/pybind_filesystem.h | 2 +- 11 files changed, 52 insertions(+), 52 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 87d0d05d533..1fc148a72bc 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -111,7 +111,7 @@ jobs: - name: Install PyTorch requirements run: | if ( '${{ matrix.BUILD_CUDA_MODULE }}' -eq 'ON' ) { - # TODO: Replace with requirements-torch-cuda.txt when available + # python -m pip install -r open3d_ml/requirements-torch-cuda.txt python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124 } else { python -m pip install -r open3d_ml/requirements-torch.txt @@ -128,8 +128,8 @@ jobs: } cmake --version cmake -G "Visual Studio 17 2022" -A x64 ` - -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DDEVELOPER_BUILD=$Env:DEVELOPER_BUILD ` + -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_EXAMPLES=OFF ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ` @@ -316,8 +316,8 @@ jobs: } cmake -G "Visual Studio 16 2019" -A x64 ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` - -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DDEVELOPER_BUILD="$Env:DEVELOPER_BUILD" ` + -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_SHARED_LIBS=OFF ` -DSTATIC_WINDOWS_RUNTIME=ON ` -DBUILD_COMMON_ISPC_ISAS=ON ` @@ -416,5 +416,5 @@ jobs: echo "Running Open3D python tests..." echo "Add --randomly-seed=SEED to the test command to reproduce test order." echo "Testing ML and ML Ops disabled" - python -m pytest python/test/ --ignore python/test/ml_ops/ + python -m pytest python/test/ deactivate diff --git a/3rdparty/assimp/assimp.cmake b/3rdparty/assimp/assimp.cmake index cce51be4ded..a3cb9bd86d0 100644 --- a/3rdparty/assimp/assimp.cmake +++ b/3rdparty/assimp/assimp.cmake @@ -35,6 +35,7 @@ ExternalProject_Add( -DHUNTER_ENABLED=OFF # Renamed to "ASSIMP_HUNTER_ENABLED" in newer assimp. -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_DEBUG_POSTFIX= + DEPENDS ext_zlib BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}IrrXML${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index 2396f839651..83f76385e8a 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -494,6 +494,41 @@ open3d_find_package_3rdparty_library(3rdparty_threads TARGETS Threads::Threads ) +# PNG +if(USE_SYSTEM_PNG) + # ZLIB::ZLIB is automatically included by the PNG package. + open3d_find_package_3rdparty_library(3rdparty_png + PACKAGE PNG + PACKAGE_VERSION_VAR PNG_VERSION_STRING + TARGETS PNG::PNG + ) + if(NOT 3rdparty_png_FOUND) + set(USE_SYSTEM_PNG OFF) + endif() +endif() +if(NOT USE_SYSTEM_PNG) + include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake) + open3d_import_3rdparty_library(3rdparty_zlib + HIDDEN + INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} + LIB_DIR ${ZLIB_LIB_DIR} + LIBRARIES ${ZLIB_LIBRARIES} + DEPENDS ext_zlib + ) + + include(${Open3D_3RDPARTY_DIR}/libpng/libpng.cmake) + open3d_import_3rdparty_library(3rdparty_png + INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS} + LIB_DIR ${LIBPNG_LIB_DIR} + LIBRARIES ${LIBPNG_LIBRARIES} + DEPENDS ext_libpng + ) + target_link_libraries(3rdparty_png INTERFACE Open3D::3rdparty_zlib) + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_png) +else() + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_png) +endif() + # Assimp if(USE_SYSTEM_ASSIMP) open3d_find_package_3rdparty_library(3rdparty_assimp @@ -927,42 +962,6 @@ if(NOT USE_SYSTEM_CURL) endif() list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_curl Open3D::3rdparty_openssl) -# PNG -if(USE_SYSTEM_PNG) - # ZLIB::ZLIB is automatically included by the PNG package. - open3d_find_package_3rdparty_library(3rdparty_png - PACKAGE PNG - PACKAGE_VERSION_VAR PNG_VERSION_STRING - TARGETS PNG::PNG - ) - if(NOT 3rdparty_png_FOUND) - set(USE_SYSTEM_PNG OFF) - endif() -endif() -if(NOT USE_SYSTEM_PNG) - include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake) - open3d_import_3rdparty_library(3rdparty_zlib - HIDDEN - INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} - LIB_DIR ${ZLIB_LIB_DIR} - LIBRARIES ${ZLIB_LIBRARIES} - DEPENDS ext_zlib - ) - - include(${Open3D_3RDPARTY_DIR}/libpng/libpng.cmake) - open3d_import_3rdparty_library(3rdparty_png - INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS} - LIB_DIR ${LIBPNG_LIB_DIR} - LIBRARIES ${LIBPNG_LIBRARIES} - DEPENDS ext_libpng - ) - add_dependencies(ext_libpng ext_zlib) - target_link_libraries(3rdparty_png INTERFACE Open3D::3rdparty_zlib) - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_png) -else() - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_png) -endif() - # rply open3d_build_3rdparty_library(3rdparty_rply DIRECTORY rply SOURCES diff --git a/3rdparty/libpng/libpng.cmake b/3rdparty/libpng/libpng.cmake index 79f23e3151d..d1703dd5d50 100644 --- a/3rdparty/libpng/libpng.cmake +++ b/3rdparty/libpng/libpng.cmake @@ -17,11 +17,12 @@ ExternalProject_Add( -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_INSTALL_PREFIX= -DPNG_SHARED=OFF - -DPNG_EXECUTABLES=OFF + -DPNG_TOOLS=OFF -DPNG_TESTS=OFF -DZLIB_ROOT=${CMAKE_BINARY_DIR}/zlib -DPNG_ARM_NEON=off # Must be lower case. ${ExternalProject_CMAKE_ARGS_hidden} + DEPENDS ext_zlib BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${LIBPNG_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${LIBPNG_LIB_NAME}d${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/CMakeLists.txt b/CMakeLists.txt index f1211d4e924..47dee3357dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -482,7 +482,7 @@ endif() if(WIN32) # Set oldest supported Windows version to Windows 10 (10.0, 0x0A00) # https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170 - add_compile_definitions(WINVER="0x0A00" _WIN32_WINNT="0x0A00") + add_compile_definitions(WINVER=0x0A00 _WIN32_WINNT=0x0A00) # Windows defaults to hidden symbol visibility, override that # TODO: It would be better to explicitly export symbols. # Then, we could use -fvisibility=hidden for Linux as well diff --git a/cmake/Open3DSetGlobalProperties.cmake b/cmake/Open3DSetGlobalProperties.cmake index 8cc6ea312b5..7e27032521e 100644 --- a/cmake/Open3DSetGlobalProperties.cmake +++ b/cmake/Open3DSetGlobalProperties.cmake @@ -135,7 +135,6 @@ function(open3d_set_global_properties target) endif() if(WIN32) target_compile_definitions(${target} PRIVATE - WINDOWS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE _SCL_SECURE_NO_WARNINGS diff --git a/cpp/open3d/utility/Download.cpp b/cpp/open3d/utility/Download.cpp index 6f3443cc907..15b954413b3 100644 --- a/cpp/open3d/utility/Download.cpp +++ b/cpp/open3d/utility/Download.cpp @@ -14,7 +14,7 @@ #include // https://stackoverflow.com/a/41873190/1255535 -#ifdef WINDOWS +#ifdef _WIN32 #pragma comment(lib, "wldap32.lib") #pragma comment(lib, "crypt32.lib") #pragma comment(lib, "Ws2_32.lib") diff --git a/cpp/open3d/utility/FileSystem.cpp b/cpp/open3d/utility/FileSystem.cpp index 604507edc35..59b3c45062b 100644 --- a/cpp/open3d/utility/FileSystem.cpp +++ b/cpp/open3d/utility/FileSystem.cpp @@ -13,7 +13,7 @@ #include #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #include #include @@ -28,7 +28,7 @@ #include #endif -#ifdef WIN32 +#ifdef _WIN32 #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #endif #ifdef __APPLE__ @@ -55,7 +55,7 @@ static std::string GetEnvVar(const std::string &env_var) { std::string GetHomeDirectory() { std::string home_dir = ""; -#ifdef WINDOWS +#ifdef _WIN32 // %USERPROFILE% // %HOMEDRIVE% // %HOMEPATH% @@ -235,7 +235,7 @@ bool DirectoryIsEmpty(const std::string &directory) { } bool MakeDirectory(const std::string &directory) { -#ifdef WINDOWS +#ifdef _WIN32 return (_mkdir(directory.c_str()) == 0); #else return (mkdir(directory.c_str(), S_IRWXU) == 0); @@ -395,7 +395,7 @@ std::string GetIOErrorString(const int errnoVal) { // Error below could be EWOULDBLOCK on Linux case EAGAIN: return "Resource unavailable, try again"; -#if !defined(WIN32) +#if !defined(_WIN32) case EDQUOT: return "Over quota"; #endif diff --git a/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp b/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp index 553bfe91815..e7a1580c4e9 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp +++ b/cpp/open3d/visualization/rendering/filament/FilamentCamera.cpp @@ -176,7 +176,7 @@ void FilamentCamera::SetProjection(const Eigen::Matrix3d& intrinsics, culling_proj[2][2] = (-far - near) / (far - near); culling_proj[3][2] = -2.0 * far * near / (far - near); -#ifdef WIN32 +#ifdef _WIN32 camera_->setCustomProjection(custom_proj, near, far); #else camera_->setCustomProjection(custom_proj, culling_proj, near, far); diff --git a/cpp/open3d/visualization/visualizer/GuiVisualizer.cpp b/cpp/open3d/visualization/visualizer/GuiVisualizer.cpp index 5f7584d7e00..41cb1c22652 100644 --- a/cpp/open3d/visualization/visualizer/GuiVisualizer.cpp +++ b/cpp/open3d/visualization/visualizer/GuiVisualizer.cpp @@ -799,7 +799,7 @@ void GuiVisualizer::Init() { file_menu->AddItem("Open...", FILE_OPEN, gui::KEY_O); file_menu->AddItem("Export Current Image...", FILE_EXPORT_RGB); file_menu->AddSeparator(); -#if defined(WIN32) +#if defined(_WIN32) file_menu->AddItem("Exit", FILE_QUIT); #elif !defined(__APPLE__) // quit goes in app menu on macOS file_menu->AddItem("Quit", FILE_QUIT, gui::KEY_Q); diff --git a/cpp/pybind/pybind_filesystem.h b/cpp/pybind/pybind_filesystem.h index 3617d6cad45..d0854598fb6 100644 --- a/cpp/pybind/pybind_filesystem.h +++ b/cpp/pybind/pybind_filesystem.h @@ -21,7 +21,7 @@ #include -#ifdef WIN32 +#ifdef _WIN32 #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #endif #ifdef __APPLE__ From 320105f54a4d09f9b5f01a068c9dfd5441123001 Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Mon, 23 Jun 2025 22:56:27 -0700 Subject: [PATCH 17/18] Use latetst Windows SDK by default. Revert zlib re-ordering. --- .github/workflows/windows.yml | 14 +----- 3rdparty/assimp/assimp.cmake | 1 - 3rdparty/find_dependencies.cmake | 71 ++++++++++++++-------------- 3rdparty/fmt/fmt.cmake | 9 +++- cpp/pybind/t/geometry/pointcloud.cpp | 7 ++- 5 files changed, 46 insertions(+), 56 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1fc148a72bc..ba2a47274de 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -56,11 +56,6 @@ jobs: - name: Disk space used run: Get-PSDrive - - name: Setup Windows SDK - uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 - with: - sdk-version: 19041 - - name: Install CUDA if: ${{ matrix.BUILD_CUDA_MODULE == 'ON' }} run: | @@ -129,7 +124,6 @@ jobs: cmake --version cmake -G "Visual Studio 17 2022" -A x64 ` -DDEVELOPER_BUILD=$Env:DEVELOPER_BUILD ` - -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_EXAMPLES=OFF ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ` @@ -282,11 +276,6 @@ jobs: repository: isl-org/Open3D-ML path: open3d_ml - - name: Setup Windows SDK - uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 - with: - sdk-version: 19041 - - name: Set up Python uses: actions/setup-python@v5 with: @@ -314,10 +303,9 @@ jobs: if ($Env:DEVELOPER_BUILD -ne "OFF") { $Env:DEVELOPER_BUILD = "ON" } - cmake -G "Visual Studio 16 2019" -A x64 ` + cmake -G "Visual Studio 17 2022" -A x64 ` -DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` -DDEVELOPER_BUILD="$Env:DEVELOPER_BUILD" ` - -DCMAKE_SYSTEM_VERSION="10.0.19041.0" ` -DBUILD_SHARED_LIBS=OFF ` -DSTATIC_WINDOWS_RUNTIME=ON ` -DBUILD_COMMON_ISPC_ISAS=ON ` diff --git a/3rdparty/assimp/assimp.cmake b/3rdparty/assimp/assimp.cmake index a3cb9bd86d0..cce51be4ded 100644 --- a/3rdparty/assimp/assimp.cmake +++ b/3rdparty/assimp/assimp.cmake @@ -35,7 +35,6 @@ ExternalProject_Add( -DHUNTER_ENABLED=OFF # Renamed to "ASSIMP_HUNTER_ENABLED" in newer assimp. -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_DEBUG_POSTFIX= - DEPENDS ext_zlib BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}IrrXML${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index 83f76385e8a..2a9a4b55df1 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -494,47 +494,11 @@ open3d_find_package_3rdparty_library(3rdparty_threads TARGETS Threads::Threads ) -# PNG -if(USE_SYSTEM_PNG) - # ZLIB::ZLIB is automatically included by the PNG package. - open3d_find_package_3rdparty_library(3rdparty_png - PACKAGE PNG - PACKAGE_VERSION_VAR PNG_VERSION_STRING - TARGETS PNG::PNG - ) - if(NOT 3rdparty_png_FOUND) - set(USE_SYSTEM_PNG OFF) - endif() -endif() -if(NOT USE_SYSTEM_PNG) - include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake) - open3d_import_3rdparty_library(3rdparty_zlib - HIDDEN - INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} - LIB_DIR ${ZLIB_LIB_DIR} - LIBRARIES ${ZLIB_LIBRARIES} - DEPENDS ext_zlib - ) - - include(${Open3D_3RDPARTY_DIR}/libpng/libpng.cmake) - open3d_import_3rdparty_library(3rdparty_png - INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS} - LIB_DIR ${LIBPNG_LIB_DIR} - LIBRARIES ${LIBPNG_LIBRARIES} - DEPENDS ext_libpng - ) - target_link_libraries(3rdparty_png INTERFACE Open3D::3rdparty_zlib) - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_png) -else() - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_png) -endif() - # Assimp if(USE_SYSTEM_ASSIMP) open3d_find_package_3rdparty_library(3rdparty_assimp PACKAGE assimp TARGETS assimp::assimp - DEPENDS ext_zlib ) if(NOT 3rdparty_assimp_FOUND) set(USE_SYSTEM_ASSIMP OFF) @@ -962,6 +926,41 @@ if(NOT USE_SYSTEM_CURL) endif() list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_curl Open3D::3rdparty_openssl) +# PNG +if(USE_SYSTEM_PNG) + # ZLIB::ZLIB is automatically included by the PNG package. + open3d_find_package_3rdparty_library(3rdparty_png + PACKAGE PNG + PACKAGE_VERSION_VAR PNG_VERSION_STRING + TARGETS PNG::PNG + ) + if(NOT 3rdparty_png_FOUND) + set(USE_SYSTEM_PNG OFF) + endif() +endif() +if(NOT USE_SYSTEM_PNG) + include(${Open3D_3RDPARTY_DIR}/zlib/zlib.cmake) + open3d_import_3rdparty_library(3rdparty_zlib + HIDDEN + INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} + LIB_DIR ${ZLIB_LIB_DIR} + LIBRARIES ${ZLIB_LIBRARIES} + DEPENDS ext_zlib + ) + + include(${Open3D_3RDPARTY_DIR}/libpng/libpng.cmake) + open3d_import_3rdparty_library(3rdparty_png + INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS} + LIB_DIR ${LIBPNG_LIB_DIR} + LIBRARIES ${LIBPNG_LIBRARIES} + DEPENDS ext_libpng + ) + target_link_libraries(3rdparty_png INTERFACE Open3D::3rdparty_zlib) + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_png) +else() + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_png) +endif() + # rply open3d_build_3rdparty_library(3rdparty_rply DIRECTORY rply SOURCES diff --git a/3rdparty/fmt/fmt.cmake b/3rdparty/fmt/fmt.cmake index 1fc9b72f587..c834d33b7e0 100644 --- a/3rdparty/fmt/fmt.cmake +++ b/3rdparty/fmt/fmt.cmake @@ -2,8 +2,13 @@ include(ExternalProject) set(FMT_LIB_NAME fmt) -set(FMT_VER "10.2.1") -set(FMT_SHA256 "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811") +if (WIN32 AND BUILD_CUDA_MODULE) + set(FMT_VER "10.1.1") + set(FMT_SHA256 "78b8c0a72b1c35e4443a7e308df52498252d1cefc2b08c9a97bc9ee6cfe61f8b") +else () + set(FMT_VER "10.2.1") + set(FMT_SHA256 "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811") +endif() ExternalProject_Add( ext_fmt diff --git a/cpp/pybind/t/geometry/pointcloud.cpp b/cpp/pybind/t/geometry/pointcloud.cpp index b343debe08c..f872b9fcd68 100644 --- a/cpp/pybind/t/geometry/pointcloud.cpp +++ b/cpp/pybind/t/geometry/pointcloud.cpp @@ -261,10 +261,9 @@ void pybind_pointcloud_definitions(py::module& m) { "non-negative number less than number of points in the " "input pointcloud.", "start_index"_a = 0); - pointcloud.def( - "remove_radius_outliers", &PointCloud::RemoveRadiusOutliers, - "nb_points"_a, "search_radius"_a, - R"(Remove points that have less than nb_points neighbors in a + pointcloud.def("remove_radius_outliers", &PointCloud::RemoveRadiusOutliers, + "nb_points"_a, "search_radius"_a, + R"(Remove points that have less than nb_points neighbors in a sphere of a given search radius. Args: From ab4f766153d2d77aa039f654bb526576f680fd3b Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Tue, 24 Jun 2025 11:54:41 -0700 Subject: [PATCH 18/18] Add cudart dependency on WIn32 --- 3rdparty/find_dependencies.cmake | 2 +- .../cmake/open3d-cmake-find-package/CMakeLists.txt | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index 2a9a4b55df1..e4d45db1765 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -1757,7 +1757,7 @@ if(BUILD_CUDA_MODULE) # ship the CUDA toolkit with the wheel (e.g. PyTorch can make use of the # cudatoolkit conda package), or have a mechanism to locate the CUDA # toolkit from the system. - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM CUDA::cusolver CUDA::cublas) + list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM CUDA::cudart CUDA::cusolver CUDA::cublas) else() # CMake docs : https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html # cusolver 11.0: https://docs.nvidia.com/cuda/archive/11.0/cusolver/index.html#static-link-lapack diff --git a/examples/cmake/open3d-cmake-find-package/CMakeLists.txt b/examples/cmake/open3d-cmake-find-package/CMakeLists.txt index 3ca108bb53f..ca4835515b7 100644 --- a/examples/cmake/open3d-cmake-find-package/CMakeLists.txt +++ b/examples/cmake/open3d-cmake-find-package/CMakeLists.txt @@ -15,20 +15,10 @@ endif() # Find installed Open3D, which exports Open3D::Open3D find_package(Open3D REQUIRED) -set(USE_CUDA FALSE) -if (TARGET Open3D::3rdparty_cublas) - set(USE_CUDA TRUE) - enable_language(CUDA) - set(CMAKE_CUDA_STANDARD 17) - find_package(CUDAToolkit REQUIRED) -endif() add_executable(Draw) target_sources(Draw PRIVATE Draw.cpp) target_link_libraries(Draw PRIVATE Open3D::Open3D) -if (USE_CUDA) - target_link_libraries(Draw PRIVATE CUDA::cudart_static) -endif() # On Windows if BUILD_SHARED_LIBS is enabled, copy .dll files to the executable directory if(WIN32)