From e52a20894d4f9419fadb05d26063fcf796c138ab Mon Sep 17 00:00:00 2001 From: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com> Date: Sun, 9 Jun 2024 00:41:16 -0700 Subject: [PATCH] Replace OneDPL with TBB in ParallelScan.h IPP version check for directory layout TBB linking is still WIP Attempt with FetchContent. --- 3rdparty/find_dependencies.cmake | 27 +-- 3rdparty/ipp/ipp.cmake | 12 +- 3rdparty/mkl/tbb.cmake | 26 +-- 3rdparty/mkl/tbb.fetccontent.cmake | 33 ++++ 3rdparty/parallelstl/LICENSE | 218 ------------------------ 3rdparty/parallelstl/parallelstl.cmake | 16 -- CMakeLists.txt | 16 +- cpp/open3d/t/geometry/kernel/IPPImage.h | 3 +- cpp/open3d/utility/ParallelScan.h | 38 ----- 9 files changed, 62 insertions(+), 327 deletions(-) create mode 100644 3rdparty/mkl/tbb.fetccontent.cmake delete mode 100644 3rdparty/parallelstl/LICENSE delete mode 100644 3rdparty/parallelstl/parallelstl.cmake diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index 7bfdfc0397a..25a3c7b0f45 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -1550,9 +1550,9 @@ if(BUILD_SYCL_MODULE) endif() if(BUILD_SYCL_MODULE) - option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB/DPL." ON) + option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB." ON) else() - option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB/DPL." OFF) + option(OPEN3D_USE_ONEAPI_PACKAGES "Use the oneAPI distribution of MKL/TBB." OFF) endif() mark_as_advanced(OPEN3D_USE_ONEAPI_PACKAGES) @@ -1565,17 +1565,7 @@ if(OPEN3D_USE_ONEAPI_PACKAGES) ) list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tbb) - # 2. oneDPL - # /opt/intel/oneapi/dpl/latest/lib/cmake/oneDPL - open3d_find_package_3rdparty_library(3rdparty_onedpl - PACKAGE oneDPL - TARGETS oneDPL - ) - target_compile_definitions(3rdparty_onedpl INTERFACE _GLIBCXX_USE_TBB_PAR_BACKEND=0) - target_compile_definitions(3rdparty_onedpl INTERFACE PSTL_USE_PARALLEL_POLICIES=0) - list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_onedpl) - - # 3. oneMKL + # 2. oneMKL # /opt/intel/oneapi/mkl/latest/lib/cmake/mkl set(MKL_THREADING tbb_thread) set(MKL_LINK static) @@ -1612,16 +1602,6 @@ else(OPEN3D_USE_ONEAPI_PACKAGES) list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tbb) endif() - # parallelstl - include(${Open3D_3RDPARTY_DIR}/parallelstl/parallelstl.cmake) - open3d_import_3rdparty_library(3rdparty_parallelstl - PUBLIC - INCLUDE_DIRS ${PARALLELSTL_INCLUDE_DIRS} - INCLUDE_ALL - DEPENDS ext_parallelstl - ) - list(APPEND Open3D_3RDPARTY_PUBLIC_TARGETS_FROM_SYSTEM Open3D::3rdparty_parallelstl) - # MKL/BLAS if(USE_BLAS) if (USE_SYSTEM_BLAS) @@ -1846,6 +1826,7 @@ if (WITH_IPP) LIB_DIR ${IPP_LIB_DIR} DEPENDS ext_ipp ) + target_compile_definitions(3rdparty_ipp INTERFACE IPP_VERSION_INT=${IPP_VERSION_INT}) list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_ipp) endif() endif() diff --git a/3rdparty/ipp/ipp.cmake b/3rdparty/ipp/ipp.cmake index 497cb13c3e2..bde12be94b4 100755 --- a/3rdparty/ipp/ipp.cmake +++ b/3rdparty/ipp/ipp.cmake @@ -2,13 +2,17 @@ # - IPP_INCLUDE_DIR # - IPP_LIBRARIES # - IPP_LIB_DIR +# - IPP_VERSION_STRING +# - IPP_VERSION_INT (for version check) include(ExternalProject) # Check in order APPLE -> WIN32 -> UNIX, since UNIX may be defined on APPLE / WIN32 as well set(IPP_VERSION_STRING "2021.11.0") # From ipp/ippversion.h +set(IPP_VERSION_INT 20211100) if(APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64) set(IPP_VERSION_STRING "2021.9.1") # From ipp/ippversion.h + set(IPP_VERSION_INT 20210901) set(IPP_URL "https://github.com/isl-org/open3d_downloads/releases/download/mkl-static-2024.1/ipp_static-2021.9.1-macosx_10_15_x86_64.tar.xz") set(IPP_HASH "f27e45da604a1f6d1d2a747a0f67ffafeaff084b0f860a963d8c3996e2f40bb3") elseif(WIN32 AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL AMD64) @@ -24,10 +28,8 @@ else() endif() if(WIN32) - set(TL mt_tl_tbb) set(IPP_SUBPATH "Library/") else() - set(TL _tl_tbb) set(IPP_SUBPATH "") endif() @@ -48,5 +50,9 @@ set(IPP_INCLUDE_DIR "${SOURCE_DIR}/${IPP_SUBPATH}include/") # https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html # Library dependency order: # https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html -set(IPP_LIBRARIES ipp_iw ippcv${TL} ippcv ippi${TL} ippi ippcc${TL} ippcc ipps ippvm ippcore${TL} ippcore) +if (WIN32) + set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt) +else() + set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore) +endif() set(IPP_LIB_DIR "${SOURCE_DIR}/${IPP_SUBPATH}lib") \ No newline at end of file diff --git a/3rdparty/mkl/tbb.cmake b/3rdparty/mkl/tbb.cmake index ccec835df69..a234d87f080 100644 --- a/3rdparty/mkl/tbb.cmake +++ b/3rdparty/mkl/tbb.cmake @@ -1,20 +1,17 @@ # TBB build scripts. -# -# - TBB_INCLUDE_DIR -# - TBB_LIB_DIR -# - TBB_LIBRARIES include(ExternalProject) # Where MKL and TBB headers and libs will be installed. # This needs to be consistent with mkl.cmake. set(MKL_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/mkl_install) -set(STATIC_MKL_INCLUDE_DIR "${MKL_INSTALL_PREFIX}/include/") +set(STATIC_MKL_INCLUDE_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_INCLUDE_DIR}/") set(STATIC_MKL_LIB_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_LIB_DIR}") # TBB variables exported for PyTorch Ops and TensorFlow Ops set(TBB_INCLUDE_DIR "${STATIC_MKL_INCLUDE_DIR}") set(TBB_LIB_DIR "${STATIC_MKL_LIB_DIR}") +set(TBB_RUNTIME_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_BIN_DIR}") set(TBB_LIBRARIES tbb tbbmalloc) ExternalProject_Add( @@ -31,23 +28,26 @@ ExternalProject_Add( -DTBBMALLOC_PROXY_BUILD=OFF -DTBB_TEST=OFF -DCMAKE_INSTALL_LIBDIR=${Open3D_INSTALL_LIB_DIR} + -DCMAKE_INSTALL_BINDIR=${Open3D_INSTALL_BIN_DIR} ${ExternalProject_CMAKE_ARGS} BUILD_BYPRODUCTS ${TBB_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX} ${TBB_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}tbbmalloc${CMAKE_SHARED_LIBRARY_SUFFIX} ) +set(__TBB_BINARY_VERSION 12) # from tbb/version.h # TBB is built and linked as a shared library - this is different from all other Open3D dependencies. add_library(3rdparty_tbb INTERFACE) target_include_directories(3rdparty_tbb SYSTEM INTERFACE $) -set(TBB_LIBRARIES_PATH "") -foreach(TBB_LIBRARY IN LISTS TBB_LIBRARIES) - file(REAL_PATH ${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX} - TBB_LIBRARY_PATH BASE_DIRECTORY ${TBB_LIB_DIR}) - list(APPEND TBB_LIBRARIES_PATH ${TBB_LIBRARY_PATH}) -endforeach() -target_link_libraries(3rdparty_tbb INTERFACE ${TBB_LIBRARIES_PATH}) add_dependencies(3rdparty_tbb ext_tbb) -add_library(${PROJECT_NAME}::3rdparty_tbb ALIAS 3rdparty_tbb) +if (WIN32) + set(TBB_LIBRARIES_PATH "${TBB_LIB_DIR}/tbb${__TBB_BINARY_VERSION}.lib;${TBB_LIB_DIR}/tbbmalloc.lib") + set(TBB_RUNTIMES_PATH "${TBB_RUNTIME_DIR}/tbb${__TBB_BINARY_VERSION}.dll;${TBB_RUNTIME_DIR}/tbbmalloc.dll") + install(FILES ${TBB_RUNTIMES_PATH} DESTINATION ${Open3D_INSTALL_BIN_DIR}) +else() + set(TBB_LIBRARIES_PATH "${TBB_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX};${TBB_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}tbbmalloc${CMAKE_SHARED_LIBRARY_SUFFIX}") +endif() +target_link_libraries(3rdparty_tbb INTERFACE ${TBB_LIBRARIES_PATH}) install(TARGETS 3rdparty_tbb EXPORT ${PROJECT_NAME}Targets) install(FILES ${TBB_LIBRARIES_PATH} DESTINATION ${Open3D_INSTALL_LIB_DIR}) +add_library(${PROJECT_NAME}::3rdparty_tbb ALIAS 3rdparty_tbb) diff --git a/3rdparty/mkl/tbb.fetccontent.cmake b/3rdparty/mkl/tbb.fetccontent.cmake new file mode 100644 index 00000000000..b639bf9a850 --- /dev/null +++ b/3rdparty/mkl/tbb.fetccontent.cmake @@ -0,0 +1,33 @@ +# TBB build scripts. + +include(FetchContent) +cmake_policy(SET CMP0077 NEW) + +# Where MKL and TBB headers and libs will be installed. +# This needs to be consistent with mkl.cmake. +set(MKL_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/mkl_install) +set(STATIC_MKL_INCLUDE_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_INCLUDE_DIR}/") +set(STATIC_MKL_LIB_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_LIB_DIR}") + +# TBB variables exported for PyTorch Ops and TensorFlow Ops +set(TBB_INCLUDE_DIR "${STATIC_MKL_INCLUDE_DIR}") +set(TBB_LIB_DIR "${STATIC_MKL_LIB_DIR}") +set(TBB_RUNTIME_DIR "${MKL_INSTALL_PREFIX}/${Open3D_INSTALL_BIN_DIR}") +set(TBB_LIBRARIES tbb tbbmalloc) + +FetchContent_Declare( + 3rdparty_tbb + URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.12.0.tar.gz # April 2024 + URL_HASH SHA256=c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f + DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/tbb" +) +set(TBBMALLOC_BUILD ON CACHE BOOL "Build TBB malloc library.") +set(TBBMALLOC_PROXY_BUILD OFF CACHE BOOL "Build TBB malloc proxy library.") +set(TBB_TEST OFF CACHE BOOL "Build TBB tests.") +FetchContent_MakeAvailable(3rdparty_tbb) + +# TBB is built and linked as a shared library - this is different from all other Open3D dependencies. +install(TARGETS 3rdparty_tbb EXPORT ${PROJECT_NAME}Targets +LIBRARY DESTINATION ${Open3D_INSTALL_LIB_DIR} +RUNTIME DESTINATION ${Open3D_INSTALL_BIN_DIR}) +add_library(${PROJECT_NAME}::3rdparty_tbb ALIAS 3rdparty_tbb) diff --git a/3rdparty/parallelstl/LICENSE b/3rdparty/parallelstl/LICENSE deleted file mode 100644 index bd8b243dfa0..00000000000 --- a/3rdparty/parallelstl/LICENSE +++ /dev/null @@ -1,218 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ---- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. diff --git a/3rdparty/parallelstl/parallelstl.cmake b/3rdparty/parallelstl/parallelstl.cmake deleted file mode 100644 index ffb10c91f6d..00000000000 --- a/3rdparty/parallelstl/parallelstl.cmake +++ /dev/null @@ -1,16 +0,0 @@ -include(ExternalProject) - -ExternalProject_Add( - ext_parallelstl - PREFIX parallelstl - URL https://github.com/oneapi-src/oneDPL/archive/refs/tags/oneDPL-2022.5.0-rc1.tar.gz - URL_HASH SHA256=9180c60331ec5b307dd89a5d8bfcd096667985c6761c52322405d4b69193ed88 - DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/parallelstl" - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) - -ExternalProject_Get_Property(ext_parallelstl SOURCE_DIR) -set(PARALLELSTL_INCLUDE_DIRS ${SOURCE_DIR}/include/) # "/" is critical. diff --git a/CMakeLists.txt b/CMakeLists.txt index 98cb5bbb99c..f9b0478bbfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,24 +300,9 @@ endif() # Global flag to set CXX standard. # This does not affect 3rd party libraries. -# Tensorflow 2.9+ requires cxx_17, but MSVC 19.29 throws errors with C++17 -# enabled. set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS OFF) # Improved compatibility -# FIXME: Remove this workaround once a fixed Visual Studio 16.10 version is released. -if (BUILD_CUDA_MODULE - AND CMAKE_CXX_COMPILER MATCHES "MSVC" - AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.29" -) - # Keep C++14 standard for unaffected C++ files, but use C++17 for CUDA files. - set(CMAKE_CUDA_STANDARD 17) - # Suppress warnings for deprecated C++17 functions. - add_compile_definitions($<$:_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING>) - message(WARNING "Visual Studio 16.10 (MSVC 19.29) introduced a compiler bug when compiling CUDA code with C++14. " - "Workaround this bug by setting the CUDA standard to C++17.") -endif() - # CMake modules list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmake") @@ -412,6 +397,7 @@ if(BUILD_CUDA_MODULE) message(STATUS "Using CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}") enable_language(CUDA) + set(CMAKE_CUDA_STANDARD 17) if (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "10.1") message(FATAL_ERROR "CUDA 10.0 and older are not supported. Please upgrade to CUDA 10.1 or newer.") diff --git a/cpp/open3d/t/geometry/kernel/IPPImage.h b/cpp/open3d/t/geometry/kernel/IPPImage.h index ef8f4d7c60b..12430f04e4c 100644 --- a/cpp/open3d/t/geometry/kernel/IPPImage.h +++ b/cpp/open3d/t/geometry/kernel/IPPImage.h @@ -11,7 +11,8 @@ #define IPP_ENABLED_THREADING_LAYER_REDEFINITIONS 1 #define IPP_CALL(ipp_function, ...) ipp_function(__VA_ARGS__); -#ifdef APPLE // macOS IPP v2021.9.11 uses old directory layout +#if IPP_VERSION_INT < \ + 20211000 // macOS IPP v2021.9.11 uses old directory layout #include #else // Linux and Windows IPP v2021.10+ uses new directory layout #include diff --git a/cpp/open3d/utility/ParallelScan.h b/cpp/open3d/utility/ParallelScan.h index bb9fc7dcfc8..47f114bb26b 100644 --- a/cpp/open3d/utility/ParallelScan.h +++ b/cpp/open3d/utility/ParallelScan.h @@ -10,34 +10,6 @@ #include #include -// clang-format off -#if TBB_INTERFACE_VERSION >= 10000 - #ifdef OPEN3D_USE_ONEAPI_PACKAGES - #include - #include - #else - // Check if the C++ standard library implements parallel algorithms - // and use this over parallelstl to avoid conflicts. - // Clang does not implement it so far, so checking for C++17 is not sufficient. - #ifdef __cpp_lib_parallel_algorithm - #include - #include - #else - #include - #include - // parallelstl incorrectly assumes MSVC to unconditionally implement - // parallel algorithms even if __cpp_lib_parallel_algorithm is not - // defined. So manually include the header which pulls all - // "pstl::execution" definitions into the "std" namespace. - #if __PSTL_CPP17_EXECUTION_POLICIES_PRESENT - #include - #endif - #endif - #endif -#endif - -// clang-format on - namespace open3d { namespace utility { @@ -69,19 +41,9 @@ class ScanSumBody { template void InclusivePrefixSum(const Tin* first, const Tin* last, Tout* out) { -#if TBB_INTERFACE_VERSION >= 10000 - // use parallelstl if we have TBB 2018 or later -#ifdef OPEN3D_USE_ONEAPI_PACKAGES - std::inclusive_scan(oneapi::dpl::execution::par_unseq, first, last, out); - -#else - std::inclusive_scan(std::execution::par_unseq, first, last, out); -#endif -#else ScanSumBody body(out, first); size_t n = std::distance(first, last); tbb::parallel_scan(tbb::blocked_range(0, n), body); -#endif } } // namespace utility