diff --git a/CHANGELOG.md b/CHANGELOG.md index 76aee620117..e7db21826c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## Main +- Allow bundling CUDA-DLLs into the pip-package on Windows with BUNDLE_CUDA_SHARED_LIBS. - Corrected documentation for Link Open3D in C++ projects (broken links). - Fix DLLs not being found in Python-package. Also prevent PATH from being searched for DLLs, except CUDA (PR #7108) - Fix MSAA sample count not being copied when FilamentView is copied diff --git a/CMakeLists.txt b/CMakeLists.txt index 47dee3357dc..93fe4ef1787 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,7 @@ option(BUILD_AZURE_KINECT "Build support for Azure Kinect sensor" OFF option(BUILD_TENSORFLOW_OPS "Build ops for TensorFlow" OFF) option(BUILD_PYTORCH_OPS "Build ops for PyTorch" OFF) option(BUNDLE_OPEN3D_ML "Includes the Open3D-ML repo in the wheel" OFF) +option(BUNDLE_CUDA_SHARED_LIBS "Includes CUDA-DLLs in the wheel (win only)" OFF) # Release build options option(DEVELOPER_BUILD "Add +commit_hash to the project version number" ON ) diff --git a/cpp/pybind/CMakeLists.txt b/cpp/pybind/CMakeLists.txt index 982b0eccd8f..9eee2350275 100644 --- a/cpp/pybind/CMakeLists.txt +++ b/cpp/pybind/CMakeLists.txt @@ -127,6 +127,15 @@ install_name_tool -change $libomp_library @rpath/$(basename $libomp_library) \ COMMAND bash update_pybind_libomp.sh COMMENT "Updating pybind to use packaged libomp") endif() +if (WIN32 AND BUILD_CUDA_MODULE AND BUNDLE_CUDA_SHARED_LIBS) + # Just bundle all DLLs from CUDA to avoid having to update + # an explicit listing of required DLLs. + # Only bundling required DLLs would decrease the package size, + # but not by much, as cublas, cusparse and cusolver alone + # need about 1GB. + file(GLOB CUDA_DLLS "${CUDAToolkit_BIN_DIR}/*.dll") + list(APPEND PYTHON_EXTRA_LIBRARIES ${CUDA_DLLS}) +endif() # Use `make python-package` to create the python package in the build directory # The python package will be created at PYTHON_PACKAGE_DST_DIR. It contains: diff --git a/python/open3d/__init__.py b/python/open3d/__init__.py index 87608701d5c..cdde49d26cd 100644 --- a/python/open3d/__init__.py +++ b/python/open3d/__init__.py @@ -44,10 +44,12 @@ ImportWarning, ) try: - if sys.platform == "win32" and sys.version_info >= (3, 8): + if sys.platform == "win32" and sys.version_info >= (3, 8) and not _build_config["BUNDLE_CUDA_SHARED_LIBS"]: # Since Python 3.8, the PATH environment variable is not used to find DLLs anymore. # To allow Windows users to use Open3D with CUDA without running into dependency-problems, # look for the CUDA bin directory in PATH and explicitly add it to the DLL search path. + # Only do this if the CUDA shared libraries are not bundled with Open3D to prevent conflicts + # beteween bundled and system libraries. cuda_bin_path = None for path in os.environ['PATH'].split(';'): # search heuristic: look for a path containing "cuda" and "bin" in this order.