cuda-cccl 0.3.1__cp313-cp313-manylinux_2_24_aarch64.whl → 0.3.2__cp313-cp313-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.
- cuda/cccl/headers/include/cub/agent/agent_histogram.cuh +354 -572
- cuda/cccl/headers/include/cub/block/block_adjacent_difference.cuh +6 -8
- cuda/cccl/headers/include/cub/block/block_discontinuity.cuh +24 -14
- cuda/cccl/headers/include/cub/block/block_exchange.cuh +5 -0
- cuda/cccl/headers/include/cub/block/block_histogram.cuh +4 -0
- cuda/cccl/headers/include/cub/block/block_load.cuh +4 -0
- cuda/cccl/headers/include/cub/block/block_radix_rank.cuh +1 -0
- cuda/cccl/headers/include/cub/block/block_reduce.cuh +1 -0
- cuda/cccl/headers/include/cub/block/block_scan.cuh +12 -2
- cuda/cccl/headers/include/cub/block/block_store.cuh +3 -2
- cuda/cccl/headers/include/cub/detail/mdspan_utils.cuh +34 -30
- cuda/cccl/headers/include/cub/detail/ptx-json-parser.h +1 -1
- cuda/cccl/headers/include/cub/device/device_for.cuh +118 -40
- cuda/cccl/headers/include/cub/device/device_reduce.cuh +6 -7
- cuda/cccl/headers/include/cub/device/device_segmented_reduce.cuh +12 -13
- cuda/cccl/headers/include/cub/device/device_transform.cuh +122 -91
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_merge.cuh +2 -3
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_reduce.cuh +4 -3
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_reduce_deterministic.cuh +1 -1
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_streaming_reduce.cuh +4 -5
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_streaming_reduce_by_key.cuh +0 -1
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_topk.cuh +3 -5
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_transform.cuh +13 -5
- cuda/cccl/headers/include/cub/device/dispatch/kernels/for_each.cuh +72 -37
- cuda/cccl/headers/include/cub/device/dispatch/kernels/transform.cuh +22 -27
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_transform.cuh +61 -70
- cuda/cccl/headers/include/cub/thread/thread_reduce.cuh +24 -17
- cuda/cccl/headers/include/cub/warp/warp_load.cuh +6 -6
- cuda/cccl/headers/include/cub/warp/warp_reduce.cuh +7 -2
- cuda/cccl/headers/include/cub/warp/warp_scan.cuh +7 -3
- cuda/cccl/headers/include/cub/warp/warp_store.cuh +1 -0
- cuda/cccl/headers/include/cuda/__barrier/barrier_block_scope.h +19 -0
- cuda/cccl/headers/include/cuda/__cccl_config +1 -0
- cuda/cccl/headers/include/cuda/__cmath/fast_modulo_division.h +3 -74
- cuda/cccl/headers/include/cuda/__cmath/mul_hi.h +146 -0
- cuda/cccl/headers/include/cuda/__complex/get_real_imag.h +0 -4
- cuda/cccl/headers/include/cuda/__device/arch_id.h +176 -0
- cuda/cccl/headers/include/cuda/__device/arch_traits.h +239 -317
- cuda/cccl/headers/include/cuda/__device/attributes.h +4 -3
- cuda/cccl/headers/include/cuda/__device/compute_capability.h +171 -0
- cuda/cccl/headers/include/cuda/__device/device_ref.h +0 -10
- cuda/cccl/headers/include/cuda/__device/physical_device.h +1 -26
- cuda/cccl/headers/include/cuda/__event/event.h +26 -26
- cuda/cccl/headers/include/cuda/__event/event_ref.h +5 -5
- cuda/cccl/headers/include/cuda/__event/timed_event.h +9 -7
- cuda/cccl/headers/include/cuda/__fwd/devices.h +4 -4
- cuda/cccl/headers/include/cuda/__iterator/constant_iterator.h +46 -31
- cuda/cccl/headers/include/cuda/__iterator/strided_iterator.h +79 -47
- cuda/cccl/headers/include/cuda/__iterator/tabulate_output_iterator.h +59 -36
- cuda/cccl/headers/include/cuda/__iterator/transform_input_output_iterator.h +79 -49
- cuda/cccl/headers/include/cuda/__iterator/transform_iterator.h +74 -48
- cuda/cccl/headers/include/cuda/__iterator/transform_output_iterator.h +80 -55
- cuda/cccl/headers/include/cuda/__iterator/zip_common.h +2 -12
- cuda/cccl/headers/include/cuda/__iterator/zip_iterator.h +15 -19
- cuda/cccl/headers/include/cuda/__iterator/zip_transform_iterator.h +59 -60
- cuda/cccl/headers/include/cuda/__mdspan/host_device_accessor.h +127 -60
- cuda/cccl/headers/include/cuda/__mdspan/host_device_mdspan.h +178 -3
- cuda/cccl/headers/include/cuda/__mdspan/restrict_accessor.h +38 -8
- cuda/cccl/headers/include/cuda/__mdspan/restrict_mdspan.h +67 -1
- cuda/cccl/headers/include/cuda/__memory/ptr_in_range.h +93 -0
- cuda/cccl/headers/include/cuda/__memory_resource/get_memory_resource.h +4 -4
- cuda/cccl/headers/include/cuda/__memory_resource/properties.h +44 -0
- cuda/cccl/headers/include/cuda/__memory_resource/resource.h +1 -1
- cuda/cccl/headers/include/cuda/__memory_resource/resource_ref.h +4 -6
- cuda/cccl/headers/include/cuda/__nvtx/nvtx3.h +2 -1
- cuda/cccl/headers/include/cuda/__runtime/ensure_current_context.h +5 -4
- cuda/cccl/headers/include/cuda/__stream/stream.h +8 -8
- cuda/cccl/headers/include/cuda/__stream/stream_ref.h +17 -16
- cuda/cccl/headers/include/cuda/__utility/in_range.h +65 -0
- cuda/cccl/headers/include/cuda/cmath +1 -0
- cuda/cccl/headers/include/cuda/devices +3 -0
- cuda/cccl/headers/include/cuda/memory +1 -0
- cuda/cccl/headers/include/cuda/std/__algorithm/equal_range.h +2 -2
- cuda/cccl/headers/include/cuda/std/__algorithm/find.h +1 -1
- cuda/cccl/headers/include/cuda/std/__algorithm/includes.h +2 -4
- cuda/cccl/headers/include/cuda/std/__algorithm/lower_bound.h +1 -1
- cuda/cccl/headers/include/cuda/std/__algorithm/make_projected.h +7 -15
- cuda/cccl/headers/include/cuda/std/__algorithm/min_element.h +1 -1
- cuda/cccl/headers/include/cuda/std/__algorithm/minmax_element.h +1 -2
- cuda/cccl/headers/include/cuda/std/__algorithm/partial_sort_copy.h +2 -2
- cuda/cccl/headers/include/cuda/std/__algorithm/upper_bound.h +1 -1
- cuda/cccl/headers/include/cuda/std/__cccl/algorithm_wrapper.h +36 -0
- cuda/cccl/headers/include/cuda/std/__cccl/builtin.h +46 -49
- cuda/cccl/headers/include/cuda/std/__cccl/execution_space.h +6 -0
- cuda/cccl/headers/include/cuda/std/__cccl/host_std_lib.h +52 -0
- cuda/cccl/headers/include/cuda/std/__cccl/memory_wrapper.h +36 -0
- cuda/cccl/headers/include/cuda/std/__cccl/numeric_wrapper.h +36 -0
- cuda/cccl/headers/include/cuda/std/__cmath/isnan.h +3 -2
- cuda/cccl/headers/include/cuda/std/__complex/complex.h +3 -2
- cuda/cccl/headers/include/cuda/std/__complex/literals.h +14 -34
- cuda/cccl/headers/include/cuda/std/__complex/nvbf16.h +2 -1
- cuda/cccl/headers/include/cuda/std/__complex/nvfp16.h +4 -3
- cuda/cccl/headers/include/cuda/std/__concepts/invocable.h +2 -2
- cuda/cccl/headers/include/cuda/std/__cstdlib/malloc.h +3 -2
- cuda/cccl/headers/include/cuda/std/__functional/bind.h +10 -13
- cuda/cccl/headers/include/cuda/std/__functional/function.h +5 -8
- cuda/cccl/headers/include/cuda/std/__functional/invoke.h +71 -335
- cuda/cccl/headers/include/cuda/std/__functional/mem_fn.h +1 -2
- cuda/cccl/headers/include/cuda/std/__functional/reference_wrapper.h +3 -3
- cuda/cccl/headers/include/cuda/std/__functional/weak_result_type.h +0 -6
- cuda/cccl/headers/include/cuda/std/__fwd/allocator.h +13 -0
- cuda/cccl/headers/include/cuda/std/__fwd/char_traits.h +13 -0
- cuda/cccl/headers/include/cuda/std/__fwd/complex.h +13 -4
- cuda/cccl/headers/include/cuda/std/__fwd/mdspan.h +23 -0
- cuda/cccl/headers/include/cuda/std/__fwd/pair.h +13 -0
- cuda/cccl/headers/include/cuda/std/__fwd/string.h +22 -0
- cuda/cccl/headers/include/cuda/std/__fwd/string_view.h +14 -0
- cuda/cccl/headers/include/cuda/std/__internal/features.h +0 -5
- cuda/cccl/headers/include/cuda/std/__internal/namespaces.h +21 -0
- cuda/cccl/headers/include/cuda/std/__iterator/iterator_traits.h +5 -5
- cuda/cccl/headers/include/cuda/std/__mdspan/extents.h +7 -1
- cuda/cccl/headers/include/cuda/std/__mdspan/mdspan.h +53 -39
- cuda/cccl/headers/include/cuda/std/__memory/allocator.h +3 -3
- cuda/cccl/headers/include/cuda/std/__memory/construct_at.h +1 -3
- cuda/cccl/headers/include/cuda/std/__optional/optional_base.h +1 -0
- cuda/cccl/headers/include/cuda/std/__ranges/compressed_movable_box.h +892 -0
- cuda/cccl/headers/include/cuda/std/__ranges/movable_box.h +2 -2
- cuda/cccl/headers/include/cuda/std/__type_traits/is_primary_template.h +7 -5
- cuda/cccl/headers/include/cuda/std/__type_traits/result_of.h +1 -1
- cuda/cccl/headers/include/cuda/std/__utility/pair.h +0 -5
- cuda/cccl/headers/include/cuda/std/bitset +1 -1
- cuda/cccl/headers/include/cuda/std/detail/libcxx/include/__config +15 -12
- cuda/cccl/headers/include/cuda/std/detail/libcxx/include/variant +11 -9
- cuda/cccl/headers/include/cuda/std/inplace_vector +4 -4
- cuda/cccl/headers/include/cuda/std/numbers +5 -0
- cuda/cccl/headers/include/cuda/std/string_view +146 -11
- cuda/cccl/headers/include/cuda/stream_ref +5 -0
- cuda/cccl/headers/include/cuda/utility +1 -0
- cuda/cccl/headers/include/nv/target +7 -2
- cuda/cccl/headers/include/thrust/allocate_unique.h +1 -1
- cuda/cccl/headers/include/thrust/detail/allocator/allocator_traits.h +309 -33
- cuda/cccl/headers/include/thrust/detail/allocator/copy_construct_range.h +151 -4
- cuda/cccl/headers/include/thrust/detail/allocator/destroy_range.h +60 -3
- cuda/cccl/headers/include/thrust/detail/allocator/fill_construct_range.h +45 -3
- cuda/cccl/headers/include/thrust/detail/allocator/malloc_allocator.h +31 -6
- cuda/cccl/headers/include/thrust/detail/allocator/tagged_allocator.h +29 -16
- cuda/cccl/headers/include/thrust/detail/allocator/temporary_allocator.h +41 -4
- cuda/cccl/headers/include/thrust/detail/allocator/value_initialize_range.h +42 -4
- cuda/cccl/headers/include/thrust/detail/complex/ccosh.h +3 -3
- cuda/cccl/headers/include/thrust/detail/internal_functional.h +1 -1
- cuda/cccl/headers/include/thrust/detail/memory_algorithms.h +1 -1
- cuda/cccl/headers/include/thrust/detail/temporary_array.h +1 -1
- cuda/cccl/headers/include/thrust/detail/type_traits.h +1 -1
- cuda/cccl/headers/include/thrust/device_delete.h +18 -3
- cuda/cccl/headers/include/thrust/device_free.h +16 -3
- cuda/cccl/headers/include/thrust/device_new.h +29 -8
- cuda/cccl/headers/include/thrust/host_vector.h +1 -1
- cuda/cccl/headers/include/thrust/iterator/tabulate_output_iterator.h +5 -2
- cuda/cccl/headers/include/thrust/mr/disjoint_pool.h +1 -1
- cuda/cccl/headers/include/thrust/mr/pool.h +1 -1
- cuda/cccl/headers/include/thrust/system/cuda/detail/find.h +13 -115
- cuda/cccl/headers/include/thrust/system/cuda/detail/mismatch.h +8 -2
- cuda/cccl/headers/include/thrust/type_traits/is_contiguous_iterator.h +7 -7
- cuda/compute/__init__.py +2 -0
- cuda/compute/_bindings.pyi +43 -1
- cuda/compute/_bindings_impl.pyx +156 -7
- cuda/compute/algorithms/_scan.py +108 -36
- cuda/compute/algorithms/_transform.py +32 -11
- cuda/compute/cu12/_bindings_impl.cpython-313-aarch64-linux-gnu.so +0 -0
- cuda/compute/cu12/cccl/libcccl.c.parallel.so +0 -0
- cuda/compute/cu13/_bindings_impl.cpython-313-aarch64-linux-gnu.so +0 -0
- cuda/compute/cu13/cccl/libcccl.c.parallel.so +0 -0
- cuda/compute/iterators/__init__.py +2 -0
- cuda/compute/iterators/_factories.py +28 -0
- cuda/compute/iterators/_iterators.py +206 -1
- cuda/compute/numba_utils.py +2 -2
- cuda/compute/typing.py +2 -0
- {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/METADATA +1 -1
- {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/RECORD +171 -175
- cuda/cccl/headers/include/thrust/detail/algorithm_wrapper.h +0 -37
- cuda/cccl/headers/include/thrust/detail/allocator/allocator_traits.inl +0 -371
- cuda/cccl/headers/include/thrust/detail/allocator/copy_construct_range.inl +0 -242
- cuda/cccl/headers/include/thrust/detail/allocator/destroy_range.inl +0 -137
- cuda/cccl/headers/include/thrust/detail/allocator/fill_construct_range.inl +0 -99
- cuda/cccl/headers/include/thrust/detail/allocator/malloc_allocator.inl +0 -68
- cuda/cccl/headers/include/thrust/detail/allocator/tagged_allocator.inl +0 -86
- cuda/cccl/headers/include/thrust/detail/allocator/temporary_allocator.inl +0 -79
- cuda/cccl/headers/include/thrust/detail/allocator/value_initialize_range.inl +0 -98
- cuda/cccl/headers/include/thrust/detail/device_delete.inl +0 -52
- cuda/cccl/headers/include/thrust/detail/device_free.inl +0 -47
- cuda/cccl/headers/include/thrust/detail/device_new.inl +0 -61
- cuda/cccl/headers/include/thrust/detail/memory_wrapper.h +0 -40
- cuda/cccl/headers/include/thrust/detail/numeric_wrapper.h +0 -37
- {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/WHEEL +0 -0
- {cuda_cccl-0.3.1.dist-info → cuda_cccl-0.3.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 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
|
-
// When a compiler uses Thrust as part of its implementation of Standard C++
|
|
30
|
-
// algorithms, a cycle of included files may result when Thrust code tries to
|
|
31
|
-
// use a standard algorithm. Having a macro that is defined only when Thrust
|
|
32
|
-
// is including an algorithms-related header gives the compiler a chance to
|
|
33
|
-
// detect and break the cycle of includes.
|
|
34
|
-
|
|
35
|
-
#define THRUST_INCLUDING_ALGORITHMS_HEADER
|
|
36
|
-
#include <algorithm>
|
|
37
|
-
#undef THRUST_INCLUDING_ALGORITHMS_HEADER
|
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2008-2018 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_deduction.h>
|
|
31
|
-
#include <thrust/detail/type_traits/is_call_possible.h>
|
|
32
|
-
|
|
33
|
-
#include <cuda/std/limits>
|
|
34
|
-
|
|
35
|
-
#include <new>
|
|
36
|
-
|
|
37
|
-
THRUST_NAMESPACE_BEGIN
|
|
38
|
-
namespace detail
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
// std::allocator's member functions are deprecated in C++17 and removed in
|
|
42
|
-
// C++20, so we can't just use the generic implementation for allocator_traits
|
|
43
|
-
// that calls the allocator's member functions.
|
|
44
|
-
// Instead, specialize allocator_traits for std::allocator and defer to
|
|
45
|
-
// std::allocator_traits<std::allocator> and let the STL do whatever it needs
|
|
46
|
-
// to for the current c++ version. Manually forward the calls to suppress
|
|
47
|
-
// host/device warnings.
|
|
48
|
-
template <typename T>
|
|
49
|
-
struct allocator_traits<std::allocator<T>> : public std::allocator_traits<std::allocator<T>>
|
|
50
|
-
{
|
|
51
|
-
private:
|
|
52
|
-
using superclass = std::allocator_traits<std::allocator<T>>;
|
|
53
|
-
|
|
54
|
-
public:
|
|
55
|
-
using allocator_type = typename superclass::allocator_type;
|
|
56
|
-
using value_type = typename superclass::value_type;
|
|
57
|
-
using pointer = typename superclass::pointer;
|
|
58
|
-
using const_pointer = typename superclass::const_pointer;
|
|
59
|
-
using void_pointer = typename superclass::void_pointer;
|
|
60
|
-
using const_void_pointer = typename superclass::const_void_pointer;
|
|
61
|
-
using difference_type = typename superclass::difference_type;
|
|
62
|
-
using size_type = typename superclass::size_type;
|
|
63
|
-
using propagate_on_container_swap = typename superclass::propagate_on_container_swap;
|
|
64
|
-
using propagate_on_container_copy_assignment = typename superclass::propagate_on_container_copy_assignment;
|
|
65
|
-
using propagate_on_container_move_assignment = typename superclass::propagate_on_container_move_assignment;
|
|
66
|
-
|
|
67
|
-
// std::allocator_traits added this in C++17, but thrust::allocator_traits defines
|
|
68
|
-
// it unconditionally.
|
|
69
|
-
using is_always_equal =
|
|
70
|
-
typename eval_if<allocator_traits_detail::has_is_always_equal<allocator_type>::value,
|
|
71
|
-
allocator_traits_detail::nested_is_always_equal<allocator_type>,
|
|
72
|
-
::cuda::std::is_empty<allocator_type>>::type;
|
|
73
|
-
|
|
74
|
-
// std::allocator_traits doesn't provide these, but
|
|
75
|
-
// thrust::detail::allocator_traits does. These used to be part of the
|
|
76
|
-
// std::allocator API but were deprecated in C++17.
|
|
77
|
-
using reference = typename thrust::detail::pointer_traits<pointer>::reference;
|
|
78
|
-
using const_reference = typename thrust::detail::pointer_traits<const_pointer>::reference;
|
|
79
|
-
|
|
80
|
-
template <typename U>
|
|
81
|
-
using rebind_alloc = std::allocator<U>;
|
|
82
|
-
template <typename U>
|
|
83
|
-
using rebind_traits = allocator_traits<std::allocator<U>>;
|
|
84
|
-
|
|
85
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
86
|
-
_CCCL_HOST_DEVICE static pointer allocate(allocator_type& a, size_type n)
|
|
87
|
-
{
|
|
88
|
-
return superclass::allocate(a, n);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
92
|
-
_CCCL_HOST_DEVICE static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint)
|
|
93
|
-
{
|
|
94
|
-
return superclass::allocate(a, n, hint);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
98
|
-
_CCCL_HOST_DEVICE static void deallocate(allocator_type& a, pointer p, size_type n) noexcept
|
|
99
|
-
{
|
|
100
|
-
superclass::deallocate(a, p, n);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
104
|
-
template <typename U, typename... Args>
|
|
105
|
-
_CCCL_HOST_DEVICE static void construct(allocator_type& a, U* p, Args&&... args)
|
|
106
|
-
{
|
|
107
|
-
superclass::construct(a, p, THRUST_FWD(args)...);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
111
|
-
template <typename U>
|
|
112
|
-
_CCCL_HOST_DEVICE static void destroy(allocator_type& a, U* p) noexcept
|
|
113
|
-
{
|
|
114
|
-
superclass::destroy(a, p);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
118
|
-
_CCCL_HOST_DEVICE static size_type max_size(const allocator_type& a)
|
|
119
|
-
{
|
|
120
|
-
return superclass::max_size(a);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
namespace allocator_traits_detail
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_allocate_with_hint_impl, allocate)
|
|
128
|
-
|
|
129
|
-
template <typename Alloc>
|
|
130
|
-
class has_member_allocate_with_hint
|
|
131
|
-
{
|
|
132
|
-
using pointer = typename allocator_traits<Alloc>::pointer;
|
|
133
|
-
using size_type = typename allocator_traits<Alloc>::size_type;
|
|
134
|
-
using const_void_pointer = typename allocator_traits<Alloc>::const_void_pointer;
|
|
135
|
-
|
|
136
|
-
public:
|
|
137
|
-
using type = typename has_member_allocate_with_hint_impl<Alloc, pointer(size_type, const_void_pointer)>::type;
|
|
138
|
-
static const bool value = type::value;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
template <typename Alloc>
|
|
142
|
-
_CCCL_HOST_DEVICE ::cuda::std::enable_if_t<has_member_allocate_with_hint<Alloc>::value,
|
|
143
|
-
typename allocator_traits<Alloc>::pointer>
|
|
144
|
-
allocate(Alloc& a,
|
|
145
|
-
typename allocator_traits<Alloc>::size_type n,
|
|
146
|
-
typename allocator_traits<Alloc>::const_void_pointer hint)
|
|
147
|
-
{
|
|
148
|
-
return a.allocate(n, hint);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
template <typename Alloc>
|
|
152
|
-
_CCCL_HOST_DEVICE ::cuda::std::enable_if_t<!has_member_allocate_with_hint<Alloc>::value,
|
|
153
|
-
typename allocator_traits<Alloc>::pointer>
|
|
154
|
-
allocate(Alloc& a, typename allocator_traits<Alloc>::size_type n, typename allocator_traits<Alloc>::const_void_pointer)
|
|
155
|
-
{
|
|
156
|
-
return a.allocate(n);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_construct1_impl, construct)
|
|
160
|
-
|
|
161
|
-
template <typename Alloc, typename T>
|
|
162
|
-
struct has_member_construct1 : has_member_construct1_impl<Alloc, void(T*)>
|
|
163
|
-
{};
|
|
164
|
-
|
|
165
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
166
|
-
template <typename Alloc, typename T>
|
|
167
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<has_member_construct1<Alloc, T>::value> construct(Alloc& a, T* p)
|
|
168
|
-
{
|
|
169
|
-
a.construct(p);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
173
|
-
template <typename Alloc, typename T>
|
|
174
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<!has_member_construct1<Alloc, T>::value> construct(Alloc&, T* p)
|
|
175
|
-
{
|
|
176
|
-
::new (static_cast<void*>(p)) T();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_construct2_impl, construct)
|
|
180
|
-
|
|
181
|
-
template <typename Alloc, typename T, typename Arg1>
|
|
182
|
-
struct has_member_construct2 : has_member_construct2_impl<Alloc, void(T*, const Arg1&)>
|
|
183
|
-
{};
|
|
184
|
-
|
|
185
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
186
|
-
template <typename Alloc, typename T, typename Arg1>
|
|
187
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<has_member_construct2<Alloc, T, Arg1>::value>
|
|
188
|
-
construct(Alloc& a, T* p, const Arg1& arg1)
|
|
189
|
-
{
|
|
190
|
-
a.construct(p, arg1);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
194
|
-
template <typename Alloc, typename T, typename Arg1>
|
|
195
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<!has_member_construct2<Alloc, T, Arg1>::value>
|
|
196
|
-
construct(Alloc&, T* p, const Arg1& arg1)
|
|
197
|
-
{
|
|
198
|
-
::new (static_cast<void*>(p)) T(arg1);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_constructN_impl, construct)
|
|
202
|
-
|
|
203
|
-
template <typename Alloc, typename T, typename... Args>
|
|
204
|
-
struct has_member_constructN : has_member_constructN_impl<Alloc, void(T*, Args...)>
|
|
205
|
-
{};
|
|
206
|
-
|
|
207
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
208
|
-
template <typename Alloc, typename T, typename... Args>
|
|
209
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<has_member_constructN<Alloc, T, Args...>::value>
|
|
210
|
-
construct(Alloc& a, T* p, Args&&... args)
|
|
211
|
-
{
|
|
212
|
-
a.construct(p, THRUST_FWD(args)...);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
216
|
-
template <typename Alloc, typename T, typename... Args>
|
|
217
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<!has_member_constructN<Alloc, T, Args...>::value>
|
|
218
|
-
construct(Alloc&, T* p, Args&&... args)
|
|
219
|
-
{
|
|
220
|
-
::new (static_cast<void*>(p)) T(THRUST_FWD(args)...);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_destroy_impl, destroy)
|
|
224
|
-
|
|
225
|
-
template <typename Alloc, typename T>
|
|
226
|
-
struct has_member_destroy : has_member_destroy_impl<Alloc, void(T*)>
|
|
227
|
-
{};
|
|
228
|
-
|
|
229
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
230
|
-
template <typename Alloc, typename T>
|
|
231
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<has_member_destroy<Alloc, T>::value> destroy(Alloc& a, T* p)
|
|
232
|
-
{
|
|
233
|
-
a.destroy(p);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
237
|
-
template <typename Alloc, typename T>
|
|
238
|
-
inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t<!has_member_destroy<Alloc, T>::value> destroy(Alloc&, T* p)
|
|
239
|
-
{
|
|
240
|
-
p->~T();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
__THRUST_DEFINE_IS_CALL_POSSIBLE(has_member_max_size_impl, max_size)
|
|
244
|
-
|
|
245
|
-
template <typename Alloc>
|
|
246
|
-
class has_member_max_size
|
|
247
|
-
{
|
|
248
|
-
using size_type = typename allocator_traits<Alloc>::size_type;
|
|
249
|
-
|
|
250
|
-
public:
|
|
251
|
-
using type = typename has_member_max_size_impl<Alloc, size_type()>::type;
|
|
252
|
-
static const bool value = type::value;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
template <typename Alloc>
|
|
256
|
-
_CCCL_HOST_DEVICE ::cuda::std::enable_if_t<has_member_max_size<Alloc>::value, typename allocator_traits<Alloc>::size_type>
|
|
257
|
-
max_size(const Alloc& a)
|
|
258
|
-
{
|
|
259
|
-
return a.max_size();
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
template <typename Alloc>
|
|
263
|
-
_CCCL_HOST_DEVICE ::cuda::std::enable_if_t<!has_member_max_size<Alloc>::value,
|
|
264
|
-
typename allocator_traits<Alloc>::size_type>
|
|
265
|
-
max_size(const Alloc&)
|
|
266
|
-
{
|
|
267
|
-
using size_type = typename allocator_traits<Alloc>::size_type;
|
|
268
|
-
return ::cuda::std::numeric_limits<size_type>::max();
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
template <typename Alloc>
|
|
272
|
-
_CCCL_HOST_DEVICE ::cuda::std::enable_if_t<has_member_system<Alloc>::value, typename allocator_system<Alloc>::type&>
|
|
273
|
-
system(Alloc& a)
|
|
274
|
-
{
|
|
275
|
-
// return the allocator's system
|
|
276
|
-
return a.system();
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
template <typename Alloc>
|
|
280
|
-
_CCCL_HOST_DEVICE ::cuda::std::enable_if_t<!has_member_system<Alloc>::value, typename allocator_system<Alloc>::type>
|
|
281
|
-
system(Alloc&)
|
|
282
|
-
{
|
|
283
|
-
// return a copy of a value-initialized system
|
|
284
|
-
return typename allocator_system<Alloc>::type();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
} // namespace allocator_traits_detail
|
|
288
|
-
|
|
289
|
-
template <typename Alloc>
|
|
290
|
-
_CCCL_HOST_DEVICE typename allocator_traits<Alloc>::pointer
|
|
291
|
-
allocator_traits<Alloc>::allocate(Alloc& a, typename allocator_traits<Alloc>::size_type n)
|
|
292
|
-
{
|
|
293
|
-
struct workaround_warnings
|
|
294
|
-
{
|
|
295
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
296
|
-
static _CCCL_HOST_DEVICE typename allocator_traits<Alloc>::pointer
|
|
297
|
-
allocate(Alloc& a, typename allocator_traits<Alloc>::size_type n)
|
|
298
|
-
{
|
|
299
|
-
return a.allocate(n);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
return workaround_warnings::allocate(a, n);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
template <typename Alloc>
|
|
307
|
-
_CCCL_HOST_DEVICE typename allocator_traits<Alloc>::pointer allocator_traits<Alloc>::allocate(
|
|
308
|
-
Alloc& a, typename allocator_traits<Alloc>::size_type n, typename allocator_traits<Alloc>::const_void_pointer hint)
|
|
309
|
-
{
|
|
310
|
-
return allocator_traits_detail::allocate(a, n, hint);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
template <typename Alloc>
|
|
314
|
-
_CCCL_HOST_DEVICE void allocator_traits<Alloc>::deallocate(
|
|
315
|
-
Alloc& a, typename allocator_traits<Alloc>::pointer p, typename allocator_traits<Alloc>::size_type n) noexcept
|
|
316
|
-
{
|
|
317
|
-
struct workaround_warnings
|
|
318
|
-
{
|
|
319
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
320
|
-
static _CCCL_HOST_DEVICE void deallocate(
|
|
321
|
-
Alloc& a, typename allocator_traits<Alloc>::pointer p, typename allocator_traits<Alloc>::size_type n) noexcept
|
|
322
|
-
{
|
|
323
|
-
return a.deallocate(p, n);
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
return workaround_warnings::deallocate(a, p, n);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
template <typename Alloc>
|
|
331
|
-
template <typename T>
|
|
332
|
-
_CCCL_HOST_DEVICE void allocator_traits<Alloc>::construct(allocator_type& a, T* p)
|
|
333
|
-
{
|
|
334
|
-
return allocator_traits_detail::construct(a, p);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
template <typename Alloc>
|
|
338
|
-
template <typename T, typename Arg1>
|
|
339
|
-
_CCCL_HOST_DEVICE void allocator_traits<Alloc>::construct(allocator_type& a, T* p, const Arg1& arg1)
|
|
340
|
-
{
|
|
341
|
-
return allocator_traits_detail::construct(a, p, arg1);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
template <typename Alloc>
|
|
345
|
-
template <typename T, typename... Args>
|
|
346
|
-
_CCCL_HOST_DEVICE void allocator_traits<Alloc>::construct(allocator_type& a, T* p, Args&&... args)
|
|
347
|
-
{
|
|
348
|
-
return allocator_traits_detail::construct(a, p, THRUST_FWD(args)...);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
template <typename Alloc>
|
|
352
|
-
template <typename T>
|
|
353
|
-
_CCCL_HOST_DEVICE void allocator_traits<Alloc>::destroy(allocator_type& a, T* p) noexcept
|
|
354
|
-
{
|
|
355
|
-
return allocator_traits_detail::destroy(a, p);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
template <typename Alloc>
|
|
359
|
-
_CCCL_HOST_DEVICE typename allocator_traits<Alloc>::size_type allocator_traits<Alloc>::max_size(const allocator_type& a)
|
|
360
|
-
{
|
|
361
|
-
return allocator_traits_detail::max_size(a);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
template <typename Alloc>
|
|
365
|
-
_CCCL_HOST_DEVICE typename allocator_system<Alloc>::get_result_type allocator_system<Alloc>::get(Alloc& a)
|
|
366
|
-
{
|
|
367
|
-
return allocator_traits_detail::system(a);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
} // namespace detail
|
|
371
|
-
THRUST_NAMESPACE_END
|
|
@@ -1,242 +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/advance.h>
|
|
29
|
-
#include <thrust/detail/allocator/allocator_traits.h>
|
|
30
|
-
#include <thrust/detail/copy.h>
|
|
31
|
-
#include <thrust/detail/memory_wrapper.h>
|
|
32
|
-
#include <thrust/detail/type_traits/pointer_traits.h>
|
|
33
|
-
#include <thrust/distance.h>
|
|
34
|
-
#include <thrust/for_each.h>
|
|
35
|
-
#include <thrust/iterator/iterator_traits.h>
|
|
36
|
-
#include <thrust/iterator/zip_iterator.h>
|
|
37
|
-
#include <thrust/tuple.h>
|
|
38
|
-
|
|
39
|
-
THRUST_NAMESPACE_BEGIN
|
|
40
|
-
namespace detail
|
|
41
|
-
{
|
|
42
|
-
namespace allocator_traits_detail
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
template <typename Allocator, typename InputType, typename OutputType>
|
|
46
|
-
struct copy_construct_with_allocator
|
|
47
|
-
{
|
|
48
|
-
Allocator& a;
|
|
49
|
-
|
|
50
|
-
_CCCL_HOST_DEVICE copy_construct_with_allocator(Allocator& a)
|
|
51
|
-
: a(a)
|
|
52
|
-
{}
|
|
53
|
-
|
|
54
|
-
template <typename Tuple>
|
|
55
|
-
inline _CCCL_HOST_DEVICE void operator()(Tuple t)
|
|
56
|
-
{
|
|
57
|
-
const InputType& in = thrust::get<0>(t);
|
|
58
|
-
OutputType& out = thrust::get<1>(t);
|
|
59
|
-
|
|
60
|
-
allocator_traits<Allocator>::construct(a, &out, in);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// we need to use allocator_traits<Allocator>::construct() to
|
|
65
|
-
// copy construct a T if either:
|
|
66
|
-
// 1. Allocator has a 2-argument construct() member or
|
|
67
|
-
// 2. T has a non-trivial copy constructor
|
|
68
|
-
template <typename Allocator, typename T>
|
|
69
|
-
struct needs_copy_construct_via_allocator
|
|
70
|
-
: integral_constant<bool,
|
|
71
|
-
(has_member_construct2<Allocator, T, T>::value
|
|
72
|
-
|| !::cuda::std::is_trivially_copy_constructible<T>::value)>
|
|
73
|
-
{};
|
|
74
|
-
|
|
75
|
-
// we know that std::allocator::construct's only effect is to call T's
|
|
76
|
-
// copy constructor, so we needn't consider or use its construct() member for copy construction
|
|
77
|
-
template <typename U, typename T>
|
|
78
|
-
struct needs_copy_construct_via_allocator<std::allocator<U>, T>
|
|
79
|
-
: integral_constant<bool, !::cuda::std::is_trivially_copy_constructible<T>::value>
|
|
80
|
-
{};
|
|
81
|
-
|
|
82
|
-
// XXX it's regrettable that this implementation is copied almost
|
|
83
|
-
// exactly from system::detail::generic::uninitialized_copy
|
|
84
|
-
// perhaps generic::uninitialized_copy could call this routine
|
|
85
|
-
// with a default allocator
|
|
86
|
-
template <typename Allocator, typename FromSystem, typename ToSystem, typename InputIterator, typename Pointer>
|
|
87
|
-
_CCCL_HOST_DEVICE enable_if_convertible_t<FromSystem, ToSystem, Pointer> uninitialized_copy_with_allocator(
|
|
88
|
-
Allocator& a,
|
|
89
|
-
const thrust::execution_policy<FromSystem>&,
|
|
90
|
-
const thrust::execution_policy<ToSystem>& to_system,
|
|
91
|
-
InputIterator first,
|
|
92
|
-
InputIterator last,
|
|
93
|
-
Pointer result)
|
|
94
|
-
{
|
|
95
|
-
// zip up the iterators
|
|
96
|
-
using IteratorTuple = thrust::tuple<InputIterator, Pointer>;
|
|
97
|
-
using ZipIterator = thrust::zip_iterator<IteratorTuple>;
|
|
98
|
-
|
|
99
|
-
ZipIterator begin = thrust::make_zip_iterator(first, result);
|
|
100
|
-
ZipIterator end = begin;
|
|
101
|
-
|
|
102
|
-
// get a zip_iterator pointing to the end
|
|
103
|
-
const thrust::detail::it_difference_t<InputIterator> n = ::cuda::std::distance(first, last);
|
|
104
|
-
::cuda::std::advance(end, n);
|
|
105
|
-
|
|
106
|
-
// create a functor
|
|
107
|
-
using InputType = it_value_t<InputIterator>;
|
|
108
|
-
using OutputType = it_value_t<Pointer>;
|
|
109
|
-
|
|
110
|
-
// do the for_each
|
|
111
|
-
// note we use to_system to dispatch the for_each
|
|
112
|
-
thrust::for_each(to_system, begin, end, copy_construct_with_allocator<Allocator, InputType, OutputType>(a));
|
|
113
|
-
|
|
114
|
-
// return the end of the output range
|
|
115
|
-
return thrust::get<1>(end.get_iterator_tuple());
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// XXX it's regrettable that this implementation is copied almost
|
|
119
|
-
// exactly from system::detail::generic::uninitialized_copy_n
|
|
120
|
-
// perhaps generic::uninitialized_copy_n could call this routine
|
|
121
|
-
// with a default allocator
|
|
122
|
-
template <typename Allocator, typename FromSystem, typename ToSystem, typename InputIterator, typename Size, typename Pointer>
|
|
123
|
-
_CCCL_HOST_DEVICE enable_if_convertible_t<FromSystem, ToSystem, Pointer> uninitialized_copy_with_allocator_n(
|
|
124
|
-
Allocator& a,
|
|
125
|
-
const thrust::execution_policy<FromSystem>&,
|
|
126
|
-
const thrust::execution_policy<ToSystem>& to_system,
|
|
127
|
-
InputIterator first,
|
|
128
|
-
Size n,
|
|
129
|
-
Pointer result)
|
|
130
|
-
{
|
|
131
|
-
// zip up the iterators
|
|
132
|
-
using IteratorTuple = thrust::tuple<InputIterator, Pointer>;
|
|
133
|
-
using ZipIterator = thrust::zip_iterator<IteratorTuple>;
|
|
134
|
-
|
|
135
|
-
ZipIterator begin = thrust::make_zip_iterator(first, result);
|
|
136
|
-
|
|
137
|
-
// create a functor
|
|
138
|
-
using InputType = it_value_t<InputIterator>;
|
|
139
|
-
using OutputType = it_value_t<Pointer>;
|
|
140
|
-
|
|
141
|
-
// do the for_each_n
|
|
142
|
-
// note we use to_system to dispatch the for_each_n
|
|
143
|
-
ZipIterator end =
|
|
144
|
-
thrust::for_each_n(to_system, begin, n, copy_construct_with_allocator<Allocator, InputType, OutputType>(a));
|
|
145
|
-
|
|
146
|
-
// return the end of the output range
|
|
147
|
-
return thrust::get<1>(end.get_iterator_tuple());
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
template <typename Allocator, typename FromSystem, typename ToSystem, typename InputIterator, typename Pointer>
|
|
151
|
-
_CCCL_HOST_DEVICE typename disable_if_convertible<FromSystem, ToSystem, Pointer>::type uninitialized_copy_with_allocator(
|
|
152
|
-
Allocator&,
|
|
153
|
-
const thrust::execution_policy<FromSystem>& from_system,
|
|
154
|
-
const thrust::execution_policy<ToSystem>& to_system,
|
|
155
|
-
InputIterator first,
|
|
156
|
-
InputIterator last,
|
|
157
|
-
Pointer result)
|
|
158
|
-
{
|
|
159
|
-
// the systems aren't trivially interoperable
|
|
160
|
-
// just call two_system_copy and hope for the best
|
|
161
|
-
return thrust::detail::two_system_copy(from_system, to_system, first, last, result);
|
|
162
|
-
} // end uninitialized_copy_with_allocator()
|
|
163
|
-
|
|
164
|
-
template <typename Allocator, typename FromSystem, typename ToSystem, typename InputIterator, typename Size, typename Pointer>
|
|
165
|
-
_CCCL_HOST_DEVICE typename disable_if_convertible<FromSystem, ToSystem, Pointer>::type
|
|
166
|
-
uninitialized_copy_with_allocator_n(
|
|
167
|
-
Allocator&,
|
|
168
|
-
const thrust::execution_policy<FromSystem>& from_system,
|
|
169
|
-
const thrust::execution_policy<ToSystem>& to_system,
|
|
170
|
-
InputIterator first,
|
|
171
|
-
Size n,
|
|
172
|
-
Pointer result)
|
|
173
|
-
{
|
|
174
|
-
// the systems aren't trivially interoperable
|
|
175
|
-
// just call two_system_copy_n and hope for the best
|
|
176
|
-
return thrust::detail::two_system_copy_n(from_system, to_system, first, n, result);
|
|
177
|
-
} // end uninitialized_copy_with_allocator_n()
|
|
178
|
-
|
|
179
|
-
template <typename FromSystem, typename Allocator, typename InputIterator, typename Pointer>
|
|
180
|
-
_CCCL_HOST_DEVICE
|
|
181
|
-
typename disable_if<needs_copy_construct_via_allocator<Allocator, typename pointer_element<Pointer>::type>::value,
|
|
182
|
-
Pointer>::type
|
|
183
|
-
copy_construct_range(thrust::execution_policy<FromSystem>& from_system,
|
|
184
|
-
Allocator& a,
|
|
185
|
-
InputIterator first,
|
|
186
|
-
InputIterator last,
|
|
187
|
-
Pointer result)
|
|
188
|
-
{
|
|
189
|
-
// just call two_system_copy
|
|
190
|
-
return thrust::detail::two_system_copy(from_system, allocator_system<Allocator>::get(a), first, last, result);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
template <typename FromSystem, typename Allocator, typename InputIterator, typename Size, typename Pointer>
|
|
194
|
-
_CCCL_HOST_DEVICE
|
|
195
|
-
typename disable_if<needs_copy_construct_via_allocator<Allocator, typename pointer_element<Pointer>::type>::value,
|
|
196
|
-
Pointer>::type
|
|
197
|
-
copy_construct_range_n(
|
|
198
|
-
thrust::execution_policy<FromSystem>& from_system, Allocator& a, InputIterator first, Size n, Pointer result)
|
|
199
|
-
{
|
|
200
|
-
// just call two_system_copy_n
|
|
201
|
-
return thrust::detail::two_system_copy_n(from_system, allocator_system<Allocator>::get(a), first, n, result);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
template <typename FromSystem, typename Allocator, typename InputIterator, typename Pointer>
|
|
205
|
-
_CCCL_HOST_DEVICE ::cuda::std::
|
|
206
|
-
enable_if_t<needs_copy_construct_via_allocator<Allocator, typename pointer_element<Pointer>::type>::value, Pointer>
|
|
207
|
-
copy_construct_range(thrust::execution_policy<FromSystem>& from_system,
|
|
208
|
-
Allocator& a,
|
|
209
|
-
InputIterator first,
|
|
210
|
-
InputIterator last,
|
|
211
|
-
Pointer result)
|
|
212
|
-
{
|
|
213
|
-
return uninitialized_copy_with_allocator(a, from_system, allocator_system<Allocator>::get(a), first, last, result);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
template <typename FromSystem, typename Allocator, typename InputIterator, typename Size, typename Pointer>
|
|
217
|
-
_CCCL_HOST_DEVICE ::cuda::std::
|
|
218
|
-
enable_if_t<needs_copy_construct_via_allocator<Allocator, typename pointer_element<Pointer>::type>::value, Pointer>
|
|
219
|
-
copy_construct_range_n(
|
|
220
|
-
thrust::execution_policy<FromSystem>& from_system, Allocator& a, InputIterator first, Size n, Pointer result)
|
|
221
|
-
{
|
|
222
|
-
return uninitialized_copy_with_allocator_n(a, from_system, allocator_system<Allocator>::get(a), first, n, result);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
} // namespace allocator_traits_detail
|
|
226
|
-
|
|
227
|
-
template <typename System, typename Allocator, typename InputIterator, typename Pointer>
|
|
228
|
-
_CCCL_HOST_DEVICE Pointer copy_construct_range(
|
|
229
|
-
thrust::execution_policy<System>& from_system, Allocator& a, InputIterator first, InputIterator last, Pointer result)
|
|
230
|
-
{
|
|
231
|
-
return allocator_traits_detail::copy_construct_range(from_system, a, first, last, result);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
template <typename System, typename Allocator, typename InputIterator, typename Size, typename Pointer>
|
|
235
|
-
_CCCL_HOST_DEVICE Pointer copy_construct_range_n(
|
|
236
|
-
thrust::execution_policy<System>& from_system, Allocator& a, InputIterator first, Size n, Pointer result)
|
|
237
|
-
{
|
|
238
|
-
return allocator_traits_detail::copy_construct_range_n(from_system, a, first, n, result);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
} // namespace detail
|
|
242
|
-
THRUST_NAMESPACE_END
|