cuda-cccl 0.3.1__cp310-cp310-manylinux_2_24_aarch64.whl → 0.3.2__cp310-cp310-manylinux_2_24_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cuda-cccl might be problematic. Click here for more details.

Files changed (185) hide show
  1. cuda/cccl/headers/include/cub/agent/agent_histogram.cuh +354 -572
  2. cuda/cccl/headers/include/cub/block/block_adjacent_difference.cuh +6 -8
  3. cuda/cccl/headers/include/cub/block/block_discontinuity.cuh +24 -14
  4. cuda/cccl/headers/include/cub/block/block_exchange.cuh +5 -0
  5. cuda/cccl/headers/include/cub/block/block_histogram.cuh +4 -0
  6. cuda/cccl/headers/include/cub/block/block_load.cuh +4 -0
  7. cuda/cccl/headers/include/cub/block/block_radix_rank.cuh +1 -0
  8. cuda/cccl/headers/include/cub/block/block_reduce.cuh +1 -0
  9. cuda/cccl/headers/include/cub/block/block_scan.cuh +12 -2
  10. cuda/cccl/headers/include/cub/block/block_store.cuh +3 -2
  11. cuda/cccl/headers/include/cub/detail/mdspan_utils.cuh +34 -30
  12. cuda/cccl/headers/include/cub/detail/ptx-json-parser.h +1 -1
  13. cuda/cccl/headers/include/cub/device/device_for.cuh +118 -40
  14. cuda/cccl/headers/include/cub/device/device_reduce.cuh +6 -7
  15. cuda/cccl/headers/include/cub/device/device_segmented_reduce.cuh +12 -13
  16. cuda/cccl/headers/include/cub/device/device_transform.cuh +122 -91
  17. cuda/cccl/headers/include/cub/device/dispatch/dispatch_merge.cuh +2 -3
  18. cuda/cccl/headers/include/cub/device/dispatch/dispatch_reduce.cuh +4 -3
  19. cuda/cccl/headers/include/cub/device/dispatch/dispatch_reduce_deterministic.cuh +1 -1
  20. cuda/cccl/headers/include/cub/device/dispatch/dispatch_streaming_reduce.cuh +4 -5
  21. cuda/cccl/headers/include/cub/device/dispatch/dispatch_streaming_reduce_by_key.cuh +0 -1
  22. cuda/cccl/headers/include/cub/device/dispatch/dispatch_topk.cuh +3 -5
  23. cuda/cccl/headers/include/cub/device/dispatch/dispatch_transform.cuh +13 -5
  24. cuda/cccl/headers/include/cub/device/dispatch/kernels/for_each.cuh +72 -37
  25. cuda/cccl/headers/include/cub/device/dispatch/kernels/transform.cuh +22 -27
  26. cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_transform.cuh +61 -70
  27. cuda/cccl/headers/include/cub/thread/thread_reduce.cuh +24 -17
  28. cuda/cccl/headers/include/cub/warp/warp_load.cuh +6 -6
  29. cuda/cccl/headers/include/cub/warp/warp_reduce.cuh +7 -2
  30. cuda/cccl/headers/include/cub/warp/warp_scan.cuh +7 -3
  31. cuda/cccl/headers/include/cub/warp/warp_store.cuh +1 -0
  32. cuda/cccl/headers/include/cuda/__barrier/barrier_block_scope.h +19 -0
  33. cuda/cccl/headers/include/cuda/__cccl_config +1 -0
  34. cuda/cccl/headers/include/cuda/__cmath/fast_modulo_division.h +3 -74
  35. cuda/cccl/headers/include/cuda/__cmath/mul_hi.h +146 -0
  36. cuda/cccl/headers/include/cuda/__complex/get_real_imag.h +0 -4
  37. cuda/cccl/headers/include/cuda/__device/arch_id.h +176 -0
  38. cuda/cccl/headers/include/cuda/__device/arch_traits.h +239 -317
  39. cuda/cccl/headers/include/cuda/__device/attributes.h +4 -3
  40. cuda/cccl/headers/include/cuda/__device/compute_capability.h +171 -0
  41. cuda/cccl/headers/include/cuda/__device/device_ref.h +0 -10
  42. cuda/cccl/headers/include/cuda/__device/physical_device.h +1 -26
  43. cuda/cccl/headers/include/cuda/__event/event.h +26 -26
  44. cuda/cccl/headers/include/cuda/__event/event_ref.h +5 -5
  45. cuda/cccl/headers/include/cuda/__event/timed_event.h +9 -7
  46. cuda/cccl/headers/include/cuda/__fwd/devices.h +4 -4
  47. cuda/cccl/headers/include/cuda/__iterator/constant_iterator.h +46 -31
  48. cuda/cccl/headers/include/cuda/__iterator/strided_iterator.h +79 -47
  49. cuda/cccl/headers/include/cuda/__iterator/tabulate_output_iterator.h +59 -36
  50. cuda/cccl/headers/include/cuda/__iterator/transform_input_output_iterator.h +79 -49
  51. cuda/cccl/headers/include/cuda/__iterator/transform_iterator.h +74 -48
  52. cuda/cccl/headers/include/cuda/__iterator/transform_output_iterator.h +80 -55
  53. cuda/cccl/headers/include/cuda/__iterator/zip_common.h +2 -12
  54. cuda/cccl/headers/include/cuda/__iterator/zip_iterator.h +15 -19
  55. cuda/cccl/headers/include/cuda/__iterator/zip_transform_iterator.h +59 -60
  56. cuda/cccl/headers/include/cuda/__mdspan/host_device_accessor.h +127 -60
  57. cuda/cccl/headers/include/cuda/__mdspan/host_device_mdspan.h +178 -3
  58. cuda/cccl/headers/include/cuda/__mdspan/restrict_accessor.h +38 -8
  59. cuda/cccl/headers/include/cuda/__mdspan/restrict_mdspan.h +67 -1
  60. cuda/cccl/headers/include/cuda/__memory/ptr_in_range.h +93 -0
  61. cuda/cccl/headers/include/cuda/__memory_resource/get_memory_resource.h +4 -4
  62. cuda/cccl/headers/include/cuda/__memory_resource/properties.h +44 -0
  63. cuda/cccl/headers/include/cuda/__memory_resource/resource.h +1 -1
  64. cuda/cccl/headers/include/cuda/__memory_resource/resource_ref.h +4 -6
  65. cuda/cccl/headers/include/cuda/__nvtx/nvtx3.h +2 -1
  66. cuda/cccl/headers/include/cuda/__runtime/ensure_current_context.h +5 -4
  67. cuda/cccl/headers/include/cuda/__stream/stream.h +8 -8
  68. cuda/cccl/headers/include/cuda/__stream/stream_ref.h +17 -16
  69. cuda/cccl/headers/include/cuda/__utility/in_range.h +65 -0
  70. cuda/cccl/headers/include/cuda/cmath +1 -0
  71. cuda/cccl/headers/include/cuda/devices +3 -0
  72. cuda/cccl/headers/include/cuda/memory +1 -0
  73. cuda/cccl/headers/include/cuda/std/__algorithm/equal_range.h +2 -2
  74. cuda/cccl/headers/include/cuda/std/__algorithm/find.h +1 -1
  75. cuda/cccl/headers/include/cuda/std/__algorithm/includes.h +2 -4
  76. cuda/cccl/headers/include/cuda/std/__algorithm/lower_bound.h +1 -1
  77. cuda/cccl/headers/include/cuda/std/__algorithm/make_projected.h +7 -15
  78. cuda/cccl/headers/include/cuda/std/__algorithm/min_element.h +1 -1
  79. cuda/cccl/headers/include/cuda/std/__algorithm/minmax_element.h +1 -2
  80. cuda/cccl/headers/include/cuda/std/__algorithm/partial_sort_copy.h +2 -2
  81. cuda/cccl/headers/include/cuda/std/__algorithm/upper_bound.h +1 -1
  82. cuda/cccl/headers/include/cuda/std/__cccl/algorithm_wrapper.h +36 -0
  83. cuda/cccl/headers/include/cuda/std/__cccl/builtin.h +46 -49
  84. cuda/cccl/headers/include/cuda/std/__cccl/execution_space.h +6 -0
  85. cuda/cccl/headers/include/cuda/std/__cccl/host_std_lib.h +52 -0
  86. cuda/cccl/headers/include/cuda/std/__cccl/memory_wrapper.h +36 -0
  87. cuda/cccl/headers/include/cuda/std/__cccl/numeric_wrapper.h +36 -0
  88. cuda/cccl/headers/include/cuda/std/__cmath/isnan.h +3 -2
  89. cuda/cccl/headers/include/cuda/std/__complex/complex.h +3 -2
  90. cuda/cccl/headers/include/cuda/std/__complex/literals.h +14 -34
  91. cuda/cccl/headers/include/cuda/std/__complex/nvbf16.h +2 -1
  92. cuda/cccl/headers/include/cuda/std/__complex/nvfp16.h +4 -3
  93. cuda/cccl/headers/include/cuda/std/__concepts/invocable.h +2 -2
  94. cuda/cccl/headers/include/cuda/std/__cstdlib/malloc.h +3 -2
  95. cuda/cccl/headers/include/cuda/std/__functional/bind.h +10 -13
  96. cuda/cccl/headers/include/cuda/std/__functional/function.h +5 -8
  97. cuda/cccl/headers/include/cuda/std/__functional/invoke.h +71 -335
  98. cuda/cccl/headers/include/cuda/std/__functional/mem_fn.h +1 -2
  99. cuda/cccl/headers/include/cuda/std/__functional/reference_wrapper.h +3 -3
  100. cuda/cccl/headers/include/cuda/std/__functional/weak_result_type.h +0 -6
  101. cuda/cccl/headers/include/cuda/std/__fwd/allocator.h +13 -0
  102. cuda/cccl/headers/include/cuda/std/__fwd/char_traits.h +13 -0
  103. cuda/cccl/headers/include/cuda/std/__fwd/complex.h +13 -4
  104. cuda/cccl/headers/include/cuda/std/__fwd/mdspan.h +23 -0
  105. cuda/cccl/headers/include/cuda/std/__fwd/pair.h +13 -0
  106. cuda/cccl/headers/include/cuda/std/__fwd/string.h +22 -0
  107. cuda/cccl/headers/include/cuda/std/__fwd/string_view.h +14 -0
  108. cuda/cccl/headers/include/cuda/std/__internal/features.h +0 -5
  109. cuda/cccl/headers/include/cuda/std/__internal/namespaces.h +21 -0
  110. cuda/cccl/headers/include/cuda/std/__iterator/iterator_traits.h +5 -5
  111. cuda/cccl/headers/include/cuda/std/__mdspan/extents.h +7 -1
  112. cuda/cccl/headers/include/cuda/std/__mdspan/mdspan.h +53 -39
  113. cuda/cccl/headers/include/cuda/std/__memory/allocator.h +3 -3
  114. cuda/cccl/headers/include/cuda/std/__memory/construct_at.h +1 -3
  115. cuda/cccl/headers/include/cuda/std/__optional/optional_base.h +1 -0
  116. cuda/cccl/headers/include/cuda/std/__ranges/compressed_movable_box.h +892 -0
  117. cuda/cccl/headers/include/cuda/std/__ranges/movable_box.h +2 -2
  118. cuda/cccl/headers/include/cuda/std/__type_traits/is_primary_template.h +7 -5
  119. cuda/cccl/headers/include/cuda/std/__type_traits/result_of.h +1 -1
  120. cuda/cccl/headers/include/cuda/std/__utility/pair.h +0 -5
  121. cuda/cccl/headers/include/cuda/std/bitset +1 -1
  122. cuda/cccl/headers/include/cuda/std/detail/libcxx/include/__config +15 -12
  123. cuda/cccl/headers/include/cuda/std/detail/libcxx/include/variant +11 -9
  124. cuda/cccl/headers/include/cuda/std/inplace_vector +4 -4
  125. cuda/cccl/headers/include/cuda/std/numbers +5 -0
  126. cuda/cccl/headers/include/cuda/std/string_view +146 -11
  127. cuda/cccl/headers/include/cuda/stream_ref +5 -0
  128. cuda/cccl/headers/include/cuda/utility +1 -0
  129. cuda/cccl/headers/include/nv/target +7 -2
  130. cuda/cccl/headers/include/thrust/allocate_unique.h +1 -1
  131. cuda/cccl/headers/include/thrust/detail/allocator/allocator_traits.h +309 -33
  132. cuda/cccl/headers/include/thrust/detail/allocator/copy_construct_range.h +151 -4
  133. cuda/cccl/headers/include/thrust/detail/allocator/destroy_range.h +60 -3
  134. cuda/cccl/headers/include/thrust/detail/allocator/fill_construct_range.h +45 -3
  135. cuda/cccl/headers/include/thrust/detail/allocator/malloc_allocator.h +31 -6
  136. cuda/cccl/headers/include/thrust/detail/allocator/tagged_allocator.h +29 -16
  137. cuda/cccl/headers/include/thrust/detail/allocator/temporary_allocator.h +41 -4
  138. cuda/cccl/headers/include/thrust/detail/allocator/value_initialize_range.h +42 -4
  139. cuda/cccl/headers/include/thrust/detail/complex/ccosh.h +3 -3
  140. cuda/cccl/headers/include/thrust/detail/internal_functional.h +1 -1
  141. cuda/cccl/headers/include/thrust/detail/memory_algorithms.h +1 -1
  142. cuda/cccl/headers/include/thrust/detail/temporary_array.h +1 -1
  143. cuda/cccl/headers/include/thrust/detail/type_traits.h +1 -1
  144. cuda/cccl/headers/include/thrust/device_delete.h +18 -3
  145. cuda/cccl/headers/include/thrust/device_free.h +16 -3
  146. cuda/cccl/headers/include/thrust/device_new.h +29 -8
  147. cuda/cccl/headers/include/thrust/host_vector.h +1 -1
  148. cuda/cccl/headers/include/thrust/iterator/tabulate_output_iterator.h +5 -2
  149. cuda/cccl/headers/include/thrust/mr/disjoint_pool.h +1 -1
  150. cuda/cccl/headers/include/thrust/mr/pool.h +1 -1
  151. cuda/cccl/headers/include/thrust/system/cuda/detail/find.h +13 -115
  152. cuda/cccl/headers/include/thrust/system/cuda/detail/mismatch.h +8 -2
  153. cuda/cccl/headers/include/thrust/type_traits/is_contiguous_iterator.h +7 -7
  154. cuda/compute/__init__.py +2 -0
  155. cuda/compute/_bindings.pyi +43 -1
  156. cuda/compute/_bindings_impl.pyx +156 -7
  157. cuda/compute/algorithms/_scan.py +108 -36
  158. cuda/compute/algorithms/_transform.py +32 -11
  159. cuda/compute/cu12/_bindings_impl.cpython-310-aarch64-linux-gnu.so +0 -0
  160. cuda/compute/cu12/cccl/libcccl.c.parallel.so +0 -0
  161. cuda/compute/cu13/_bindings_impl.cpython-310-aarch64-linux-gnu.so +0 -0
  162. cuda/compute/cu13/cccl/libcccl.c.parallel.so +0 -0
  163. cuda/compute/iterators/__init__.py +2 -0
  164. cuda/compute/iterators/_factories.py +28 -0
  165. cuda/compute/iterators/_iterators.py +206 -1
  166. cuda/compute/numba_utils.py +2 -2
  167. cuda/compute/typing.py +2 -0
  168. {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/METADATA +1 -1
  169. {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/RECORD +171 -175
  170. cuda/cccl/headers/include/thrust/detail/algorithm_wrapper.h +0 -37
  171. cuda/cccl/headers/include/thrust/detail/allocator/allocator_traits.inl +0 -371
  172. cuda/cccl/headers/include/thrust/detail/allocator/copy_construct_range.inl +0 -242
  173. cuda/cccl/headers/include/thrust/detail/allocator/destroy_range.inl +0 -137
  174. cuda/cccl/headers/include/thrust/detail/allocator/fill_construct_range.inl +0 -99
  175. cuda/cccl/headers/include/thrust/detail/allocator/malloc_allocator.inl +0 -68
  176. cuda/cccl/headers/include/thrust/detail/allocator/tagged_allocator.inl +0 -86
  177. cuda/cccl/headers/include/thrust/detail/allocator/temporary_allocator.inl +0 -79
  178. cuda/cccl/headers/include/thrust/detail/allocator/value_initialize_range.inl +0 -98
  179. cuda/cccl/headers/include/thrust/detail/device_delete.inl +0 -52
  180. cuda/cccl/headers/include/thrust/detail/device_free.inl +0 -47
  181. cuda/cccl/headers/include/thrust/detail/device_new.inl +0 -61
  182. cuda/cccl/headers/include/thrust/detail/memory_wrapper.h +0 -40
  183. cuda/cccl/headers/include/thrust/detail/numeric_wrapper.h +0 -37
  184. {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/WHEEL +0 -0
  185. {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,137 +0,0 @@
1
- /*
2
- * Copyright 2008-2021 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
-
29
- #include <thrust/detail/allocator/allocator_traits.h>
30
- #include <thrust/detail/allocator/destroy_range.h>
31
- #include <thrust/detail/memory_wrapper.h>
32
- #include <thrust/detail/type_traits/pointer_traits.h>
33
- #include <thrust/for_each.h>
34
-
35
- THRUST_NAMESPACE_BEGIN
36
- namespace detail
37
- {
38
- namespace allocator_traits_detail
39
- {
40
-
41
- // destroy_range has three cases:
42
- // if Allocator has an effectful member function destroy:
43
- // 1. destroy via the allocator
44
- // else
45
- // 2. if T has a non-trivial destructor, destroy the range without using the allocator
46
- // 3. if T has a trivial destructor, do a no-op
47
-
48
- template <typename Allocator, typename T>
49
- struct has_effectful_member_destroy : has_member_destroy<Allocator, T>
50
- {};
51
-
52
- // std::allocator::destroy's only effect is to invoke its argument's destructor
53
- template <typename U, typename T>
54
- struct has_effectful_member_destroy<std::allocator<U>, T> : thrust::detail::false_type
55
- {};
56
-
57
- // case 1: Allocator has an effectful 1-argument member function "destroy"
58
- template <typename Allocator, typename Pointer>
59
- struct enable_if_destroy_range_case1
60
- : ::cuda::std::enable_if<has_effectful_member_destroy<Allocator, typename pointer_element<Pointer>::type>::value>
61
- {};
62
-
63
- // case 2: Allocator has no member function "destroy", but T has a non-trivial destructor
64
- template <typename Allocator, typename Pointer>
65
- struct enable_if_destroy_range_case2
66
- : ::cuda::std::enable_if<!has_effectful_member_destroy<Allocator, typename pointer_element<Pointer>::type>::value
67
- && !::cuda::std::is_trivially_destructible<typename pointer_element<Pointer>::type>::value>
68
- {};
69
-
70
- // case 3: Allocator has no member function "destroy", and T has a trivial destructor
71
- template <typename Allocator, typename Pointer>
72
- struct enable_if_destroy_range_case3
73
- : ::cuda::std::enable_if<!has_effectful_member_destroy<Allocator, typename pointer_element<Pointer>::type>::value
74
- && ::cuda::std::is_trivially_destructible<typename pointer_element<Pointer>::type>::value>
75
- {};
76
-
77
- template <typename Allocator>
78
- struct destroy_via_allocator
79
- {
80
- Allocator& a;
81
-
82
- _CCCL_HOST_DEVICE destroy_via_allocator(Allocator& a) noexcept
83
- : a(a)
84
- {}
85
-
86
- template <typename T>
87
- inline _CCCL_HOST_DEVICE void operator()(T& x) noexcept
88
- {
89
- allocator_traits<Allocator>::destroy(a, &x);
90
- }
91
- };
92
-
93
- // destroy_range case 1: destroy via allocator
94
- template <typename Allocator, typename Pointer, typename Size>
95
- _CCCL_HOST_DEVICE typename enable_if_destroy_range_case1<Allocator, Pointer>::type
96
- destroy_range(Allocator& a, Pointer p, Size n) noexcept
97
- {
98
- thrust::for_each_n(allocator_system<Allocator>::get(a), p, n, destroy_via_allocator<Allocator>(a));
99
- }
100
-
101
- // we must prepare for His coming
102
- struct gozer
103
- {
104
- _CCCL_EXEC_CHECK_DISABLE
105
- template <typename T>
106
- inline _CCCL_HOST_DEVICE void operator()(T& x) noexcept
107
- {
108
- x.~T();
109
- }
110
- };
111
-
112
- // destroy_range case 2: destroy without the allocator
113
- template <typename Allocator, typename Pointer, typename Size>
114
- _CCCL_HOST_DEVICE typename enable_if_destroy_range_case2<Allocator, Pointer>::type
115
- destroy_range(Allocator& a, Pointer p, Size n) noexcept
116
- {
117
- thrust::for_each_n(allocator_system<Allocator>::get(a), p, n, gozer());
118
- }
119
-
120
- // destroy_range case 3: no-op
121
- template <typename Allocator, typename Pointer, typename Size>
122
- _CCCL_HOST_DEVICE typename enable_if_destroy_range_case3<Allocator, Pointer>::type
123
- destroy_range(Allocator&, Pointer, Size) noexcept
124
- {
125
- // no op
126
- }
127
-
128
- } // namespace allocator_traits_detail
129
-
130
- template <typename Allocator, typename Pointer, typename Size>
131
- _CCCL_HOST_DEVICE void destroy_range(Allocator& a, Pointer p, Size n) noexcept
132
- {
133
- return allocator_traits_detail::destroy_range(a, p, n);
134
- }
135
-
136
- } // namespace detail
137
- THRUST_NAMESPACE_END
@@ -1,99 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
- #include <thrust/detail/allocator/allocator_traits.h>
29
- #include <thrust/detail/memory_wrapper.h>
30
- #include <thrust/detail/type_traits.h>
31
- #include <thrust/detail/type_traits/pointer_traits.h>
32
- #include <thrust/for_each.h>
33
- #include <thrust/uninitialized_fill.h>
34
-
35
- THRUST_NAMESPACE_BEGIN
36
- namespace detail
37
- {
38
- namespace allocator_traits_detail
39
- {
40
-
41
- // fill_construct_range has 2 cases:
42
- // if Allocator has an effectful member function construct:
43
- // 1. construct via the allocator
44
- // else
45
- // 2. construct via uninitialized_fill
46
-
47
- template <typename Allocator, typename T, typename Arg1>
48
- struct has_effectful_member_construct2 : has_member_construct2<Allocator, T, Arg1>
49
- {};
50
-
51
- // std::allocator::construct's only effect is to invoke placement new
52
- template <typename U, typename T, typename Arg1>
53
- struct has_effectful_member_construct2<std::allocator<U>, T, Arg1> : thrust::detail::false_type
54
- {};
55
-
56
- template <typename Allocator, typename Arg1>
57
- struct construct2_via_allocator
58
- {
59
- Allocator& a;
60
- Arg1 arg;
61
-
62
- _CCCL_HOST_DEVICE construct2_via_allocator(Allocator& a, const Arg1& arg)
63
- : a(a)
64
- , arg(arg)
65
- {}
66
-
67
- template <typename T>
68
- inline _CCCL_HOST_DEVICE void operator()(T& x)
69
- {
70
- allocator_traits<Allocator>::construct(a, &x, arg);
71
- }
72
- };
73
-
74
- template <typename Allocator, typename Pointer, typename Size, typename T>
75
- _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<
76
- has_effectful_member_construct2<Allocator, typename pointer_element<Pointer>::type, T>::value>
77
- fill_construct_range(Allocator& a, Pointer p, Size n, const T& value)
78
- {
79
- thrust::for_each_n(allocator_system<Allocator>::get(a), p, n, construct2_via_allocator<Allocator, T>(a, value));
80
- }
81
-
82
- template <typename Allocator, typename Pointer, typename Size, typename T>
83
- _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<
84
- !has_effectful_member_construct2<Allocator, typename pointer_element<Pointer>::type, T>::value>
85
- fill_construct_range(Allocator& a, Pointer p, Size n, const T& value)
86
- {
87
- thrust::uninitialized_fill_n(allocator_system<Allocator>::get(a), p, n, value);
88
- }
89
-
90
- } // namespace allocator_traits_detail
91
-
92
- template <typename Alloc, typename Pointer, typename Size, typename T>
93
- _CCCL_HOST_DEVICE void fill_construct_range(Alloc& a, Pointer p, Size n, const T& value)
94
- {
95
- return allocator_traits_detail::fill_construct_range(a, p, n, value);
96
- }
97
-
98
- } // namespace detail
99
- THRUST_NAMESPACE_END
@@ -1,68 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
- #include <thrust/detail/allocator/malloc_allocator.h>
29
- #include <thrust/detail/malloc_and_free.h>
30
- #include <thrust/detail/raw_pointer_cast.h>
31
- #include <thrust/system/detail/bad_alloc.h>
32
- #include <thrust/system/detail/generic/select_system.h>
33
-
34
- THRUST_NAMESPACE_BEGIN
35
- namespace detail
36
- {
37
-
38
- template <typename T, typename System, typename Pointer>
39
- typename malloc_allocator<T, System, Pointer>::pointer
40
- malloc_allocator<T, System, Pointer>::allocate(typename malloc_allocator<T, System, Pointer>::size_type cnt)
41
- {
42
- using thrust::system::detail::generic::select_system;
43
-
44
- // XXX should use a hypothetical thrust::static_pointer_cast here
45
- System system;
46
-
47
- pointer result = thrust::malloc<T>(select_system(system), cnt);
48
-
49
- if (result.get() == 0)
50
- {
51
- throw thrust::system::detail::bad_alloc("malloc_allocator::allocate: malloc failed");
52
- } // end if
53
-
54
- return result;
55
- } // end malloc_allocator::allocate()
56
-
57
- template <typename T, typename System, typename Pointer>
58
- void malloc_allocator<T, System, Pointer>::deallocate(typename malloc_allocator<T, System, Pointer>::pointer p,
59
- typename malloc_allocator<T, System, Pointer>::size_type) noexcept
60
- {
61
- using thrust::system::detail::generic::select_system;
62
-
63
- System system;
64
- thrust::free(select_system(system), p);
65
- } // end malloc_allocator
66
-
67
- } // namespace detail
68
- THRUST_NAMESPACE_END
@@ -1,86 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
- #include <thrust/detail/allocator/tagged_allocator.h>
29
-
30
- #include <cuda/std/limits>
31
-
32
- THRUST_NAMESPACE_BEGIN
33
- namespace detail
34
- {
35
-
36
- template <typename T, typename Tag, typename Pointer>
37
- _CCCL_HOST_DEVICE tagged_allocator<T, Tag, Pointer>::tagged_allocator()
38
- {}
39
-
40
- template <typename T, typename Tag, typename Pointer>
41
- _CCCL_HOST_DEVICE tagged_allocator<T, Tag, Pointer>::tagged_allocator(const tagged_allocator<T, Tag, Pointer>&)
42
- {}
43
-
44
- template <typename T, typename Tag, typename Pointer>
45
- template <typename U, typename OtherPointer>
46
- _CCCL_HOST_DEVICE tagged_allocator<T, Tag, Pointer>::tagged_allocator(const tagged_allocator<U, Tag, OtherPointer>&)
47
- {}
48
-
49
- template <typename T, typename Tag, typename Pointer>
50
- _CCCL_HOST_DEVICE tagged_allocator<T, Tag, Pointer>::~tagged_allocator()
51
- {}
52
-
53
- template <typename T, typename Tag, typename Pointer>
54
- _CCCL_HOST_DEVICE typename tagged_allocator<T, Tag, Pointer>::pointer
55
- tagged_allocator<T, Tag, Pointer>::address(reference x) const
56
- {
57
- return &x;
58
- }
59
-
60
- template <typename T, typename Tag, typename Pointer>
61
- _CCCL_HOST_DEVICE typename tagged_allocator<T, Tag, Pointer>::const_pointer
62
- tagged_allocator<T, Tag, Pointer>::address(const_reference x) const
63
- {
64
- return &x;
65
- }
66
-
67
- template <typename T, typename Tag, typename Pointer>
68
- typename tagged_allocator<T, Tag, Pointer>::size_type tagged_allocator<T, Tag, Pointer>::max_size() const
69
- {
70
- return (::cuda::std::numeric_limits<size_type>::max)() / sizeof(T);
71
- }
72
-
73
- template <typename T1, typename Pointer1, typename T2, typename Pointer2, typename Tag>
74
- _CCCL_HOST_DEVICE bool operator==(const tagged_allocator<T1, Pointer1, Tag>&, const tagged_allocator<T2, Pointer2, Tag>&)
75
- {
76
- return true;
77
- }
78
-
79
- template <typename T1, typename Pointer1, typename T2, typename Pointer2, typename Tag>
80
- _CCCL_HOST_DEVICE bool operator!=(const tagged_allocator<T1, Pointer1, Tag>&, const tagged_allocator<T2, Pointer2, Tag>&)
81
- {
82
- return false;
83
- }
84
-
85
- } // namespace detail
86
- THRUST_NAMESPACE_END
@@ -1,79 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
- #include <thrust/detail/allocator/temporary_allocator.h>
29
- #include <thrust/detail/temporary_buffer.h>
30
- #include <thrust/system/detail/bad_alloc.h>
31
-
32
- #include <cuda/std/cassert>
33
-
34
- #include <nv/target>
35
-
36
- #if _CCCL_CUDA_COMPILATION() && _CCCL_DEVICE_COMPILATION()
37
- # include <thrust/system/cuda/detail/terminate.h>
38
- #endif // _CCCL_CUDA_COMPILATION() && _CCCL_DEVICE_COMPILATION()
39
-
40
- THRUST_NAMESPACE_BEGIN
41
- namespace detail
42
- {
43
-
44
- template <typename T, typename System>
45
- _CCCL_HOST_DEVICE typename temporary_allocator<T, System>::pointer
46
- temporary_allocator<T, System>::allocate(typename temporary_allocator<T, System>::size_type cnt)
47
- {
48
- pointer_and_size result = thrust::get_temporary_buffer<T>(system(), cnt);
49
-
50
- // handle failure
51
- if (result.second < cnt)
52
- {
53
- // deallocate and throw
54
- // note that we pass cnt to deallocate, not a value derived from result.second
55
- deallocate(result.first, cnt);
56
-
57
- #if _CCCL_CUDA_COMPILATION()
58
- NV_IF_TARGET(NV_IS_HOST,
59
- (throw thrust::system::detail::bad_alloc("temporary_buffer::allocate: get_temporary_buffer failed");),
60
- ( // NV_IS_DEVICE
61
- thrust::system::cuda::detail::terminate_with_message("temporary_buffer::allocate: "
62
- "get_temporary_buffer failed");));
63
- #else
64
- throw thrust::system::detail::bad_alloc("temporary_buffer::allocate: get_temporary_buffer failed");
65
- #endif
66
- } // end if
67
-
68
- return result.first;
69
- } // end temporary_allocator::allocate()
70
-
71
- template <typename T, typename System>
72
- _CCCL_HOST_DEVICE void temporary_allocator<T, System>::deallocate(
73
- typename temporary_allocator<T, System>::pointer p, typename temporary_allocator<T, System>::size_type n) noexcept
74
- {
75
- return thrust::return_temporary_buffer(system(), p, n);
76
- } // end temporary_allocator
77
-
78
- } // namespace detail
79
- THRUST_NAMESPACE_END
@@ -1,98 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
- #include <thrust/detail/allocator/allocator_traits.h>
29
- #include <thrust/detail/type_traits.h>
30
- #include <thrust/detail/type_traits/pointer_traits.h>
31
- #include <thrust/for_each.h>
32
- #include <thrust/uninitialized_fill.h>
33
-
34
- THRUST_NAMESPACE_BEGIN
35
- namespace detail
36
- {
37
- namespace allocator_traits_detail
38
- {
39
-
40
- template <typename Allocator>
41
- struct construct1_via_allocator
42
- {
43
- Allocator& a;
44
-
45
- _CCCL_HOST_DEVICE construct1_via_allocator(Allocator& a)
46
- : a(a)
47
- {}
48
-
49
- template <typename T>
50
- inline _CCCL_HOST_DEVICE void operator()(T& x)
51
- {
52
- allocator_traits<Allocator>::construct(a, &x);
53
- }
54
- };
55
-
56
- // we need to construct T via the allocator if...
57
- template <typename Allocator, typename T>
58
- struct needs_default_construct_via_allocator
59
- : ::cuda::std::disjunction<has_member_construct1<Allocator, T>, // if the Allocator does something interesting
60
- // or if T's default constructor does something
61
- // interesting
62
- thrust::detail::not_<::cuda::std::is_trivially_default_constructible<T>>>
63
- {};
64
-
65
- // we know that std::allocator::construct's only effect is to call T's
66
- // default constructor, so we needn't use it for default construction
67
- // unless T's constructor does something interesting
68
- template <typename U, typename T>
69
- struct needs_default_construct_via_allocator<std::allocator<U>, T>
70
- : thrust::detail::not_<::cuda::std::is_trivially_default_constructible<T>>
71
- {};
72
-
73
- template <typename Allocator, typename Pointer, typename Size>
74
- _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<
75
- needs_default_construct_via_allocator<Allocator, typename pointer_element<Pointer>::type>::value>
76
- value_initialize_range(Allocator& a, Pointer p, Size n)
77
- {
78
- thrust::for_each_n(allocator_system<Allocator>::get(a), p, n, construct1_via_allocator<Allocator>(a));
79
- }
80
-
81
- template <typename Allocator, typename Pointer, typename Size>
82
- _CCCL_HOST_DEVICE
83
- typename disable_if<needs_default_construct_via_allocator<Allocator, typename pointer_element<Pointer>::type>::value>::type
84
- value_initialize_range(Allocator& a, Pointer p, Size n)
85
- {
86
- thrust::uninitialized_fill_n(allocator_system<Allocator>::get(a), p, n, typename pointer_element<Pointer>::type());
87
- }
88
-
89
- } // namespace allocator_traits_detail
90
-
91
- template <typename Allocator, typename Pointer, typename Size>
92
- _CCCL_HOST_DEVICE void value_initialize_range(Allocator& a, Pointer p, Size n)
93
- {
94
- return allocator_traits_detail::value_initialize_range(a, p, n);
95
- }
96
-
97
- } // namespace detail
98
- THRUST_NAMESPACE_END
@@ -1,52 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
- #include <thrust/detail/allocator/destroy_range.h>
29
- #include <thrust/device_delete.h>
30
- #include <thrust/device_free.h>
31
-
32
- THRUST_NAMESPACE_BEGIN
33
-
34
- namespace detail
35
- {
36
-
37
- // define an empty allocator class to use below
38
- struct device_delete_allocator
39
- {};
40
-
41
- } // namespace detail
42
-
43
- template <typename T>
44
- void device_delete(device_ptr<T> ptr, const size_t n)
45
- {
46
- // we can use device_allocator to destroy the range
47
- thrust::detail::device_delete_allocator a;
48
- thrust::detail::destroy_range(a, ptr, n);
49
- thrust::device_free(ptr);
50
- } // end device_delete()
51
-
52
- THRUST_NAMESPACE_END
@@ -1,47 +0,0 @@
1
- /*
2
- * Copyright 2008-2013 NVIDIA Corporation
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #pragma once
18
-
19
- #include <thrust/detail/config.h>
20
-
21
- #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
22
- # pragma GCC system_header
23
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
24
- # pragma clang system_header
25
- #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
26
- # pragma system_header
27
- #endif // no system header
28
- #include <thrust/detail/malloc_and_free.h>
29
- #include <thrust/device_free.h>
30
- #include <thrust/iterator/iterator_traits.h>
31
- #include <thrust/system/detail/generic/select_system.h>
32
-
33
- THRUST_NAMESPACE_BEGIN
34
-
35
- void device_free(thrust::device_ptr<void> ptr)
36
- {
37
- using thrust::system::detail::generic::select_system;
38
-
39
- using system = thrust::iterator_system<thrust::device_ptr<void>>::type;
40
-
41
- // XXX lower to select_system(system) here
42
- system s;
43
-
44
- thrust::free(s, ptr);
45
- } // end device_free()
46
-
47
- THRUST_NAMESPACE_END