diff --git a/.gitattributes b/.gitattributes index af5539ed4bd769a294a8ca87d107d88f0bd67ba8..9c899e9d6f9d85be7504c0544042e6f110a20cc2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -98,3 +98,4 @@ miniCUDA124/bin/nvrtc-builtins64_124.dll filter=lfs diff=lfs merge=lfs -text miniCUDA124/bin/nvjpeg64_12.dll filter=lfs diff=lfs merge=lfs -text ffmpeg/bin/avfilter-10.dll filter=lfs diff=lfs merge=lfs -text ComfyUI-YoloWorld-EfficientSAM/efficient_sam_s_cpu.jit filter=lfs diff=lfs merge=lfs -text +miniCUDA124/lib/x64/cudadevrt.lib filter=lfs diff=lfs merge=lfs -text diff --git a/miniCUDA124/lib/cmake/cccl/cccl-config-version.cmake b/miniCUDA124/lib/cmake/cccl/cccl-config-version.cmake new file mode 100644 index 0000000000000000000000000000000000000000..22a8cbeb43d3a4d5abb0adb71d14a0c15d6b98b6 --- /dev/null +++ b/miniCUDA124/lib/cmake/cccl/cccl-config-version.cmake @@ -0,0 +1,22 @@ +set(CCCL_VERSION_MAJOR 2) +set(CCCL_VERSION_MINOR 3) +set(CCCL_VERSION_PATCH 2) +set(CCCL_VERSION_TWEAK 0) + +set(CCCL_VERSION "${CCCL_VERSION_MAJOR}.${CCCL_VERSION_MINOR}.${CCCL_VERSION_PATCH}.${CCCL_VERSION_TWEAK}") + +set(PACKAGE_VERSION ${CCCL_VERSION}) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_UNSUITABLE FALSE) + +# Semantic versioning: +if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION) + if(CCCL_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() + + if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/miniCUDA124/lib/cmake/cccl/cccl-config.cmake b/miniCUDA124/lib/cmake/cccl/cccl-config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d9eeeba50782175f68bdbbfc7a9f0580e307a085 --- /dev/null +++ b/miniCUDA124/lib/cmake/cccl/cccl-config.cmake @@ -0,0 +1,103 @@ +# +# find_package(CCCL) config file. +# +# Imports the Thrust, CUB, and libcudacxx components of the NVIDIA +# CUDA/C++ Core Libraries. + +set(cccl_cmake_dir "${CMAKE_CURRENT_LIST_DIR}") + +if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(cccl_quiet_flag "QUIET") +else() + set(cccl_quiet_flag "") +endif() + +if (DEFINED ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS AND + ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + set(components ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}) +else() + set(components Thrust CUB libcudacxx) +endif() + +if (NOT TARGET CCCL::CCCL) + add_library(CCCL::CCCL INTERFACE IMPORTED GLOBAL) +endif() + +foreach(component IN LISTS components) + string(TOLOWER "${component}" component_lower) + + unset(req) + if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${component}) + set(cccl_comp_required_flag "REQUIRED") + endif() + + if(component_lower STREQUAL "libcudacxx") + find_package(libcudacxx ${CCCL_VERSION} EXACT CONFIG + ${cccl_quiet_flag} + ${cccl_comp_required_flag} + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS + "${cccl_cmake_dir}/../../../libcudacxx/lib/cmake/" # Source layout (GitHub) + "${cccl_cmake_dir}/.." # Install layout + ) + # Can't alias other alias targets, so use the uglified target name instead + # of libcudacxx::libcudacxx: + if (TARGET _libcudacxx_libcudacxx AND NOT TARGET CCCL::libcudacxx) + add_library(CCCL::libcudacxx ALIAS _libcudacxx_libcudacxx) + target_link_libraries(CCCL::CCCL INTERFACE CCCL::libcudacxx) + endif() + elseif(component_lower STREQUAL "cub") + find_package(CUB ${CCCL_VERSION} EXACT CONFIG + ${cccl_quiet_flag} + ${cccl_comp_required_flag} + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS + "${cccl_cmake_dir}/../../../cub/cub/cmake/" # Source layout (GitHub) + "${cccl_cmake_dir}/.." # Install layout + ) + # Can't alias other alias targets, so use the uglified target name instead + # of CUB::CUB: + if (TARGET _CUB_CUB AND NOT TARGET CCCL::CUB) + add_library(CCCL::CUB ALIAS _CUB_CUB) + target_link_libraries(CCCL::CCCL INTERFACE CCCL::CUB) + endif() + elseif(component_lower STREQUAL "thrust") + find_package(Thrust ${CCCL_VERSION} EXACT CONFIG + ${cccl_quiet_flag} + ${cccl_comp_required_flag} + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS + "${cccl_cmake_dir}/../../../thrust/thrust/cmake/" # Source layout (GitHub) + "${cccl_cmake_dir}/.." # Install layout + ) + + if (TARGET Thrust::Thrust AND NOT TARGET CCCL::Thrust) + # By default, configure a CCCL::Thrust target with host=cpp device=cuda + option(CCCL_ENABLE_DEFAULT_THRUST_TARGET + "Create a CCCL::Thrust target using CCCL_THRUST_[HOST|DEVICE]_SYSTEM." + ON + ) + mark_as_advanced(CCCL_ENABLE_DEFAULT_THRUST_TARGET) + if (CCCL_ENABLE_DEFAULT_THRUST_TARGET) + thrust_create_target(CCCL::Thrust FROM_OPTIONS + HOST_OPTION CCCL_THRUST_HOST_SYSTEM + DEVICE_OPTION CCCL_THRUST_DEVICE_SYSTEM + HOST_OPTION_DOC + "Host system for CCCL::Thrust target." + DEVICE_OPTION_DOC + "Device system for CCCL::Thrust target." + ADVANCED + ) + target_link_libraries(CCCL::CCCL INTERFACE CCCL::Thrust) + endif() + endif() + else() + message(FATAL_ERROR "Invalid CCCL component requested: '${component}'") + endif() +endforeach() + +include(FindPackageHandleStandardArgs) +if (NOT CCCL_CONFIG) + set(CCCL_CONFIG "${CMAKE_CURRENT_LIST_FILE}") +endif() +find_package_handle_standard_args(CCCL CONFIG_MODE) diff --git a/miniCUDA124/lib/cmake/cub/cub-config-version.cmake b/miniCUDA124/lib/cmake/cub/cub-config-version.cmake new file mode 100644 index 0000000000000000000000000000000000000000..27e945bfd521d5527ff5ca29b25b6d8314395505 --- /dev/null +++ b/miniCUDA124/lib/cmake/cub/cub-config-version.cmake @@ -0,0 +1,24 @@ +# Parse version information from version.cuh: +include("${CMAKE_CURRENT_LIST_DIR}/cub-header-search.cmake") + +set(CUB_VERSION_MAJOR 2) +set(CUB_VERSION_MINOR 3) +set(CUB_VERSION_PATCH 2) +set(CUB_VERSION_TWEAK 0) +set(CUB_VERSION "${CUB_VERSION_MAJOR}.${CUB_VERSION_MINOR}.${CUB_VERSION_PATCH}.${CUB_VERSION_TWEAK}") + +set(PACKAGE_VERSION ${CUB_VERSION}) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_UNSUITABLE FALSE) + +if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION) + if(CUB_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR AND + CUB_VERSION_MINOR VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MINOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() + + if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/miniCUDA124/lib/cmake/cub/cub-config.cmake b/miniCUDA124/lib/cmake/cub/cub-config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..718fa29a1038c5d5823fdfcf94ded1b2b6d1832e --- /dev/null +++ b/miniCUDA124/lib/cmake/cub/cub-config.cmake @@ -0,0 +1,126 @@ +# +# find_package(CUB) config file. +# +# Defines a CUB::CUB target that may be linked from user projects to include +# CUB. + +if (TARGET CUB::CUB) + return() +endif() + +# Minimum supported libcudacxx version: +set(cub_libcudacxx_version "${CUB_VERSION}") + +function(_cub_declare_interface_alias alias_name ugly_name) + # 1) Only IMPORTED and ALIAS targets can be placed in a namespace. + # 2) When an IMPORTED library is linked to another target, its include + # directories are treated as SYSTEM includes. + # 3) nvcc will automatically check the CUDA Toolkit include path *before* the + # system includes. This means that the Toolkit CUB will *always* be used + # during compilation, and the include paths of an IMPORTED CUB::CUB + # target will never have any effect. + # 4) This behavior can be fixed by setting the property NO_SYSTEM_FROM_IMPORTED + # on EVERY target that links to CUB::CUB. This would be a burden and a + # footgun for our users. Forgetting this would silently pull in the wrong CUB! + # 5) A workaround is to make a non-IMPORTED library outside of the namespace, + # configure it, and then ALIAS it into the namespace (or ALIAS and then + # configure, that seems to work too). + add_library(${ugly_name} INTERFACE) + add_library(${alias_name} ALIAS ${ugly_name}) +endfunction() + +# +# Setup some internal cache variables +# + +# Pull in the include dir detected by cub-config-version.cmake +set(_CUB_INCLUDE_DIR "${_CUB_VERSION_INCLUDE_DIR}" + CACHE INTERNAL "Location of CUB headers." + FORCE +) +unset(_CUB_VERSION_INCLUDE_DIR CACHE) # Clear tmp variable from cache + +if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(_CUB_QUIET ON CACHE INTERNAL "Quiet mode enabled for CUB find_package calls." FORCE) + set(_CUB_QUIET_FLAG "QUIET" CACHE INTERNAL "" FORCE) +else() + set(_CUB_QUIET OFF CACHE INTERNAL "Quiet mode enabled for CUB find_package calls." FORCE) + set(_CUB_QUIET_FLAG "" CACHE INTERNAL "" FORCE) +endif() + +# +# Setup dependencies +# + +if (NOT TARGET CUB::libcudacxx) + if (TARGET Thrust::libcudacxx) + # Prefer the same libcudacxx as Thrust, if available: + _cub_declare_interface_alias(CUB::libcudacxx _CUB_libcudacxx) + target_link_libraries(_CUB_libcudacxx INTERFACE Thrust::libcudacxx) + else() + if (NOT TARGET libcudacxx::libcudacxx) + # First do a non-required search for any co-packaged versions. + # These are preferred. + find_package(libcudacxx ${cub_libcudacxx_version} CONFIG + ${_CUB_QUIET_FLAG} + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS + "${_CUB_INCLUDE_DIR}/../libcudacxx" # Source layout + "${_CUB_CMAKE_DIR}/.." # Install layout + ) + + # A second required search allows externally packaged to be used and fails if + # no suitable package exists. + find_package(libcudacxx ${cub_libcudacxx_version} CONFIG + REQUIRED + ${_CUB_QUIET_FLAG} + ) + endif() + _cub_declare_interface_alias(CUB::libcudacxx _CUB_libcudacxx) + target_link_libraries(_CUB_libcudacxx INTERFACE libcudacxx::libcudacxx) + endif() +endif() + +# +# Setup targets +# + +_cub_declare_interface_alias(CUB::CUB _CUB_CUB) +target_include_directories(_CUB_CUB INTERFACE "${_CUB_INCLUDE_DIR}") +target_link_libraries(_CUB_CUB INTERFACE CUB::libcudacxx) + +if (CUB_IGNORE_DEPRECATED_API OR THRUST_IGNORE_DEPRECATED_API) + target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_API") +endif() + +if (CUB_IGNORE_DEPRECATED_CPP_DIALECT OR + THRUST_IGNORE_DEPRECATED_CPP_DIALECT) + target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_CPP_DIALECT") +endif() + +if (CUB_IGNORE_DEPRECATED_CPP_11 OR + THRUST_IGNORE_DEPRECATED_CPP_11) + target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_CPP_11") +endif() + +if (CUB_IGNORE_DEPRECATED_COMPILER OR + THRUST_IGNORE_DEPRECATED_COMPILER) + target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_COMPILER") +endif() + +# +# Standardize version info +# + +set(CUB_VERSION ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} CACHE INTERNAL "" FORCE) +set(CUB_VERSION_MAJOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR} CACHE INTERNAL "" FORCE) +set(CUB_VERSION_MINOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR} CACHE INTERNAL "" FORCE) +set(CUB_VERSION_PATCH ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH} CACHE INTERNAL "" FORCE) +set(CUB_VERSION_TWEAK ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_TWEAK} CACHE INTERNAL "" FORCE) +set(CUB_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTERNAL "" FORCE) + +include(FindPackageHandleStandardArgs) +if (NOT CUB_CONFIG) + set(CUB_CONFIG "${CMAKE_CURRENT_LIST_FILE}") +endif() +find_package_handle_standard_args(CUB CONFIG_MODE) diff --git a/miniCUDA124/lib/cmake/cub/cub-header-search.cmake b/miniCUDA124/lib/cmake/cub/cub-header-search.cmake new file mode 100644 index 0000000000000000000000000000000000000000..80bce3464e8e4e20048ab5f0b3a9b8039c3ced45 --- /dev/null +++ b/miniCUDA124/lib/cmake/cub/cub-header-search.cmake @@ -0,0 +1,19 @@ +# Parse version information from version.h: +unset(_CUB_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search + +# Find CMAKE_INSTALL_INCLUDEDIR=include directory" +set(from_install_prefix "lib/cmake/cub") + +# Transform to a list of directories, replace each directoy with "../" +# and convert back to a string +string(REGEX REPLACE "/" ";" from_install_prefix "${from_install_prefix}") +list(TRANSFORM from_install_prefix REPLACE ".+" "../") +list(JOIN from_install_prefix "" from_install_prefix) + +find_path(_CUB_VERSION_INCLUDE_DIR cub/version.cuh + NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search + NO_DEFAULT_PATH # Only search explicit paths below: + PATHS + "${CMAKE_CURRENT_LIST_DIR}/${from_install_prefix}/include" +) +set_property(CACHE _CUB_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL) diff --git a/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config-version.cmake b/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config-version.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b724dabe46e591c9b4d96bf5cd6a5fadd5b581f5 --- /dev/null +++ b/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config-version.cmake @@ -0,0 +1,34 @@ +# Parse version information from version header: +include("${CMAKE_CURRENT_LIST_DIR}/libcudacxx-header-search.cmake") + +set(libcudacxx_VERSION_MAJOR 2) +set(libcudacxx_VERSION_MINOR 3) +set(libcudacxx_VERSION_PATCH 2) +set(libcudacxx_VERSION_TWEAK 0) + +set(libcudacxx_VERSION + "${libcudacxx_VERSION_MAJOR}.${libcudacxx_VERSION_MINOR}.${libcudacxx_VERSION_PATCH}.${libcudacxx_VERSION_TWEAK}" +) + +set(PACKAGE_VERSION ${libcudacxx_VERSION}) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_UNSUITABLE FALSE) + +if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION) + # Semantic version check: + if(libcudacxx_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() + + # Special case: Major version 1->2 was bumped to sync with other CCCL + # libraries. There was no break, and requests for 1 are compatible with 2. + if(PACKAGE_FIND_VERSION VERSION_EQUAL 1 AND + libcudacxx_VERSION_MAJOR VERSION_EQUAL 2) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() + + if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config.cmake b/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..824a4976b194749e49ccd723321e22539c8156eb --- /dev/null +++ b/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config.cmake @@ -0,0 +1,58 @@ +# +# find_package(libcudacxx) config file. +# +# Defines a libcudacxx::libcudacxx target that may be linked from user projects to include +# libcudacxx. + +if (TARGET libcudacxx::libcudacxx) + return() +endif() + +function(_libcudacxx_declare_interface_alias alias_name ugly_name) + # 1) Only IMPORTED and ALIAS targets can be placed in a namespace. + # 2) When an IMPORTED library is linked to another target, its include + # directories are treated as SYSTEM includes. + # 3) nvcc will automatically check the CUDA Toolkit include path *before* the + # system includes. This means that the Toolkit libcudacxx will *always* be used + # during compilation, and the include paths of an IMPORTED libcudacxx::libcudacxx + # target will never have any effect. + # 4) This behavior can be fixed by setting the property NO_SYSTEM_FROM_IMPORTED + # on EVERY target that links to libcudacxx::libcudacxx. This would be a burden and a + # footgun for our users. Forgetting this would silently pull in the wrong libcudacxx! + # 5) A workaround is to make a non-IMPORTED library outside of the namespace, + # configure it, and then ALIAS it into the namespace (or ALIAS and then + # configure, that seems to work too). + add_library(${ugly_name} INTERFACE) + + add_library(${alias_name} INTERFACE IMPORTED GLOBAL) + target_link_libraries(${alias_name} INTERFACE ${ugly_name}) +endfunction() + +# +# Setup targets +# + +_libcudacxx_declare_interface_alias(libcudacxx::libcudacxx _libcudacxx_libcudacxx) +# Pull in the include dir detected by libcudacxx-config-version.cmake +set(_libcudacxx_INCLUDE_DIR "${_libcudacxx_VERSION_INCLUDE_DIR}" + CACHE INTERNAL "Location of libcudacxx headers." +) +unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear tmp variable from cache +target_include_directories(_libcudacxx_libcudacxx INTERFACE "${_libcudacxx_INCLUDE_DIR}") + +# +# Standardize version info +# + +set(LIBCUDACXX_VERSION ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} CACHE INTERNAL "") +set(LIBCUDACXX_VERSION_MAJOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR} CACHE INTERNAL "") +set(LIBCUDACXX_VERSION_MINOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR} CACHE INTERNAL "") +set(LIBCUDACXX_VERSION_PATCH ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH} CACHE INTERNAL "") +set(LIBCUDACXX_VERSION_TWEAK ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_TWEAK} CACHE INTERNAL "") +set(LIBCUDACXX_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTERNAL "") + +include(FindPackageHandleStandardArgs) +if (NOT libcudacxx_CONFIG) + set(libcudacxx_CONFIG "${CMAKE_CURRENT_LIST_FILE}") +endif() +find_package_handle_standard_args(libcudacxx CONFIG_MODE) diff --git a/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-header-search.cmake b/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-header-search.cmake new file mode 100644 index 0000000000000000000000000000000000000000..f9003f2eaf525b9191a575f89166bc9045adbb2e --- /dev/null +++ b/miniCUDA124/lib/cmake/libcudacxx/libcudacxx-header-search.cmake @@ -0,0 +1,13 @@ +# Parse version information from version header: +unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search + +# Find CMAKE_INSTALL_INCLUDEDIR=include directory" +set(from_install_prefix "../../../") + +find_path(_libcudacxx_VERSION_INCLUDE_DIR cuda/std/detail/__config + NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search + NO_DEFAULT_PATH # Only search explicit paths below: + PATHS + "${CMAKE_CURRENT_LIST_DIR}/${from_install_prefix}/include" # Install tree +) +set_property(CACHE _libcudacxx_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL) diff --git a/miniCUDA124/lib/cmake/thrust/FindTBB.cmake b/miniCUDA124/lib/cmake/thrust/FindTBB.cmake new file mode 100644 index 0000000000000000000000000000000000000000..01e53d5e746f9eb25c5ae3dc8ff07327e30ac706 --- /dev/null +++ b/miniCUDA124/lib/cmake/thrust/FindTBB.cmake @@ -0,0 +1,446 @@ +# - Find ThreadingBuildingBlocks include dirs and libraries +# Use this module by invoking find_package with the form: +# find_package(TBB +# [REQUIRED] # Fail with error if TBB is not found +# ) # +# Once done, this will define +# +# TBB_FOUND - system has TBB +# TBB_INCLUDE_DIRS - the TBB include directories +# TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or +# malloc proxy +# TBB::tbb - imported target for the TBB library +# +# TBB_VERSION - Product Version Number ("MAJOR.MINOR") +# TBB_VERSION_MAJOR - Major Product Version Number +# TBB_VERSION_MINOR - Minor Product Version Number +# TBB_INTERFACE_VERSION - Engineering Focused Version Number +# TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version +# still supported. This uses the engineering +# focused interface version numbers. +# +# TBB_MALLOC_FOUND - system has TBB malloc library +# TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories +# TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined +# TBB::malloc - imported target for the TBB malloc library +# +# TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library +# TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories +# TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined +# TBB::malloc_proxy - imported target for the TBB malloc proxy library +# +# +# This module reads hints about search locations from variables: +# ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds +# ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation +# ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb +# libraries. Should be specified with ENV TBB_ROOT +# and optionally... +# ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build +# +# +# Modified by Robert Maynard from the original OGRE source +# +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ +# +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- +# +#============================================================================= +# Copyright 2010-2012 Kitware, Inc. +# Copyright 2012 Rolf Eike Beer +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +#============================================================================= +# FindTBB helper functions and macros +# + +#==================================================== +# Fix the library path in case it is a linker script +#==================================================== +function(tbb_extract_real_library library real_library) + if(NOT UNIX OR NOT EXISTS ${library}) + set(${real_library} "${library}" PARENT_SCOPE) + return() + endif() + + #Read in the first 4 bytes and see if they are the ELF magic number + set(_elf_magic "7f454c46") + file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX) + if(_hex_data STREQUAL _elf_magic) + #we have opened a elf binary so this is what + #we should link to + set(${real_library} "${library}" PARENT_SCOPE) + return() + endif() + + file(READ ${library} _data OFFSET 0 LIMIT 1024) + if("${_data}" MATCHES "INPUT \\(([^(]+)\\)") + #extract out the .so name from REGEX MATCH command + set(_proper_so_name "${CMAKE_MATCH_1}") + + #construct path to the real .so which is presumed to be in the same directory + #as the input file + get_filename_component(_so_dir "${library}" DIRECTORY) + set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE) + else() + #unable to determine what this library is so just hope everything works + #and pass it unmodified. + set(${real_library} "${library}" PARENT_SCOPE) + endif() +endfunction() + +#=============================================== +# Do the final processing for the package find. +#=============================================== +macro(findpkg_finish PREFIX TARGET_NAME) + if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) + set(${PREFIX}_FOUND TRUE) + set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) + set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) + else () + if (${PREFIX}_FIND_REQUIRED) + message(FATAL_ERROR "Required library ${PREFIX} not found.") + elseif (NOT ${PREFIX}_FIND_QUIETLY) + message("Library ${PREFIX} not found.") + endif() + return() + endif () + + if (NOT TARGET "TBB::${TARGET_NAME}") + if (${PREFIX}_LIBRARY_RELEASE) + tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) + endif () + if (${PREFIX}_LIBRARY_DEBUG) + tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) + endif () + add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") + if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}" + IMPORTED_LOCATION_DEBUG "${real_debug}" + IMPORTED_LOCATION_RELEASE "${real_release}") + elseif (${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}") + elseif (${PREFIX}_LIBRARY_DEBUG) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_debug}") + endif () + endif () + + #mark the following variables as internal variables + mark_as_advanced(${PREFIX}_INCLUDE_DIR + ${PREFIX}_LIBRARY + ${PREFIX}_LIBRARY_DEBUG + ${PREFIX}_LIBRARY_RELEASE) +endmacro() + +#=============================================== +# Generate debug names from given release names +#=============================================== +macro(get_debug_names PREFIX) + foreach(i ${${PREFIX}}) + set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i}) + endforeach() +endmacro() + +#=============================================== +# See if we have env vars to help us find tbb +#=============================================== +macro(getenv_path VAR) + set(ENV_${VAR} $ENV{${VAR}}) + # replace won't work if var is blank + if (ENV_${VAR}) + string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) + endif () +endmacro() + +#=============================================== +# Couple a set of release AND debug libraries +#=============================================== +macro(make_library_set PREFIX) + if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG) + set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG}) + elseif (${PREFIX}_RELEASE) + set(${PREFIX} ${${PREFIX}_RELEASE}) + elseif (${PREFIX}_DEBUG) + set(${PREFIX} ${${PREFIX}_DEBUG}) + endif () +endmacro() + + +#============================================================================= +# Now to actually find TBB +# + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(TBB_ROOT) + +# initialize search paths +set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT}) +set(TBB_INC_SEARCH_PATH "") +set(TBB_LIB_SEARCH_PATH "") + + +# If user built from sources +set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX}) +if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT) + getenv_path(TBB_BUILD_DIR) + if (NOT ENV_TBB_BUILD_DIR) + set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build) + endif () + + # include directory under ${ENV_TBB_ROOT}/include + list(APPEND TBB_LIB_SEARCH_PATH + ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release + ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug) +endif () + + +# For Windows, let's assume that the user might be using the precompiled +# TBB packages from the main website. These use a rather awkward directory +# structure (at least for automatically finding the right files) depending +# on platform and compiler, but we'll do our best to accommodate it. +# Not adding the same effort for the precompiled linux builds, though. Those +# have different versions for CC compiler versions and linux kernels which +# will never adequately match the user's setup, so there is no feasible way +# to detect the "best" version to use. The user will have to manually +# select the right files. (Chances are the distributions are shipping their +# custom version of tbb, anyway, so the problem is probably nonexistent.) +if (WIN32 AND MSVC) + set(COMPILER_PREFIX "vc7.1") + if (MSVC_VERSION EQUAL 1400) + set(COMPILER_PREFIX "vc8") + elseif(MSVC_VERSION EQUAL 1500) + set(COMPILER_PREFIX "vc9") + elseif(MSVC_VERSION EQUAL 1600) + set(COMPILER_PREFIX "vc10") + elseif(MSVC_VERSION EQUAL 1700) + set(COMPILER_PREFIX "vc11") + elseif(MSVC_VERSION EQUAL 1800) + set(COMPILER_PREFIX "vc12") + elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS_EQUAL 1939) + # 1900-1925 actually spans three Visual Studio versions: + # 1900 = VS 14.0 (v140 toolset) a.k.a. MSVC 2015 + # 1910-1919 = VS 15.0 (v141 toolset) a.k.a. MSVC 2017 + # 1920-1929 = VS 16.0 (v142 toolset) a.k.a. MSVC 2019 + # 1930-1939 = VS 17.0 (v143 toolset) a.k.a. MSVC 2022 + # + # But these are binary compatible and TBB's open source distribution only + # ships a single vs14 lib (as of 2020.0) + set(COMPILER_PREFIX "vc14") + else() + # The next poor soul who finds themselves having to decode visual studio + # version conventions may find these helpful: + # - https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html + # - https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering + message(AUTHOR_WARNING + "Unrecognized MSVC version (${MSVC_VERSION}). " + "Please update FindTBB.cmake. " + "Some TBB_* CMake variables may need to be set manually." + ) + endif () + + # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path + foreach (dir IN LISTS TBB_PREFIX_PATH) + if (CMAKE_CL_64) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX}) + else () + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX}) + endif () + endforeach () +endif () + +# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9) +# and above and AppleClang +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND + NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0) + set (USE_LIBCXX OFF) + cmake_policy(GET CMP0025 POLICY_VAR) + + if (POLICY_VAR STREQUAL "NEW") + if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + set (USE_LIBCXX ON) + endif () + else () + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set (USE_LIBCXX ON) + endif () + endif () + + if (USE_LIBCXX) + foreach (dir IN LISTS TBB_PREFIX_PATH) + list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib) + endforeach () + endif () +endif () + +# check compiler ABI +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(COMPILER_PREFIX) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) + list(APPEND COMPILER_PREFIX "gcc4.7") + endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) + list(APPEND COMPILER_PREFIX "gcc4.4") + endif() + list(APPEND COMPILER_PREFIX "gcc4.1") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(COMPILER_PREFIX) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6) + list(APPEND COMPILER_PREFIX "gcc4.7") + endif() + list(APPEND COMPILER_PREFIX "gcc4.4") +else() # Assume compatibility with 4.4 for other compilers + list(APPEND COMPILER_PREFIX "gcc4.4") +endif () + +# if platform architecture is explicitly specified +set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM}) +if (TBB_ARCH_PLATFORM) + foreach (dir IN LISTS TBB_PREFIX_PATH) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM}) + endforeach () +endif () + +foreach (dir IN LISTS TBB_PREFIX_PATH) + foreach (prefix IN LISTS COMPILER_PREFIX) + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib) + else () + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib) + endif () + endforeach() +endforeach () + +# add general search paths +foreach (dir IN LISTS TBB_PREFIX_PATH) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb + ${dir}/Libs) + list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include + ${dir}/include/tbb) +endforeach () + +set(TBB_LIBRARY_NAMES tbb) +get_debug_names(TBB_LIBRARY_NAMES) + +find_path(TBB_INCLUDE_DIR + NAMES tbb/tbb.h + PATHS ${TBB_INC_SEARCH_PATH}) + +find_library(TBB_LIBRARY_RELEASE + NAMES ${TBB_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH}) +find_library(TBB_LIBRARY_DEBUG + NAMES ${TBB_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH}) +make_library_set(TBB_LIBRARY) + +findpkg_finish(TBB tbb) + +#if we haven't found TBB no point on going any further +if (NOT TBB_FOUND) + return() +endif () + +#============================================================================= +# Look for TBB's malloc package +set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc) +get_debug_names(TBB_MALLOC_LIBRARY_NAMES) + +find_path(TBB_MALLOC_INCLUDE_DIR + NAMES tbb/tbb.h + PATHS ${TBB_INC_SEARCH_PATH}) + +find_library(TBB_MALLOC_LIBRARY_RELEASE + NAMES ${TBB_MALLOC_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH}) +find_library(TBB_MALLOC_LIBRARY_DEBUG + NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH}) +make_library_set(TBB_MALLOC_LIBRARY) + +findpkg_finish(TBB_MALLOC tbbmalloc) + +#============================================================================= +# Look for TBB's malloc proxy package +set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy) +get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES) + +find_path(TBB_MALLOC_PROXY_INCLUDE_DIR + NAMES tbb/tbbmalloc_proxy.h + PATHS ${TBB_INC_SEARCH_PATH}) + +find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE + NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH}) +find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG + NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH}) +make_library_set(TBB_MALLOC_PROXY_LIBRARY) + +findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy) + + +#============================================================================= +# Parse all the version numbers from tbb. +if(NOT TBB_VERSION) + if(EXISTS "${TBB_INCLUDE_DIR}/tbb/version.h") + # The newer oneTBB provides tbb/version.h but no tbb/tbb_stddef.h. + set(version_file "${TBB_INCLUDE_DIR}/tbb/version.h") + else() + # Older TBB provides tbb/tbb_stddef.h but no tbb/version.h. + set(version_file "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h") + endif() + + file(STRINGS + "${version_file}" + TBB_VERSION_CONTENTS + REGEX "VERSION") + + string(REGEX REPLACE + ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" + TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}") + + string(REGEX REPLACE + ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" + TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}") + + string(REGEX REPLACE + ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" + TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") + + string(REGEX REPLACE + ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1" + TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") + + set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") +endif() diff --git a/miniCUDA124/lib/cmake/thrust/README.md b/miniCUDA124/lib/cmake/thrust/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ae296b635b5c1027ee261fd418d3424108fbb5d6 --- /dev/null +++ b/miniCUDA124/lib/cmake/thrust/README.md @@ -0,0 +1,226 @@ +# Using Thrust with CMake + +Thrust provides configuration files that simplify using Thrust +from other CMake projects. Requirements: + +- Thrust >= 1.9.10 +- CMake >= 3.15 + +See the [Fixing Legacy FindThrust.cmake](#fixing-legacy-findthrustcmake) +section for solutions that work on older Thrust versions. + +## User Guide + +#### Default Configuration (CUDA) + +Thrust is configured using a `thrust_create_target` CMake function that +assembles a complete interface to the Thrust library: + +```cmake +find_package(Thrust REQUIRED CONFIG) +thrust_create_target(Thrust) +target_link_libraries(MyProgram Thrust) +``` + +The first argument is the name of the interface target to create, and any +additional options will be used to configure the target. By default, +`thrust_create_target` will configure its result to use CUDA acceleration. + +If desired, `thrust_create_target` may be called multiple times to build +several unique Thrust interface targets with different configurations, as +detailed below. + +**Note:** If CMake is unable to locate Thrust, specify the path to Thrust's CMake +configuration directory (where this README file is located) as `Thrust_DIR`. +If cloning Thrust from github, this would be + +``` +$ cmake . -DThrust_DIR=/thrust/cmake/ +``` + +#### TBB / OpenMP + +To explicitly specify host/device systems, `HOST` and `DEVICE` arguments can be +passed to `thrust_create_target`. If an explicit system is not specified, the +target will default to using CPP for host and/or CUDA for device. + +```cmake +thrust_create_target(ThrustTBB DEVICE TBB) +thrust_create_target(ThrustOMP HOST CPP DEVICE OMP) +``` + +will create targets `ThrustTBB` and `ThrustOMP`. Both will use the serial `CPP` +host system, but will find and use TBB or OpenMP for the device system. + +#### Configure Target from Cache Options + +To allow a Thrust target to be configurable easily via `cmake-gui` or +`ccmake`, pass the `FROM_OPTIONS` flag to `thrust_create_target`. This will add +`THRUST_HOST_SYSTEM` and `THRUST_DEVICE_SYSTEM` options to the CMake cache that +allow selection from the systems supported by this version of Thrust. + +```cmake +thrust_create_target(Thrust FROM_OPTIONS + [HOST_OPTION