paredeyes commited on
Commit
61bf5da
·
verified ·
1 Parent(s): a1b80c9

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. miniCUDA124/lib/cmake/cccl/cccl-config-version.cmake +22 -0
  3. miniCUDA124/lib/cmake/cccl/cccl-config.cmake +103 -0
  4. miniCUDA124/lib/cmake/cub/cub-config-version.cmake +24 -0
  5. miniCUDA124/lib/cmake/cub/cub-config.cmake +126 -0
  6. miniCUDA124/lib/cmake/cub/cub-header-search.cmake +19 -0
  7. miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config-version.cmake +34 -0
  8. miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config.cmake +58 -0
  9. miniCUDA124/lib/cmake/libcudacxx/libcudacxx-header-search.cmake +13 -0
  10. miniCUDA124/lib/cmake/thrust/FindTBB.cmake +446 -0
  11. miniCUDA124/lib/cmake/thrust/README.md +226 -0
  12. miniCUDA124/lib/cmake/thrust/thrust-config-version.cmake +24 -0
  13. miniCUDA124/lib/cmake/thrust/thrust-config.cmake +744 -0
  14. miniCUDA124/lib/cmake/thrust/thrust-header-search.cmake +19 -0
  15. miniCUDA124/lib/x64/OpenCL.lib +0 -0
  16. miniCUDA124/lib/x64/cudadevrt.lib +3 -0
  17. miniCUDA124/lib/x64/nvJitLink.lib +0 -0
  18. miniCUDA124/lib/x64/nvfatbin.lib +0 -0
  19. miniCUDA124/lib/x64/nvjpeg.lib +0 -0
  20. miniCUDA124/lib/x64/nvml.lib +0 -0
  21. miniCUDA124/lib/x64/nvrtc.lib +0 -0
  22. miniCUDA124/nvvm/include/nvvm.h +351 -0
  23. miniCUDA124/nvvm/lib/x64/nvvm.lib +0 -0
  24. miniCUDA124/nvvm/libdevice/libdevice.10.bc +0 -0
  25. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/concrt140d.dll +0 -0
  26. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140_1d.dll +0 -0
  27. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140_2d.dll +0 -0
  28. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140d.dll +0 -0
  29. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140d_atomic_wait.dll +0 -0
  30. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140d_codecvt_ids.dll +0 -0
  31. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vcruntime140_1d.dll +0 -0
  32. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vcruntime140_threadsd.dll +0 -0
  33. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vcruntime140d.dll +0 -0
  34. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCXXAMP/vcamp140d.dll +0 -0
  35. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugOpenMP/vcomp140d.dll +0 -0
  36. miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.OpenMP.LLVM/libomp140.x86_64.dll +0 -0
  37. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/concrt140.dll +0 -0
  38. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140.dll +0 -0
  39. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_1.dll +0 -0
  40. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_2.dll +0 -0
  41. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_atomic_wait.dll +0 -0
  42. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_codecvt_ids.dll +0 -0
  43. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vccorlib140.dll +0 -0
  44. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vcruntime140.dll +0 -0
  45. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vcruntime140_1.dll +0 -0
  46. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vcruntime140_threads.dll +0 -0
  47. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CXXAMP/vcamp140.dll +0 -0
  48. miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.OpenMP/vcomp140.dll +0 -0
  49. miniMSVC/VC/Tools/MSVC/14.42.34433/include/agents.h +0 -0
  50. miniMSVC/VC/Tools/MSVC/14.42.34433/include/agile.h +459 -0
.gitattributes CHANGED
@@ -98,3 +98,4 @@ miniCUDA124/bin/nvrtc-builtins64_124.dll filter=lfs diff=lfs merge=lfs -text
98
  miniCUDA124/bin/nvjpeg64_12.dll filter=lfs diff=lfs merge=lfs -text
99
  ffmpeg/bin/avfilter-10.dll filter=lfs diff=lfs merge=lfs -text
100
  ComfyUI-YoloWorld-EfficientSAM/efficient_sam_s_cpu.jit filter=lfs diff=lfs merge=lfs -text
 
 
98
  miniCUDA124/bin/nvjpeg64_12.dll filter=lfs diff=lfs merge=lfs -text
99
  ffmpeg/bin/avfilter-10.dll filter=lfs diff=lfs merge=lfs -text
100
  ComfyUI-YoloWorld-EfficientSAM/efficient_sam_s_cpu.jit filter=lfs diff=lfs merge=lfs -text
101
+ miniCUDA124/lib/x64/cudadevrt.lib filter=lfs diff=lfs merge=lfs -text
miniCUDA124/lib/cmake/cccl/cccl-config-version.cmake ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ set(CCCL_VERSION_MAJOR 2)
2
+ set(CCCL_VERSION_MINOR 3)
3
+ set(CCCL_VERSION_PATCH 2)
4
+ set(CCCL_VERSION_TWEAK 0)
5
+
6
+ set(CCCL_VERSION "${CCCL_VERSION_MAJOR}.${CCCL_VERSION_MINOR}.${CCCL_VERSION_PATCH}.${CCCL_VERSION_TWEAK}")
7
+
8
+ set(PACKAGE_VERSION ${CCCL_VERSION})
9
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
10
+ set(PACKAGE_VERSION_EXACT FALSE)
11
+ set(PACKAGE_VERSION_UNSUITABLE FALSE)
12
+
13
+ # Semantic versioning:
14
+ if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION)
15
+ if(CCCL_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR)
16
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
17
+ endif()
18
+
19
+ if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
20
+ set(PACKAGE_VERSION_EXACT TRUE)
21
+ endif()
22
+ endif()
miniCUDA124/lib/cmake/cccl/cccl-config.cmake ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # find_package(CCCL) config file.
3
+ #
4
+ # Imports the Thrust, CUB, and libcudacxx components of the NVIDIA
5
+ # CUDA/C++ Core Libraries.
6
+
7
+ set(cccl_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
8
+
9
+ if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
10
+ set(cccl_quiet_flag "QUIET")
11
+ else()
12
+ set(cccl_quiet_flag "")
13
+ endif()
14
+
15
+ if (DEFINED ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS AND
16
+ ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
17
+ set(components ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
18
+ else()
19
+ set(components Thrust CUB libcudacxx)
20
+ endif()
21
+
22
+ if (NOT TARGET CCCL::CCCL)
23
+ add_library(CCCL::CCCL INTERFACE IMPORTED GLOBAL)
24
+ endif()
25
+
26
+ foreach(component IN LISTS components)
27
+ string(TOLOWER "${component}" component_lower)
28
+
29
+ unset(req)
30
+ if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${component})
31
+ set(cccl_comp_required_flag "REQUIRED")
32
+ endif()
33
+
34
+ if(component_lower STREQUAL "libcudacxx")
35
+ find_package(libcudacxx ${CCCL_VERSION} EXACT CONFIG
36
+ ${cccl_quiet_flag}
37
+ ${cccl_comp_required_flag}
38
+ NO_DEFAULT_PATH # Only check the explicit HINTS below:
39
+ HINTS
40
+ "${cccl_cmake_dir}/../../../libcudacxx/lib/cmake/" # Source layout (GitHub)
41
+ "${cccl_cmake_dir}/.." # Install layout
42
+ )
43
+ # Can't alias other alias targets, so use the uglified target name instead
44
+ # of libcudacxx::libcudacxx:
45
+ if (TARGET _libcudacxx_libcudacxx AND NOT TARGET CCCL::libcudacxx)
46
+ add_library(CCCL::libcudacxx ALIAS _libcudacxx_libcudacxx)
47
+ target_link_libraries(CCCL::CCCL INTERFACE CCCL::libcudacxx)
48
+ endif()
49
+ elseif(component_lower STREQUAL "cub")
50
+ find_package(CUB ${CCCL_VERSION} EXACT CONFIG
51
+ ${cccl_quiet_flag}
52
+ ${cccl_comp_required_flag}
53
+ NO_DEFAULT_PATH # Only check the explicit HINTS below:
54
+ HINTS
55
+ "${cccl_cmake_dir}/../../../cub/cub/cmake/" # Source layout (GitHub)
56
+ "${cccl_cmake_dir}/.." # Install layout
57
+ )
58
+ # Can't alias other alias targets, so use the uglified target name instead
59
+ # of CUB::CUB:
60
+ if (TARGET _CUB_CUB AND NOT TARGET CCCL::CUB)
61
+ add_library(CCCL::CUB ALIAS _CUB_CUB)
62
+ target_link_libraries(CCCL::CCCL INTERFACE CCCL::CUB)
63
+ endif()
64
+ elseif(component_lower STREQUAL "thrust")
65
+ find_package(Thrust ${CCCL_VERSION} EXACT CONFIG
66
+ ${cccl_quiet_flag}
67
+ ${cccl_comp_required_flag}
68
+ NO_DEFAULT_PATH # Only check the explicit HINTS below:
69
+ HINTS
70
+ "${cccl_cmake_dir}/../../../thrust/thrust/cmake/" # Source layout (GitHub)
71
+ "${cccl_cmake_dir}/.." # Install layout
72
+ )
73
+
74
+ if (TARGET Thrust::Thrust AND NOT TARGET CCCL::Thrust)
75
+ # By default, configure a CCCL::Thrust target with host=cpp device=cuda
76
+ option(CCCL_ENABLE_DEFAULT_THRUST_TARGET
77
+ "Create a CCCL::Thrust target using CCCL_THRUST_[HOST|DEVICE]_SYSTEM."
78
+ ON
79
+ )
80
+ mark_as_advanced(CCCL_ENABLE_DEFAULT_THRUST_TARGET)
81
+ if (CCCL_ENABLE_DEFAULT_THRUST_TARGET)
82
+ thrust_create_target(CCCL::Thrust FROM_OPTIONS
83
+ HOST_OPTION CCCL_THRUST_HOST_SYSTEM
84
+ DEVICE_OPTION CCCL_THRUST_DEVICE_SYSTEM
85
+ HOST_OPTION_DOC
86
+ "Host system for CCCL::Thrust target."
87
+ DEVICE_OPTION_DOC
88
+ "Device system for CCCL::Thrust target."
89
+ ADVANCED
90
+ )
91
+ target_link_libraries(CCCL::CCCL INTERFACE CCCL::Thrust)
92
+ endif()
93
+ endif()
94
+ else()
95
+ message(FATAL_ERROR "Invalid CCCL component requested: '${component}'")
96
+ endif()
97
+ endforeach()
98
+
99
+ include(FindPackageHandleStandardArgs)
100
+ if (NOT CCCL_CONFIG)
101
+ set(CCCL_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
102
+ endif()
103
+ find_package_handle_standard_args(CCCL CONFIG_MODE)
miniCUDA124/lib/cmake/cub/cub-config-version.cmake ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parse version information from version.cuh:
2
+ include("${CMAKE_CURRENT_LIST_DIR}/cub-header-search.cmake")
3
+
4
+ set(CUB_VERSION_MAJOR 2)
5
+ set(CUB_VERSION_MINOR 3)
6
+ set(CUB_VERSION_PATCH 2)
7
+ set(CUB_VERSION_TWEAK 0)
8
+ set(CUB_VERSION "${CUB_VERSION_MAJOR}.${CUB_VERSION_MINOR}.${CUB_VERSION_PATCH}.${CUB_VERSION_TWEAK}")
9
+
10
+ set(PACKAGE_VERSION ${CUB_VERSION})
11
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
12
+ set(PACKAGE_VERSION_EXACT FALSE)
13
+ set(PACKAGE_VERSION_UNSUITABLE FALSE)
14
+
15
+ if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION)
16
+ if(CUB_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR AND
17
+ CUB_VERSION_MINOR VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MINOR)
18
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
19
+ endif()
20
+
21
+ if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
22
+ set(PACKAGE_VERSION_EXACT TRUE)
23
+ endif()
24
+ endif()
miniCUDA124/lib/cmake/cub/cub-config.cmake ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # find_package(CUB) config file.
3
+ #
4
+ # Defines a CUB::CUB target that may be linked from user projects to include
5
+ # CUB.
6
+
7
+ if (TARGET CUB::CUB)
8
+ return()
9
+ endif()
10
+
11
+ # Minimum supported libcudacxx version:
12
+ set(cub_libcudacxx_version "${CUB_VERSION}")
13
+
14
+ function(_cub_declare_interface_alias alias_name ugly_name)
15
+ # 1) Only IMPORTED and ALIAS targets can be placed in a namespace.
16
+ # 2) When an IMPORTED library is linked to another target, its include
17
+ # directories are treated as SYSTEM includes.
18
+ # 3) nvcc will automatically check the CUDA Toolkit include path *before* the
19
+ # system includes. This means that the Toolkit CUB will *always* be used
20
+ # during compilation, and the include paths of an IMPORTED CUB::CUB
21
+ # target will never have any effect.
22
+ # 4) This behavior can be fixed by setting the property NO_SYSTEM_FROM_IMPORTED
23
+ # on EVERY target that links to CUB::CUB. This would be a burden and a
24
+ # footgun for our users. Forgetting this would silently pull in the wrong CUB!
25
+ # 5) A workaround is to make a non-IMPORTED library outside of the namespace,
26
+ # configure it, and then ALIAS it into the namespace (or ALIAS and then
27
+ # configure, that seems to work too).
28
+ add_library(${ugly_name} INTERFACE)
29
+ add_library(${alias_name} ALIAS ${ugly_name})
30
+ endfunction()
31
+
32
+ #
33
+ # Setup some internal cache variables
34
+ #
35
+
36
+ # Pull in the include dir detected by cub-config-version.cmake
37
+ set(_CUB_INCLUDE_DIR "${_CUB_VERSION_INCLUDE_DIR}"
38
+ CACHE INTERNAL "Location of CUB headers."
39
+ FORCE
40
+ )
41
+ unset(_CUB_VERSION_INCLUDE_DIR CACHE) # Clear tmp variable from cache
42
+
43
+ if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
44
+ set(_CUB_QUIET ON CACHE INTERNAL "Quiet mode enabled for CUB find_package calls." FORCE)
45
+ set(_CUB_QUIET_FLAG "QUIET" CACHE INTERNAL "" FORCE)
46
+ else()
47
+ set(_CUB_QUIET OFF CACHE INTERNAL "Quiet mode enabled for CUB find_package calls." FORCE)
48
+ set(_CUB_QUIET_FLAG "" CACHE INTERNAL "" FORCE)
49
+ endif()
50
+
51
+ #
52
+ # Setup dependencies
53
+ #
54
+
55
+ if (NOT TARGET CUB::libcudacxx)
56
+ if (TARGET Thrust::libcudacxx)
57
+ # Prefer the same libcudacxx as Thrust, if available:
58
+ _cub_declare_interface_alias(CUB::libcudacxx _CUB_libcudacxx)
59
+ target_link_libraries(_CUB_libcudacxx INTERFACE Thrust::libcudacxx)
60
+ else()
61
+ if (NOT TARGET libcudacxx::libcudacxx)
62
+ # First do a non-required search for any co-packaged versions.
63
+ # These are preferred.
64
+ find_package(libcudacxx ${cub_libcudacxx_version} CONFIG
65
+ ${_CUB_QUIET_FLAG}
66
+ NO_DEFAULT_PATH # Only check the explicit HINTS below:
67
+ HINTS
68
+ "${_CUB_INCLUDE_DIR}/../libcudacxx" # Source layout
69
+ "${_CUB_CMAKE_DIR}/.." # Install layout
70
+ )
71
+
72
+ # A second required search allows externally packaged to be used and fails if
73
+ # no suitable package exists.
74
+ find_package(libcudacxx ${cub_libcudacxx_version} CONFIG
75
+ REQUIRED
76
+ ${_CUB_QUIET_FLAG}
77
+ )
78
+ endif()
79
+ _cub_declare_interface_alias(CUB::libcudacxx _CUB_libcudacxx)
80
+ target_link_libraries(_CUB_libcudacxx INTERFACE libcudacxx::libcudacxx)
81
+ endif()
82
+ endif()
83
+
84
+ #
85
+ # Setup targets
86
+ #
87
+
88
+ _cub_declare_interface_alias(CUB::CUB _CUB_CUB)
89
+ target_include_directories(_CUB_CUB INTERFACE "${_CUB_INCLUDE_DIR}")
90
+ target_link_libraries(_CUB_CUB INTERFACE CUB::libcudacxx)
91
+
92
+ if (CUB_IGNORE_DEPRECATED_API OR THRUST_IGNORE_DEPRECATED_API)
93
+ target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_API")
94
+ endif()
95
+
96
+ if (CUB_IGNORE_DEPRECATED_CPP_DIALECT OR
97
+ THRUST_IGNORE_DEPRECATED_CPP_DIALECT)
98
+ target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_CPP_DIALECT")
99
+ endif()
100
+
101
+ if (CUB_IGNORE_DEPRECATED_CPP_11 OR
102
+ THRUST_IGNORE_DEPRECATED_CPP_11)
103
+ target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_CPP_11")
104
+ endif()
105
+
106
+ if (CUB_IGNORE_DEPRECATED_COMPILER OR
107
+ THRUST_IGNORE_DEPRECATED_COMPILER)
108
+ target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_COMPILER")
109
+ endif()
110
+
111
+ #
112
+ # Standardize version info
113
+ #
114
+
115
+ set(CUB_VERSION ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} CACHE INTERNAL "" FORCE)
116
+ set(CUB_VERSION_MAJOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR} CACHE INTERNAL "" FORCE)
117
+ set(CUB_VERSION_MINOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR} CACHE INTERNAL "" FORCE)
118
+ set(CUB_VERSION_PATCH ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH} CACHE INTERNAL "" FORCE)
119
+ set(CUB_VERSION_TWEAK ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_TWEAK} CACHE INTERNAL "" FORCE)
120
+ set(CUB_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTERNAL "" FORCE)
121
+
122
+ include(FindPackageHandleStandardArgs)
123
+ if (NOT CUB_CONFIG)
124
+ set(CUB_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
125
+ endif()
126
+ find_package_handle_standard_args(CUB CONFIG_MODE)
miniCUDA124/lib/cmake/cub/cub-header-search.cmake ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parse version information from version.h:
2
+ unset(_CUB_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
3
+
4
+ # Find CMAKE_INSTALL_INCLUDEDIR=include directory"
5
+ set(from_install_prefix "lib/cmake/cub")
6
+
7
+ # Transform to a list of directories, replace each directoy with "../"
8
+ # and convert back to a string
9
+ string(REGEX REPLACE "/" ";" from_install_prefix "${from_install_prefix}")
10
+ list(TRANSFORM from_install_prefix REPLACE ".+" "../")
11
+ list(JOIN from_install_prefix "" from_install_prefix)
12
+
13
+ find_path(_CUB_VERSION_INCLUDE_DIR cub/version.cuh
14
+ NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search
15
+ NO_DEFAULT_PATH # Only search explicit paths below:
16
+ PATHS
17
+ "${CMAKE_CURRENT_LIST_DIR}/${from_install_prefix}/include"
18
+ )
19
+ set_property(CACHE _CUB_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL)
miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config-version.cmake ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parse version information from version header:
2
+ include("${CMAKE_CURRENT_LIST_DIR}/libcudacxx-header-search.cmake")
3
+
4
+ set(libcudacxx_VERSION_MAJOR 2)
5
+ set(libcudacxx_VERSION_MINOR 3)
6
+ set(libcudacxx_VERSION_PATCH 2)
7
+ set(libcudacxx_VERSION_TWEAK 0)
8
+
9
+ set(libcudacxx_VERSION
10
+ "${libcudacxx_VERSION_MAJOR}.${libcudacxx_VERSION_MINOR}.${libcudacxx_VERSION_PATCH}.${libcudacxx_VERSION_TWEAK}"
11
+ )
12
+
13
+ set(PACKAGE_VERSION ${libcudacxx_VERSION})
14
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
15
+ set(PACKAGE_VERSION_EXACT FALSE)
16
+ set(PACKAGE_VERSION_UNSUITABLE FALSE)
17
+
18
+ if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION)
19
+ # Semantic version check:
20
+ if(libcudacxx_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR)
21
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
22
+ endif()
23
+
24
+ # Special case: Major version 1->2 was bumped to sync with other CCCL
25
+ # libraries. There was no break, and requests for 1 are compatible with 2.
26
+ if(PACKAGE_FIND_VERSION VERSION_EQUAL 1 AND
27
+ libcudacxx_VERSION_MAJOR VERSION_EQUAL 2)
28
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
29
+ endif()
30
+
31
+ if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
32
+ set(PACKAGE_VERSION_EXACT TRUE)
33
+ endif()
34
+ endif()
miniCUDA124/lib/cmake/libcudacxx/libcudacxx-config.cmake ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # find_package(libcudacxx) config file.
3
+ #
4
+ # Defines a libcudacxx::libcudacxx target that may be linked from user projects to include
5
+ # libcudacxx.
6
+
7
+ if (TARGET libcudacxx::libcudacxx)
8
+ return()
9
+ endif()
10
+
11
+ function(_libcudacxx_declare_interface_alias alias_name ugly_name)
12
+ # 1) Only IMPORTED and ALIAS targets can be placed in a namespace.
13
+ # 2) When an IMPORTED library is linked to another target, its include
14
+ # directories are treated as SYSTEM includes.
15
+ # 3) nvcc will automatically check the CUDA Toolkit include path *before* the
16
+ # system includes. This means that the Toolkit libcudacxx will *always* be used
17
+ # during compilation, and the include paths of an IMPORTED libcudacxx::libcudacxx
18
+ # target will never have any effect.
19
+ # 4) This behavior can be fixed by setting the property NO_SYSTEM_FROM_IMPORTED
20
+ # on EVERY target that links to libcudacxx::libcudacxx. This would be a burden and a
21
+ # footgun for our users. Forgetting this would silently pull in the wrong libcudacxx!
22
+ # 5) A workaround is to make a non-IMPORTED library outside of the namespace,
23
+ # configure it, and then ALIAS it into the namespace (or ALIAS and then
24
+ # configure, that seems to work too).
25
+ add_library(${ugly_name} INTERFACE)
26
+
27
+ add_library(${alias_name} INTERFACE IMPORTED GLOBAL)
28
+ target_link_libraries(${alias_name} INTERFACE ${ugly_name})
29
+ endfunction()
30
+
31
+ #
32
+ # Setup targets
33
+ #
34
+
35
+ _libcudacxx_declare_interface_alias(libcudacxx::libcudacxx _libcudacxx_libcudacxx)
36
+ # Pull in the include dir detected by libcudacxx-config-version.cmake
37
+ set(_libcudacxx_INCLUDE_DIR "${_libcudacxx_VERSION_INCLUDE_DIR}"
38
+ CACHE INTERNAL "Location of libcudacxx headers."
39
+ )
40
+ unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear tmp variable from cache
41
+ target_include_directories(_libcudacxx_libcudacxx INTERFACE "${_libcudacxx_INCLUDE_DIR}")
42
+
43
+ #
44
+ # Standardize version info
45
+ #
46
+
47
+ set(LIBCUDACXX_VERSION ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} CACHE INTERNAL "")
48
+ set(LIBCUDACXX_VERSION_MAJOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR} CACHE INTERNAL "")
49
+ set(LIBCUDACXX_VERSION_MINOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR} CACHE INTERNAL "")
50
+ set(LIBCUDACXX_VERSION_PATCH ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH} CACHE INTERNAL "")
51
+ set(LIBCUDACXX_VERSION_TWEAK ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_TWEAK} CACHE INTERNAL "")
52
+ set(LIBCUDACXX_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTERNAL "")
53
+
54
+ include(FindPackageHandleStandardArgs)
55
+ if (NOT libcudacxx_CONFIG)
56
+ set(libcudacxx_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
57
+ endif()
58
+ find_package_handle_standard_args(libcudacxx CONFIG_MODE)
miniCUDA124/lib/cmake/libcudacxx/libcudacxx-header-search.cmake ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parse version information from version header:
2
+ unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
3
+
4
+ # Find CMAKE_INSTALL_INCLUDEDIR=include directory"
5
+ set(from_install_prefix "../../../")
6
+
7
+ find_path(_libcudacxx_VERSION_INCLUDE_DIR cuda/std/detail/__config
8
+ NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search
9
+ NO_DEFAULT_PATH # Only search explicit paths below:
10
+ PATHS
11
+ "${CMAKE_CURRENT_LIST_DIR}/${from_install_prefix}/include" # Install tree
12
+ )
13
+ set_property(CACHE _libcudacxx_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL)
miniCUDA124/lib/cmake/thrust/FindTBB.cmake ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # - Find ThreadingBuildingBlocks include dirs and libraries
2
+ # Use this module by invoking find_package with the form:
3
+ # find_package(TBB
4
+ # [REQUIRED] # Fail with error if TBB is not found
5
+ # ) #
6
+ # Once done, this will define
7
+ #
8
+ # TBB_FOUND - system has TBB
9
+ # TBB_INCLUDE_DIRS - the TBB include directories
10
+ # TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
11
+ # malloc proxy
12
+ # TBB::tbb - imported target for the TBB library
13
+ #
14
+ # TBB_VERSION - Product Version Number ("MAJOR.MINOR")
15
+ # TBB_VERSION_MAJOR - Major Product Version Number
16
+ # TBB_VERSION_MINOR - Minor Product Version Number
17
+ # TBB_INTERFACE_VERSION - Engineering Focused Version Number
18
+ # TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
19
+ # still supported. This uses the engineering
20
+ # focused interface version numbers.
21
+ #
22
+ # TBB_MALLOC_FOUND - system has TBB malloc library
23
+ # TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
24
+ # TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
25
+ # TBB::malloc - imported target for the TBB malloc library
26
+ #
27
+ # TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
28
+ # TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
29
+ # TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
30
+ # TBB::malloc_proxy - imported target for the TBB malloc proxy library
31
+ #
32
+ #
33
+ # This module reads hints about search locations from variables:
34
+ # ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds
35
+ # ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation
36
+ # ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb
37
+ # libraries. Should be specified with ENV TBB_ROOT
38
+ # and optionally...
39
+ # ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build
40
+ #
41
+ #
42
+ # Modified by Robert Maynard from the original OGRE source
43
+ #
44
+ #-------------------------------------------------------------------
45
+ # This file is part of the CMake build system for OGRE
46
+ # (Object-oriented Graphics Rendering Engine)
47
+ # For the latest info, see http://www.ogre3d.org/
48
+ #
49
+ # The contents of this file are placed in the public domain. Feel
50
+ # free to make use of it in any way you like.
51
+ #-------------------------------------------------------------------
52
+ #
53
+ #=============================================================================
54
+ # Copyright 2010-2012 Kitware, Inc.
55
+ # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
56
+ #
57
+ # Distributed under the OSI-approved BSD License (the "License");
58
+ # see accompanying file Copyright.txt for details.
59
+ #
60
+ # This software is distributed WITHOUT ANY WARRANTY; without even the
61
+ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
62
+ # See the License for more information.
63
+ #=============================================================================
64
+ # (To distribute this file outside of CMake, substitute the full
65
+ # License text for the above reference.)
66
+
67
+
68
+ #=============================================================================
69
+ # FindTBB helper functions and macros
70
+ #
71
+
72
+ #====================================================
73
+ # Fix the library path in case it is a linker script
74
+ #====================================================
75
+ function(tbb_extract_real_library library real_library)
76
+ if(NOT UNIX OR NOT EXISTS ${library})
77
+ set(${real_library} "${library}" PARENT_SCOPE)
78
+ return()
79
+ endif()
80
+
81
+ #Read in the first 4 bytes and see if they are the ELF magic number
82
+ set(_elf_magic "7f454c46")
83
+ file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX)
84
+ if(_hex_data STREQUAL _elf_magic)
85
+ #we have opened a elf binary so this is what
86
+ #we should link to
87
+ set(${real_library} "${library}" PARENT_SCOPE)
88
+ return()
89
+ endif()
90
+
91
+ file(READ ${library} _data OFFSET 0 LIMIT 1024)
92
+ if("${_data}" MATCHES "INPUT \\(([^(]+)\\)")
93
+ #extract out the .so name from REGEX MATCH command
94
+ set(_proper_so_name "${CMAKE_MATCH_1}")
95
+
96
+ #construct path to the real .so which is presumed to be in the same directory
97
+ #as the input file
98
+ get_filename_component(_so_dir "${library}" DIRECTORY)
99
+ set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE)
100
+ else()
101
+ #unable to determine what this library is so just hope everything works
102
+ #and pass it unmodified.
103
+ set(${real_library} "${library}" PARENT_SCOPE)
104
+ endif()
105
+ endfunction()
106
+
107
+ #===============================================
108
+ # Do the final processing for the package find.
109
+ #===============================================
110
+ macro(findpkg_finish PREFIX TARGET_NAME)
111
+ if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
112
+ set(${PREFIX}_FOUND TRUE)
113
+ set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
114
+ set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
115
+ else ()
116
+ if (${PREFIX}_FIND_REQUIRED)
117
+ message(FATAL_ERROR "Required library ${PREFIX} not found.")
118
+ elseif (NOT ${PREFIX}_FIND_QUIETLY)
119
+ message("Library ${PREFIX} not found.")
120
+ endif()
121
+ return()
122
+ endif ()
123
+
124
+ if (NOT TARGET "TBB::${TARGET_NAME}")
125
+ if (${PREFIX}_LIBRARY_RELEASE)
126
+ tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release)
127
+ endif ()
128
+ if (${PREFIX}_LIBRARY_DEBUG)
129
+ tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug)
130
+ endif ()
131
+ add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED)
132
+ set_target_properties(TBB::${TARGET_NAME} PROPERTIES
133
+ INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}")
134
+ if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE)
135
+ set_target_properties(TBB::${TARGET_NAME} PROPERTIES
136
+ IMPORTED_LOCATION "${real_release}"
137
+ IMPORTED_LOCATION_DEBUG "${real_debug}"
138
+ IMPORTED_LOCATION_RELEASE "${real_release}")
139
+ elseif (${PREFIX}_LIBRARY_RELEASE)
140
+ set_target_properties(TBB::${TARGET_NAME} PROPERTIES
141
+ IMPORTED_LOCATION "${real_release}")
142
+ elseif (${PREFIX}_LIBRARY_DEBUG)
143
+ set_target_properties(TBB::${TARGET_NAME} PROPERTIES
144
+ IMPORTED_LOCATION "${real_debug}")
145
+ endif ()
146
+ endif ()
147
+
148
+ #mark the following variables as internal variables
149
+ mark_as_advanced(${PREFIX}_INCLUDE_DIR
150
+ ${PREFIX}_LIBRARY
151
+ ${PREFIX}_LIBRARY_DEBUG
152
+ ${PREFIX}_LIBRARY_RELEASE)
153
+ endmacro()
154
+
155
+ #===============================================
156
+ # Generate debug names from given release names
157
+ #===============================================
158
+ macro(get_debug_names PREFIX)
159
+ foreach(i ${${PREFIX}})
160
+ set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
161
+ endforeach()
162
+ endmacro()
163
+
164
+ #===============================================
165
+ # See if we have env vars to help us find tbb
166
+ #===============================================
167
+ macro(getenv_path VAR)
168
+ set(ENV_${VAR} $ENV{${VAR}})
169
+ # replace won't work if var is blank
170
+ if (ENV_${VAR})
171
+ string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
172
+ endif ()
173
+ endmacro()
174
+
175
+ #===============================================
176
+ # Couple a set of release AND debug libraries
177
+ #===============================================
178
+ macro(make_library_set PREFIX)
179
+ if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
180
+ set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
181
+ elseif (${PREFIX}_RELEASE)
182
+ set(${PREFIX} ${${PREFIX}_RELEASE})
183
+ elseif (${PREFIX}_DEBUG)
184
+ set(${PREFIX} ${${PREFIX}_DEBUG})
185
+ endif ()
186
+ endmacro()
187
+
188
+
189
+ #=============================================================================
190
+ # Now to actually find TBB
191
+ #
192
+
193
+ # Get path, convert backslashes as ${ENV_${var}}
194
+ getenv_path(TBB_ROOT)
195
+
196
+ # initialize search paths
197
+ set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
198
+ set(TBB_INC_SEARCH_PATH "")
199
+ set(TBB_LIB_SEARCH_PATH "")
200
+
201
+
202
+ # If user built from sources
203
+ set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})
204
+ if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)
205
+ getenv_path(TBB_BUILD_DIR)
206
+ if (NOT ENV_TBB_BUILD_DIR)
207
+ set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build)
208
+ endif ()
209
+
210
+ # include directory under ${ENV_TBB_ROOT}/include
211
+ list(APPEND TBB_LIB_SEARCH_PATH
212
+ ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release
213
+ ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug)
214
+ endif ()
215
+
216
+
217
+ # For Windows, let's assume that the user might be using the precompiled
218
+ # TBB packages from the main website. These use a rather awkward directory
219
+ # structure (at least for automatically finding the right files) depending
220
+ # on platform and compiler, but we'll do our best to accommodate it.
221
+ # Not adding the same effort for the precompiled linux builds, though. Those
222
+ # have different versions for CC compiler versions and linux kernels which
223
+ # will never adequately match the user's setup, so there is no feasible way
224
+ # to detect the "best" version to use. The user will have to manually
225
+ # select the right files. (Chances are the distributions are shipping their
226
+ # custom version of tbb, anyway, so the problem is probably nonexistent.)
227
+ if (WIN32 AND MSVC)
228
+ set(COMPILER_PREFIX "vc7.1")
229
+ if (MSVC_VERSION EQUAL 1400)
230
+ set(COMPILER_PREFIX "vc8")
231
+ elseif(MSVC_VERSION EQUAL 1500)
232
+ set(COMPILER_PREFIX "vc9")
233
+ elseif(MSVC_VERSION EQUAL 1600)
234
+ set(COMPILER_PREFIX "vc10")
235
+ elseif(MSVC_VERSION EQUAL 1700)
236
+ set(COMPILER_PREFIX "vc11")
237
+ elseif(MSVC_VERSION EQUAL 1800)
238
+ set(COMPILER_PREFIX "vc12")
239
+ elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS_EQUAL 1939)
240
+ # 1900-1925 actually spans three Visual Studio versions:
241
+ # 1900 = VS 14.0 (v140 toolset) a.k.a. MSVC 2015
242
+ # 1910-1919 = VS 15.0 (v141 toolset) a.k.a. MSVC 2017
243
+ # 1920-1929 = VS 16.0 (v142 toolset) a.k.a. MSVC 2019
244
+ # 1930-1939 = VS 17.0 (v143 toolset) a.k.a. MSVC 2022
245
+ #
246
+ # But these are binary compatible and TBB's open source distribution only
247
+ # ships a single vs14 lib (as of 2020.0)
248
+ set(COMPILER_PREFIX "vc14")
249
+ else()
250
+ # The next poor soul who finds themselves having to decode visual studio
251
+ # version conventions may find these helpful:
252
+ # - https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
253
+ # - https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
254
+ message(AUTHOR_WARNING
255
+ "Unrecognized MSVC version (${MSVC_VERSION}). "
256
+ "Please update FindTBB.cmake. "
257
+ "Some TBB_* CMake variables may need to be set manually."
258
+ )
259
+ endif ()
260
+
261
+ # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
262
+ foreach (dir IN LISTS TBB_PREFIX_PATH)
263
+ if (CMAKE_CL_64)
264
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
265
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
266
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
267
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
268
+ else ()
269
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
270
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
271
+ endif ()
272
+ endforeach ()
273
+ endif ()
274
+
275
+ # For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
276
+ # and above and AppleClang
277
+ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
278
+ NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
279
+ set (USE_LIBCXX OFF)
280
+ cmake_policy(GET CMP0025 POLICY_VAR)
281
+
282
+ if (POLICY_VAR STREQUAL "NEW")
283
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
284
+ set (USE_LIBCXX ON)
285
+ endif ()
286
+ else ()
287
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
288
+ set (USE_LIBCXX ON)
289
+ endif ()
290
+ endif ()
291
+
292
+ if (USE_LIBCXX)
293
+ foreach (dir IN LISTS TBB_PREFIX_PATH)
294
+ list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
295
+ endforeach ()
296
+ endif ()
297
+ endif ()
298
+
299
+ # check compiler ABI
300
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
301
+ set(COMPILER_PREFIX)
302
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
303
+ list(APPEND COMPILER_PREFIX "gcc4.7")
304
+ endif()
305
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
306
+ list(APPEND COMPILER_PREFIX "gcc4.4")
307
+ endif()
308
+ list(APPEND COMPILER_PREFIX "gcc4.1")
309
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
310
+ set(COMPILER_PREFIX)
311
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
312
+ list(APPEND COMPILER_PREFIX "gcc4.7")
313
+ endif()
314
+ list(APPEND COMPILER_PREFIX "gcc4.4")
315
+ else() # Assume compatibility with 4.4 for other compilers
316
+ list(APPEND COMPILER_PREFIX "gcc4.4")
317
+ endif ()
318
+
319
+ # if platform architecture is explicitly specified
320
+ set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
321
+ if (TBB_ARCH_PLATFORM)
322
+ foreach (dir IN LISTS TBB_PREFIX_PATH)
323
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
324
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
325
+ endforeach ()
326
+ endif ()
327
+
328
+ foreach (dir IN LISTS TBB_PREFIX_PATH)
329
+ foreach (prefix IN LISTS COMPILER_PREFIX)
330
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
331
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
332
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
333
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
334
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
335
+ else ()
336
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
337
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
338
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
339
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
340
+ endif ()
341
+ endforeach()
342
+ endforeach ()
343
+
344
+ # add general search paths
345
+ foreach (dir IN LISTS TBB_PREFIX_PATH)
346
+ list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
347
+ ${dir}/Libs)
348
+ list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
349
+ ${dir}/include/tbb)
350
+ endforeach ()
351
+
352
+ set(TBB_LIBRARY_NAMES tbb)
353
+ get_debug_names(TBB_LIBRARY_NAMES)
354
+
355
+ find_path(TBB_INCLUDE_DIR
356
+ NAMES tbb/tbb.h
357
+ PATHS ${TBB_INC_SEARCH_PATH})
358
+
359
+ find_library(TBB_LIBRARY_RELEASE
360
+ NAMES ${TBB_LIBRARY_NAMES}
361
+ PATHS ${TBB_LIB_SEARCH_PATH})
362
+ find_library(TBB_LIBRARY_DEBUG
363
+ NAMES ${TBB_LIBRARY_NAMES_DEBUG}
364
+ PATHS ${TBB_LIB_SEARCH_PATH})
365
+ make_library_set(TBB_LIBRARY)
366
+
367
+ findpkg_finish(TBB tbb)
368
+
369
+ #if we haven't found TBB no point on going any further
370
+ if (NOT TBB_FOUND)
371
+ return()
372
+ endif ()
373
+
374
+ #=============================================================================
375
+ # Look for TBB's malloc package
376
+ set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
377
+ get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
378
+
379
+ find_path(TBB_MALLOC_INCLUDE_DIR
380
+ NAMES tbb/tbb.h
381
+ PATHS ${TBB_INC_SEARCH_PATH})
382
+
383
+ find_library(TBB_MALLOC_LIBRARY_RELEASE
384
+ NAMES ${TBB_MALLOC_LIBRARY_NAMES}
385
+ PATHS ${TBB_LIB_SEARCH_PATH})
386
+ find_library(TBB_MALLOC_LIBRARY_DEBUG
387
+ NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG}
388
+ PATHS ${TBB_LIB_SEARCH_PATH})
389
+ make_library_set(TBB_MALLOC_LIBRARY)
390
+
391
+ findpkg_finish(TBB_MALLOC tbbmalloc)
392
+
393
+ #=============================================================================
394
+ # Look for TBB's malloc proxy package
395
+ set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
396
+ get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
397
+
398
+ find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
399
+ NAMES tbb/tbbmalloc_proxy.h
400
+ PATHS ${TBB_INC_SEARCH_PATH})
401
+
402
+ find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE
403
+ NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES}
404
+ PATHS ${TBB_LIB_SEARCH_PATH})
405
+ find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG
406
+ NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG}
407
+ PATHS ${TBB_LIB_SEARCH_PATH})
408
+ make_library_set(TBB_MALLOC_PROXY_LIBRARY)
409
+
410
+ findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
411
+
412
+
413
+ #=============================================================================
414
+ # Parse all the version numbers from tbb.
415
+ if(NOT TBB_VERSION)
416
+ if(EXISTS "${TBB_INCLUDE_DIR}/tbb/version.h")
417
+ # The newer oneTBB provides tbb/version.h but no tbb/tbb_stddef.h.
418
+ set(version_file "${TBB_INCLUDE_DIR}/tbb/version.h")
419
+ else()
420
+ # Older TBB provides tbb/tbb_stddef.h but no tbb/version.h.
421
+ set(version_file "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h")
422
+ endif()
423
+
424
+ file(STRINGS
425
+ "${version_file}"
426
+ TBB_VERSION_CONTENTS
427
+ REGEX "VERSION")
428
+
429
+ string(REGEX REPLACE
430
+ ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
431
+ TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}")
432
+
433
+ string(REGEX REPLACE
434
+ ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
435
+ TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}")
436
+
437
+ string(REGEX REPLACE
438
+ ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
439
+ TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
440
+
441
+ string(REGEX REPLACE
442
+ ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
443
+ TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
444
+
445
+ set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
446
+ endif()
miniCUDA124/lib/cmake/thrust/README.md ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Using Thrust with CMake
2
+
3
+ Thrust provides configuration files that simplify using Thrust
4
+ from other CMake projects. Requirements:
5
+
6
+ - Thrust >= 1.9.10
7
+ - CMake >= 3.15
8
+
9
+ See the [Fixing Legacy FindThrust.cmake](#fixing-legacy-findthrustcmake)
10
+ section for solutions that work on older Thrust versions.
11
+
12
+ ## User Guide
13
+
14
+ #### Default Configuration (CUDA)
15
+
16
+ Thrust is configured using a `thrust_create_target` CMake function that
17
+ assembles a complete interface to the Thrust library:
18
+
19
+ ```cmake
20
+ find_package(Thrust REQUIRED CONFIG)
21
+ thrust_create_target(Thrust)
22
+ target_link_libraries(MyProgram Thrust)
23
+ ```
24
+
25
+ The first argument is the name of the interface target to create, and any
26
+ additional options will be used to configure the target. By default,
27
+ `thrust_create_target` will configure its result to use CUDA acceleration.
28
+
29
+ If desired, `thrust_create_target` may be called multiple times to build
30
+ several unique Thrust interface targets with different configurations, as
31
+ detailed below.
32
+
33
+ **Note:** If CMake is unable to locate Thrust, specify the path to Thrust's CMake
34
+ configuration directory (where this README file is located) as `Thrust_DIR`.
35
+ If cloning Thrust from github, this would be
36
+
37
+ ```
38
+ $ cmake . -DThrust_DIR=<thrust git repo root>/thrust/cmake/
39
+ ```
40
+
41
+ #### TBB / OpenMP
42
+
43
+ To explicitly specify host/device systems, `HOST` and `DEVICE` arguments can be
44
+ passed to `thrust_create_target`. If an explicit system is not specified, the
45
+ target will default to using CPP for host and/or CUDA for device.
46
+
47
+ ```cmake
48
+ thrust_create_target(ThrustTBB DEVICE TBB)
49
+ thrust_create_target(ThrustOMP HOST CPP DEVICE OMP)
50
+ ```
51
+
52
+ will create targets `ThrustTBB` and `ThrustOMP`. Both will use the serial `CPP`
53
+ host system, but will find and use TBB or OpenMP for the device system.
54
+
55
+ #### Configure Target from Cache Options
56
+
57
+ To allow a Thrust target to be configurable easily via `cmake-gui` or
58
+ `ccmake`, pass the `FROM_OPTIONS` flag to `thrust_create_target`. This will add
59
+ `THRUST_HOST_SYSTEM` and `THRUST_DEVICE_SYSTEM` options to the CMake cache that
60
+ allow selection from the systems supported by this version of Thrust.
61
+
62
+ ```cmake
63
+ thrust_create_target(Thrust FROM_OPTIONS
64
+ [HOST_OPTION <option name>]
65
+ [DEVICE_OPTION <option name>]
66
+ [HOST_OPTION_DOC <doc string>]
67
+ [DEVICE_OPTION_DOC <doc string>]
68
+ [HOST <default host system name>]
69
+ [DEVICE <default device system name>]
70
+ [ADVANCED]
71
+ )
72
+ ```
73
+
74
+ The optional arguments have sensible defaults, but may be configured per
75
+ `thrust_create_target` call:
76
+
77
+ | Argument | Default | Description |
78
+ |---------------------|-------------------------|---------------------------------|
79
+ | `HOST_OPTION` | `THRUST_HOST_SYSTEM` | Name of cache option for host |
80
+ | `DEVICE_OPTION` | `THRUST_DEVICE_SYSTEM` | Name of cache option for device |
81
+ | `HOST_OPTION_DOC` | Thrust's host system. | Docstring for host option |
82
+ | `DEVICE_OPTION_DOC` | Thrust's device system. | Docstring for device option |
83
+ | `HOST` | `CPP` | Default host system |
84
+ | `DEVICE` | `CUDA` | Default device system |
85
+ | `ADVANCED` | *N/A* | Mark cache options advanced |
86
+
87
+ ### Specifying Thrust Version Requirements
88
+
89
+ A specific version of Thrust may be required in the `find_package` call:
90
+
91
+ ```cmake
92
+ find_package(Thrust 1.9.10)
93
+ ```
94
+
95
+ will only consider Thrust installations with version `1.9.10.X`. An exact match
96
+ down to the patch version can be forced by using `EXACT` matching:
97
+
98
+ ```cmake
99
+ find_package(Thrust 1.9.10.1 EXACT)
100
+ ```
101
+
102
+ would only match the 1.9.10.1 release.
103
+
104
+ #### Using an Explicit TBB or OpenMP CMake Target
105
+
106
+ When `thrust_create_target` is called, it will lazily load the requested
107
+ systems on-demand through internal `find_package` calls. If a project already
108
+ uses TBB or OpenMP, it may specify a CMake target for Thrust to share instead:
109
+
110
+ ```cmake
111
+ thrust_set_TBB_target(MyTBBTarget)
112
+ thrust_set_OMP_target(MyOMPTarget)
113
+ ```
114
+
115
+ These functions must be called **before** the corresponding system is loaded
116
+ through `thrust_create_target` or `find_package(Thrust COMPONENT [OMP|TBB])`.
117
+
118
+ #### Using an Explicit libcu++ CMake Target
119
+
120
+ In contrast to the optional TBB/OMP dependencies, there is no
121
+ `thrust_set_libcudacxx_target` function that specifies an explicit libcu++
122
+ target. This is because libcu++ is always required and must be found during the
123
+ initial `find_target(Thrust)` call that defines these functions.
124
+
125
+ To force Thrust to use a specific libcu++ target, ensure that either the
126
+ `Thrust::libcudacxx` or `libcudacxx::libcudacxx` targets are defined prior to
127
+ the first invocation of `find_package(Thrust)`. Thrust will automatically use
128
+ these, giving preference to the `Thrust::libcudacxx` target.
129
+
130
+ #### Testing for Systems
131
+
132
+ The following functions check if a system has been found, either by lazy loading
133
+ through `thrust_create_target` or as a `find_package` `COMPONENT` /
134
+ `OPTIONAL_COMPONENT`:
135
+
136
+ ```cmake
137
+ # Set var_name to TRUE or FALSE if an individual system has been found:
138
+ thrust_is_cuda_system_found(<var_name>)
139
+ thrust_is_cpp_system_found(<var_name>)
140
+ thrust_is_tbb_system_found(<var_name>)
141
+ thrust_is_omp_system_found(<var_name>)
142
+
143
+ # Generic version that takes a component name from CUDA, CPP, TBB, OMP:
144
+ thrust_is_system_found(<component_name> <var_name>)
145
+
146
+ # Defines `THRUST_*_FOUND` variables in the current scope that reflect the
147
+ # state of all known systems. Can be used to refresh these flags after
148
+ # lazy system loading.
149
+ thrust_update_system_found_flags()
150
+ ```
151
+
152
+ #### Debugging
153
+
154
+ Thrust will produce a detailed log describing its targets, cache options, and
155
+ interfaces when `--log-level=VERBOSE` is passed to CMake 3.15.7 or newer:
156
+
157
+ ```
158
+ $ cmake . --log-level=VERBOSE
159
+ ```
160
+
161
+ This can be handy for inspecting interface and dependency information.
162
+
163
+ ## Fixing Legacy FindThrust.cmake
164
+
165
+ A community-created `FindThrust.cmake` module exists and is necessary to find
166
+ Thrust installations prior to Thrust 1.9.10. Its usage is discouraged whenever
167
+ possible and the config files in this directory should be strongly preferred.
168
+ However, projects that need to support old versions of Thrust may still need to
169
+ use the legacy `FindThrust.cmake` with pre-1.9.10 installations.
170
+
171
+ One popular flavor of this find module has a version parsing bug. Projects that
172
+ rely on `FindThrust.cmake` should check for this and patch their copies as
173
+ follows.
174
+
175
+ Replace:
176
+
177
+ ```cmake
178
+ string( REGEX MATCH "^[0-9]" major ${version} )
179
+ string( REGEX REPLACE "^${major}00" "" version "${version}" )
180
+ string( REGEX MATCH "^[0-9]" minor ${version} )
181
+ string( REGEX REPLACE "^${minor}0" "" version "${version}" )
182
+ ```
183
+
184
+ with:
185
+
186
+ ```cmake
187
+ math(EXPR major "${version} / 100000")
188
+ math(EXPR minor "(${version} / 100) % 1000")
189
+ math(EXPR version "${version} % 100")
190
+ ```
191
+
192
+ # Thrust Developer Documentation
193
+
194
+ This portion of the file contains descriptions of Thrust's internal CMake target
195
+ structure for Thrust developers. It should not be necessary for users
196
+ who just want to use Thrust from their projects.
197
+
198
+ ## Internal Targets
199
+
200
+ By default, `find_package(Thrust)` will only create a single `Thrust::Thrust`
201
+ target that describes where the actual Thrust headers are located. It does not
202
+ locate or create configurations for any dependencies; these are lazily loaded
203
+ on-demand by calls to `create_thrust_target`, or when explicitly requested via
204
+ `find_package`'s component mechanism.
205
+
206
+ As mentioned, the basic Thrust interface is described by the `Thrust::Thrust`
207
+ target.
208
+
209
+ Each backend system (`CPP`, `CUDA`, `TBB`, `OMP`) is described by multiple
210
+ targets:
211
+
212
+ - `Thrust::${system}`
213
+ - Specifies an interface configured to build against all
214
+ dependencies for this backend (including `Thrust::Thrust`).
215
+ - For example, the `Thrust::CUDA` target is an interface
216
+ target that combines the interfaces of both Thrust and CUB.
217
+ - `Thrust::${system}::Host`
218
+ - Configures an interface for using a specific host system.
219
+ - Multiple `::Host` targets cannot be combined in the same library/executable.
220
+ Attempting to do so will produce a CMake configuration error.
221
+ - Only defined for systems that support being used as the host.
222
+ - `Thrust::${system}::Device`
223
+ - Configures an interface for using a specific device system.
224
+ - Multiple `::Device` targets cannot be combined in the same library/executable.
225
+ Attempting to do so will produce a CMake configuration error.
226
+ - Only defined for systems that support being used as the device.
miniCUDA124/lib/cmake/thrust/thrust-config-version.cmake ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parse version information from version.h:
2
+ include("${CMAKE_CURRENT_LIST_DIR}/thrust-header-search.cmake")
3
+
4
+ set(THRUST_VERSION_MAJOR 2)
5
+ set(THRUST_VERSION_MINOR 3)
6
+ set(THRUST_VERSION_PATCH 2) # Thrust: "subminor" CMake: "patch"
7
+ set(THRUST_VERSION_TWEAK 0)
8
+ set(THRUST_VERSION "${THRUST_VERSION_MAJOR}.${THRUST_VERSION_MINOR}.${THRUST_VERSION_PATCH}.${THRUST_VERSION_TWEAK}")
9
+
10
+ set(PACKAGE_VERSION ${THRUST_VERSION})
11
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
12
+ set(PACKAGE_VERSION_EXACT FALSE)
13
+ set(PACKAGE_VERSION_UNSUITABLE FALSE)
14
+
15
+ if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION)
16
+ if(THRUST_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR AND
17
+ THRUST_VERSION_MINOR VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MINOR)
18
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
19
+ endif()
20
+
21
+ if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
22
+ set(PACKAGE_VERSION_EXACT TRUE)
23
+ endif()
24
+ endif()
miniCUDA124/lib/cmake/thrust/thrust-config.cmake ADDED
@@ -0,0 +1,744 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # find_package(Thrust) config file.
3
+ #
4
+ # Provided by NVIDIA under the same license as the associated Thrust library.
5
+ #
6
+ # Reply-To: Allison Vacanti <alliepiper16@gmail.com>
7
+ #
8
+ # *****************************************************************************
9
+ # ** The following is a short reference to using Thrust from CMake. **
10
+ # ** For more details, see the README.md in the same directory as this file. **
11
+ # *****************************************************************************
12
+ #
13
+ # # General Usage:
14
+ # find_package(Thrust REQUIRED CONFIG)
15
+ # thrust_create_target(Thrust [options])
16
+ # target_link_libraries(some_project_lib Thrust)
17
+ #
18
+ # # Create default target with: HOST=CPP DEVICE=CUDA
19
+ # thrust_create_target(TargetName)
20
+ #
21
+ # # Create target with: HOST=CPP DEVICE=TBB
22
+ # thrust_create_target(TargetName DEVICE TBB)
23
+ #
24
+ # # Create target with: HOST=TBB DEVICE=OMP
25
+ # thrust_create_target(TargetName HOST TBB DEVICE OMP)
26
+ #
27
+ # # Create CMake cache options THRUST_[HOST|DEVICE]_SYSTEM and configure a
28
+ # # target from them. This allows these systems to be changed by developers at
29
+ # # configure time, per build.
30
+ # thrust_create_target(TargetName FROM_OPTIONS
31
+ # [HOST_OPTION <option_name>] # Optionally rename the host system option
32
+ # [DEVICE_OPTION <option_name>] # Optionally rename the device system option
33
+ # [HOST_OPTION_DOC <doc_string>] # Optionally change the cache label
34
+ # [DEVICE_OPTION_DOC <doc_string>] # Optionally change the cache label
35
+ # [HOST <default system>] # Optionally change the default backend
36
+ # [DEVICE <default system>] # Optionally change the default backend
37
+ # [ADVANCED] # Optionally mark options as advanced
38
+ # )
39
+ #
40
+ # # Use a custom TBB, CUB, and/or OMP
41
+ # # (Note that once set, these cannot be changed. This includes COMPONENT
42
+ # # preloading and lazy lookups in thrust_create_target)
43
+ # find_package(Thrust REQUIRED)
44
+ # thrust_set_CUB_target(MyCUBTarget) # MyXXXTarget contains an existing
45
+ # thrust_set_TBB_target(MyTBBTarget) # interface to XXX for Thrust to use.
46
+ # thrust_set_OMP_target(MyOMPTarget)
47
+ # thrust_create_target(ThrustWithMyCUB DEVICE CUDA)
48
+ # thrust_create_target(ThrustWithMyTBB DEVICE TBB)
49
+ # thrust_create_target(ThrustWithMyOMP DEVICE OMP)
50
+ #
51
+ # # Create target with HOST=CPP DEVICE=CUDA and some advanced flags set
52
+ # thrust_create_target(TargetName
53
+ # IGNORE_DEPRECATED_API # Silence build warnings about deprecated APIs
54
+ # IGNORE_DEPRECATED_CPP_DIALECT # Silence build warnings about deprecated compilers and C++ standards
55
+ # IGNORE_DEPRECATED_CPP_11 # Only silence deprecation warnings for C++11
56
+ # IGNORE_DEPRECATED_COMPILER # Only silence deprecation warnings for old compilers
57
+ # IGNORE_CUB_VERSION # Skip configure-time and compile-time CUB version checks
58
+ # )
59
+ #
60
+ # # Test if a particular system has been loaded. ${var_name} is set to TRUE or
61
+ # # FALSE to indicate if "system" is found.
62
+ # thrust_is_system_found(<system> <var_name>)
63
+ # thrust_is_cuda_system_found(<var_name>)
64
+ # thrust_is_tbb_system_found(<var_name>)
65
+ # thrust_is_omp_system_found(<var_name>)
66
+ # thrust_is_cpp_system_found(<var_name>)
67
+ #
68
+ # # Define / update THRUST_${system}_FOUND flags in current scope
69
+ # thrust_update_system_found_flags()
70
+ #
71
+ # # View verbose log with target and dependency information:
72
+ # $ cmake . --log-level=VERBOSE (CMake 3.15.7 and above)
73
+ #
74
+ # # Print debugging output to status channel:
75
+ # thrust_debug_internal_targets()
76
+ # thrust_debug_target(TargetName "${THRUST_VERSION}")
77
+
78
+ cmake_minimum_required(VERSION 3.15)
79
+
80
+ # Minimum supported libcudacxx version:
81
+ set(thrust_libcudacxx_version "${Thrust_VERSION}")
82
+
83
+ ################################################################################
84
+ # User variables and APIs. Users can rely on these:
85
+ #
86
+
87
+ # Advertise system options:
88
+ set(THRUST_HOST_SYSTEM_OPTIONS
89
+ CPP OMP TBB
90
+ CACHE INTERNAL "Valid Thrust host systems."
91
+ FORCE
92
+ )
93
+ set(THRUST_DEVICE_SYSTEM_OPTIONS
94
+ CUDA CPP OMP TBB
95
+ CACHE INTERNAL "Valid Thrust device systems"
96
+ FORCE
97
+ )
98
+
99
+ # Workaround cmake issue #20670 https://gitlab.kitware.com/cmake/cmake/-/issues/20670
100
+ set(THRUST_VERSION ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} CACHE INTERNAL "" FORCE)
101
+ set(THRUST_VERSION_MAJOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR} CACHE INTERNAL "" FORCE)
102
+ set(THRUST_VERSION_MINOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR} CACHE INTERNAL "" FORCE)
103
+ set(THRUST_VERSION_PATCH ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH} CACHE INTERNAL "" FORCE)
104
+ set(THRUST_VERSION_TWEAK ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_TWEAK} CACHE INTERNAL "" FORCE)
105
+ set(THRUST_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTERNAL "" FORCE)
106
+
107
+ function(thrust_create_target target_name)
108
+ thrust_debug("Assembling target ${target_name}. Options: ${ARGN}" internal)
109
+ set(options
110
+ ADVANCED
111
+ FROM_OPTIONS
112
+ IGNORE_CUB_VERSION_CHECK
113
+ IGNORE_DEPRECATED_API
114
+ IGNORE_DEPRECATED_COMPILER
115
+ IGNORE_DEPRECATED_CPP_11
116
+ IGNORE_DEPRECATED_CPP_DIALECT
117
+ )
118
+ set(keys
119
+ DEVICE
120
+ DEVICE_OPTION
121
+ DEVICE_OPTION_DOC
122
+ HOST
123
+ HOST_OPTION
124
+ HOST_OPTION_DOC
125
+ )
126
+ cmake_parse_arguments(TCT "${options}" "${keys}" "" ${ARGN})
127
+ if (TCT_UNPARSED_ARGUMENTS)
128
+ message(AUTHOR_WARNING
129
+ "Unrecognized arguments passed to thrust_create_target: "
130
+ ${TCT_UNPARSED_ARGUMENTS}
131
+ )
132
+ endif()
133
+
134
+ # Check that the main Thrust internal target is available
135
+ # (functions have global scope, targets have directory scope, so this
136
+ # might happen)
137
+ if (NOT TARGET Thrust::Thrust)
138
+ message(AUTHOR_WARNING
139
+ "The `thrust_create_target` function was called outside the scope of the "
140
+ "thrust targets. Call find_package again to recreate targets."
141
+ )
142
+ endif()
143
+
144
+ _thrust_set_if_undefined(TCT_HOST CPP)
145
+ _thrust_set_if_undefined(TCT_DEVICE CUDA)
146
+ _thrust_set_if_undefined(TCT_HOST_OPTION THRUST_HOST_SYSTEM)
147
+ _thrust_set_if_undefined(TCT_DEVICE_OPTION THRUST_DEVICE_SYSTEM)
148
+ _thrust_set_if_undefined(TCT_HOST_OPTION_DOC "Thrust host system.")
149
+ _thrust_set_if_undefined(TCT_DEVICE_OPTION_DOC "Thrust device system.")
150
+
151
+ if (NOT TCT_HOST IN_LIST THRUST_HOST_SYSTEM_OPTIONS)
152
+ message(FATAL_ERROR
153
+ "Requested HOST=${TCT_HOST}; must be one of ${THRUST_HOST_SYSTEM_OPTIONS}"
154
+ )
155
+ endif()
156
+
157
+ if (NOT TCT_DEVICE IN_LIST THRUST_DEVICE_SYSTEM_OPTIONS)
158
+ message(FATAL_ERROR
159
+ "Requested DEVICE=${TCT_DEVICE}; must be one of ${THRUST_DEVICE_SYSTEM_OPTIONS}"
160
+ )
161
+ endif()
162
+
163
+ if (TCT_FROM_OPTIONS)
164
+ _thrust_create_cache_options(
165
+ ${TCT_HOST} ${TCT_DEVICE}
166
+ ${TCT_HOST_OPTION} ${TCT_DEVICE_OPTION}
167
+ ${TCT_HOST_OPTION_DOC} ${TCT_DEVICE_OPTION_DOC}
168
+ ${TCT_ADVANCED}
169
+ )
170
+ set(TCT_HOST ${${TCT_HOST_OPTION}})
171
+ set(TCT_DEVICE ${${TCT_DEVICE_OPTION}})
172
+ thrust_debug("Current option settings:" internal)
173
+ thrust_debug(" - ${TCT_HOST_OPTION}=${TCT_HOST}" internal)
174
+ thrust_debug(" - ${TCT_DEVICE_OPTION}=${TCT_DEVICE}" internal)
175
+ endif()
176
+
177
+ _thrust_find_backend(${TCT_HOST} REQUIRED)
178
+ _thrust_find_backend(${TCT_DEVICE} REQUIRED)
179
+
180
+ # We can just create an INTERFACE IMPORTED target here instead of going
181
+ # through _thrust_declare_interface_alias as long as we aren't hanging any
182
+ # Thrust/CUB include paths directly on ${target_name}.
183
+ add_library(${target_name} INTERFACE IMPORTED)
184
+ target_link_libraries(${target_name}
185
+ INTERFACE
186
+ Thrust::${TCT_HOST}::Host
187
+ Thrust::${TCT_DEVICE}::Device
188
+ )
189
+
190
+ # This would be nice to enforce, but breaks when using old cmake + new
191
+ # compiler, since cmake doesn't know what features the new compiler version
192
+ # supports.
193
+ # Leaving this here as a reminder not to add it back. Just let the
194
+ # compile-time checks in thrust/detail/config/cpp_dialect.h handle it.
195
+ #
196
+ # if (NOT TCT_IGNORE_DEPRECATED_CPP_DIALECT)
197
+ # if (TCT_IGNORE_DEPRECATED_CPP_11)
198
+ # target_compile_features(${target_name} INTERFACE cxx_std_11)
199
+ # else()
200
+ # target_compile_features(${target_name} INTERFACE cxx_std_14)
201
+ # endif()
202
+ # endif()
203
+
204
+ if (TCT_IGNORE_DEPRECATED_CPP_DIALECT)
205
+ target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_DEPRECATED_CPP_DIALECT")
206
+ endif()
207
+
208
+ if (TCT_IGNORE_DEPRECATED_API)
209
+ target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_DEPRECATED_API")
210
+ endif()
211
+
212
+ if (TCT_IGNORE_DEPRECATED_CPP_11)
213
+ target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_DEPRECATED_CPP_11")
214
+ endif()
215
+
216
+ if (TCT_IGNORE_DEPRECATED_COMPILER)
217
+ target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_DEPRECATED_COMPILER")
218
+ endif()
219
+
220
+ if (TCT_IGNORE_CUB_VERSION_CHECK)
221
+ target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_CUB_VERSION_CHECK")
222
+ else()
223
+ if (("${TCT_HOST}" STREQUAL "CUDA" OR "${TCT_DEVICE}" STREQUAL "CUDA") AND
224
+ (NOT THRUST_VERSION VERSION_EQUAL THRUST_CUB_VERSION))
225
+ message(FATAL_ERROR
226
+ "The version of CUB found by CMake is not compatible with this release of Thrust. "
227
+ "CUB is now included in the CUDA Toolkit, so you no longer need to use your own checkout of CUB. "
228
+ "Pass IGNORE_CUB_VERSION_CHECK to thrust_create_target to ignore. "
229
+ "(CUB ${THRUST_CUB_VERSION}, Thrust ${THRUST_VERSION})."
230
+ )
231
+ endif()
232
+ endif()
233
+
234
+ thrust_debug_target(${target_name} "Thrust ${THRUST_VERSION}" internal)
235
+ endfunction()
236
+
237
+ function(thrust_is_system_found system var_name)
238
+ if (TARGET Thrust::${system})
239
+ set(${var_name} TRUE PARENT_SCOPE)
240
+ else()
241
+ set(${var_name} FALSE PARENT_SCOPE)
242
+ endif()
243
+ endfunction()
244
+
245
+ function(thrust_is_cpp_system_found var_name)
246
+ thrust_is_system_found(CPP ${var_name})
247
+ set(${var_name} ${${var_name}} PARENT_SCOPE)
248
+ endfunction()
249
+
250
+ function(thrust_is_cuda_system_found var_name)
251
+ thrust_is_system_found(CUDA ${var_name})
252
+ set(${var_name} ${${var_name}} PARENT_SCOPE)
253
+ endfunction()
254
+
255
+ function(thrust_is_tbb_system_found var_name)
256
+ thrust_is_system_found(TBB ${var_name})
257
+ set(${var_name} ${${var_name}} PARENT_SCOPE)
258
+ endfunction()
259
+
260
+ function(thrust_is_omp_system_found var_name)
261
+ thrust_is_system_found(OMP ${var_name})
262
+ set(${var_name} ${${var_name}} PARENT_SCOPE)
263
+ endfunction()
264
+
265
+ # Since components are loaded lazily, this will refresh the
266
+ # THRUST_${component}_FOUND flags in the current scope.
267
+ # Alternatively, check system states individually using the
268
+ # thrust_is_system_found functions.
269
+ macro(thrust_update_system_found_flags)
270
+ set(THRUST_FOUND TRUE)
271
+ thrust_is_system_found(CPP THRUST_CPP_FOUND)
272
+ thrust_is_system_found(CUDA THRUST_CUDA_FOUND)
273
+ thrust_is_system_found(TBB THRUST_TBB_FOUND)
274
+ thrust_is_system_found(OMP THRUST_OMP_FOUND)
275
+ endmacro()
276
+
277
+ function(thrust_debug msg)
278
+ # Use the VERBOSE channel when called internally
279
+ # Run `cmake . --log-level=VERBOSE` to view.
280
+ if ("${ARGN}" STREQUAL "internal")
281
+ # If CMake is too old to know about the VERBOSE channel, just be silent.
282
+ # Users reproduce much the same output on the STATUS channel by using:
283
+ # thrust_create_target(Thrust [...])
284
+ # thrust_debug_internal_targets()
285
+ # thrust_debug_target(Thrust)
286
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.7")
287
+ set(channel VERBOSE)
288
+ else()
289
+ return()
290
+ endif()
291
+ else()
292
+ set(channel STATUS)
293
+ endif()
294
+
295
+ message(${channel} "Thrust: ${msg}")
296
+ endfunction()
297
+
298
+ # Print details of the specified target.
299
+ function(thrust_debug_target target_name version)
300
+ if (NOT TARGET ${target_name})
301
+ return()
302
+ endif()
303
+
304
+ set(is_internal "${ARGN}")
305
+
306
+ if (version)
307
+ set(version "(${version})")
308
+ endif()
309
+
310
+ thrust_debug("TargetInfo: ${target_name}: ${version}" ${is_internal})
311
+
312
+ function(_thrust_print_prop_if_set target_name prop)
313
+ get_target_property(value ${target_name} ${prop})
314
+ if (value)
315
+ thrust_debug("TargetInfo: ${target_name} > ${prop}: ${value}" ${is_internal})
316
+ endif()
317
+ endfunction()
318
+
319
+ function(_thrust_print_imported_prop_if_set target_name prop)
320
+ get_target_property(imported ${target_name} IMPORTED)
321
+ get_target_property(type ${target_name} TYPE)
322
+ if (imported AND NOT ${type} STREQUAL "INTERFACE_LIBRARY")
323
+ _thrust_print_prop_if_set(${target_name} ${prop})
324
+ endif()
325
+ endfunction()
326
+
327
+ _thrust_print_prop_if_set(${target_name} ALIASED_TARGET)
328
+ _thrust_print_prop_if_set(${target_name} IMPORTED)
329
+ _thrust_print_prop_if_set(${target_name} INTERFACE_COMPILE_DEFINITIONS)
330
+ _thrust_print_prop_if_set(${target_name} INTERFACE_COMPILE_FEATURES)
331
+ _thrust_print_prop_if_set(${target_name} INTERFACE_COMPILE_OPTIONS)
332
+ _thrust_print_prop_if_set(${target_name} INTERFACE_INCLUDE_DIRECTORIES)
333
+ _thrust_print_prop_if_set(${target_name} INTERFACE_LINK_DEPENDS)
334
+ _thrust_print_prop_if_set(${target_name} INTERFACE_LINK_DIRECTORIES)
335
+ _thrust_print_prop_if_set(${target_name} INTERFACE_LINK_LIBRARIES)
336
+ _thrust_print_prop_if_set(${target_name} INTERFACE_LINK_OPTIONS)
337
+ _thrust_print_prop_if_set(${target_name} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
338
+ _thrust_print_prop_if_set(${target_name} INTERFACE_THRUST_HOST)
339
+ _thrust_print_prop_if_set(${target_name} INTERFACE_THRUST_DEVICE)
340
+ _thrust_print_imported_prop_if_set(${target_name} IMPORTED_LOCATION)
341
+ _thrust_print_imported_prop_if_set(${target_name} IMPORTED_LOCATION_DEBUG)
342
+ _thrust_print_imported_prop_if_set(${target_name} IMPORTED_LOCATION_RELEASE)
343
+ endfunction()
344
+
345
+ function(thrust_debug_internal_targets)
346
+ function(_thrust_debug_backend_targets backend version)
347
+ thrust_debug_target(Thrust::${backend} "${version}")
348
+ thrust_debug_target(Thrust::${backend}::Host "${version}")
349
+ thrust_debug_target(Thrust::${backend}::Device "${version}")
350
+ endfunction()
351
+
352
+ thrust_debug_target(Thrust::Thrust "${THRUST_VERSION}")
353
+
354
+ _thrust_debug_backend_targets(CPP "Thrust ${THRUST_VERSION}")
355
+
356
+ _thrust_debug_backend_targets(OMP "${THRUST_OMP_VERSION}")
357
+ thrust_debug_target(OpenMP::OpenMP_CXX "${THRUST_OMP_VERSION}")
358
+
359
+ _thrust_debug_backend_targets(TBB "${THRUST_TBB_VERSION}")
360
+ thrust_debug_target(TBB:tbb "${THRUST_TBB_VERSION}")
361
+
362
+ _thrust_debug_backend_targets(CUDA "CUB ${THRUST_CUB_VERSION}")
363
+ thrust_debug_target(CUB::CUB "${THRUST_CUB_VERSION}")
364
+ thrust_debug_target(libcudacxx::libcudacxx "${THRUST_libcudacxx_VERSION}")
365
+ endfunction()
366
+
367
+ ################################################################################
368
+ # Internal utilities. Subject to change.
369
+ #
370
+
371
+ function(_thrust_set_if_undefined var)
372
+ if (NOT DEFINED ${var})
373
+ set(${var} ${ARGN} PARENT_SCOPE)
374
+ endif()
375
+ endfunction()
376
+
377
+ function(_thrust_declare_interface_alias alias_name ugly_name)
378
+ # 1) Only IMPORTED and ALIAS targets can be placed in a namespace.
379
+ # 2) When an IMPORTED library is linked to another target, its include
380
+ # directories are treated as SYSTEM includes.
381
+ # 3) nvcc will automatically check the CUDA Toolkit include path *before* the
382
+ # system includes. This means that the Toolkit Thrust will *always* be used
383
+ # during compilation, and the include paths of an IMPORTED Thrust::Thrust
384
+ # target will never have any effect.
385
+ # 4) This behavior can be fixed by setting the property NO_SYSTEM_FROM_IMPORTED
386
+ # on EVERY target that links to Thrust::Thrust. This would be a burden and a
387
+ # footgun for our users. Forgetting this would silently pull in the wrong thrust!
388
+ # 5) A workaround is to make a non-IMPORTED library outside of the namespace,
389
+ # configure it, and then ALIAS it into the namespace (or ALIAS and then
390
+ # configure, that seems to work too).
391
+ add_library(${ugly_name} INTERFACE)
392
+ add_library(${alias_name} ALIAS ${ugly_name})
393
+ endfunction()
394
+
395
+ # Create cache options for selecting the user/device systems with ccmake/cmake-gui.
396
+ function(_thrust_create_cache_options host device host_option device_option host_doc device_doc advanced)
397
+ thrust_debug("Creating system cache options: (advanced=${advanced})" internal)
398
+ thrust_debug(" - Host Option=${host_option} Default=${host} Doc='${host_doc}'" internal)
399
+ thrust_debug(" - Device Option=${device_option} Default=${device} Doc='${device_doc}'" internal)
400
+ set(${host_option} ${host} CACHE STRING "${host_doc}")
401
+ set_property(CACHE ${host_option} PROPERTY STRINGS ${THRUST_HOST_SYSTEM_OPTIONS})
402
+ set(${device_option} ${device} CACHE STRING "${device_doc}")
403
+ set_property(CACHE ${device_option} PROPERTY STRINGS ${THRUST_DEVICE_SYSTEM_OPTIONS})
404
+ if (advanced)
405
+ mark_as_advanced(${host_option} ${device_option})
406
+ endif()
407
+ endfunction()
408
+
409
+ # Create Thrust::${backend}::Host and Thrust::${backend}::Device targets.
410
+ # Assumes that `Thrust::${backend}` and `_Thrust_${backend}` have been created
411
+ # by _thrust_declare_interface_alias and configured to bring in system
412
+ # dependency interfaces (including Thrust::Thrust).
413
+ function(_thrust_setup_system backend)
414
+ set(backend_target_alias "Thrust::${backend}")
415
+
416
+ if (backend IN_LIST THRUST_HOST_SYSTEM_OPTIONS)
417
+ set(host_target "_Thrust_${backend}_Host")
418
+ set(host_target_alias "Thrust::${backend}::Host")
419
+ if (NOT TARGET ${host_target_alias})
420
+ _thrust_declare_interface_alias(${host_target_alias} ${host_target})
421
+ target_compile_definitions(${host_target} INTERFACE
422
+ "THRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_${backend}")
423
+ target_link_libraries(${host_target} INTERFACE ${backend_target_alias})
424
+ set_property(TARGET ${host_target} PROPERTY INTERFACE_THRUST_HOST ${backend})
425
+ set_property(TARGET ${host_target} APPEND PROPERTY COMPATIBLE_INTERFACE_STRING THRUST_HOST)
426
+ thrust_debug_target(${host_target_alias} "" internal)
427
+ endif()
428
+ endif()
429
+
430
+ if (backend IN_LIST THRUST_DEVICE_SYSTEM_OPTIONS)
431
+ set(device_target "_Thrust_${backend}_Device")
432
+ set(device_target_alias "Thrust::${backend}::Device")
433
+ if (NOT TARGET ${device_target_alias})
434
+ _thrust_declare_interface_alias(${device_target_alias} ${device_target})
435
+ target_compile_definitions(${device_target} INTERFACE
436
+ "THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_${backend}")
437
+ target_link_libraries(${device_target} INTERFACE ${backend_target_alias})
438
+ set_property(TARGET ${device_target} PROPERTY INTERFACE_THRUST_DEVICE ${backend})
439
+ set_property(TARGET ${device_target} APPEND PROPERTY COMPATIBLE_INTERFACE_STRING THRUST_DEVICE)
440
+ thrust_debug_target(${device_target_alias} "" internal)
441
+ endif()
442
+ endif()
443
+ endfunction()
444
+
445
+ # Use the provided cub_target for the CUDA backend. If Thrust::CUB already
446
+ # exists, this call has no effect.
447
+ function(thrust_set_CUB_target cub_target)
448
+ if (NOT TARGET Thrust::CUB)
449
+ thrust_debug("Setting CUB target to ${cub_target}" internal)
450
+ # Workaround cmake issue #20670 https://gitlab.kitware.com/cmake/cmake/-/issues/20670
451
+ set(THRUST_CUB_VERSION ${CUB_VERSION} CACHE INTERNAL
452
+ "CUB version used by Thrust"
453
+ FORCE
454
+ )
455
+ _thrust_declare_interface_alias(Thrust::CUB _Thrust_CUB)
456
+ target_link_libraries(_Thrust_CUB INTERFACE ${cub_target})
457
+ thrust_debug_target(${cub_target} "${THRUST_CUB_VERSION}" internal)
458
+ thrust_debug_target(Thrust::CUB "CUB ${THRUST_CUB_VERSION}" internal)
459
+ endif()
460
+ endfunction()
461
+
462
+ # Internal use only -- libcudacxx must be found during the initial
463
+ # `find_package(Thrust)` call and cannot be set afterwards. See README.md in
464
+ # this directory for details on using a specific libcudacxx target.
465
+ function(_thrust_set_libcudacxx_target libcudacxx_target)
466
+ if (NOT TARGET Thrust::libcudacxx)
467
+ thrust_debug("Setting libcudacxx target to ${libcudacxx_target}" internal)
468
+ # Workaround cmake issue #20670 https://gitlab.kitware.com/cmake/cmake/-/issues/20670
469
+ set(THRUST_libcudacxx_VERSION ${libcudacxx_VERSION} CACHE INTERNAL
470
+ "libcudacxx version used by Thrust"
471
+ FORCE
472
+ )
473
+ _thrust_declare_interface_alias(Thrust::libcudacxx _Thrust_libcudacxx)
474
+ target_link_libraries(_Thrust_libcudacxx INTERFACE ${libcudacxx_target})
475
+ thrust_debug_target(${libcudacxx_target} "${THRUST_libcudacxx_VERSION}" internal)
476
+ thrust_debug_target(Thrust::libcudacxx "libcudacxx ${THRUST_libcudacxx_VERSION}" internal)
477
+ endif()
478
+ endfunction()
479
+
480
+ # Use the provided tbb_target for the TBB backend. If Thrust::TBB already
481
+ # exists, this call has no effect.
482
+ function(thrust_set_TBB_target tbb_target)
483
+ if (NOT TARGET Thrust::TBB)
484
+ thrust_debug("Setting TBB target to ${tbb_target}" internal)
485
+ # Workaround cmake issue #20670 https://gitlab.kitware.com/cmake/cmake/-/issues/20670
486
+ set(THRUST_TBB_VERSION ${TBB_VERSION} CACHE INTERNAL
487
+ "TBB version used by Thrust"
488
+ FORCE
489
+ )
490
+ _thrust_declare_interface_alias(Thrust::TBB _Thrust_TBB)
491
+ target_link_libraries(_Thrust_TBB INTERFACE Thrust::Thrust ${tbb_target})
492
+ thrust_debug_target(${tbb_target} "${THRUST_TBB_VERSION}" internal)
493
+ thrust_debug_target(Thrust::TBB "${THRUST_TBB_VERSION}" internal)
494
+ _thrust_setup_system(TBB)
495
+ endif()
496
+ endfunction()
497
+
498
+ # Use the provided omp_target for the OMP backend. If Thrust::OMP already
499
+ # exists, this call has no effect.
500
+ function(thrust_set_OMP_target omp_target)
501
+ if (NOT TARGET Thrust::OMP)
502
+ thrust_debug("Setting OMP target to ${omp_target}" internal)
503
+ # Workaround cmake issue #20670 https://gitlab.kitware.com/cmake/cmake/-/issues/20670
504
+ set(THRUST_OMP_VERSION ${OpenMP_CXX_VERSION} CACHE INTERNAL
505
+ "OpenMP version used by Thrust"
506
+ FORCE
507
+ )
508
+ _thrust_declare_interface_alias(Thrust::OMP _Thrust_OMP)
509
+ target_link_libraries(_Thrust_OMP INTERFACE Thrust::Thrust ${omp_target})
510
+ thrust_debug_target(${omp_target} "${THRUST_OMP_VERSION}" internal)
511
+ thrust_debug_target(Thrust::OMP "${THRUST_OMP_VERSION}" internal)
512
+ _thrust_setup_system(OMP)
513
+ endif()
514
+ endfunction()
515
+
516
+ function(_thrust_find_CPP required)
517
+ if (NOT TARGET Thrust::CPP)
518
+ thrust_debug("Generating CPP targets." internal)
519
+ _thrust_declare_interface_alias(Thrust::CPP _Thrust_CPP)
520
+ target_link_libraries(_Thrust_CPP INTERFACE Thrust::Thrust)
521
+ thrust_debug_target(Thrust::CPP "Thrust ${THRUST_VERSION}" internal)
522
+ _thrust_setup_system(CPP)
523
+ endif()
524
+ endfunction()
525
+
526
+ # This must be a macro instead of a function to ensure that backends passed to
527
+ # find_package(Thrust COMPONENTS [...]) have their full configuration loaded
528
+ # into the current scope. This provides at least some remedy for CMake issue
529
+ # #20670 -- otherwise variables like CUB_VERSION, etc won't be in the caller's
530
+ # scope.
531
+ macro(_thrust_find_CUDA required)
532
+ if (NOT TARGET Thrust::CUB)
533
+ thrust_debug("Searching for CUB ${required}" internal)
534
+ find_package(CUB ${THRUST_VERSION} CONFIG
535
+ ${_THRUST_QUIET_FLAG}
536
+ ${required}
537
+ NO_DEFAULT_PATH # Only check the explicit HINTS below:
538
+ HINTS
539
+ "${_THRUST_INCLUDE_DIR}/dependencies/cub" # Source layout (GitHub)
540
+ "${_THRUST_INCLUDE_DIR}/../cub/cub/cmake" # Source layout (Perforce)
541
+ "${_THRUST_CMAKE_DIR}/.." # Install layout
542
+ )
543
+
544
+ if (TARGET CUB::CUB)
545
+ thrust_set_CUB_target(CUB::CUB)
546
+ else()
547
+ thrust_debug("CUB not found!" internal)
548
+ endif()
549
+ endif()
550
+
551
+ if (NOT TARGET Thrust::CUDA)
552
+ _thrust_declare_interface_alias(Thrust::CUDA _Thrust_CUDA)
553
+ _thrust_setup_system(CUDA)
554
+ target_link_libraries(_Thrust_CUDA INTERFACE
555
+ Thrust::Thrust
556
+ Thrust::CUB
557
+ )
558
+ thrust_debug_target(Thrust::CUDA "" internal)
559
+ endif()
560
+ endmacro()
561
+
562
+ # This must be a macro instead of a function to ensure that backends passed to
563
+ # find_package(Thrust COMPONENTS [...]) have their full configuration loaded
564
+ # into the current scope. This provides at least some remedy for CMake issue
565
+ # #20670 -- otherwise variables like TBB_VERSION, etc won't be in the caller's
566
+ # scope.
567
+ macro(_thrust_find_TBB required)
568
+ if(NOT TARGET Thrust::TBB)
569
+ thrust_debug("Searching for TBB ${required}" internal)
570
+ # Swap in a temporary module path to make sure we use our FindTBB.cmake
571
+ set(_THRUST_STASH_MODULE_PATH "${CMAKE_MODULE_PATH}")
572
+ set(CMAKE_MODULE_PATH "${_THRUST_CMAKE_DIR}")
573
+
574
+ # Push policy CMP0074 to silence warnings about TBB_ROOT being set. This
575
+ # var is used unconventionally in this FindTBB.cmake module.
576
+ # Someday we'll have a suitable TBB cmake configuration and can avoid this.
577
+ cmake_policy(PUSH)
578
+ cmake_policy(SET CMP0074 OLD)
579
+ set(THRUST_TBB_ROOT "" CACHE PATH "Path to the root of the TBB installation.")
580
+ if (TBB_ROOT AND NOT THRUST_TBB_ROOT)
581
+ message(
582
+ "Warning: TBB_ROOT is set. "
583
+ "Thrust uses THRUST_TBB_ROOT to avoid issues with CMake Policy CMP0074. "
584
+ "Please set this variable instead when using Thrust with TBB."
585
+ )
586
+ endif()
587
+ set(TBB_ROOT "${THRUST_TBB_ROOT}")
588
+ set(_THRUST_STASH_TBB_ROOT "${TBB_ROOT}")
589
+
590
+ find_package(TBB
591
+ ${_THRUST_QUIET_FLAG}
592
+ ${required}
593
+ )
594
+
595
+ cmake_policy(POP)
596
+ set(TBB_ROOT "${_THRUST_STASH_TBB_ROOT}")
597
+ set(CMAKE_MODULE_PATH "${_THRUST_STASH_MODULE_PATH}")
598
+
599
+ if (TARGET TBB::tbb)
600
+ thrust_set_TBB_target(TBB::tbb)
601
+ else()
602
+ thrust_debug("TBB not found!" internal)
603
+ endif()
604
+ endif()
605
+ endmacro()
606
+
607
+ # Wrap the OpenMP flags for CUDA targets
608
+ function(thrust_fixup_omp_target omp_target)
609
+ get_target_property(opts ${omp_target} INTERFACE_COMPILE_OPTIONS)
610
+ if (opts MATCHES "\\$<\\$<COMPILE_LANGUAGE:CXX>:([^>]*)>")
611
+ target_compile_options(${omp_target} INTERFACE
612
+ $<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:-Xcompiler=${CMAKE_MATCH_1}>
613
+ )
614
+ endif()
615
+ endfunction()
616
+
617
+ # This must be a macro instead of a function to ensure that backends passed to
618
+ # find_package(Thrust COMPONENTS [...]) have their full configuration loaded
619
+ # into the current scope. This provides at least some remedy for CMake issue
620
+ # #20670 -- otherwise variables like OpenMP_CXX_VERSION, etc won't be in the caller's
621
+ # scope.
622
+ macro(_thrust_find_OMP required)
623
+ if (NOT TARGET Thrust::OMP)
624
+ thrust_debug("Searching for OMP ${required}" internal)
625
+ find_package(OpenMP
626
+ ${_THRUST_QUIET_FLAG}
627
+ ${_THRUST_REQUIRED_FLAG_OMP}
628
+ COMPONENTS CXX
629
+ )
630
+
631
+ if (TARGET OpenMP::OpenMP_CXX)
632
+ thrust_fixup_omp_target(OpenMP::OpenMP_CXX)
633
+ thrust_set_OMP_target(OpenMP::OpenMP_CXX)
634
+ else()
635
+ thrust_debug("OpenMP::OpenMP_CXX not found!" internal)
636
+ endif()
637
+ endif()
638
+ endmacro()
639
+
640
+ # This must be a macro instead of a function to ensure that backends passed to
641
+ # find_package(Thrust COMPONENTS [...]) have their full configuration loaded
642
+ # into the current scope. This provides at least some remedy for CMake issue
643
+ # #20670 -- otherwise variables like CUB_VERSION, etc won't be in the caller's
644
+ # scope.
645
+ macro(_thrust_find_backend backend required)
646
+ # Unfortunately, _thrust_find_${backend}(req) is not valid CMake syntax. Hence
647
+ # why this function exists.
648
+ if ("${backend}" STREQUAL "CPP")
649
+ _thrust_find_CPP("${required}")
650
+ elseif ("${backend}" STREQUAL "CUDA")
651
+ _thrust_find_CUDA("${required}")
652
+ elseif ("${backend}" STREQUAL "TBB")
653
+ _thrust_find_TBB("${required}")
654
+ elseif ("${backend}" STREQUAL "OMP")
655
+ _thrust_find_OMP("${required}")
656
+ else()
657
+ message(FATAL_ERROR "_thrust_find_backend: Invalid system: ${backend}")
658
+ endif()
659
+ endmacro()
660
+
661
+ ################################################################################
662
+ # Initialization. Executed inside find_package(Thrust) call.
663
+ #
664
+
665
+ if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
666
+ set(_THRUST_QUIET ON CACHE INTERNAL "Quiet mode enabled for Thrust find_package calls." FORCE)
667
+ set(_THRUST_QUIET_FLAG "QUIET" CACHE INTERNAL "" FORCE)
668
+ else()
669
+ unset(_THRUST_QUIET CACHE)
670
+ unset(_THRUST_QUIET_FLAG CACHE)
671
+ endif()
672
+
673
+ set(_THRUST_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL
674
+ "Location of thrust-config.cmake"
675
+ FORCE
676
+ )
677
+
678
+ # Internal target that actually holds the Thrust interface. Used by all other Thrust targets.
679
+ if (NOT TARGET Thrust::Thrust)
680
+ _thrust_declare_interface_alias(Thrust::Thrust _Thrust_Thrust)
681
+ # Pull in the include dir detected by thrust-config-version.cmake
682
+ set(_THRUST_INCLUDE_DIR "${_THRUST_VERSION_INCLUDE_DIR}"
683
+ CACHE INTERNAL "Location of Thrust headers."
684
+ FORCE
685
+ )
686
+ unset(_THRUST_VERSION_INCLUDE_DIR CACHE) # Clear tmp variable from cache
687
+ target_include_directories(_Thrust_Thrust INTERFACE "${_THRUST_INCLUDE_DIR}")
688
+ thrust_debug_target(Thrust::Thrust "${THRUST_VERSION}" internal)
689
+ endif()
690
+
691
+ # Find libcudacxx prior to locating backend-specific deps. This ensures that CUB
692
+ # finds the same package.
693
+ if (NOT TARGET Thrust::libcudacxx)
694
+ thrust_debug("Searching for libcudacxx REQUIRED" internal)
695
+
696
+ # First do a non-required search for any co-packaged versions.
697
+ # These are preferred.
698
+ find_package(libcudacxx ${thrust_libcudacxx_version} CONFIG
699
+ ${_THRUST_QUIET_FLAG}
700
+ NO_DEFAULT_PATH # Only check the explicit HINTS below:
701
+ HINTS
702
+ "${_THRUST_INCLUDE_DIR}/../libcudacxx" # Source layout
703
+ "${_THRUST_CMAKE_DIR}/.." # Install layout
704
+ )
705
+
706
+ # A second required search allows externally packaged to be used and fails if
707
+ # no suitable package exists.
708
+ find_package(libcudacxx ${thrust_libcudacxx_version} CONFIG
709
+ REQUIRED
710
+ ${_THRUST_QUIET_FLAG}
711
+ )
712
+
713
+ if (TARGET libcudacxx::libcudacxx)
714
+ _thrust_set_libcudacxx_target(libcudacxx::libcudacxx)
715
+ else()
716
+ thrust_debug("Expected libcudacxx::libcudacxx target not found!" internal)
717
+ endif()
718
+
719
+ target_link_libraries(_Thrust_Thrust INTERFACE Thrust::libcudacxx)
720
+ endif()
721
+
722
+ # Handle find_package COMPONENT requests:
723
+ foreach(component ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
724
+ if (NOT component IN_LIST THRUST_HOST_SYSTEM_OPTIONS AND
725
+ NOT component IN_LIST THRUST_DEVICE_SYSTEM_OPTIONS)
726
+ message(FATAL_ERROR "Invalid component requested: '${component}'")
727
+ endif()
728
+
729
+ unset(req)
730
+ if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${component})
731
+ set(req "REQUIRED")
732
+ endif()
733
+
734
+ thrust_debug("Preloading COMPONENT '${component}' ${req}" internal)
735
+ _thrust_find_backend(${component} "${req}")
736
+ endforeach()
737
+
738
+ thrust_update_system_found_flags()
739
+
740
+ include(FindPackageHandleStandardArgs)
741
+ if (NOT Thrust_CONFIG)
742
+ set(Thrust_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
743
+ endif()
744
+ find_package_handle_standard_args(Thrust CONFIG_MODE)
miniCUDA124/lib/cmake/thrust/thrust-header-search.cmake ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parse version information from version.h:
2
+ unset(_THRUST_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
3
+
4
+ # Find CMAKE_INSTALL_INCLUDEDIR=include directory"
5
+ set(from_install_prefix "lib/cmake/thrust")
6
+
7
+ # Transform to a list of directories, replace each directoy with "../"
8
+ # and convert back to a string
9
+ string(REGEX REPLACE "/" ";" from_install_prefix "${from_install_prefix}")
10
+ list(TRANSFORM from_install_prefix REPLACE ".+" "../")
11
+ list(JOIN from_install_prefix "" from_install_prefix)
12
+
13
+ find_path(_THRUST_VERSION_INCLUDE_DIR thrust/version.h
14
+ NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search
15
+ NO_DEFAULT_PATH # Only search explicit paths below:
16
+ PATHS
17
+ "${CMAKE_CURRENT_LIST_DIR}/${from_install_prefix}/include"
18
+ )
19
+ set_property(CACHE _THRUST_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL)
miniCUDA124/lib/x64/OpenCL.lib ADDED
Binary file (28.8 kB). View file
 
miniCUDA124/lib/x64/cudadevrt.lib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:962b4ff5365b2e0f922a7e482f57bd778be255b8135619f0a8e9f2c25893e8bf
3
+ size 1604608
miniCUDA124/lib/x64/nvJitLink.lib ADDED
Binary file (22.7 kB). View file
 
miniCUDA124/lib/x64/nvfatbin.lib ADDED
Binary file (3.56 kB). View file
 
miniCUDA124/lib/x64/nvjpeg.lib ADDED
Binary file (22 kB). View file
 
miniCUDA124/lib/x64/nvml.lib ADDED
Binary file (95.3 kB). View file
 
miniCUDA124/lib/x64/nvrtc.lib ADDED
Binary file (6.44 kB). View file
 
miniCUDA124/nvvm/include/nvvm.h ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // NVIDIA_COPYRIGHT_BEGIN
3
+ //
4
+ // Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
5
+ //
6
+ // NVIDIA CORPORATION and its licensors retain all intellectual property
7
+ // and proprietary rights in and to this software, related documentation
8
+ // and any modifications thereto. Any use, reproduction, disclosure or
9
+ // distribution of this software and related documentation without an express
10
+ // license agreement from NVIDIA CORPORATION is strictly prohibited.
11
+ //
12
+ // NVIDIA_COPYRIGHT_END
13
+ //
14
+
15
+ #ifndef NVVM_H
16
+ #define NVVM_H
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif /* __cplusplus */
21
+
22
+ #include <stdlib.h>
23
+
24
+
25
+ /*****************************//**
26
+ *
27
+ * \defgroup error Error Handling
28
+ *
29
+ ********************************/
30
+
31
+
32
+ /**
33
+ * \ingroup error
34
+ * \brief NVVM API call result code.
35
+ */
36
+ typedef enum {
37
+ NVVM_SUCCESS = 0,
38
+ NVVM_ERROR_OUT_OF_MEMORY = 1,
39
+ NVVM_ERROR_PROGRAM_CREATION_FAILURE = 2,
40
+ NVVM_ERROR_IR_VERSION_MISMATCH = 3,
41
+ NVVM_ERROR_INVALID_INPUT = 4,
42
+ NVVM_ERROR_INVALID_PROGRAM = 5,
43
+ NVVM_ERROR_INVALID_IR = 6,
44
+ NVVM_ERROR_INVALID_OPTION = 7,
45
+ NVVM_ERROR_NO_MODULE_IN_PROGRAM = 8,
46
+ NVVM_ERROR_COMPILATION = 9
47
+ } nvvmResult;
48
+
49
+
50
+ /**
51
+ * \ingroup error
52
+ * \brief Get the message string for the given #nvvmResult code.
53
+ *
54
+ * \param [in] result NVVM API result code.
55
+ * \return Message string for the given #nvvmResult code.
56
+ */
57
+ const char *nvvmGetErrorString(nvvmResult result);
58
+
59
+
60
+ /****************************************//**
61
+ *
62
+ * \defgroup query General Information Query
63
+ *
64
+ *******************************************/
65
+
66
+
67
+ /**
68
+ * \ingroup query
69
+ * \brief Get the NVVM version.
70
+ *
71
+ * \param [out] major NVVM major version number.
72
+ * \param [out] minor NVVM minor version number.
73
+ * \return
74
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
75
+ *
76
+ */
77
+ nvvmResult nvvmVersion(int *major, int *minor);
78
+
79
+
80
+ /**
81
+ * \ingroup query
82
+ * \brief Get the NVVM IR version.
83
+ *
84
+ * \param [out] majorIR NVVM IR major version number.
85
+ * \param [out] minorIR NVVM IR minor version number.
86
+ * \param [out] majorDbg NVVM IR debug metadata major version number.
87
+ * \param [out] minorDbg NVVM IR debug metadata minor version number.
88
+ * \return
89
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
90
+ *
91
+ */
92
+ nvvmResult nvvmIRVersion(int *majorIR, int *minorIR, int *majorDbg, int *minorDbg);
93
+
94
+
95
+ /********************************//**
96
+ *
97
+ * \defgroup compilation Compilation
98
+ *
99
+ ***********************************/
100
+
101
+ /**
102
+ * \ingroup compilation
103
+ * \brief NVVM Program.
104
+ *
105
+ * An opaque handle for a program.
106
+ */
107
+ typedef struct _nvvmProgram *nvvmProgram;
108
+
109
+ /**
110
+ * \ingroup compilation
111
+ * \brief Create a program, and set the value of its handle to \p *prog.
112
+ *
113
+ * \param [in] prog NVVM program.
114
+ * \return
115
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
116
+ * - \link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \endlink
117
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
118
+ *
119
+ * \see nvvmDestroyProgram()
120
+ */
121
+ nvvmResult nvvmCreateProgram(nvvmProgram *prog);
122
+
123
+
124
+ /**
125
+ * \ingroup compilation
126
+ * \brief Destroy a program.
127
+ *
128
+ * \param [in] prog NVVM program.
129
+ * \return
130
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
131
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
132
+ *
133
+ * \see nvvmCreateProgram()
134
+ */
135
+ nvvmResult nvvmDestroyProgram(nvvmProgram *prog);
136
+
137
+
138
+ /**
139
+ * \ingroup compilation
140
+ * \brief Add a module level NVVM IR to a program.
141
+ *
142
+ * The \p buffer should contain an NVVM IR module.
143
+ * The module should have NVVM IR either in the LLVM 7.0.1 bitcode
144
+ * representation or in the LLVM 7.0.1 text representation. Support for reading
145
+ * the text representation of NVVM IR is deprecated and may be removed in a
146
+ * later version.
147
+ *
148
+ * \param [in] prog NVVM program.
149
+ * \param [in] buffer NVVM IR module in the bitcode or text
150
+ * representation.
151
+ * \param [in] size Size of the NVVM IR module.
152
+ * \param [in] name Name of the NVVM IR module.
153
+ * If NULL, "<unnamed>" is used as the name.
154
+ * \return
155
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
156
+ * - \link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \endlink
157
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_INPUT \endlink
158
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
159
+ */
160
+ nvvmResult nvvmAddModuleToProgram(nvvmProgram prog, const char *buffer, size_t size, const char *name);
161
+
162
+ /**
163
+ * \ingroup compilation
164
+ * \brief Add a module level NVVM IR to a program.
165
+ *
166
+ * The \p buffer should contain an NVVM IR module. The module should have NVVM
167
+ * IR in the LLVM 7.0.1 bitcode representation.
168
+ *
169
+ * A module added using this API is lazily loaded - the only symbols loaded
170
+ * are those that are required by module(s) loaded using
171
+ * nvvmAddModuleToProgram. It is an error for a program to have
172
+ * all modules loaded using this API. Compiler may also optimize entities
173
+ * in this module by making them internal to the linked NVVM IR module,
174
+ * making them eligible for other optimizations. Due to these
175
+ * optimizations, this API to load a module is more efficient and should
176
+ * be used where possible.
177
+ *
178
+ * \param [in] prog NVVM program.
179
+ * \param [in] buffer NVVM IR module in the bitcode representation.
180
+ * \param [in] size Size of the NVVM IR module.
181
+ * \param [in] name Name of the NVVM IR module.
182
+ * If NULL, "<unnamed>" is used as the name.
183
+ * \return
184
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
185
+ * - \link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \endlink
186
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_INPUT \endlink
187
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
188
+ */
189
+ nvvmResult nvvmLazyAddModuleToProgram(nvvmProgram prog, const char *buffer, size_t size, const char *name);
190
+
191
+ /**
192
+ * \ingroup compilation
193
+ * \brief Compile the NVVM program.
194
+ *
195
+ * The NVVM IR modules in the program will be linked at the IR level.
196
+ * The linked IR program is compiled to PTX.
197
+ *
198
+ * The target datalayout in the linked IR program is used to
199
+ * determine the address size (32bit vs 64bit).
200
+ *
201
+ * The valid compiler options are:
202
+ *
203
+ * - -g (enable generation of full debugging information).
204
+ * Full debug support is only valid with '-opt=0'. Debug support
205
+ * requires the input module to utilize NVVM IR Debug Metadata.
206
+ * Line number (line info) only generation is also enabled via NVVM IR
207
+ * Debug Metadata, there is no specific libNVVM API flag for that case.
208
+ * - -opt=
209
+ * - 0 (disable optimizations)
210
+ * - 3 (default, enable optimizations)
211
+ * - -arch=
212
+ * - compute_50
213
+ * - compute_52 (default)
214
+ * - compute_53
215
+ * - compute_60
216
+ * - compute_61
217
+ * - compute_62
218
+ * - compute_70
219
+ * - compute_72
220
+ * - compute_75
221
+ * - compute_80
222
+ * - compute_87
223
+ * - compute_89
224
+ * - compute_90
225
+ * - -ftz=
226
+ * - 0 (default, preserve denormal values, when performing
227
+ * single-precision floating-point operations)
228
+ * - 1 (flush denormal values to zero, when performing
229
+ * single-precision floating-point operations)
230
+ * - -prec-sqrt=
231
+ * - 0 (use a faster approximation for single-precision
232
+ * floating-point square root)
233
+ * - 1 (default, use IEEE round-to-nearest mode for
234
+ * single-precision floating-point square root)
235
+ * - -prec-div=
236
+ * - 0 (use a faster approximation for single-precision
237
+ * floating-point division and reciprocals)
238
+ * - 1 (default, use IEEE round-to-nearest mode for
239
+ * single-precision floating-point division and reciprocals)
240
+ * - -fma=
241
+ * - 0 (disable FMA contraction)
242
+ * - 1 (default, enable FMA contraction)
243
+ * - -jump-table-density=[0-101]
244
+ * Specify the case density percentage in switch statements, and use
245
+ * it as a minimal threshold to determine whether jump table(brx.idx
246
+ * instruction) will be used to implement a switch statement. Default
247
+ * value is 101. The percentage ranges from 0 to 101 inclusively.
248
+ * - -gen-lto (Generate LTO IR instead of PTX).
249
+ *
250
+ * \param [in] prog NVVM program.
251
+ * \param [in] numOptions Number of compiler \p options passed.
252
+ * \param [in] options Compiler options in the form of C string array.
253
+ * \return
254
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
255
+ * - \link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \endlink
256
+ * - \link ::nvvmResult NVVM_ERROR_IR_VERSION_MISMATCH \endlink
257
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
258
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_OPTION \endlink
259
+ * - \link ::nvvmResult NVVM_ERROR_NO_MODULE_IN_PROGRAM \endlink
260
+ * - \link ::nvvmResult NVVM_ERROR_COMPILATION \endlink
261
+ */
262
+ nvvmResult nvvmCompileProgram(nvvmProgram prog, int numOptions, const char **options);
263
+
264
+ /**
265
+ * \ingroup compilation
266
+ * \brief Verify the NVVM program.
267
+ *
268
+ * The valid compiler options are:
269
+ *
270
+ * Same as for nvvmCompileProgram().
271
+ *
272
+ * \param [in] prog NVVM program.
273
+ * \param [in] numOptions Number of compiler \p options passed.
274
+ * \param [in] options Compiler options in the form of C string array.
275
+ * \return
276
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
277
+ * - \link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \endlink
278
+ * - \link ::nvvmResult NVVM_ERROR_IR_VERSION_MISMATCH \endlink
279
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
280
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_IR \endlink
281
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_OPTION \endlink
282
+ * - \link ::nvvmResult NVVM_ERROR_NO_MODULE_IN_PROGRAM \endlink
283
+ *
284
+ * \see nvvmCompileProgram()
285
+ */
286
+ nvvmResult nvvmVerifyProgram(nvvmProgram prog, int numOptions, const char **options);
287
+
288
+ /**
289
+ * \ingroup compilation
290
+ * \brief Get the size of the compiled result.
291
+ *
292
+ * \param [in] prog NVVM program.
293
+ * \param [out] bufferSizeRet Size of the compiled result (including the
294
+ * trailing NULL).
295
+ * \return
296
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
297
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
298
+ */
299
+ nvvmResult nvvmGetCompiledResultSize(nvvmProgram prog, size_t *bufferSizeRet);
300
+
301
+
302
+ /**
303
+ * \ingroup compilation
304
+ * \brief Get the compiled result.
305
+ *
306
+ * The result is stored in the memory pointed to by \p buffer.
307
+ *
308
+ * \param [in] prog NVVM program.
309
+ * \param [out] buffer Compiled result.
310
+ * \return
311
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
312
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
313
+ */
314
+ nvvmResult nvvmGetCompiledResult(nvvmProgram prog, char *buffer);
315
+
316
+ /**
317
+ * \ingroup compilation
318
+ * \brief Get the Size of Compiler/Verifier Message.
319
+ *
320
+ * The size of the message string (including the trailing NULL) is stored into
321
+ * \p bufferSizeRet when the return value is NVVM_SUCCESS.
322
+ *
323
+ * \param [in] prog NVVM program.
324
+ * \param [out] bufferSizeRet Size of the compilation/verification log
325
+ (including the trailing NULL).
326
+ * \return
327
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
328
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
329
+ */
330
+ nvvmResult nvvmGetProgramLogSize(nvvmProgram prog, size_t *bufferSizeRet);
331
+
332
+ /**
333
+ * \ingroup compilation
334
+ * \brief Get the Compiler/Verifier Message.
335
+ *
336
+ * The NULL terminated message string is stored in the memory pointed to by
337
+ * \p buffer when the return value is NVVM_SUCCESS.
338
+ *
339
+ * \param [in] prog NVVM program.
340
+ * \param [out] buffer Compilation/Verification log.
341
+ * \return
342
+ * - \link ::nvvmResult NVVM_SUCCESS \endlink
343
+ * - \link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \endlink
344
+ */
345
+ nvvmResult nvvmGetProgramLog(nvvmProgram prog, char *buffer);
346
+
347
+ #ifdef __cplusplus
348
+ }
349
+ #endif /* __cplusplus */
350
+
351
+ #endif /* NVVM_H */
miniCUDA124/nvvm/lib/x64/nvvm.lib ADDED
Binary file (4.92 kB). View file
 
miniCUDA124/nvvm/libdevice/libdevice.10.bc ADDED
Binary file (484 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/concrt140d.dll ADDED
Binary file (729 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140_1d.dll ADDED
Binary file (41.6 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140_2d.dll ADDED
Binary file (453 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140d.dll ADDED
Binary file (928 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140d_atomic_wait.dll ADDED
Binary file (102 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/msvcp140d_codecvt_ids.dll ADDED
Binary file (35.9 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vcruntime140_1d.dll ADDED
Binary file (65.1 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vcruntime140_threadsd.dll ADDED
Binary file (51.3 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vcruntime140d.dll ADDED
Binary file (187 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCXXAMP/vcamp140d.dll ADDED
Binary file (883 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugOpenMP/vcomp140d.dll ADDED
Binary file (219 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.OpenMP.LLVM/libomp140.x86_64.dll ADDED
Binary file (631 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/concrt140.dll ADDED
Binary file (323 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140.dll ADDED
Binary file (576 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_1.dll ADDED
Binary file (35.9 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_2.dll ADDED
Binary file (268 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_atomic_wait.dll ADDED
Binary file (50.3 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/msvcp140_codecvt_ids.dll ADDED
Binary file (31.8 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vccorlib140.dll ADDED
Binary file (352 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vcruntime140.dll ADDED
Binary file (120 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vcruntime140_1.dll ADDED
Binary file (49.7 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CRT/vcruntime140_threads.dll ADDED
Binary file (38.5 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.CXXAMP/vcamp140.dll ADDED
Binary file (409 kB). View file
 
miniMSVC/VC/Redist/MSVC/14.42.34433/x64/Microsoft.VC143.OpenMP/vcomp140.dll ADDED
Binary file (192 kB). View file
 
miniMSVC/VC/Tools/MSVC/14.42.34433/include/agents.h ADDED
The diff for this file is too large to render. See raw diff
 
miniMSVC/VC/Tools/MSVC/14.42.34433/include/agile.h ADDED
@@ -0,0 +1,459 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // Copyright (C) Microsoft Corporation
3
+ // All rights reserved.
4
+ //
5
+ // Code in Details namespace is for internal usage within the library code
6
+ //
7
+
8
+ #ifndef _PLATFORM_AGILE_H_
9
+ #define _PLATFORM_AGILE_H_
10
+
11
+ #ifdef _MSC_VER
12
+ #pragma once
13
+ #endif // _MSC_VER
14
+
15
+ #include <algorithm>
16
+ #include <wrl/client.h>
17
+
18
+ #if !defined(__cplusplus_winrt)
19
+ #error agile.h can only be used with /ZW
20
+ #endif
21
+
22
+ namespace Platform
23
+ {
24
+ namespace Details
25
+ {
26
+ __declspec(dllimport) IUnknown* __stdcall GetObjectContext();
27
+ __declspec(dllimport) HRESULT __stdcall GetProxyImpl(::IUnknown*, REFIID, ::IUnknown*, ::IUnknown**);
28
+ __declspec(dllimport) HRESULT __stdcall ReleaseInContextImpl(::IUnknown*, ::IUnknown*);
29
+
30
+ template <typename T>
31
+ __declspec(no_refcount) inline HRESULT GetProxy(T ^ObjectIn, ::IUnknown *ContextCallBack, T ^*Proxy)
32
+ {
33
+ return GetProxyImpl(*reinterpret_cast<IUnknown**>(&ObjectIn), __uuidof(T^) , ContextCallBack, reinterpret_cast< ::IUnknown**>(Proxy));
34
+ }
35
+
36
+ template <typename T>
37
+ inline HRESULT ReleaseInContext(T *ObjectIn, ::IUnknown *ContextCallBack)
38
+ {
39
+ return ReleaseInContextImpl(ObjectIn, ContextCallBack);
40
+ }
41
+
42
+ template <typename T>
43
+ class AgileHelper
44
+ {
45
+ __abi_IUnknown* _p;
46
+ bool _release;
47
+ public:
48
+ AgileHelper(__abi_IUnknown* p, bool release = true) : _p(p), _release(release)
49
+ {
50
+ }
51
+ AgileHelper(AgileHelper && other) : _p(other._p), _release(other._release)
52
+ {
53
+ _other._p = nullptr;
54
+ _other._release = true;
55
+ }
56
+ AgileHelper operator=(AgileHelper && other)
57
+ {
58
+ _p = other._p;
59
+ _release = other._release;
60
+ _other._p = nullptr;
61
+ _other._release = true;
62
+ return *this;
63
+ }
64
+
65
+ ~AgileHelper()
66
+ {
67
+ if (_release && _p)
68
+ {
69
+ _p->__abi_Release();
70
+ }
71
+ }
72
+
73
+ __declspec(no_refcount) __declspec(no_release_return)
74
+ T^ operator->()
75
+ {
76
+ return reinterpret_cast<T^>(_p);
77
+ }
78
+
79
+ __declspec(no_refcount) __declspec(no_release_return)
80
+ operator T^()
81
+ {
82
+ return reinterpret_cast<T^>(_p);
83
+ }
84
+ private:
85
+ AgileHelper(const AgileHelper&);
86
+ AgileHelper operator=(const AgileHelper&) ;
87
+ };
88
+ template <typename T>
89
+ struct __remove_hat
90
+ {
91
+ typedef T type;
92
+ };
93
+ template <typename T>
94
+ struct __remove_hat<T^>
95
+ {
96
+ typedef T type;
97
+ };
98
+ template <typename T>
99
+ struct AgileTypeHelper
100
+ {
101
+ typename typedef __remove_hat<T>::type type;
102
+ typename typedef __remove_hat<T>::type^ agileMemberType;
103
+ };
104
+ } // namespace Details
105
+
106
+ #pragma warning(push)
107
+ #pragma warning(disable: 4451) // Usage of ref class inside this context can lead to invalid marshaling of object across contexts
108
+
109
+ template <
110
+ typename T,
111
+ bool TIsNotAgile = (__is_win_class(typename Details::AgileTypeHelper<T>::type) && !__is_winrt_agile(typename Details::AgileTypeHelper<T>::type)) ||
112
+ __is_win_interface(typename Details::AgileTypeHelper<T>::type)
113
+ >
114
+ class Agile
115
+ {
116
+ static_assert(__is_win_class(typename Details::AgileTypeHelper<T>::type) || __is_win_interface(typename Details::AgileTypeHelper<T>::type), "Agile can only be used with ref class or interface class types");
117
+ typename typedef Details::AgileTypeHelper<T>::agileMemberType TypeT;
118
+ TypeT _object;
119
+ ::Microsoft::WRL::ComPtr< ::IUnknown> _contextCallback;
120
+ ULONG_PTR _contextToken;
121
+
122
+ enum class AgileState
123
+ {
124
+ NonAgilePointer = 0,
125
+ AgilePointer = 1,
126
+ Unknown = 2
127
+ };
128
+ AgileState _agileState;
129
+
130
+ void CaptureContext()
131
+ {
132
+ _contextCallback = Details::GetObjectContext();
133
+ __abi_ThrowIfFailed(CoGetContextToken(&_contextToken));
134
+ }
135
+
136
+ void SetObject(TypeT object)
137
+ {
138
+ // Capture context before setting the pointer
139
+ // If context capture fails then nothing to cleanup
140
+ Release();
141
+ if (object != nullptr)
142
+ {
143
+ ::Microsoft::WRL::ComPtr< ::IAgileObject> checkIfAgile;
144
+ HRESULT hr = reinterpret_cast< ::IUnknown*>(object)->QueryInterface(__uuidof(::IAgileObject), &checkIfAgile);
145
+ // Don't Capture context if object is agile
146
+ if (hr != S_OK)
147
+ {
148
+ _agileState = AgileState::NonAgilePointer;
149
+ CaptureContext();
150
+ }
151
+ else
152
+ {
153
+ _agileState = AgileState::AgilePointer;
154
+ }
155
+ }
156
+ _object = object;
157
+ }
158
+
159
+ public:
160
+ Agile() throw() : _object(nullptr), _contextToken(0), _agileState(AgileState::Unknown)
161
+ {
162
+ }
163
+
164
+ Agile(nullptr_t) throw() : _object(nullptr), _contextToken(0), _agileState(AgileState::Unknown)
165
+ {
166
+ }
167
+
168
+ explicit Agile(TypeT object) throw() : _object(nullptr), _contextToken(0), _agileState(AgileState::Unknown)
169
+ {
170
+ // Assumes that the source object is from the current context
171
+ SetObject(object);
172
+ }
173
+
174
+ Agile(const Agile& object) throw() : _object(nullptr), _contextToken(0), _agileState(AgileState::Unknown)
175
+ {
176
+ // Get returns pointer valid for current context
177
+ SetObject(object.Get());
178
+ }
179
+
180
+ Agile(Agile && object) throw() : _object(nullptr), _contextToken(0), _agileState(AgileState::Unknown)
181
+ {
182
+ // Assumes that the source object is from the current context
183
+ Swap(object);
184
+ }
185
+
186
+ ~Agile() throw()
187
+ {
188
+ Release();
189
+ }
190
+
191
+ TypeT Get() const
192
+ {
193
+ // Agile object, no proxy required
194
+ if (_agileState == AgileState::AgilePointer || _object == nullptr)
195
+ {
196
+ return _object;
197
+ }
198
+
199
+ // Do the check for same context
200
+ ULONG_PTR currentContextToken;
201
+ __abi_ThrowIfFailed(CoGetContextToken(&currentContextToken));
202
+ if (currentContextToken == _contextToken)
203
+ {
204
+ return _object;
205
+ }
206
+
207
+ // Different context and holding on to a non agile object
208
+ // Do the costly work of getting a proxy
209
+ TypeT localObject;
210
+ __abi_ThrowIfFailed(Details::GetProxy(_object, _contextCallback.Get(), &localObject));
211
+
212
+ if (_agileState == AgileState::Unknown)
213
+ {
214
+ // Object is agile if it implements IAgileObject
215
+ // GetAddressOf captures the context with out knowing the type of object that it will hold
216
+ ::Microsoft::WRL::ComPtr< ::IAgileObject> checkIfAgile;
217
+ HRESULT hr = reinterpret_cast<IUnknown*>(localObject)->QueryInterface(__uuidof(::IAgileObject), &checkIfAgile);
218
+ if (hr == S_OK)
219
+ {
220
+ auto pThis = const_cast<Agile*>(this);
221
+ pThis->_agileState = AgileState::AgilePointer;
222
+ pThis->_contextToken = 0;
223
+ pThis->_contextCallback = nullptr;
224
+ return _object;
225
+ }
226
+ else
227
+ {
228
+ auto pThis = const_cast<Agile*>(this);
229
+ pThis->_agileState = AgileState::NonAgilePointer;
230
+ }
231
+ }
232
+
233
+ return localObject;
234
+ }
235
+
236
+ TypeT* GetAddressOf() throw()
237
+ {
238
+ Release();
239
+ CaptureContext();
240
+ return &_object;
241
+ }
242
+
243
+ TypeT* GetAddressOfForInOut() throw()
244
+ {
245
+ CaptureContext();
246
+ return &_object;
247
+ }
248
+
249
+ TypeT operator->() const throw()
250
+ {
251
+ return Get();
252
+ }
253
+
254
+ Agile& operator=(nullptr_t) throw()
255
+ {
256
+ Release();
257
+ return *this;
258
+ }
259
+
260
+ Agile& operator=(TypeT object) throw()
261
+ {
262
+ Agile(object).Swap(*this);
263
+ return *this;
264
+ }
265
+
266
+ Agile& operator=(Agile object) throw()
267
+ {
268
+ // parameter is by copy which gets pointer valid for current context
269
+ object.Swap(*this);
270
+ return *this;
271
+ }
272
+
273
+ void Swap(Agile& object)
274
+ {
275
+ std::swap(_object, object._object);
276
+ std::swap(_contextCallback, object._contextCallback);
277
+ std::swap(_contextToken, object._contextToken);
278
+ std::swap(_agileState, object._agileState);
279
+ }
280
+
281
+ // Release the interface and set to NULL
282
+ void Release() throw()
283
+ {
284
+ if (_object)
285
+ {
286
+ // Cast to IInspectable (no QI)
287
+ IUnknown* pObject = *(::IUnknown**) (&_object);
288
+ // Set ^ to null without release
289
+ *(IUnknown**) (&_object) = nullptr;
290
+
291
+ ULONG_PTR currentContextToken;
292
+ __abi_ThrowIfFailed(CoGetContextToken(&currentContextToken));
293
+ if (_contextToken == 0 || _contextCallback == nullptr || _contextToken == currentContextToken)
294
+ {
295
+ pObject->Release();
296
+ }
297
+ else
298
+ {
299
+ Details::ReleaseInContext(pObject, _contextCallback.Get());
300
+ }
301
+ _contextCallback = nullptr;
302
+ _contextToken = 0;
303
+ _agileState = AgileState::Unknown;
304
+ }
305
+ }
306
+
307
+ bool operator==(nullptr_t) const throw()
308
+ {
309
+ return _object == nullptr;
310
+ }
311
+
312
+ bool operator==(const Agile& other) const throw()
313
+ {
314
+ return _object == other._object && _contextToken == other._contextToken;
315
+ }
316
+
317
+ bool operator < (const Agile& other) const throw()
318
+ {
319
+ if (reinterpret_cast<void*>(_object) < reinterpret_cast<void*>(other._object))
320
+ {
321
+ return true;
322
+ }
323
+
324
+ return _object == other._object && _contextToken < other._contextToken;
325
+ }
326
+ };
327
+
328
+ template <typename T>
329
+ class Agile<T, false>
330
+ {
331
+ static_assert(__is_win_class(typename Details::AgileTypeHelper<T>::type) || __is_win_interface(typename Details::AgileTypeHelper<T>::type), "Agile can only be used with ref class or interface class types");
332
+ typename typedef Details::AgileTypeHelper<T>::agileMemberType TypeT;
333
+ TypeT _object;
334
+
335
+ public:
336
+ Agile() throw() : _object(nullptr)
337
+ {
338
+ }
339
+
340
+ Agile(nullptr_t) throw() : _object(nullptr)
341
+ {
342
+ }
343
+
344
+ explicit Agile(TypeT object) throw() : _object(object)
345
+ {
346
+ }
347
+
348
+ Agile(const Agile& object) throw() : _object(object._object)
349
+ {
350
+ }
351
+
352
+ Agile(Agile && object) throw() : _object(nullptr)
353
+ {
354
+ Swap(object);
355
+ }
356
+
357
+ ~Agile() throw()
358
+ {
359
+ Release();
360
+ }
361
+
362
+ TypeT Get() const
363
+ {
364
+ return _object;
365
+ }
366
+
367
+ TypeT* GetAddressOf() throw()
368
+ {
369
+ Release();
370
+ return &_object;
371
+ }
372
+
373
+ TypeT* GetAddressOfForInOut() throw()
374
+ {
375
+ return &_object;
376
+ }
377
+
378
+ TypeT operator->() const throw()
379
+ {
380
+ return Get();
381
+ }
382
+
383
+ Agile& operator=(nullptr_t) throw()
384
+ {
385
+ Release();
386
+ return *this;
387
+ }
388
+
389
+ Agile& operator=(TypeT object) throw()
390
+ {
391
+ if (_object != object)
392
+ {
393
+ _object = object;
394
+ }
395
+ return *this;
396
+ }
397
+
398
+ Agile& operator=(Agile object) throw()
399
+ {
400
+ object.Swap(*this);
401
+ return *this;
402
+ }
403
+
404
+ // Release the interface and set to NULL
405
+ void Release() throw()
406
+ {
407
+ _object = nullptr;
408
+ }
409
+
410
+ void Swap(Agile& object)
411
+ {
412
+ std::swap(_object, object._object);
413
+ }
414
+
415
+ bool operator==(nullptr_t) const throw()
416
+ {
417
+ return _object == nullptr;
418
+ }
419
+
420
+ bool operator==(const Agile& other) const throw()
421
+ {
422
+ return _object == other._object;
423
+ }
424
+
425
+ bool operator < (const Agile& other) const throw()
426
+ {
427
+ return reinterpret_cast<void*>(_object) < reinterpret_cast<void*>(other._object);
428
+ }
429
+ };
430
+
431
+ #pragma warning(pop)
432
+
433
+ template<class U>
434
+ bool operator==(nullptr_t, const Agile<U>& a) throw()
435
+ {
436
+ return a == nullptr;
437
+ }
438
+
439
+ template<class U>
440
+ bool operator!=(const Agile<U>& a, nullptr_t) throw()
441
+ {
442
+ return !(a == nullptr);
443
+ }
444
+
445
+ template<class U>
446
+ bool operator!=(nullptr_t, const Agile<U>& a) throw()
447
+ {
448
+ return !(a == nullptr);
449
+ }
450
+
451
+ template<class U>
452
+ bool operator!=(const Agile<U>& a, const Agile<U>& b) throw()
453
+ {
454
+ return !(a == b);
455
+ }
456
+
457
+ } // namespace Platform
458
+
459
+ #endif // _PLATFORM_AGILE_H_