Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- miniCUDA124/include/thrust/system/cpp/detail/extrema.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/fill.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/find.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/for_each.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/gather.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/generate.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/get_value.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/inner_product.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/iter_swap.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/logical.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/malloc_and_free.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/memory.inl +60 -0
- miniCUDA124/include/thrust/system/cpp/detail/merge.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/mismatch.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/par.h +69 -0
- miniCUDA124/include/thrust/system/cpp/detail/partition.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/per_device_resource.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/reduce.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/reduce_by_key.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/remove.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/replace.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/reverse.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/scan.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/scan_by_key.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/scatter.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/sequence.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/set_operations.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/sort.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/swap_ranges.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/tabulate.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/temporary_buffer.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/transform.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/transform_reduce.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/transform_scan.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/uninitialized_copy.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/uninitialized_fill.h +30 -0
- miniCUDA124/include/thrust/system/cpp/detail/unique.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/unique_by_key.h +31 -0
- miniCUDA124/include/thrust/system/cpp/detail/vector.inl +154 -0
- miniCUDA124/include/thrust/system/cuda/detail/adjacent_difference.h +302 -0
- miniCUDA124/include/thrust/system/cuda/detail/assign_value.h +102 -0
- miniCUDA124/include/thrust/system/cuda/detail/binary_search.h +29 -0
- miniCUDA124/include/thrust/system/cuda/detail/cdp_dispatch.h +98 -0
- miniCUDA124/include/thrust/system/cuda/detail/copy.h +192 -0
- miniCUDA124/include/thrust/system/cuda/detail/copy_if.h +839 -0
- miniCUDA124/include/thrust/system/cuda/detail/count.h +88 -0
- miniCUDA124/include/thrust/system/cuda/detail/cross_system.h +347 -0
- miniCUDA124/include/thrust/system/cuda/detail/dispatch.h +89 -0
- miniCUDA124/include/thrust/system/cuda/detail/equal.h +82 -0
- miniCUDA124/include/thrust/system/cuda/detail/error.inl +107 -0
miniCUDA124/include/thrust/system/cpp/detail/extrema.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits extrema algorithms
|
| 30 |
+
#include <thrust/system/detail/sequential/extrema.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/fill.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/find.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits find
|
| 30 |
+
#include <thrust/system/detail/sequential/find.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/for_each.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits for_each
|
| 30 |
+
#include <thrust/system/detail/sequential/for_each.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/gather.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/generate.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/get_value.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits get_value
|
| 30 |
+
#include <thrust/system/detail/sequential/get_value.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/inner_product.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/iter_swap.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits iter_swap
|
| 30 |
+
#include <thrust/system/detail/sequential/iter_swap.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/logical.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/malloc_and_free.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits malloc & free
|
| 30 |
+
#include <thrust/system/detail/sequential/malloc_and_free.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/memory.inl
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/system/cpp/memory.h>
|
| 29 |
+
#include <thrust/system/cpp/detail/malloc_and_free.h>
|
| 30 |
+
#include <limits>
|
| 31 |
+
|
| 32 |
+
THRUST_NAMESPACE_BEGIN
|
| 33 |
+
namespace system
|
| 34 |
+
{
|
| 35 |
+
namespace cpp
|
| 36 |
+
{
|
| 37 |
+
|
| 38 |
+
pointer<void> malloc(std::size_t n)
|
| 39 |
+
{
|
| 40 |
+
tag t;
|
| 41 |
+
return pointer<void>(thrust::system::detail::sequential::malloc(t, n));
|
| 42 |
+
} // end malloc()
|
| 43 |
+
|
| 44 |
+
template<typename T>
|
| 45 |
+
pointer<T> malloc(std::size_t n)
|
| 46 |
+
{
|
| 47 |
+
pointer<void> raw_ptr = thrust::system::cpp::malloc(sizeof(T) * n);
|
| 48 |
+
return pointer<T>(reinterpret_cast<T*>(raw_ptr.get()));
|
| 49 |
+
} // end malloc()
|
| 50 |
+
|
| 51 |
+
void free(pointer<void> ptr)
|
| 52 |
+
{
|
| 53 |
+
tag t;
|
| 54 |
+
return thrust::system::detail::sequential::free(t, ptr);
|
| 55 |
+
} // end free()
|
| 56 |
+
|
| 57 |
+
} // end cpp
|
| 58 |
+
} // end system
|
| 59 |
+
THRUST_NAMESPACE_END
|
| 60 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/merge.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits merge
|
| 30 |
+
#include <thrust/system/detail/sequential/merge.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/mismatch.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/par.h
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_aware_execution_policy.h>
|
| 29 |
+
#include <thrust/system/cpp/detail/execution_policy.h>
|
| 30 |
+
|
| 31 |
+
THRUST_NAMESPACE_BEGIN
|
| 32 |
+
namespace system
|
| 33 |
+
{
|
| 34 |
+
namespace cpp
|
| 35 |
+
{
|
| 36 |
+
namespace detail
|
| 37 |
+
{
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
struct par_t : thrust::system::cpp::detail::execution_policy<par_t>,
|
| 41 |
+
thrust::detail::allocator_aware_execution_policy<
|
| 42 |
+
thrust::system::cpp::detail::execution_policy>
|
| 43 |
+
{
|
| 44 |
+
__host__ __device__
|
| 45 |
+
constexpr par_t() : thrust::system::cpp::detail::execution_policy<par_t>() {}
|
| 46 |
+
};
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
} // end detail
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
THRUST_INLINE_CONSTANT detail::par_t par;
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
} // end cpp
|
| 56 |
+
} // end system
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
// alias par here
|
| 60 |
+
namespace cpp
|
| 61 |
+
{
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
using thrust::system::cpp::par;
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
} // end cpp
|
| 68 |
+
THRUST_NAMESPACE_END
|
| 69 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/partition.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits partition
|
| 30 |
+
#include <thrust/system/detail/sequential/partition.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/per_device_resource.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 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 |
+
|
| 29 |
+
// this system has no special per device resource functions
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/reduce.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits reduce
|
| 30 |
+
#include <thrust/system/detail/sequential/reduce.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/reduce_by_key.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits reduce_by_key
|
| 30 |
+
#include <thrust/system/detail/sequential/reduce_by_key.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/remove.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits remove
|
| 30 |
+
#include <thrust/system/detail/sequential/remove.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/replace.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/reverse.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/scan.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits scan
|
| 30 |
+
#include <thrust/system/detail/sequential/scan.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/scan_by_key.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits the scan_by_key algorithms
|
| 30 |
+
#include <thrust/system/detail/sequential/scan_by_key.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/scatter.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/sequence.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/set_operations.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits the set operations
|
| 30 |
+
#include <thrust/system/detail/sequential/set_operations.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/sort.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits sort
|
| 30 |
+
#include <thrust/system/detail/sequential/sort.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/swap_ranges.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// cpp has no special swap_ranges
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/tabulate.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/temporary_buffer.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special temporary buffer functions
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/transform.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// cpp has no special transform
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/transform_reduce.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/transform_scan.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/uninitialized_copy.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/uninitialized_fill.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system has no special version of this algorithm
|
| 30 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/unique.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits unique
|
| 30 |
+
#include <thrust/system/detail/sequential/unique.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/unique_by_key.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
// this system inherits unique_by_key
|
| 30 |
+
#include <thrust/system/detail/sequential/unique_by_key.h>
|
| 31 |
+
|
miniCUDA124/include/thrust/system/cpp/detail/vector.inl
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/system/cpp/vector.h>
|
| 29 |
+
#include <utility>
|
| 30 |
+
|
| 31 |
+
THRUST_NAMESPACE_BEGIN
|
| 32 |
+
namespace system
|
| 33 |
+
{
|
| 34 |
+
namespace cpp
|
| 35 |
+
{
|
| 36 |
+
|
| 37 |
+
template<typename T, typename Allocator>
|
| 38 |
+
vector<T,Allocator>
|
| 39 |
+
::vector()
|
| 40 |
+
: super_t()
|
| 41 |
+
{}
|
| 42 |
+
|
| 43 |
+
template<typename T, typename Allocator>
|
| 44 |
+
vector<T,Allocator>
|
| 45 |
+
::vector(size_type n)
|
| 46 |
+
: super_t(n)
|
| 47 |
+
{}
|
| 48 |
+
|
| 49 |
+
template<typename T, typename Allocator>
|
| 50 |
+
vector<T,Allocator>
|
| 51 |
+
::vector(size_type n, const value_type &value)
|
| 52 |
+
: super_t(n,value)
|
| 53 |
+
{}
|
| 54 |
+
|
| 55 |
+
template<typename T, typename Allocator>
|
| 56 |
+
vector<T,Allocator>
|
| 57 |
+
::vector(const vector &x)
|
| 58 |
+
: super_t(x)
|
| 59 |
+
{}
|
| 60 |
+
|
| 61 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 62 |
+
template<typename T, typename Allocator>
|
| 63 |
+
vector<T,Allocator>
|
| 64 |
+
::vector(vector &&x)
|
| 65 |
+
: super_t(std::move(x))
|
| 66 |
+
{}
|
| 67 |
+
#endif
|
| 68 |
+
|
| 69 |
+
template<typename T, typename Allocator>
|
| 70 |
+
template<typename OtherT, typename OtherAllocator>
|
| 71 |
+
vector<T,Allocator>
|
| 72 |
+
::vector(const thrust::detail::vector_base<OtherT,OtherAllocator> &x)
|
| 73 |
+
: super_t(x)
|
| 74 |
+
{}
|
| 75 |
+
|
| 76 |
+
template<typename T, typename Allocator>
|
| 77 |
+
template<typename OtherT, typename OtherAllocator>
|
| 78 |
+
vector<T,Allocator>
|
| 79 |
+
::vector(const std::vector<OtherT,OtherAllocator> &x)
|
| 80 |
+
: super_t(x)
|
| 81 |
+
{}
|
| 82 |
+
|
| 83 |
+
template<typename T, typename Allocator>
|
| 84 |
+
template<typename InputIterator>
|
| 85 |
+
vector<T,Allocator>
|
| 86 |
+
::vector(InputIterator first, InputIterator last)
|
| 87 |
+
: super_t(first,last)
|
| 88 |
+
{}
|
| 89 |
+
|
| 90 |
+
template<typename T, typename Allocator>
|
| 91 |
+
vector<T,Allocator> &
|
| 92 |
+
vector<T,Allocator>
|
| 93 |
+
::operator=(const vector &x)
|
| 94 |
+
{
|
| 95 |
+
super_t::operator=(x);
|
| 96 |
+
return *this;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 100 |
+
template<typename T, typename Allocator>
|
| 101 |
+
vector<T,Allocator> &
|
| 102 |
+
vector<T,Allocator>
|
| 103 |
+
::operator=(vector &&x)
|
| 104 |
+
{
|
| 105 |
+
super_t::operator=(std::move(x));
|
| 106 |
+
return *this;
|
| 107 |
+
}
|
| 108 |
+
#endif
|
| 109 |
+
|
| 110 |
+
template<typename T, typename Allocator>
|
| 111 |
+
vector<T,Allocator>
|
| 112 |
+
::vector(std::initializer_list<T> il)
|
| 113 |
+
: super_t(il)
|
| 114 |
+
{}
|
| 115 |
+
|
| 116 |
+
template<typename T, typename Allocator>
|
| 117 |
+
vector<T,Allocator>
|
| 118 |
+
::vector(std::initializer_list<T> il, const Allocator& alloc)
|
| 119 |
+
: super_t(il, alloc)
|
| 120 |
+
{}
|
| 121 |
+
|
| 122 |
+
template<typename T, typename Allocator>
|
| 123 |
+
vector<T,Allocator> &
|
| 124 |
+
vector<T,Allocator>
|
| 125 |
+
::operator=(std::initializer_list<T> il)
|
| 126 |
+
{
|
| 127 |
+
super_t::operator=(il);
|
| 128 |
+
return *this;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
template<typename T, typename Allocator>
|
| 132 |
+
template<typename OtherT, typename OtherAllocator>
|
| 133 |
+
vector<T,Allocator> &
|
| 134 |
+
vector<T,Allocator>
|
| 135 |
+
::operator=(const std::vector<OtherT,OtherAllocator> &x)
|
| 136 |
+
{
|
| 137 |
+
super_t::operator=(x);
|
| 138 |
+
return *this;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
template<typename T, typename Allocator>
|
| 142 |
+
template<typename OtherT, typename OtherAllocator>
|
| 143 |
+
vector<T,Allocator> &
|
| 144 |
+
vector<T,Allocator>
|
| 145 |
+
::operator=(const thrust::detail::vector_base<OtherT,OtherAllocator> &x)
|
| 146 |
+
{
|
| 147 |
+
super_t::operator=(x);
|
| 148 |
+
return *this;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
} // end cpp
|
| 152 |
+
} // end system
|
| 153 |
+
THRUST_NAMESPACE_END
|
| 154 |
+
|
miniCUDA124/include/thrust/system/cuda/detail/adjacent_difference.h
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************************************************************************
|
| 2 |
+
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* Redistribution and use in source and binary forms, with or without
|
| 5 |
+
* modification, are permitted provided that the following conditions are met:
|
| 6 |
+
* * Redistributions of source code must retain the above copyright
|
| 7 |
+
* notice, this list of conditions and the following disclaimer.
|
| 8 |
+
* * Redistributions in binary form must reproduce the above copyright
|
| 9 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 10 |
+
* documentation and/or other materials provided with the distribution.
|
| 11 |
+
* * Neither the name of the NVIDIA CORPORATION nor the
|
| 12 |
+
* names of its contributors may be used to endorse or promote products
|
| 13 |
+
* derived from this software without specific prior written permission.
|
| 14 |
+
*
|
| 15 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 16 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 17 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 18 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
|
| 19 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 20 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 21 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 22 |
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 23 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 24 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 25 |
+
*
|
| 26 |
+
******************************************************************************/
|
| 27 |
+
#pragma once
|
| 28 |
+
|
| 29 |
+
#include <thrust/detail/config.h>
|
| 30 |
+
|
| 31 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 32 |
+
# pragma GCC system_header
|
| 33 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 34 |
+
# pragma clang system_header
|
| 35 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 36 |
+
# pragma system_header
|
| 37 |
+
#endif // no system header
|
| 38 |
+
|
| 39 |
+
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC
|
| 40 |
+
|
| 41 |
+
#include <thrust/detail/cstdint.h>
|
| 42 |
+
#include <thrust/detail/minmax.h>
|
| 43 |
+
#include <thrust/detail/temporary_array.h>
|
| 44 |
+
#include <thrust/detail/type_traits.h>
|
| 45 |
+
#include <thrust/functional.h>
|
| 46 |
+
#include <thrust/system/cuda/config.h>
|
| 47 |
+
#include <thrust/system/cuda/detail/cdp_dispatch.h>
|
| 48 |
+
#include <thrust/system/cuda/detail/dispatch.h>
|
| 49 |
+
#include <thrust/system/cuda/detail/par_to_seq.h>
|
| 50 |
+
#include <thrust/system/cuda/detail/util.h>
|
| 51 |
+
#include <thrust/type_traits/is_contiguous_iterator.h>
|
| 52 |
+
#include <thrust/type_traits/remove_cvref.h>
|
| 53 |
+
|
| 54 |
+
#include <cub/device/device_adjacent_difference.cuh>
|
| 55 |
+
#include <cub/device/device_select.cuh>
|
| 56 |
+
#include <cub/util_math.cuh>
|
| 57 |
+
|
| 58 |
+
THRUST_NAMESPACE_BEGIN
|
| 59 |
+
|
| 60 |
+
template <typename DerivedPolicy, typename InputIterator, typename OutputIterator, typename BinaryFunction>
|
| 61 |
+
__host__ __device__ OutputIterator
|
| 62 |
+
adjacent_difference(
|
| 63 |
+
const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
| 64 |
+
InputIterator first,
|
| 65 |
+
InputIterator last,
|
| 66 |
+
OutputIterator result,
|
| 67 |
+
BinaryFunction binary_op);
|
| 68 |
+
|
| 69 |
+
namespace cuda_cub {
|
| 70 |
+
|
| 71 |
+
namespace __adjacent_difference {
|
| 72 |
+
|
| 73 |
+
template <bool MayAlias,
|
| 74 |
+
class InputIt,
|
| 75 |
+
class OutputIt,
|
| 76 |
+
class BinaryOp>
|
| 77 |
+
cudaError_t THRUST_RUNTIME_FUNCTION
|
| 78 |
+
doit_step(void *d_temp_storage,
|
| 79 |
+
size_t &temp_storage_bytes,
|
| 80 |
+
InputIt first,
|
| 81 |
+
OutputIt result,
|
| 82 |
+
BinaryOp binary_op,
|
| 83 |
+
std::size_t num_items,
|
| 84 |
+
cudaStream_t stream)
|
| 85 |
+
{
|
| 86 |
+
if (num_items == 0)
|
| 87 |
+
{
|
| 88 |
+
return cudaSuccess;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
constexpr bool may_alias = MayAlias;
|
| 92 |
+
constexpr bool read_left = true;
|
| 93 |
+
|
| 94 |
+
using Dispatch32 = cub::DispatchAdjacentDifference<InputIt,
|
| 95 |
+
OutputIt,
|
| 96 |
+
BinaryOp,
|
| 97 |
+
thrust::detail::int32_t,
|
| 98 |
+
may_alias,
|
| 99 |
+
read_left>;
|
| 100 |
+
using Dispatch64 = cub::DispatchAdjacentDifference<InputIt,
|
| 101 |
+
OutputIt,
|
| 102 |
+
BinaryOp,
|
| 103 |
+
thrust::detail::int64_t,
|
| 104 |
+
may_alias,
|
| 105 |
+
read_left>;
|
| 106 |
+
|
| 107 |
+
cudaError_t status;
|
| 108 |
+
THRUST_INDEX_TYPE_DISPATCH2(status,
|
| 109 |
+
Dispatch32::Dispatch,
|
| 110 |
+
Dispatch64::Dispatch,
|
| 111 |
+
num_items,
|
| 112 |
+
(d_temp_storage,
|
| 113 |
+
temp_storage_bytes,
|
| 114 |
+
first,
|
| 115 |
+
result,
|
| 116 |
+
num_items_fixed,
|
| 117 |
+
binary_op,
|
| 118 |
+
stream));
|
| 119 |
+
return status;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
template <class InputIt,
|
| 123 |
+
class OutputIt,
|
| 124 |
+
class BinaryOp>
|
| 125 |
+
cudaError_t THRUST_RUNTIME_FUNCTION
|
| 126 |
+
doit_step(void *d_temp_storage,
|
| 127 |
+
size_t &temp_storage_bytes,
|
| 128 |
+
InputIt first,
|
| 129 |
+
OutputIt result,
|
| 130 |
+
BinaryOp binary_op,
|
| 131 |
+
std::size_t num_items,
|
| 132 |
+
cudaStream_t stream,
|
| 133 |
+
thrust::detail::integral_constant<bool, false> /* comparable */)
|
| 134 |
+
{
|
| 135 |
+
constexpr bool may_alias = true;
|
| 136 |
+
return doit_step<may_alias>(d_temp_storage,
|
| 137 |
+
temp_storage_bytes,
|
| 138 |
+
first,
|
| 139 |
+
result,
|
| 140 |
+
binary_op,
|
| 141 |
+
num_items,
|
| 142 |
+
stream);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
template <class InputIt,
|
| 146 |
+
class OutputIt,
|
| 147 |
+
class BinaryOp>
|
| 148 |
+
cudaError_t THRUST_RUNTIME_FUNCTION
|
| 149 |
+
doit_step(void *d_temp_storage,
|
| 150 |
+
size_t &temp_storage_bytes,
|
| 151 |
+
InputIt first,
|
| 152 |
+
OutputIt result,
|
| 153 |
+
BinaryOp binary_op,
|
| 154 |
+
std::size_t num_items,
|
| 155 |
+
cudaStream_t stream,
|
| 156 |
+
thrust::detail::integral_constant<bool, true> /* comparable */)
|
| 157 |
+
{
|
| 158 |
+
// The documentation states that pointers might be equal but can't alias in
|
| 159 |
+
// any other way. That is, the distance should be equal to zero or exceed
|
| 160 |
+
// `num_items`. In the latter case, we use an optimized version.
|
| 161 |
+
if (first != result)
|
| 162 |
+
{
|
| 163 |
+
constexpr bool may_alias = false;
|
| 164 |
+
return doit_step<may_alias>(d_temp_storage,
|
| 165 |
+
temp_storage_bytes,
|
| 166 |
+
first,
|
| 167 |
+
result,
|
| 168 |
+
binary_op,
|
| 169 |
+
num_items,
|
| 170 |
+
stream);
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
constexpr bool may_alias = true;
|
| 174 |
+
return doit_step<may_alias>(d_temp_storage,
|
| 175 |
+
temp_storage_bytes,
|
| 176 |
+
first,
|
| 177 |
+
result,
|
| 178 |
+
binary_op,
|
| 179 |
+
num_items,
|
| 180 |
+
stream);
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
template <typename Derived,
|
| 184 |
+
typename InputIt,
|
| 185 |
+
typename OutputIt,
|
| 186 |
+
typename BinaryOp>
|
| 187 |
+
OutputIt THRUST_RUNTIME_FUNCTION
|
| 188 |
+
adjacent_difference(execution_policy<Derived>& policy,
|
| 189 |
+
InputIt first,
|
| 190 |
+
InputIt last,
|
| 191 |
+
OutputIt result,
|
| 192 |
+
BinaryOp binary_op)
|
| 193 |
+
{
|
| 194 |
+
const auto num_items =
|
| 195 |
+
static_cast<std::size_t>(thrust::distance(first, last));
|
| 196 |
+
std::size_t storage_size = 0;
|
| 197 |
+
cudaStream_t stream = cuda_cub::stream(policy);
|
| 198 |
+
|
| 199 |
+
using UnwrapInputIt = thrust::detail::try_unwrap_contiguous_iterator_return_t<InputIt>;
|
| 200 |
+
using UnwrapOutputIt = thrust::detail::try_unwrap_contiguous_iterator_return_t<OutputIt>;
|
| 201 |
+
|
| 202 |
+
using InputValueT = thrust::iterator_value_t<UnwrapInputIt>;
|
| 203 |
+
using OutputValueT = thrust::iterator_value_t<UnwrapOutputIt>;
|
| 204 |
+
|
| 205 |
+
constexpr bool can_compare_iterators =
|
| 206 |
+
std::is_pointer<UnwrapInputIt>::value &&
|
| 207 |
+
std::is_pointer<UnwrapOutputIt>::value &&
|
| 208 |
+
std::is_same<InputValueT, OutputValueT>::value;
|
| 209 |
+
|
| 210 |
+
auto first_unwrap = thrust::detail::try_unwrap_contiguous_iterator(first);
|
| 211 |
+
auto result_unwrap = thrust::detail::try_unwrap_contiguous_iterator(result);
|
| 212 |
+
|
| 213 |
+
thrust::detail::integral_constant<bool, can_compare_iterators> comparable;
|
| 214 |
+
|
| 215 |
+
cudaError_t status = doit_step(nullptr,
|
| 216 |
+
storage_size,
|
| 217 |
+
first_unwrap,
|
| 218 |
+
result_unwrap,
|
| 219 |
+
binary_op,
|
| 220 |
+
num_items,
|
| 221 |
+
stream,
|
| 222 |
+
comparable);
|
| 223 |
+
cuda_cub::throw_on_error(status, "adjacent_difference failed on 1st step");
|
| 224 |
+
|
| 225 |
+
// Allocate temporary storage.
|
| 226 |
+
thrust::detail::temporary_array<thrust::detail::uint8_t, Derived>
|
| 227 |
+
tmp(policy, storage_size);
|
| 228 |
+
|
| 229 |
+
status = doit_step(static_cast<void *>(tmp.data().get()),
|
| 230 |
+
storage_size,
|
| 231 |
+
first_unwrap,
|
| 232 |
+
result_unwrap,
|
| 233 |
+
binary_op,
|
| 234 |
+
num_items,
|
| 235 |
+
stream,
|
| 236 |
+
comparable);
|
| 237 |
+
cuda_cub::throw_on_error(status, "adjacent_difference failed on 2nd step");
|
| 238 |
+
|
| 239 |
+
status = cuda_cub::synchronize_optional(policy);
|
| 240 |
+
cuda_cub::throw_on_error(status, "adjacent_difference failed to synchronize");
|
| 241 |
+
|
| 242 |
+
return result + num_items;
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
} // namespace __adjacent_difference
|
| 246 |
+
|
| 247 |
+
//-------------------------
|
| 248 |
+
// Thrust API entry points
|
| 249 |
+
//-------------------------
|
| 250 |
+
|
| 251 |
+
__thrust_exec_check_disable__
|
| 252 |
+
template <class Derived,
|
| 253 |
+
class InputIt,
|
| 254 |
+
class OutputIt,
|
| 255 |
+
class BinaryOp>
|
| 256 |
+
OutputIt __host__ __device__
|
| 257 |
+
adjacent_difference(execution_policy<Derived> &policy,
|
| 258 |
+
InputIt first,
|
| 259 |
+
InputIt last,
|
| 260 |
+
OutputIt result,
|
| 261 |
+
BinaryOp binary_op)
|
| 262 |
+
{
|
| 263 |
+
THRUST_CDP_DISPATCH(
|
| 264 |
+
(result = __adjacent_difference::adjacent_difference(policy,
|
| 265 |
+
first,
|
| 266 |
+
last,
|
| 267 |
+
result,
|
| 268 |
+
binary_op);),
|
| 269 |
+
(result = thrust::adjacent_difference(cvt_to_seq(derived_cast(policy)),
|
| 270 |
+
first,
|
| 271 |
+
last,
|
| 272 |
+
result,
|
| 273 |
+
binary_op);));
|
| 274 |
+
return result;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
template <class Derived,
|
| 278 |
+
class InputIt,
|
| 279 |
+
class OutputIt>
|
| 280 |
+
OutputIt __host__ __device__
|
| 281 |
+
adjacent_difference(execution_policy<Derived> &policy,
|
| 282 |
+
InputIt first,
|
| 283 |
+
InputIt last,
|
| 284 |
+
OutputIt result)
|
| 285 |
+
{
|
| 286 |
+
typedef typename iterator_traits<InputIt>::value_type input_type;
|
| 287 |
+
return cuda_cub::adjacent_difference(policy,
|
| 288 |
+
first,
|
| 289 |
+
last,
|
| 290 |
+
result,
|
| 291 |
+
minus<input_type>());
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
|
| 295 |
+
} // namespace cuda_cub
|
| 296 |
+
THRUST_NAMESPACE_END
|
| 297 |
+
|
| 298 |
+
//
|
| 299 |
+
#include <thrust/memory.h>
|
| 300 |
+
#include <thrust/adjacent_difference.h>
|
| 301 |
+
#endif
|
| 302 |
+
|
miniCUDA124/include/thrust/system/cuda/detail/assign_value.h
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 29 |
+
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC
|
| 30 |
+
#include <thrust/system/cuda/config.h>
|
| 31 |
+
#include <thrust/system/cuda/detail/execution_policy.h>
|
| 32 |
+
#include <thrust/detail/raw_pointer_cast.h>
|
| 33 |
+
#include <thrust/system/cuda/detail/copy.h>
|
| 34 |
+
|
| 35 |
+
#include <nv/target>
|
| 36 |
+
|
| 37 |
+
THRUST_NAMESPACE_BEGIN
|
| 38 |
+
namespace cuda_cub {
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
template<typename DerivedPolicy, typename Pointer1, typename Pointer2>
|
| 42 |
+
inline __host__ __device__
|
| 43 |
+
void assign_value(thrust::cuda::execution_policy<DerivedPolicy> &exec, Pointer1 dst, Pointer2 src)
|
| 44 |
+
{
|
| 45 |
+
// XXX war nvbugs/881631
|
| 46 |
+
struct war_nvbugs_881631
|
| 47 |
+
{
|
| 48 |
+
__host__ inline static void host_path(thrust::cuda::execution_policy<DerivedPolicy> &exec, Pointer1 dst, Pointer2 src)
|
| 49 |
+
{
|
| 50 |
+
cuda_cub::copy(exec, src, src + 1, dst);
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
__device__ inline static void device_path(thrust::cuda::execution_policy<DerivedPolicy> &, Pointer1 dst, Pointer2 src)
|
| 54 |
+
{
|
| 55 |
+
*thrust::raw_pointer_cast(dst) = *thrust::raw_pointer_cast(src);
|
| 56 |
+
}
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
NV_IF_TARGET(NV_IS_HOST, (
|
| 60 |
+
war_nvbugs_881631::host_path(exec,dst,src);
|
| 61 |
+
), (
|
| 62 |
+
war_nvbugs_881631::device_path(exec,dst,src);
|
| 63 |
+
));
|
| 64 |
+
|
| 65 |
+
} // end assign_value()
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
template<typename System1, typename System2, typename Pointer1, typename Pointer2>
|
| 69 |
+
inline __host__ __device__
|
| 70 |
+
void assign_value(cross_system<System1,System2> &systems, Pointer1 dst, Pointer2 src)
|
| 71 |
+
{
|
| 72 |
+
// XXX war nvbugs/881631
|
| 73 |
+
struct war_nvbugs_881631
|
| 74 |
+
{
|
| 75 |
+
__host__ inline static void host_path(cross_system<System1,System2> &systems, Pointer1 dst, Pointer2 src)
|
| 76 |
+
{
|
| 77 |
+
// rotate the systems so that they are ordered the same as (src, dst)
|
| 78 |
+
// for the call to thrust::copy
|
| 79 |
+
cross_system<System2,System1> rotated_systems = systems.rotate();
|
| 80 |
+
cuda_cub::copy(rotated_systems, src, src + 1, dst);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
__device__ inline static void device_path(cross_system<System1,System2> &, Pointer1 dst, Pointer2 src)
|
| 84 |
+
{
|
| 85 |
+
// XXX forward the true cuda::execution_policy inside systems here
|
| 86 |
+
// instead of materializing a tag
|
| 87 |
+
thrust::cuda::tag cuda_tag;
|
| 88 |
+
thrust::cuda_cub::assign_value(cuda_tag, dst, src);
|
| 89 |
+
}
|
| 90 |
+
};
|
| 91 |
+
|
| 92 |
+
NV_IF_TARGET(NV_IS_HOST, (
|
| 93 |
+
war_nvbugs_881631::host_path(systems,dst,src);
|
| 94 |
+
), (
|
| 95 |
+
war_nvbugs_881631::device_path(systems,dst,src);
|
| 96 |
+
));
|
| 97 |
+
} // end assign_value()
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
} // end cuda_cub
|
| 101 |
+
THRUST_NAMESPACE_END
|
| 102 |
+
#endif
|
miniCUDA124/include/thrust/system/cuda/detail/binary_search.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 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 |
+
// this system has no special version of this algorithm
|
miniCUDA124/include/thrust/system/cuda/detail/cdp_dispatch.h
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2021-2022 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 |
+
/**
|
| 18 |
+
* \file
|
| 19 |
+
* Utilities for CUDA dynamic parallelism.
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
#pragma once
|
| 23 |
+
|
| 24 |
+
#include <thrust/detail/config.h>
|
| 25 |
+
|
| 26 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 27 |
+
# pragma GCC system_header
|
| 28 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 29 |
+
# pragma clang system_header
|
| 30 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 31 |
+
# pragma system_header
|
| 32 |
+
#endif // no system header
|
| 33 |
+
|
| 34 |
+
#include <cub/config.cuh>
|
| 35 |
+
#include <cub/detail/detect_cuda_runtime.cuh>
|
| 36 |
+
|
| 37 |
+
#include <nv/target>
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* \def THRUST_CDP_DISPATCH
|
| 41 |
+
*
|
| 42 |
+
* If CUDA Dynamic Parallelism / CUDA Nested Parallelism is available, always
|
| 43 |
+
* run the parallel implementation. Otherwise, run the parallel implementation
|
| 44 |
+
* when called from the host, and fallback to the sequential implementation on
|
| 45 |
+
* the device.
|
| 46 |
+
*
|
| 47 |
+
* `par_impl` and `seq_impl` are blocks of C++ statements enclosed in
|
| 48 |
+
* parentheses, similar to NV_IF_TARGET blocks:
|
| 49 |
+
*
|
| 50 |
+
* \code
|
| 51 |
+
* THRUST_CDP_DISPATCH((launch_parallel_kernel();), (run_serial_impl();));
|
| 52 |
+
* \endcode
|
| 53 |
+
*/
|
| 54 |
+
|
| 55 |
+
#if defined(CUB_DETAIL_CDPv1)
|
| 56 |
+
|
| 57 |
+
// Special case for NVCC -- need to inform the device path about the kernels
|
| 58 |
+
// that are launched from the host path.
|
| 59 |
+
#if defined(__CUDACC__) && defined(__CUDA_ARCH__)
|
| 60 |
+
|
| 61 |
+
// seq_impl only used on platforms that do not support device synchronization.
|
| 62 |
+
#define THRUST_CDP_DISPATCH(par_impl, seq_impl) \
|
| 63 |
+
if (false) \
|
| 64 |
+
{ /* Without this, the device pass won't compile any kernels. */ \
|
| 65 |
+
NV_IF_TARGET(NV_ANY_TARGET, par_impl); \
|
| 66 |
+
} \
|
| 67 |
+
NV_IF_TARGET(NV_PROVIDES_SM_90, seq_impl, par_impl)
|
| 68 |
+
|
| 69 |
+
#else // NVCC device pass
|
| 70 |
+
|
| 71 |
+
// seq_impl only used on platforms that do not support device synchronization.
|
| 72 |
+
#define THRUST_CDP_DISPATCH(par_impl, seq_impl) \
|
| 73 |
+
NV_IF_TARGET(NV_PROVIDES_SM_90, seq_impl, par_impl)
|
| 74 |
+
|
| 75 |
+
#endif // NVCC device pass
|
| 76 |
+
|
| 77 |
+
#else // CDPv1 unavailable. Always fallback to serial on device:
|
| 78 |
+
|
| 79 |
+
// Special case for NVCC -- need to inform the device path about the kernels
|
| 80 |
+
// that are launched from the host path.
|
| 81 |
+
#if defined(__CUDACC__) && defined(__CUDA_ARCH__)
|
| 82 |
+
|
| 83 |
+
// Device-side launch not supported, fallback to sequential in device code.
|
| 84 |
+
#define THRUST_CDP_DISPATCH(par_impl, seq_impl) \
|
| 85 |
+
if (false) \
|
| 86 |
+
{ /* Without this, the device pass won't compile any kernels. */ \
|
| 87 |
+
NV_IF_TARGET(NV_ANY_TARGET, par_impl); \
|
| 88 |
+
} \
|
| 89 |
+
NV_IF_TARGET(NV_IS_HOST, par_impl, seq_impl)
|
| 90 |
+
|
| 91 |
+
#else // !(NVCC device pass):
|
| 92 |
+
|
| 93 |
+
#define THRUST_CDP_DISPATCH(par_impl, seq_impl) \
|
| 94 |
+
NV_IF_TARGET(NV_IS_HOST, par_impl, seq_impl)
|
| 95 |
+
|
| 96 |
+
#endif // NVCC device pass
|
| 97 |
+
|
| 98 |
+
#endif // CDP version
|
miniCUDA124/include/thrust/system/cuda/detail/copy.h
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************************************************************************
|
| 2 |
+
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* Redistribution and use in source and binary forms, with or without
|
| 5 |
+
* modification, are permitted provided that the following conditions are met:
|
| 6 |
+
* * Redistributions of source code must retain the above copyright
|
| 7 |
+
* notice, this list of conditions and the following disclaimer.
|
| 8 |
+
* * Redistributions in binary form must reproduce the above copyright
|
| 9 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 10 |
+
* documentation and/or other materials provided with the distribution.
|
| 11 |
+
* * Neither the name of the NVIDIA CORPORATION nor the
|
| 12 |
+
* names of its contributors may be used to endorse or promote products
|
| 13 |
+
* derived from this software without specific prior written permission.
|
| 14 |
+
*
|
| 15 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 16 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 17 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 18 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
|
| 19 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 20 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 21 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 22 |
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 23 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 24 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 25 |
+
*
|
| 26 |
+
******************************************************************************/
|
| 27 |
+
#pragma once
|
| 28 |
+
|
| 29 |
+
#include <thrust/detail/config.h>
|
| 30 |
+
|
| 31 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 32 |
+
# pragma GCC system_header
|
| 33 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 34 |
+
# pragma clang system_header
|
| 35 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 36 |
+
# pragma system_header
|
| 37 |
+
#endif // no system header
|
| 38 |
+
|
| 39 |
+
#include <thrust/advance.h>
|
| 40 |
+
|
| 41 |
+
#include <thrust/system/cuda/config.h>
|
| 42 |
+
#include <thrust/system/cuda/detail/cdp_dispatch.h>
|
| 43 |
+
#include <thrust/system/cuda/detail/execution_policy.h>
|
| 44 |
+
#include <thrust/system/cuda/detail/cross_system.h>
|
| 45 |
+
|
| 46 |
+
THRUST_NAMESPACE_BEGIN
|
| 47 |
+
|
| 48 |
+
template <typename DerivedPolicy, typename InputIt, typename OutputIt>
|
| 49 |
+
__host__ __device__ OutputIt
|
| 50 |
+
copy(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
| 51 |
+
InputIt first,
|
| 52 |
+
InputIt last,
|
| 53 |
+
OutputIt result);
|
| 54 |
+
|
| 55 |
+
template <class DerivedPolicy, class InputIt, class Size, class OutputIt>
|
| 56 |
+
__host__ __device__ OutputIt
|
| 57 |
+
copy_n(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
| 58 |
+
InputIt first,
|
| 59 |
+
Size n,
|
| 60 |
+
OutputIt result);
|
| 61 |
+
|
| 62 |
+
namespace cuda_cub {
|
| 63 |
+
|
| 64 |
+
// D->D copy requires NVCC compiler
|
| 65 |
+
template <class System,
|
| 66 |
+
class InputIterator,
|
| 67 |
+
class OutputIterator>
|
| 68 |
+
OutputIterator __host__ __device__
|
| 69 |
+
copy(execution_policy<System> &system,
|
| 70 |
+
InputIterator first,
|
| 71 |
+
InputIterator last,
|
| 72 |
+
OutputIterator result);
|
| 73 |
+
|
| 74 |
+
template <class System1,
|
| 75 |
+
class System2,
|
| 76 |
+
class InputIterator,
|
| 77 |
+
class OutputIterator>
|
| 78 |
+
OutputIterator __host__
|
| 79 |
+
copy(cross_system<System1, System2> systems,
|
| 80 |
+
InputIterator first,
|
| 81 |
+
InputIterator last,
|
| 82 |
+
OutputIterator result);
|
| 83 |
+
|
| 84 |
+
template <class System,
|
| 85 |
+
class InputIterator,
|
| 86 |
+
class Size,
|
| 87 |
+
class OutputIterator>
|
| 88 |
+
OutputIterator __host__ __device__
|
| 89 |
+
copy_n(execution_policy<System> &system,
|
| 90 |
+
InputIterator first,
|
| 91 |
+
Size n,
|
| 92 |
+
OutputIterator result);
|
| 93 |
+
|
| 94 |
+
template <class System1,
|
| 95 |
+
class System2,
|
| 96 |
+
class InputIterator,
|
| 97 |
+
class Size,
|
| 98 |
+
class OutputIterator>
|
| 99 |
+
OutputIterator __host__
|
| 100 |
+
copy_n(cross_system<System1, System2> systems,
|
| 101 |
+
InputIterator first,
|
| 102 |
+
Size n,
|
| 103 |
+
OutputIterator result);
|
| 104 |
+
|
| 105 |
+
} // namespace cuda_
|
| 106 |
+
THRUST_NAMESPACE_END
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
#include <thrust/system/cuda/detail/internal/copy_device_to_device.h>
|
| 111 |
+
#include <thrust/system/cuda/detail/internal/copy_cross_system.h>
|
| 112 |
+
#include <thrust/system/cuda/detail/par_to_seq.h>
|
| 113 |
+
|
| 114 |
+
THRUST_NAMESPACE_BEGIN
|
| 115 |
+
namespace cuda_cub {
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC
|
| 119 |
+
// D->D copy requires NVCC compiler
|
| 120 |
+
|
| 121 |
+
__thrust_exec_check_disable__
|
| 122 |
+
template <class System,
|
| 123 |
+
class InputIterator,
|
| 124 |
+
class OutputIterator>
|
| 125 |
+
OutputIterator __host__ __device__
|
| 126 |
+
copy(execution_policy<System> &system,
|
| 127 |
+
InputIterator first,
|
| 128 |
+
InputIterator last,
|
| 129 |
+
OutputIterator result)
|
| 130 |
+
{
|
| 131 |
+
THRUST_CDP_DISPATCH(
|
| 132 |
+
(result = __copy::device_to_device(system, first, last, result);),
|
| 133 |
+
(result =
|
| 134 |
+
thrust::copy(cvt_to_seq(derived_cast(system)), first, last, result);));
|
| 135 |
+
return result;
|
| 136 |
+
} // end copy()
|
| 137 |
+
|
| 138 |
+
__thrust_exec_check_disable__
|
| 139 |
+
template <class System,
|
| 140 |
+
class InputIterator,
|
| 141 |
+
class Size,
|
| 142 |
+
class OutputIterator>
|
| 143 |
+
OutputIterator __host__ __device__
|
| 144 |
+
copy_n(execution_policy<System> &system,
|
| 145 |
+
InputIterator first,
|
| 146 |
+
Size n,
|
| 147 |
+
OutputIterator result)
|
| 148 |
+
{
|
| 149 |
+
THRUST_CDP_DISPATCH(
|
| 150 |
+
(result = __copy::device_to_device(system,
|
| 151 |
+
first,
|
| 152 |
+
thrust::next(first, n),
|
| 153 |
+
result);),
|
| 154 |
+
(result =
|
| 155 |
+
thrust::copy_n(cvt_to_seq(derived_cast(system)), first, n, result);));
|
| 156 |
+
return result;
|
| 157 |
+
} // end copy_n()
|
| 158 |
+
#endif
|
| 159 |
+
|
| 160 |
+
template <class System1,
|
| 161 |
+
class System2,
|
| 162 |
+
class InputIterator,
|
| 163 |
+
class OutputIterator>
|
| 164 |
+
OutputIterator __host__
|
| 165 |
+
copy(cross_system<System1, System2> systems,
|
| 166 |
+
InputIterator first,
|
| 167 |
+
InputIterator last,
|
| 168 |
+
OutputIterator result)
|
| 169 |
+
{
|
| 170 |
+
return __copy::cross_system_copy(systems,first,last,result);
|
| 171 |
+
} // end copy()
|
| 172 |
+
|
| 173 |
+
template <class System1,
|
| 174 |
+
class System2,
|
| 175 |
+
class InputIterator,
|
| 176 |
+
class Size,
|
| 177 |
+
class OutputIterator>
|
| 178 |
+
OutputIterator __host__
|
| 179 |
+
copy_n(cross_system<System1, System2> systems,
|
| 180 |
+
InputIterator first,
|
| 181 |
+
Size n,
|
| 182 |
+
OutputIterator result)
|
| 183 |
+
{
|
| 184 |
+
return __copy::cross_system_copy_n(systems, first, n, result);
|
| 185 |
+
} // end copy_n()
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
} // namespace cuda_cub
|
| 189 |
+
THRUST_NAMESPACE_END
|
| 190 |
+
|
| 191 |
+
#include <thrust/memory.h>
|
| 192 |
+
#include <thrust/detail/temporary_array.h>
|
miniCUDA124/include/thrust/system/cuda/detail/copy_if.h
ADDED
|
@@ -0,0 +1,839 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************************************************************************
|
| 2 |
+
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* Redistribution and use in source and binary forms, with or without
|
| 5 |
+
* modification, are permitted provided that the following conditions are met:
|
| 6 |
+
* * Redistributions of source code must retain the above copyright
|
| 7 |
+
* notice, this list of conditions and the following disclaimer.
|
| 8 |
+
* * Redistributions in binary form must reproduce the above copyright
|
| 9 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 10 |
+
* documentation and/or other materials provided with the distribution.
|
| 11 |
+
* * Neither the name of the NVIDIA CORPORATION nor the
|
| 12 |
+
* names of its contributors may be used to endorse or promote products
|
| 13 |
+
* derived from this software without specific prior written permission.
|
| 14 |
+
*
|
| 15 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 16 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 17 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 18 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
|
| 19 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 20 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 21 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 22 |
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 23 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 24 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 25 |
+
*
|
| 26 |
+
******************************************************************************/
|
| 27 |
+
#pragma once
|
| 28 |
+
|
| 29 |
+
#include <thrust/detail/config.h>
|
| 30 |
+
|
| 31 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 32 |
+
# pragma GCC system_header
|
| 33 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 34 |
+
# pragma clang system_header
|
| 35 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 36 |
+
# pragma system_header
|
| 37 |
+
#endif // no system header
|
| 38 |
+
|
| 39 |
+
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC
|
| 40 |
+
|
| 41 |
+
#include <thrust/detail/alignment.h>
|
| 42 |
+
#include <thrust/detail/cstdint.h>
|
| 43 |
+
#include <thrust/detail/function.h>
|
| 44 |
+
#include <thrust/detail/temporary_array.h>
|
| 45 |
+
#include <thrust/distance.h>
|
| 46 |
+
#include <thrust/system/cuda/config.h>
|
| 47 |
+
#include <thrust/system/cuda/detail/cdp_dispatch.h>
|
| 48 |
+
#include <thrust/system/cuda/detail/core/agent_launcher.h>
|
| 49 |
+
#include <thrust/system/cuda/detail/core/util.h>
|
| 50 |
+
#include <thrust/system/cuda/detail/par_to_seq.h>
|
| 51 |
+
#include <thrust/system/cuda/detail/util.h>
|
| 52 |
+
|
| 53 |
+
#include <cub/device/device_select.cuh>
|
| 54 |
+
#include <cub/util_math.cuh>
|
| 55 |
+
|
| 56 |
+
THRUST_NAMESPACE_BEGIN
|
| 57 |
+
// XXX declare generic copy_if interface
|
| 58 |
+
// to avoid circulular dependency from thrust/copy.h
|
| 59 |
+
template <typename DerivedPolicy, typename InputIterator, typename OutputIterator, typename Predicate>
|
| 60 |
+
__host__ __device__
|
| 61 |
+
OutputIterator
|
| 62 |
+
copy_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
| 63 |
+
InputIterator first,
|
| 64 |
+
InputIterator last,
|
| 65 |
+
OutputIterator result,
|
| 66 |
+
Predicate pred);
|
| 67 |
+
|
| 68 |
+
template <typename DerivedPolicy, typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Predicate>
|
| 69 |
+
__host__ __device__
|
| 70 |
+
OutputIterator
|
| 71 |
+
copy_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
| 72 |
+
InputIterator1 first,
|
| 73 |
+
InputIterator1 last,
|
| 74 |
+
InputIterator2 stencil,
|
| 75 |
+
OutputIterator result,
|
| 76 |
+
Predicate pred);
|
| 77 |
+
|
| 78 |
+
namespace cuda_cub {
|
| 79 |
+
|
| 80 |
+
namespace __copy_if {
|
| 81 |
+
|
| 82 |
+
template <int _BLOCK_THREADS,
|
| 83 |
+
int _ITEMS_PER_THREAD = 1,
|
| 84 |
+
cub::BlockLoadAlgorithm _LOAD_ALGORITHM = cub::BLOCK_LOAD_DIRECT,
|
| 85 |
+
cub::CacheLoadModifier _LOAD_MODIFIER = cub::LOAD_LDG,
|
| 86 |
+
cub::BlockScanAlgorithm _SCAN_ALGORITHM = cub::BLOCK_SCAN_WARP_SCANS>
|
| 87 |
+
struct PtxPolicy
|
| 88 |
+
{
|
| 89 |
+
enum
|
| 90 |
+
{
|
| 91 |
+
BLOCK_THREADS = _BLOCK_THREADS,
|
| 92 |
+
ITEMS_PER_THREAD = _ITEMS_PER_THREAD,
|
| 93 |
+
ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD,
|
| 94 |
+
};
|
| 95 |
+
static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM;
|
| 96 |
+
static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER;
|
| 97 |
+
static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM;
|
| 98 |
+
}; // struct PtxPolicy
|
| 99 |
+
|
| 100 |
+
template<class, class>
|
| 101 |
+
struct Tuning;
|
| 102 |
+
|
| 103 |
+
template<class T>
|
| 104 |
+
struct Tuning<sm52, T>
|
| 105 |
+
{
|
| 106 |
+
const static int INPUT_SIZE = sizeof(T);
|
| 107 |
+
|
| 108 |
+
enum
|
| 109 |
+
{
|
| 110 |
+
NOMINAL_4B_ITEMS_PER_THREAD = 9,
|
| 111 |
+
ITEMS_PER_THREAD = CUB_MIN(NOMINAL_4B_ITEMS_PER_THREAD, CUB_MAX(1, (NOMINAL_4B_ITEMS_PER_THREAD * 4 / sizeof(T)))),
|
| 112 |
+
};
|
| 113 |
+
|
| 114 |
+
typedef PtxPolicy<128,
|
| 115 |
+
ITEMS_PER_THREAD,
|
| 116 |
+
cub::BLOCK_LOAD_WARP_TRANSPOSE,
|
| 117 |
+
cub::LOAD_LDG,
|
| 118 |
+
cub::BLOCK_SCAN_WARP_SCANS>
|
| 119 |
+
type;
|
| 120 |
+
}; // Tuning<350>
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
template<class T>
|
| 124 |
+
struct Tuning<sm35, T>
|
| 125 |
+
{
|
| 126 |
+
const static int INPUT_SIZE = sizeof(T);
|
| 127 |
+
|
| 128 |
+
enum
|
| 129 |
+
{
|
| 130 |
+
NOMINAL_4B_ITEMS_PER_THREAD = 10,
|
| 131 |
+
ITEMS_PER_THREAD = CUB_MIN(NOMINAL_4B_ITEMS_PER_THREAD, CUB_MAX(1, (NOMINAL_4B_ITEMS_PER_THREAD * 4 / sizeof(T)))),
|
| 132 |
+
};
|
| 133 |
+
|
| 134 |
+
typedef PtxPolicy<128,
|
| 135 |
+
ITEMS_PER_THREAD,
|
| 136 |
+
cub::BLOCK_LOAD_WARP_TRANSPOSE,
|
| 137 |
+
cub::LOAD_LDG,
|
| 138 |
+
cub::BLOCK_SCAN_WARP_SCANS>
|
| 139 |
+
type;
|
| 140 |
+
}; // Tuning<350>
|
| 141 |
+
|
| 142 |
+
template<class T>
|
| 143 |
+
struct Tuning<sm30, T>
|
| 144 |
+
{
|
| 145 |
+
const static int INPUT_SIZE = sizeof(T);
|
| 146 |
+
|
| 147 |
+
enum
|
| 148 |
+
{
|
| 149 |
+
NOMINAL_4B_ITEMS_PER_THREAD = 7,
|
| 150 |
+
ITEMS_PER_THREAD = CUB_MIN(NOMINAL_4B_ITEMS_PER_THREAD, CUB_MAX(3, (NOMINAL_4B_ITEMS_PER_THREAD * 4 / sizeof(T)))),
|
| 151 |
+
};
|
| 152 |
+
|
| 153 |
+
typedef PtxPolicy<128,
|
| 154 |
+
ITEMS_PER_THREAD,
|
| 155 |
+
cub::BLOCK_LOAD_WARP_TRANSPOSE,
|
| 156 |
+
cub::LOAD_DEFAULT,
|
| 157 |
+
cub::BLOCK_SCAN_WARP_SCANS>
|
| 158 |
+
type;
|
| 159 |
+
}; // Tuning<300>
|
| 160 |
+
|
| 161 |
+
struct no_stencil_tag_ {};
|
| 162 |
+
typedef no_stencil_tag_* no_stencil_tag;
|
| 163 |
+
template <class ItemsIt,
|
| 164 |
+
class StencilIt,
|
| 165 |
+
class OutputIt,
|
| 166 |
+
class Predicate,
|
| 167 |
+
class Size,
|
| 168 |
+
class NumSelectedOutputIt>
|
| 169 |
+
struct CopyIfAgent
|
| 170 |
+
{
|
| 171 |
+
typedef typename iterator_traits<ItemsIt>::value_type item_type;
|
| 172 |
+
typedef typename iterator_traits<StencilIt>::value_type stencil_type;
|
| 173 |
+
|
| 174 |
+
typedef cub::ScanTileState<Size> ScanTileState;
|
| 175 |
+
|
| 176 |
+
template <class Arch>
|
| 177 |
+
struct PtxPlan : Tuning<Arch, item_type>::type
|
| 178 |
+
{
|
| 179 |
+
typedef Tuning<Arch,item_type> tuning;
|
| 180 |
+
|
| 181 |
+
typedef typename core::LoadIterator<PtxPlan, ItemsIt>::type ItemsLoadIt;
|
| 182 |
+
typedef typename core::LoadIterator<PtxPlan, StencilIt>::type StencilLoadIt;
|
| 183 |
+
|
| 184 |
+
typedef typename core::BlockLoad<PtxPlan, ItemsLoadIt>::type BlockLoadItems;
|
| 185 |
+
typedef typename core::BlockLoad<PtxPlan, StencilLoadIt>::type BlockLoadStencil;
|
| 186 |
+
|
| 187 |
+
typedef cub::TilePrefixCallbackOp<Size,
|
| 188 |
+
cub::Sum,
|
| 189 |
+
ScanTileState,
|
| 190 |
+
Arch::ver>
|
| 191 |
+
TilePrefixCallback;
|
| 192 |
+
|
| 193 |
+
typedef cub::BlockScan<Size,
|
| 194 |
+
PtxPlan::BLOCK_THREADS,
|
| 195 |
+
PtxPlan::SCAN_ALGORITHM,
|
| 196 |
+
1,
|
| 197 |
+
1,
|
| 198 |
+
Arch::ver>
|
| 199 |
+
BlockScan;
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
union TempStorage
|
| 203 |
+
{
|
| 204 |
+
struct ScanStorage
|
| 205 |
+
{
|
| 206 |
+
typename BlockScan::TempStorage scan;
|
| 207 |
+
typename TilePrefixCallback::TempStorage prefix;
|
| 208 |
+
} scan_storage;
|
| 209 |
+
|
| 210 |
+
typename BlockLoadItems::TempStorage load_items;
|
| 211 |
+
typename BlockLoadStencil::TempStorage load_stencil;
|
| 212 |
+
|
| 213 |
+
core::uninitialized_array<item_type, PtxPlan::ITEMS_PER_TILE> raw_exchange;
|
| 214 |
+
}; // union TempStorage
|
| 215 |
+
}; // struct PtxPlan
|
| 216 |
+
|
| 217 |
+
typedef typename core::specialize_plan_msvc10_war<PtxPlan>::type::type ptx_plan;
|
| 218 |
+
|
| 219 |
+
typedef typename ptx_plan::ItemsLoadIt ItemsLoadIt;
|
| 220 |
+
typedef typename ptx_plan::StencilLoadIt StencilLoadIt;
|
| 221 |
+
typedef typename ptx_plan::BlockLoadItems BlockLoadItems;
|
| 222 |
+
typedef typename ptx_plan::BlockLoadStencil BlockLoadStencil;
|
| 223 |
+
typedef typename ptx_plan::TilePrefixCallback TilePrefixCallback;
|
| 224 |
+
typedef typename ptx_plan::BlockScan BlockScan;
|
| 225 |
+
typedef typename ptx_plan::TempStorage TempStorage;
|
| 226 |
+
|
| 227 |
+
enum
|
| 228 |
+
{
|
| 229 |
+
USE_STENCIL = !thrust::detail::is_same<StencilIt, no_stencil_tag>::value,
|
| 230 |
+
BLOCK_THREADS = ptx_plan::BLOCK_THREADS,
|
| 231 |
+
ITEMS_PER_THREAD = ptx_plan::ITEMS_PER_THREAD,
|
| 232 |
+
ITEMS_PER_TILE = ptx_plan::ITEMS_PER_TILE
|
| 233 |
+
};
|
| 234 |
+
|
| 235 |
+
struct impl
|
| 236 |
+
{
|
| 237 |
+
//---------------------------------------------------------------------
|
| 238 |
+
// Per-thread fields
|
| 239 |
+
//---------------------------------------------------------------------
|
| 240 |
+
|
| 241 |
+
TempStorage & storage;
|
| 242 |
+
ScanTileState &tile_state;
|
| 243 |
+
ItemsLoadIt items_load_it;
|
| 244 |
+
StencilLoadIt stencil_load_it;
|
| 245 |
+
OutputIt output_it;
|
| 246 |
+
Predicate predicate;
|
| 247 |
+
Size num_items;
|
| 248 |
+
|
| 249 |
+
//------------------------------------------
|
| 250 |
+
// scatter results to memory
|
| 251 |
+
//------------------------------------------
|
| 252 |
+
|
| 253 |
+
THRUST_DEVICE_FUNCTION void
|
| 254 |
+
scatter(item_type (&items)[ITEMS_PER_THREAD],
|
| 255 |
+
Size (&selection_flags)[ITEMS_PER_THREAD],
|
| 256 |
+
Size (&selection_indices)[ITEMS_PER_THREAD],
|
| 257 |
+
int num_tile_selections,
|
| 258 |
+
Size num_selections_prefix)
|
| 259 |
+
{
|
| 260 |
+
using core::sync_threadblock;
|
| 261 |
+
|
| 262 |
+
#pragma unroll
|
| 263 |
+
for (int ITEM = 0; ITEM < ITEMS_PER_THREAD; ++ITEM)
|
| 264 |
+
{
|
| 265 |
+
int local_scatter_offset = selection_indices[ITEM] -
|
| 266 |
+
num_selections_prefix;
|
| 267 |
+
if (selection_flags[ITEM])
|
| 268 |
+
{
|
| 269 |
+
new (&storage.raw_exchange[local_scatter_offset]) item_type(items[ITEM]);
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
sync_threadblock();
|
| 274 |
+
|
| 275 |
+
for (int item = threadIdx.x;
|
| 276 |
+
item < num_tile_selections;
|
| 277 |
+
item += BLOCK_THREADS)
|
| 278 |
+
{
|
| 279 |
+
output_it[num_selections_prefix + item] = storage.raw_exchange[item];
|
| 280 |
+
}
|
| 281 |
+
} // func scatter
|
| 282 |
+
|
| 283 |
+
//------------------------------------------
|
| 284 |
+
// specialize predicate on different types
|
| 285 |
+
//------------------------------------------
|
| 286 |
+
|
| 287 |
+
template <int T>
|
| 288 |
+
struct __tag {};
|
| 289 |
+
|
| 290 |
+
enum ItemStencil
|
| 291 |
+
{
|
| 292 |
+
ITEM,
|
| 293 |
+
STENCIL
|
| 294 |
+
};
|
| 295 |
+
|
| 296 |
+
template <bool TAG, class T>
|
| 297 |
+
struct wrap_value
|
| 298 |
+
{
|
| 299 |
+
T const & x;
|
| 300 |
+
THRUST_DEVICE_FUNCTION wrap_value(T const &x) : x(x) {}
|
| 301 |
+
|
| 302 |
+
THRUST_DEVICE_FUNCTION T const &operator()() const { return x; };
|
| 303 |
+
}; // struct wrap_type
|
| 304 |
+
|
| 305 |
+
//------- item
|
| 306 |
+
|
| 307 |
+
THRUST_DEVICE_FUNCTION bool
|
| 308 |
+
predicate_wrapper(wrap_value<ITEM, item_type> const &x,
|
| 309 |
+
__tag<false /* USE_STENCIL */>)
|
| 310 |
+
{
|
| 311 |
+
return predicate(x());
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
THRUST_DEVICE_FUNCTION bool
|
| 315 |
+
predicate_wrapper(wrap_value<ITEM, item_type> const &,
|
| 316 |
+
__tag<true>)
|
| 317 |
+
{
|
| 318 |
+
return false;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
//-------- stencil
|
| 322 |
+
|
| 323 |
+
template <class T>
|
| 324 |
+
THRUST_DEVICE_FUNCTION bool
|
| 325 |
+
predicate_wrapper(wrap_value<STENCIL, T> const &x,
|
| 326 |
+
__tag<true>)
|
| 327 |
+
{
|
| 328 |
+
return predicate(x());
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
THRUST_DEVICE_FUNCTION bool
|
| 332 |
+
predicate_wrapper(wrap_value<STENCIL, no_stencil_tag_> const &,
|
| 333 |
+
__tag<true>)
|
| 334 |
+
{
|
| 335 |
+
return false;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
THRUST_DEVICE_FUNCTION bool
|
| 340 |
+
predicate_wrapper(wrap_value<STENCIL, stencil_type> const &,
|
| 341 |
+
__tag<false>)
|
| 342 |
+
{
|
| 343 |
+
return false;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
template <bool IS_LAST_TILE, ItemStencil TYPE, class T>
|
| 347 |
+
THRUST_DEVICE_FUNCTION void
|
| 348 |
+
compute_selection_flags(int num_tile_items,
|
| 349 |
+
T (&values)[ITEMS_PER_THREAD],
|
| 350 |
+
Size (&selection_flags)[ITEMS_PER_THREAD])
|
| 351 |
+
{
|
| 352 |
+
#pragma unroll
|
| 353 |
+
for (int ITEM = 0; ITEM < ITEMS_PER_THREAD; ++ITEM)
|
| 354 |
+
{
|
| 355 |
+
// Out-of-bounds items are selection_flags
|
| 356 |
+
selection_flags[ITEM] = 1;
|
| 357 |
+
|
| 358 |
+
if (!IS_LAST_TILE ||
|
| 359 |
+
(Size(threadIdx.x * ITEMS_PER_THREAD) + ITEM < num_tile_items))
|
| 360 |
+
{
|
| 361 |
+
selection_flags[ITEM] =
|
| 362 |
+
predicate_wrapper(wrap_value<TYPE, T>(values[ITEM]),
|
| 363 |
+
__tag<USE_STENCIL>());
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
//------------------------------------------
|
| 369 |
+
// consume tiles
|
| 370 |
+
//------------------------------------------
|
| 371 |
+
|
| 372 |
+
template <bool IS_LAST_TILE, bool IS_FIRST_TILE>
|
| 373 |
+
Size THRUST_DEVICE_FUNCTION
|
| 374 |
+
consume_tile_impl(int num_tile_items,
|
| 375 |
+
int tile_idx,
|
| 376 |
+
Size tile_base)
|
| 377 |
+
{
|
| 378 |
+
item_type items_loc[ITEMS_PER_THREAD];
|
| 379 |
+
Size selection_flags[ITEMS_PER_THREAD];
|
| 380 |
+
Size selection_idx[ITEMS_PER_THREAD];
|
| 381 |
+
|
| 382 |
+
if (IS_LAST_TILE) {
|
| 383 |
+
BlockLoadItems(storage.load_items)
|
| 384 |
+
.Load(items_load_it + tile_base,
|
| 385 |
+
items_loc,
|
| 386 |
+
num_tile_items);
|
| 387 |
+
}
|
| 388 |
+
else
|
| 389 |
+
{
|
| 390 |
+
BlockLoadItems(storage.load_items)
|
| 391 |
+
.Load(items_load_it + tile_base,
|
| 392 |
+
items_loc);
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
core::sync_threadblock();
|
| 396 |
+
|
| 397 |
+
if (USE_STENCIL)
|
| 398 |
+
{
|
| 399 |
+
stencil_type stencil_loc[ITEMS_PER_THREAD];
|
| 400 |
+
|
| 401 |
+
if (IS_LAST_TILE)
|
| 402 |
+
{
|
| 403 |
+
BlockLoadStencil(storage.load_stencil)
|
| 404 |
+
.Load(stencil_load_it + tile_base,
|
| 405 |
+
stencil_loc,
|
| 406 |
+
num_tile_items);
|
| 407 |
+
}
|
| 408 |
+
else
|
| 409 |
+
{
|
| 410 |
+
BlockLoadStencil(storage.load_stencil)
|
| 411 |
+
.Load(stencil_load_it + tile_base,
|
| 412 |
+
stencil_loc);
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
compute_selection_flags<IS_LAST_TILE, STENCIL>(num_tile_items,
|
| 416 |
+
stencil_loc,
|
| 417 |
+
selection_flags);
|
| 418 |
+
}
|
| 419 |
+
else /* Use predicate on items rather then stencil */
|
| 420 |
+
{
|
| 421 |
+
compute_selection_flags<IS_LAST_TILE, ITEM>(num_tile_items,
|
| 422 |
+
items_loc,
|
| 423 |
+
selection_flags);
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
core::sync_threadblock();
|
| 427 |
+
|
| 428 |
+
Size num_tile_selections = 0;
|
| 429 |
+
Size num_selections = 0;
|
| 430 |
+
Size num_selections_prefix = 0;
|
| 431 |
+
if (IS_FIRST_TILE)
|
| 432 |
+
{
|
| 433 |
+
BlockScan(storage.scan_storage.scan)
|
| 434 |
+
.ExclusiveSum(selection_flags,
|
| 435 |
+
selection_idx,
|
| 436 |
+
num_tile_selections);
|
| 437 |
+
|
| 438 |
+
if (threadIdx.x == 0)
|
| 439 |
+
{
|
| 440 |
+
// Update tile status if this is not the last tile
|
| 441 |
+
if (!IS_LAST_TILE)
|
| 442 |
+
tile_state.SetInclusive(0, num_tile_selections);
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
// Do not count any out-of-bounds selections
|
| 446 |
+
if (IS_LAST_TILE)
|
| 447 |
+
{
|
| 448 |
+
int num_discount = ITEMS_PER_TILE - num_tile_items;
|
| 449 |
+
num_tile_selections -= num_discount;
|
| 450 |
+
}
|
| 451 |
+
num_selections = num_tile_selections;
|
| 452 |
+
}
|
| 453 |
+
else
|
| 454 |
+
{
|
| 455 |
+
TilePrefixCallback prefix_cb(tile_state,
|
| 456 |
+
storage.scan_storage.prefix,
|
| 457 |
+
cub::Sum(),
|
| 458 |
+
tile_idx);
|
| 459 |
+
BlockScan(storage.scan_storage.scan)
|
| 460 |
+
.ExclusiveSum(selection_flags,
|
| 461 |
+
selection_idx,
|
| 462 |
+
prefix_cb);
|
| 463 |
+
|
| 464 |
+
num_selections = prefix_cb.GetInclusivePrefix();
|
| 465 |
+
num_tile_selections = prefix_cb.GetBlockAggregate();
|
| 466 |
+
num_selections_prefix = prefix_cb.GetExclusivePrefix();
|
| 467 |
+
|
| 468 |
+
if (IS_LAST_TILE)
|
| 469 |
+
{
|
| 470 |
+
int num_discount = ITEMS_PER_TILE - num_tile_items;
|
| 471 |
+
num_tile_selections -= num_discount;
|
| 472 |
+
num_selections -= num_discount;
|
| 473 |
+
}
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
core::sync_threadblock();
|
| 477 |
+
|
| 478 |
+
scatter(items_loc,
|
| 479 |
+
selection_flags,
|
| 480 |
+
selection_idx,
|
| 481 |
+
num_tile_selections,
|
| 482 |
+
num_selections_prefix);
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
return num_selections;
|
| 486 |
+
} // func consume_tile_impl
|
| 487 |
+
|
| 488 |
+
template <bool IS_LAST_TILE>
|
| 489 |
+
THRUST_DEVICE_FUNCTION Size
|
| 490 |
+
consume_tile(int num_tile_items,
|
| 491 |
+
int tile_idx,
|
| 492 |
+
Size tile_base)
|
| 493 |
+
{
|
| 494 |
+
if (tile_idx == 0)
|
| 495 |
+
{
|
| 496 |
+
return consume_tile_impl<IS_LAST_TILE, true>(num_tile_items,
|
| 497 |
+
tile_idx,
|
| 498 |
+
tile_base);
|
| 499 |
+
}
|
| 500 |
+
else
|
| 501 |
+
{
|
| 502 |
+
return consume_tile_impl<IS_LAST_TILE, false>(num_tile_items,
|
| 503 |
+
tile_idx,
|
| 504 |
+
tile_base);
|
| 505 |
+
}
|
| 506 |
+
} // func consume_tile
|
| 507 |
+
|
| 508 |
+
//---------------------------------------------------------------------
|
| 509 |
+
// Constructor
|
| 510 |
+
//---------------------------------------------------------------------
|
| 511 |
+
|
| 512 |
+
THRUST_DEVICE_FUNCTION impl(TempStorage & storage_,
|
| 513 |
+
ScanTileState & tile_state_,
|
| 514 |
+
ItemsIt items_it,
|
| 515 |
+
StencilIt stencil_it,
|
| 516 |
+
OutputIt output_it_,
|
| 517 |
+
Predicate predicate_,
|
| 518 |
+
Size num_items_,
|
| 519 |
+
int num_tiles,
|
| 520 |
+
NumSelectedOutputIt num_selected_out)
|
| 521 |
+
: storage(storage_),
|
| 522 |
+
tile_state(tile_state_),
|
| 523 |
+
items_load_it(core::make_load_iterator(ptx_plan(), items_it)),
|
| 524 |
+
stencil_load_it(core::make_load_iterator(ptx_plan(), stencil_it)),
|
| 525 |
+
output_it(output_it_),
|
| 526 |
+
predicate(predicate_),
|
| 527 |
+
num_items(num_items_)
|
| 528 |
+
{
|
| 529 |
+
int tile_idx = blockIdx.x;
|
| 530 |
+
Size tile_base = tile_idx * ITEMS_PER_TILE;
|
| 531 |
+
|
| 532 |
+
if (tile_idx < num_tiles - 1)
|
| 533 |
+
{
|
| 534 |
+
consume_tile<false>(ITEMS_PER_TILE,
|
| 535 |
+
tile_idx,
|
| 536 |
+
tile_base);
|
| 537 |
+
}
|
| 538 |
+
else
|
| 539 |
+
{
|
| 540 |
+
int num_remaining = static_cast<int>(num_items - tile_base);
|
| 541 |
+
Size num_selections = consume_tile<true>(num_remaining,
|
| 542 |
+
tile_idx,
|
| 543 |
+
tile_base);
|
| 544 |
+
if (threadIdx.x == 0)
|
| 545 |
+
{
|
| 546 |
+
*num_selected_out = num_selections;
|
| 547 |
+
}
|
| 548 |
+
}
|
| 549 |
+
} // ctor impl
|
| 550 |
+
};
|
| 551 |
+
|
| 552 |
+
//---------------------------------------------------------------------
|
| 553 |
+
// Agent entry point
|
| 554 |
+
//---------------------------------------------------------------------
|
| 555 |
+
|
| 556 |
+
THRUST_AGENT_ENTRY(ItemsIt items_it,
|
| 557 |
+
StencilIt stencil_it,
|
| 558 |
+
OutputIt output_it,
|
| 559 |
+
Predicate predicate,
|
| 560 |
+
Size num_items,
|
| 561 |
+
NumSelectedOutputIt num_selected_out,
|
| 562 |
+
ScanTileState tile_state,
|
| 563 |
+
int num_tiles,
|
| 564 |
+
char * shmem)
|
| 565 |
+
{
|
| 566 |
+
TempStorage &storage = *reinterpret_cast<TempStorage *>(shmem);
|
| 567 |
+
|
| 568 |
+
impl(storage,
|
| 569 |
+
tile_state,
|
| 570 |
+
items_it,
|
| 571 |
+
stencil_it,
|
| 572 |
+
output_it,
|
| 573 |
+
predicate,
|
| 574 |
+
num_items,
|
| 575 |
+
num_tiles,
|
| 576 |
+
num_selected_out);
|
| 577 |
+
}
|
| 578 |
+
}; // struct CopyIfAgent
|
| 579 |
+
|
| 580 |
+
template <class ScanTileState,
|
| 581 |
+
class NumSelectedIt,
|
| 582 |
+
class Size>
|
| 583 |
+
struct InitAgent
|
| 584 |
+
{
|
| 585 |
+
template <class Arch>
|
| 586 |
+
struct PtxPlan : PtxPolicy<128> {};
|
| 587 |
+
typedef core::specialize_plan<PtxPlan> ptx_plan;
|
| 588 |
+
|
| 589 |
+
//---------------------------------------------------------------------
|
| 590 |
+
// Agent entry point
|
| 591 |
+
//---------------------------------------------------------------------
|
| 592 |
+
|
| 593 |
+
THRUST_AGENT_ENTRY(ScanTileState tile_state,
|
| 594 |
+
Size num_tiles,
|
| 595 |
+
NumSelectedIt num_selected_out,
|
| 596 |
+
char * /*shmem*/)
|
| 597 |
+
{
|
| 598 |
+
tile_state.InitializeStatus(num_tiles);
|
| 599 |
+
if (blockIdx.x == 0 && threadIdx.x == 0)
|
| 600 |
+
*num_selected_out = 0;
|
| 601 |
+
}
|
| 602 |
+
}; // struct InitAgent
|
| 603 |
+
|
| 604 |
+
template <class ItemsIt,
|
| 605 |
+
class StencilIt,
|
| 606 |
+
class OutputIt,
|
| 607 |
+
class Predicate,
|
| 608 |
+
class Size,
|
| 609 |
+
class NumSelectedOutIt>
|
| 610 |
+
THRUST_RUNTIME_FUNCTION
|
| 611 |
+
static cudaError_t doit_step(void * d_temp_storage,
|
| 612 |
+
size_t & temp_storage_bytes,
|
| 613 |
+
ItemsIt items,
|
| 614 |
+
StencilIt stencil,
|
| 615 |
+
OutputIt output_it,
|
| 616 |
+
Predicate predicate,
|
| 617 |
+
NumSelectedOutIt num_selected_out,
|
| 618 |
+
Size num_items,
|
| 619 |
+
cudaStream_t stream)
|
| 620 |
+
{
|
| 621 |
+
if (num_items == 0)
|
| 622 |
+
return cudaSuccess;
|
| 623 |
+
|
| 624 |
+
using core::AgentLauncher;
|
| 625 |
+
using core::AgentPlan;
|
| 626 |
+
using core::get_agent_plan;
|
| 627 |
+
|
| 628 |
+
typedef AgentLauncher<
|
| 629 |
+
CopyIfAgent<ItemsIt,
|
| 630 |
+
StencilIt,
|
| 631 |
+
OutputIt,
|
| 632 |
+
Predicate,
|
| 633 |
+
Size,
|
| 634 |
+
NumSelectedOutIt> >
|
| 635 |
+
copy_if_agent;
|
| 636 |
+
|
| 637 |
+
typedef typename copy_if_agent::ScanTileState ScanTileState;
|
| 638 |
+
|
| 639 |
+
typedef AgentLauncher<
|
| 640 |
+
InitAgent<ScanTileState, NumSelectedOutIt, Size> >
|
| 641 |
+
init_agent;
|
| 642 |
+
|
| 643 |
+
|
| 644 |
+
using core::get_plan;
|
| 645 |
+
typename get_plan<init_agent>::type init_plan = init_agent::get_plan();
|
| 646 |
+
typename get_plan<copy_if_agent>::type copy_if_plan = copy_if_agent::get_plan(stream);
|
| 647 |
+
|
| 648 |
+
int tile_size = copy_if_plan.items_per_tile;
|
| 649 |
+
size_t num_tiles = cub::DivideAndRoundUp(num_items, tile_size);
|
| 650 |
+
|
| 651 |
+
size_t vshmem_size = core::vshmem_size(copy_if_plan.shared_memory_size,
|
| 652 |
+
num_tiles);
|
| 653 |
+
|
| 654 |
+
cudaError_t status = cudaSuccess;
|
| 655 |
+
if (num_items == 0)
|
| 656 |
+
return status;
|
| 657 |
+
|
| 658 |
+
size_t allocation_sizes[2] = {0, vshmem_size};
|
| 659 |
+
status = ScanTileState::AllocationSize(static_cast<int>(num_tiles), allocation_sizes[0]);
|
| 660 |
+
CUDA_CUB_RET_IF_FAIL(status);
|
| 661 |
+
|
| 662 |
+
|
| 663 |
+
void* allocations[2] = {NULL, NULL};
|
| 664 |
+
status = cub::AliasTemporaries(d_temp_storage,
|
| 665 |
+
temp_storage_bytes,
|
| 666 |
+
allocations,
|
| 667 |
+
allocation_sizes);
|
| 668 |
+
CUDA_CUB_RET_IF_FAIL(status);
|
| 669 |
+
|
| 670 |
+
|
| 671 |
+
if (d_temp_storage == NULL)
|
| 672 |
+
{
|
| 673 |
+
return status;
|
| 674 |
+
}
|
| 675 |
+
|
| 676 |
+
ScanTileState tile_status;
|
| 677 |
+
status = tile_status.Init(static_cast<int>(num_tiles), allocations[0], allocation_sizes[0]);
|
| 678 |
+
CUDA_CUB_RET_IF_FAIL(status);
|
| 679 |
+
|
| 680 |
+
init_agent ia(init_plan, num_tiles, stream, "copy_if::init_agent");
|
| 681 |
+
|
| 682 |
+
char *vshmem_ptr = vshmem_size > 0 ? (char*)allocations[1] : NULL;
|
| 683 |
+
|
| 684 |
+
copy_if_agent pa(copy_if_plan, num_items, stream, vshmem_ptr, "copy_if::partition_agent");
|
| 685 |
+
|
| 686 |
+
ia.launch(tile_status, num_tiles, num_selected_out);
|
| 687 |
+
CUDA_CUB_RET_IF_FAIL(cudaPeekAtLastError());
|
| 688 |
+
|
| 689 |
+
pa.launch(items,
|
| 690 |
+
stencil,
|
| 691 |
+
output_it,
|
| 692 |
+
predicate,
|
| 693 |
+
num_items,
|
| 694 |
+
num_selected_out,
|
| 695 |
+
tile_status,
|
| 696 |
+
num_tiles);
|
| 697 |
+
CUDA_CUB_RET_IF_FAIL(cudaPeekAtLastError());
|
| 698 |
+
return status;
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
template <typename Derived,
|
| 702 |
+
typename InputIt,
|
| 703 |
+
typename StencilIt,
|
| 704 |
+
typename OutputIt,
|
| 705 |
+
typename Predicate>
|
| 706 |
+
THRUST_RUNTIME_FUNCTION
|
| 707 |
+
OutputIt copy_if(execution_policy<Derived>& policy,
|
| 708 |
+
InputIt first,
|
| 709 |
+
InputIt last,
|
| 710 |
+
StencilIt stencil,
|
| 711 |
+
OutputIt output,
|
| 712 |
+
Predicate predicate)
|
| 713 |
+
{
|
| 714 |
+
typedef int size_type;
|
| 715 |
+
|
| 716 |
+
size_type num_items = static_cast<size_type>(thrust::distance(first, last));
|
| 717 |
+
size_t temp_storage_bytes = 0;
|
| 718 |
+
cudaStream_t stream = cuda_cub::stream(policy);
|
| 719 |
+
|
| 720 |
+
if (num_items == 0)
|
| 721 |
+
return output;
|
| 722 |
+
|
| 723 |
+
cudaError_t status;
|
| 724 |
+
status = doit_step(NULL,
|
| 725 |
+
temp_storage_bytes,
|
| 726 |
+
first,
|
| 727 |
+
stencil,
|
| 728 |
+
output,
|
| 729 |
+
predicate,
|
| 730 |
+
reinterpret_cast<size_type*>(NULL),
|
| 731 |
+
num_items,
|
| 732 |
+
stream);
|
| 733 |
+
cuda_cub::throw_on_error(status, "copy_if failed on 1st step");
|
| 734 |
+
|
| 735 |
+
size_t allocation_sizes[2] = {sizeof(size_type), temp_storage_bytes};
|
| 736 |
+
void * allocations[2] = {NULL, NULL};
|
| 737 |
+
|
| 738 |
+
size_t storage_size = 0;
|
| 739 |
+
|
| 740 |
+
status = core::alias_storage(NULL,
|
| 741 |
+
storage_size,
|
| 742 |
+
allocations,
|
| 743 |
+
allocation_sizes);
|
| 744 |
+
cuda_cub::throw_on_error(status, "copy_if failed on 1st alias_storage");
|
| 745 |
+
|
| 746 |
+
// Allocate temporary storage.
|
| 747 |
+
thrust::detail::temporary_array<thrust::detail::uint8_t, Derived>
|
| 748 |
+
tmp(policy, storage_size);
|
| 749 |
+
void *ptr = static_cast<void*>(tmp.data().get());
|
| 750 |
+
|
| 751 |
+
status = core::alias_storage(ptr,
|
| 752 |
+
storage_size,
|
| 753 |
+
allocations,
|
| 754 |
+
allocation_sizes);
|
| 755 |
+
cuda_cub::throw_on_error(status, "copy_if failed on 2nd alias_storage");
|
| 756 |
+
|
| 757 |
+
size_type* d_num_selected_out
|
| 758 |
+
= thrust::detail::aligned_reinterpret_cast<size_type*>(allocations[0]);
|
| 759 |
+
|
| 760 |
+
status = doit_step(allocations[1],
|
| 761 |
+
temp_storage_bytes,
|
| 762 |
+
first,
|
| 763 |
+
stencil,
|
| 764 |
+
output,
|
| 765 |
+
predicate,
|
| 766 |
+
d_num_selected_out,
|
| 767 |
+
num_items,
|
| 768 |
+
stream);
|
| 769 |
+
cuda_cub::throw_on_error(status, "copy_if failed on 2nd step");
|
| 770 |
+
|
| 771 |
+
status = cuda_cub::synchronize(policy);
|
| 772 |
+
cuda_cub::throw_on_error(status, "copy_if failed to synchronize");
|
| 773 |
+
|
| 774 |
+
size_type num_selected = get_value(policy, d_num_selected_out);
|
| 775 |
+
|
| 776 |
+
return output + num_selected;
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
} // namespace __copy_if
|
| 780 |
+
|
| 781 |
+
//-------------------------
|
| 782 |
+
// Thrust API entry points
|
| 783 |
+
//-------------------------
|
| 784 |
+
|
| 785 |
+
__thrust_exec_check_disable__
|
| 786 |
+
template <class Derived,
|
| 787 |
+
class InputIterator,
|
| 788 |
+
class OutputIterator,
|
| 789 |
+
class Predicate>
|
| 790 |
+
OutputIterator __host__ __device__
|
| 791 |
+
copy_if(execution_policy<Derived> &policy,
|
| 792 |
+
InputIterator first,
|
| 793 |
+
InputIterator last,
|
| 794 |
+
OutputIterator result,
|
| 795 |
+
Predicate pred)
|
| 796 |
+
{
|
| 797 |
+
THRUST_CDP_DISPATCH((return __copy_if::copy_if(policy,
|
| 798 |
+
first,
|
| 799 |
+
last,
|
| 800 |
+
__copy_if::no_stencil_tag(),
|
| 801 |
+
result,
|
| 802 |
+
pred);),
|
| 803 |
+
(return
|
| 804 |
+
thrust::copy_if(cvt_to_seq(derived_cast(policy)),
|
| 805 |
+
first,
|
| 806 |
+
last,
|
| 807 |
+
result,
|
| 808 |
+
pred);));
|
| 809 |
+
} // func copy_if
|
| 810 |
+
|
| 811 |
+
__thrust_exec_check_disable__
|
| 812 |
+
template <class Derived,
|
| 813 |
+
class InputIterator,
|
| 814 |
+
class StencilIterator,
|
| 815 |
+
class OutputIterator,
|
| 816 |
+
class Predicate>
|
| 817 |
+
OutputIterator __host__ __device__
|
| 818 |
+
copy_if(execution_policy<Derived> &policy,
|
| 819 |
+
InputIterator first,
|
| 820 |
+
InputIterator last,
|
| 821 |
+
StencilIterator stencil,
|
| 822 |
+
OutputIterator result,
|
| 823 |
+
Predicate pred)
|
| 824 |
+
{
|
| 825 |
+
THRUST_CDP_DISPATCH(
|
| 826 |
+
(return __copy_if::copy_if(policy, first, last, stencil, result, pred);),
|
| 827 |
+
(return thrust::copy_if(cvt_to_seq(derived_cast(policy)),
|
| 828 |
+
first,
|
| 829 |
+
last,
|
| 830 |
+
stencil,
|
| 831 |
+
result,
|
| 832 |
+
pred);));
|
| 833 |
+
} // func copy_if
|
| 834 |
+
|
| 835 |
+
} // namespace cuda_cub
|
| 836 |
+
THRUST_NAMESPACE_END
|
| 837 |
+
|
| 838 |
+
#include <thrust/copy.h>
|
| 839 |
+
#endif
|
miniCUDA124/include/thrust/system/cuda/detail/count.h
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************************************************************************
|
| 2 |
+
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* Redistribution and use in source and binary forms, with or without
|
| 5 |
+
* modification, are permitted provided that the following conditions are met:
|
| 6 |
+
* * Redistributions of source code must retain the above copyright
|
| 7 |
+
* notice, this list of conditions and the following disclaimer.
|
| 8 |
+
* * Redistributions in binary form must reproduce the above copyright
|
| 9 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 10 |
+
* documentation and/or other materials provided with the distribution.
|
| 11 |
+
* * Neither the name of the NVIDIA CORPORATION nor the
|
| 12 |
+
* names of its contributors may be used to endorse or promote products
|
| 13 |
+
* derived from this software without specific prior written permission.
|
| 14 |
+
*
|
| 15 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 16 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 17 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 18 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
|
| 19 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 20 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 21 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 22 |
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 23 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 24 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 25 |
+
*
|
| 26 |
+
******************************************************************************/
|
| 27 |
+
#pragma once
|
| 28 |
+
|
| 29 |
+
#include <thrust/detail/config.h>
|
| 30 |
+
|
| 31 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 32 |
+
# pragma GCC system_header
|
| 33 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 34 |
+
# pragma clang system_header
|
| 35 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 36 |
+
# pragma system_header
|
| 37 |
+
#endif // no system header
|
| 38 |
+
|
| 39 |
+
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC
|
| 40 |
+
#include <thrust/system/cuda/config.h>
|
| 41 |
+
|
| 42 |
+
#include <thrust/system/cuda/detail/util.h>
|
| 43 |
+
#include <thrust/system/cuda/detail/reduce.h>
|
| 44 |
+
#include <thrust/distance.h>
|
| 45 |
+
|
| 46 |
+
THRUST_NAMESPACE_BEGIN
|
| 47 |
+
namespace cuda_cub {
|
| 48 |
+
|
| 49 |
+
template <class Derived,
|
| 50 |
+
class InputIt,
|
| 51 |
+
class UnaryPred>
|
| 52 |
+
typename iterator_traits<InputIt>::difference_type __host__ __device__
|
| 53 |
+
count_if(execution_policy<Derived> &policy,
|
| 54 |
+
InputIt first,
|
| 55 |
+
InputIt last,
|
| 56 |
+
UnaryPred unary_pred)
|
| 57 |
+
{
|
| 58 |
+
typedef typename iterator_traits<InputIt>::difference_type size_type;
|
| 59 |
+
typedef transform_input_iterator_t<size_type,
|
| 60 |
+
InputIt,
|
| 61 |
+
UnaryPred>
|
| 62 |
+
flag_iterator_t;
|
| 63 |
+
|
| 64 |
+
return cuda_cub::reduce_n(policy,
|
| 65 |
+
flag_iterator_t(first, unary_pred),
|
| 66 |
+
thrust::distance(first, last),
|
| 67 |
+
size_type(0),
|
| 68 |
+
plus<size_type>());
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
template <class Derived,
|
| 72 |
+
class InputIt,
|
| 73 |
+
class Value>
|
| 74 |
+
typename iterator_traits<InputIt>::difference_type __host__ __device__
|
| 75 |
+
count(execution_policy<Derived> &policy,
|
| 76 |
+
InputIt first,
|
| 77 |
+
InputIt last,
|
| 78 |
+
Value const & value)
|
| 79 |
+
{
|
| 80 |
+
return cuda_cub::count_if(policy,
|
| 81 |
+
first,
|
| 82 |
+
last,
|
| 83 |
+
thrust::detail::equal_to_value<Value>(value));
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
} // namespace cuda_cub
|
| 87 |
+
THRUST_NAMESPACE_END
|
| 88 |
+
#endif
|
miniCUDA124/include/thrust/system/cuda/detail/cross_system.h
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************************************************************************
|
| 2 |
+
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* Redistribution and use in source and binary forms, with or without
|
| 5 |
+
* modification, are permitted provided that the following conditions are met:
|
| 6 |
+
* * Redistributions of source code must retain the above copyright
|
| 7 |
+
* notice, this list of conditions and the following disclaimer.
|
| 8 |
+
* * Redistributions in binary form must reproduce the above copyright
|
| 9 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 10 |
+
* documentation and/or other materials provided with the distribution.
|
| 11 |
+
* * Neither the name of the NVIDIA CORPORATION nor the
|
| 12 |
+
* names of its contributors may be used to endorse or promote products
|
| 13 |
+
* derived from this software without specific prior written permission.
|
| 14 |
+
*
|
| 15 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 16 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 17 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 18 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
|
| 19 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 20 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 21 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 22 |
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 23 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 24 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 25 |
+
*
|
| 26 |
+
******************************************************************************/
|
| 27 |
+
#pragma once
|
| 28 |
+
|
| 29 |
+
#include <thrust/detail/config.h>
|
| 30 |
+
|
| 31 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 32 |
+
# pragma GCC system_header
|
| 33 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 34 |
+
# pragma clang system_header
|
| 35 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 36 |
+
# pragma system_header
|
| 37 |
+
#endif // no system header
|
| 38 |
+
|
| 39 |
+
#include <thrust/system/cuda/detail/guarded_cuda_runtime_api.h>
|
| 40 |
+
#include <thrust/system/cpp/detail/execution_policy.h>
|
| 41 |
+
#include <thrust/system/cuda/detail/execution_policy.h>
|
| 42 |
+
|
| 43 |
+
THRUST_NAMESPACE_BEGIN
|
| 44 |
+
namespace cuda_cub {
|
| 45 |
+
|
| 46 |
+
template <class Sys1, class Sys2>
|
| 47 |
+
struct cross_system : execution_policy<cross_system<Sys1, Sys2> >
|
| 48 |
+
{
|
| 49 |
+
typedef thrust::execution_policy<Sys1> policy1;
|
| 50 |
+
typedef thrust::execution_policy<Sys2> policy2;
|
| 51 |
+
|
| 52 |
+
policy1 &sys1;
|
| 53 |
+
policy2 &sys2;
|
| 54 |
+
|
| 55 |
+
inline __host__ __device__
|
| 56 |
+
cross_system(policy1 &sys1, policy2 &sys2) : sys1(sys1), sys2(sys2) {}
|
| 57 |
+
|
| 58 |
+
inline __host__ __device__
|
| 59 |
+
cross_system<Sys2, Sys1> rotate() const
|
| 60 |
+
{
|
| 61 |
+
return cross_system<Sys2, Sys1>(sys2, sys1);
|
| 62 |
+
}
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
#if THRUST_CPP_DIALECT >= 2011
|
| 66 |
+
// Device to host.
|
| 67 |
+
template <class Sys1, class Sys2>
|
| 68 |
+
constexpr __host__ __device__
|
| 69 |
+
auto direction_of_copy(
|
| 70 |
+
thrust::system::cuda::execution_policy<Sys1> const&
|
| 71 |
+
, thrust::cpp::execution_policy<Sys2> const&
|
| 72 |
+
)
|
| 73 |
+
THRUST_DECLTYPE_RETURNS(
|
| 74 |
+
thrust::detail::integral_constant<
|
| 75 |
+
cudaMemcpyKind, cudaMemcpyDeviceToHost
|
| 76 |
+
>{}
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
// Host to device.
|
| 80 |
+
template <class Sys1, class Sys2>
|
| 81 |
+
constexpr __host__ __device__
|
| 82 |
+
auto direction_of_copy(
|
| 83 |
+
thrust::cpp::execution_policy<Sys1> const&
|
| 84 |
+
, thrust::system::cuda::execution_policy<Sys2> const&
|
| 85 |
+
)
|
| 86 |
+
THRUST_DECLTYPE_RETURNS(
|
| 87 |
+
thrust::detail::integral_constant<
|
| 88 |
+
cudaMemcpyKind, cudaMemcpyHostToDevice
|
| 89 |
+
>{}
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
// Device to device.
|
| 93 |
+
template <class Sys1, class Sys2>
|
| 94 |
+
constexpr __host__ __device__
|
| 95 |
+
auto direction_of_copy(
|
| 96 |
+
thrust::system::cuda::execution_policy<Sys1> const&
|
| 97 |
+
, thrust::system::cuda::execution_policy<Sys2> const&
|
| 98 |
+
)
|
| 99 |
+
THRUST_DECLTYPE_RETURNS(
|
| 100 |
+
thrust::detail::integral_constant<
|
| 101 |
+
cudaMemcpyKind, cudaMemcpyDeviceToDevice
|
| 102 |
+
>{}
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
// Device to device.
|
| 106 |
+
template <class DerivedPolicy>
|
| 107 |
+
constexpr __host__ __device__
|
| 108 |
+
auto direction_of_copy(execution_policy<DerivedPolicy> const &)
|
| 109 |
+
THRUST_DECLTYPE_RETURNS(
|
| 110 |
+
thrust::detail::integral_constant<
|
| 111 |
+
cudaMemcpyKind, cudaMemcpyDeviceToDevice
|
| 112 |
+
>{}
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
template <class Sys1, class Sys2>
|
| 116 |
+
constexpr __host__ __device__
|
| 117 |
+
auto direction_of_copy(
|
| 118 |
+
execution_policy<cross_system<Sys1, Sys2>> const &systems
|
| 119 |
+
)
|
| 120 |
+
THRUST_DECLTYPE_RETURNS(
|
| 121 |
+
direction_of_copy(
|
| 122 |
+
derived_cast(derived_cast(systems).sys1)
|
| 123 |
+
, derived_cast(derived_cast(systems).sys2)
|
| 124 |
+
)
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
template <typename ExecutionPolicy0,
|
| 128 |
+
typename ExecutionPolicy1,
|
| 129 |
+
// MSVC2015 WAR: put decltype here instead of in trailing return type
|
| 130 |
+
typename Direction =
|
| 131 |
+
decltype(direction_of_copy(std::declval<ExecutionPolicy0>(),
|
| 132 |
+
std::declval<ExecutionPolicy1>()))>
|
| 133 |
+
constexpr __host__ __device__
|
| 134 |
+
thrust::detail::integral_constant<
|
| 135 |
+
bool, cudaMemcpyDeviceToHost == Direction::value
|
| 136 |
+
>
|
| 137 |
+
is_device_to_host_copy(
|
| 138 |
+
ExecutionPolicy0 const& exec0
|
| 139 |
+
, ExecutionPolicy1 const& exec1
|
| 140 |
+
) noexcept
|
| 141 |
+
{
|
| 142 |
+
return {};
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
template <typename ExecutionPolicy,
|
| 146 |
+
// MSVC2015 WAR: put decltype here instead of in trailing return type
|
| 147 |
+
typename Direction =
|
| 148 |
+
decltype(direction_of_copy(std::declval<ExecutionPolicy>()))>
|
| 149 |
+
constexpr __host__ __device__
|
| 150 |
+
thrust::detail::integral_constant<
|
| 151 |
+
bool, cudaMemcpyDeviceToHost == Direction::value
|
| 152 |
+
>
|
| 153 |
+
is_device_to_host_copy(ExecutionPolicy const& exec) noexcept
|
| 154 |
+
{
|
| 155 |
+
return {};
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
template <typename ExecutionPolicy0,
|
| 159 |
+
typename ExecutionPolicy1,
|
| 160 |
+
// MSVC2015 WAR: put decltype here instead of in trailing return type
|
| 161 |
+
typename Direction =
|
| 162 |
+
decltype(direction_of_copy(std::declval<ExecutionPolicy0>(),
|
| 163 |
+
std::declval<ExecutionPolicy1>()))>
|
| 164 |
+
constexpr __host__ __device__
|
| 165 |
+
thrust::detail::integral_constant<
|
| 166 |
+
bool, cudaMemcpyHostToDevice == Direction::value
|
| 167 |
+
>
|
| 168 |
+
is_host_to_device_copy(
|
| 169 |
+
ExecutionPolicy0 const& exec0
|
| 170 |
+
, ExecutionPolicy1 const& exec1
|
| 171 |
+
) noexcept
|
| 172 |
+
{
|
| 173 |
+
return {};
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
template <typename ExecutionPolicy,
|
| 177 |
+
// MSVC2015 WAR: put decltype here instead of in trailing return type
|
| 178 |
+
typename Direction =
|
| 179 |
+
decltype(direction_of_copy(std::declval<ExecutionPolicy>()))>
|
| 180 |
+
constexpr __host__ __device__
|
| 181 |
+
thrust::detail::integral_constant<
|
| 182 |
+
bool, cudaMemcpyHostToDevice == Direction::value
|
| 183 |
+
>
|
| 184 |
+
is_host_to_device_copy(ExecutionPolicy const& exec) noexcept
|
| 185 |
+
{
|
| 186 |
+
return {};
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
template <typename ExecutionPolicy0,
|
| 190 |
+
typename ExecutionPolicy1,
|
| 191 |
+
// MSVC2015 WAR: put decltype here instead of in trailing return type
|
| 192 |
+
typename Direction =
|
| 193 |
+
decltype(direction_of_copy(std::declval<ExecutionPolicy0>(),
|
| 194 |
+
std::declval<ExecutionPolicy1>()))>
|
| 195 |
+
constexpr __host__ __device__
|
| 196 |
+
thrust::detail::integral_constant<
|
| 197 |
+
bool, cudaMemcpyDeviceToDevice == Direction::value
|
| 198 |
+
>
|
| 199 |
+
is_device_to_device_copy(
|
| 200 |
+
ExecutionPolicy0 const& exec0
|
| 201 |
+
, ExecutionPolicy1 const& exec1
|
| 202 |
+
) noexcept
|
| 203 |
+
{
|
| 204 |
+
return {};
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
template <typename ExecutionPolicy,
|
| 208 |
+
// MSVC2015 WAR: put decltype here instead of in trailing return type
|
| 209 |
+
typename Direction =
|
| 210 |
+
decltype(direction_of_copy(std::declval<ExecutionPolicy>()))>
|
| 211 |
+
constexpr __host__ __device__
|
| 212 |
+
thrust::detail::integral_constant<
|
| 213 |
+
bool, cudaMemcpyDeviceToDevice == Direction::value
|
| 214 |
+
>
|
| 215 |
+
is_device_to_device_copy(ExecutionPolicy const& exec) noexcept
|
| 216 |
+
{
|
| 217 |
+
return {};
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
/////////////////////////////////////////////////////////////////////////////
|
| 221 |
+
|
| 222 |
+
// Device to host.
|
| 223 |
+
template <class Sys1, class Sys2>
|
| 224 |
+
__host__ __device__
|
| 225 |
+
auto
|
| 226 |
+
select_device_system(thrust::cuda::execution_policy<Sys1> &sys1,
|
| 227 |
+
thrust::execution_policy<Sys2> &)
|
| 228 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 229 |
+
|
| 230 |
+
// Device to host.
|
| 231 |
+
template <class Sys1, class Sys2>
|
| 232 |
+
__host__ __device__
|
| 233 |
+
auto
|
| 234 |
+
select_device_system(thrust::cuda::execution_policy<Sys1> const &sys1,
|
| 235 |
+
thrust::execution_policy<Sys2> const &)
|
| 236 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 237 |
+
|
| 238 |
+
// Host to device.
|
| 239 |
+
template <class Sys1, class Sys2>
|
| 240 |
+
__host__ __device__
|
| 241 |
+
auto
|
| 242 |
+
select_device_system(thrust::execution_policy<Sys1> &,
|
| 243 |
+
thrust::cuda::execution_policy<Sys2> &sys2)
|
| 244 |
+
THRUST_DECLTYPE_RETURNS(sys2)
|
| 245 |
+
|
| 246 |
+
// Host to device.
|
| 247 |
+
template <class Sys1, class Sys2>
|
| 248 |
+
__host__ __device__
|
| 249 |
+
auto
|
| 250 |
+
select_device_system(thrust::execution_policy<Sys1> const &,
|
| 251 |
+
thrust::cuda::execution_policy<Sys2> const &sys2)
|
| 252 |
+
THRUST_DECLTYPE_RETURNS(sys2)
|
| 253 |
+
|
| 254 |
+
// Device to device.
|
| 255 |
+
template <class Sys1, class Sys2>
|
| 256 |
+
__host__ __device__
|
| 257 |
+
auto
|
| 258 |
+
select_device_system(thrust::cuda::execution_policy<Sys1> &sys1,
|
| 259 |
+
thrust::cuda::execution_policy<Sys2> &)
|
| 260 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 261 |
+
|
| 262 |
+
// Device to device.
|
| 263 |
+
template <class Sys1, class Sys2>
|
| 264 |
+
__host__ __device__
|
| 265 |
+
auto
|
| 266 |
+
select_device_system(thrust::cuda::execution_policy<Sys1> const &sys1,
|
| 267 |
+
thrust::cuda::execution_policy<Sys2> const &)
|
| 268 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 269 |
+
|
| 270 |
+
/////////////////////////////////////////////////////////////////////////////
|
| 271 |
+
|
| 272 |
+
// Device to host.
|
| 273 |
+
template <class Sys1, class Sys2>
|
| 274 |
+
__host__ __device__
|
| 275 |
+
auto
|
| 276 |
+
select_host_system(thrust::cuda::execution_policy<Sys1> &,
|
| 277 |
+
thrust::execution_policy<Sys2> &sys2)
|
| 278 |
+
THRUST_DECLTYPE_RETURNS(sys2)
|
| 279 |
+
|
| 280 |
+
// Device to host.
|
| 281 |
+
template <class Sys1, class Sys2>
|
| 282 |
+
__host__ __device__
|
| 283 |
+
auto
|
| 284 |
+
select_host_system(thrust::cuda::execution_policy<Sys1> const &,
|
| 285 |
+
thrust::execution_policy<Sys2> const &sys2)
|
| 286 |
+
THRUST_DECLTYPE_RETURNS(sys2)
|
| 287 |
+
|
| 288 |
+
// Host to device.
|
| 289 |
+
template <class Sys1, class Sys2>
|
| 290 |
+
__host__ __device__
|
| 291 |
+
auto
|
| 292 |
+
select_host_system(thrust::execution_policy<Sys1> &sys1,
|
| 293 |
+
thrust::cuda::execution_policy<Sys2> &)
|
| 294 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 295 |
+
|
| 296 |
+
// Host to device.
|
| 297 |
+
template <class Sys1, class Sys2>
|
| 298 |
+
__host__ __device__
|
| 299 |
+
auto
|
| 300 |
+
select_host_system(thrust::execution_policy<Sys1> const &sys1,
|
| 301 |
+
thrust::cuda::execution_policy<Sys2> const &)
|
| 302 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 303 |
+
|
| 304 |
+
// Device to device.
|
| 305 |
+
template <class Sys1, class Sys2>
|
| 306 |
+
__host__ __device__
|
| 307 |
+
auto
|
| 308 |
+
select_host_system(thrust::execution_policy<Sys1> &sys1,
|
| 309 |
+
thrust::execution_policy<Sys2> &)
|
| 310 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 311 |
+
|
| 312 |
+
// Device to device.
|
| 313 |
+
template <class Sys1, class Sys2>
|
| 314 |
+
__host__ __device__
|
| 315 |
+
auto
|
| 316 |
+
select_host_system(thrust::execution_policy<Sys1> const &sys1,
|
| 317 |
+
thrust::execution_policy<Sys2> const &)
|
| 318 |
+
THRUST_DECLTYPE_RETURNS(sys1)
|
| 319 |
+
#endif
|
| 320 |
+
|
| 321 |
+
// Device to host.
|
| 322 |
+
template <class Sys1, class Sys2>
|
| 323 |
+
__host__ __device__
|
| 324 |
+
cross_system<Sys1, Sys2>
|
| 325 |
+
select_system(execution_policy<Sys1> const & sys1,
|
| 326 |
+
thrust::cpp::execution_policy<Sys2> const &sys2)
|
| 327 |
+
{
|
| 328 |
+
thrust::execution_policy<Sys1> & non_const_sys1 = const_cast<execution_policy<Sys1> &>(sys1);
|
| 329 |
+
thrust::cpp::execution_policy<Sys2> &non_const_sys2 = const_cast<thrust::cpp::execution_policy<Sys2> &>(sys2);
|
| 330 |
+
return cross_system<Sys1, Sys2>(non_const_sys1, non_const_sys2);
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
// Host to device.
|
| 334 |
+
template <class Sys1, class Sys2>
|
| 335 |
+
__host__ __device__
|
| 336 |
+
cross_system<Sys1, Sys2>
|
| 337 |
+
select_system(thrust::cpp::execution_policy<Sys1> const &sys1,
|
| 338 |
+
execution_policy<Sys2> const & sys2)
|
| 339 |
+
{
|
| 340 |
+
thrust::cpp::execution_policy<Sys1> &non_const_sys1 = const_cast<thrust::cpp::execution_policy<Sys1> &>(sys1);
|
| 341 |
+
thrust::execution_policy<Sys2> & non_const_sys2 = const_cast<execution_policy<Sys2> &>(sys2);
|
| 342 |
+
return cross_system<Sys1, Sys2>(non_const_sys1, non_const_sys2);
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
} // namespace cuda_cub
|
| 346 |
+
THRUST_NAMESPACE_END
|
| 347 |
+
|
miniCUDA124/include/thrust/system/cuda/detail/dispatch.h
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 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 |
+
|
| 29 |
+
#include <thrust/detail/cstdint.h>
|
| 30 |
+
#include <thrust/detail/preprocessor.h>
|
| 31 |
+
#include <thrust/detail/integer_traits.h>
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Dispatch between 32-bit and 64-bit index based versions of the same algorithm
|
| 35 |
+
* implementation. This version assumes that callables for both branches consist
|
| 36 |
+
* of the same tokens, and is intended to be used with Thrust-style dispatch
|
| 37 |
+
* interfaces, that always deduce the size type from the arguments.
|
| 38 |
+
*/
|
| 39 |
+
#define THRUST_INDEX_TYPE_DISPATCH(status, call, count, arguments) \
|
| 40 |
+
if (count <= thrust::detail::integer_traits<thrust::detail::int32_t>::const_max) { \
|
| 41 |
+
auto THRUST_PP_CAT2(count, _fixed) = static_cast<thrust::detail::int32_t>(count); \
|
| 42 |
+
status = call arguments; \
|
| 43 |
+
} \
|
| 44 |
+
else { \
|
| 45 |
+
auto THRUST_PP_CAT2(count, _fixed) = static_cast<thrust::detail::int64_t>(count); \
|
| 46 |
+
status = call arguments; \
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Dispatch between 32-bit and 64-bit index based versions of the same algorithm
|
| 51 |
+
* implementation. This version assumes that callables for both branches consist
|
| 52 |
+
* of the same tokens, and is intended to be used with Thrust-style dispatch
|
| 53 |
+
* interfaces, that always deduce the size type from the arguments.
|
| 54 |
+
*
|
| 55 |
+
* This version of the macro supports providing two count variables, which is
|
| 56 |
+
* necessary for set algorithms.
|
| 57 |
+
*/
|
| 58 |
+
#define THRUST_DOUBLE_INDEX_TYPE_DISPATCH(status, call, count1, count2, arguments) \
|
| 59 |
+
if (count1 + count2 <= thrust::detail::integer_traits<thrust::detail::int32_t>::const_max) { \
|
| 60 |
+
auto THRUST_PP_CAT2(count1, _fixed) = static_cast<thrust::detail::int32_t>(count1); \
|
| 61 |
+
auto THRUST_PP_CAT2(count2, _fixed) = static_cast<thrust::detail::int32_t>(count2); \
|
| 62 |
+
status = call arguments; \
|
| 63 |
+
} \
|
| 64 |
+
else { \
|
| 65 |
+
auto THRUST_PP_CAT2(count1, _fixed) = static_cast<thrust::detail::int64_t>(count1); \
|
| 66 |
+
auto THRUST_PP_CAT2(count2, _fixed) = static_cast<thrust::detail::int64_t>(count2); \
|
| 67 |
+
status = call arguments; \
|
| 68 |
+
}
|
| 69 |
+
/**
|
| 70 |
+
* Dispatch between 32-bit and 64-bit index based versions of the same algorithm
|
| 71 |
+
* implementation. This version allows using different token sequences for callables
|
| 72 |
+
* in both branches, and is intended to be used with CUB-style dispatch interfaces,
|
| 73 |
+
* where the "simple" interface always forces the size to be `int` (making it harder
|
| 74 |
+
* for us to use), but the complex interface that we end up using doesn't actually
|
| 75 |
+
* provide a way to fully deduce the type from just the call, making the size type
|
| 76 |
+
* appear in the token sequence of the callable.
|
| 77 |
+
*
|
| 78 |
+
* See reduce_n_impl to see an example of how this is meant to be used.
|
| 79 |
+
*/
|
| 80 |
+
#define THRUST_INDEX_TYPE_DISPATCH2(status, call_32, call_64, count, arguments) \
|
| 81 |
+
if (count <= thrust::detail::integer_traits<thrust::detail::int32_t>::const_max) { \
|
| 82 |
+
auto THRUST_PP_CAT2(count, _fixed) = static_cast<thrust::detail::int32_t>(count); \
|
| 83 |
+
status = call_32 arguments; \
|
| 84 |
+
} \
|
| 85 |
+
else { \
|
| 86 |
+
auto THRUST_PP_CAT2(count, _fixed) = static_cast<thrust::detail::int64_t>(count); \
|
| 87 |
+
status = call_64 arguments; \
|
| 88 |
+
}
|
| 89 |
+
|
miniCUDA124/include/thrust/system/cuda/detail/equal.h
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************************************************************************
|
| 2 |
+
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* Redistribution and use in source and binary forms, with or without
|
| 5 |
+
* modification, are permitted provided that the following conditions are met:
|
| 6 |
+
* * Redistributions of source code must retain the above copyright
|
| 7 |
+
* notice, this list of conditions and the following disclaimer.
|
| 8 |
+
* * Redistributions in binary form must reproduce the above copyright
|
| 9 |
+
* notice, this list of conditions and the following disclaimer in the
|
| 10 |
+
* documentation and/or other materials provided with the distribution.
|
| 11 |
+
* * Neither the name of the NVIDIA CORPORATION nor the
|
| 12 |
+
* names of its contributors may be used to endorse or promote products
|
| 13 |
+
* derived from this software without specific prior written permission.
|
| 14 |
+
*
|
| 15 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 16 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 17 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 18 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
|
| 19 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 20 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 21 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 22 |
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 23 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 24 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 25 |
+
*
|
| 26 |
+
******************************************************************************/
|
| 27 |
+
#pragma once
|
| 28 |
+
|
| 29 |
+
#include <thrust/detail/config.h>
|
| 30 |
+
|
| 31 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 32 |
+
# pragma GCC system_header
|
| 33 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 34 |
+
# pragma clang system_header
|
| 35 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 36 |
+
# pragma system_header
|
| 37 |
+
#endif // no system header
|
| 38 |
+
|
| 39 |
+
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC
|
| 40 |
+
#include <thrust/system/cuda/config.h>
|
| 41 |
+
|
| 42 |
+
#include <thrust/system/cuda/detail/mismatch.h>
|
| 43 |
+
|
| 44 |
+
THRUST_NAMESPACE_BEGIN
|
| 45 |
+
namespace cuda_cub {
|
| 46 |
+
|
| 47 |
+
template <class Derived,
|
| 48 |
+
class InputIt1,
|
| 49 |
+
class InputIt2,
|
| 50 |
+
class BinaryPred>
|
| 51 |
+
bool __host__ __device__
|
| 52 |
+
equal(execution_policy<Derived>& policy,
|
| 53 |
+
InputIt1 first1,
|
| 54 |
+
InputIt1 last1,
|
| 55 |
+
InputIt2 first2,
|
| 56 |
+
BinaryPred binary_pred)
|
| 57 |
+
{
|
| 58 |
+
return cuda_cub::mismatch(policy, first1, last1, first2, binary_pred).first == last1;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
template <class Derived,
|
| 62 |
+
class InputIt1,
|
| 63 |
+
class InputIt2>
|
| 64 |
+
bool __host__ __device__
|
| 65 |
+
equal(execution_policy<Derived>& policy,
|
| 66 |
+
InputIt1 first1,
|
| 67 |
+
InputIt1 last1,
|
| 68 |
+
InputIt2 first2)
|
| 69 |
+
{
|
| 70 |
+
typedef typename thrust::iterator_value<InputIt1>::type InputType1;
|
| 71 |
+
return cuda_cub::equal(policy,
|
| 72 |
+
first1,
|
| 73 |
+
last1,
|
| 74 |
+
first2,
|
| 75 |
+
equal_to<InputType1>());
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
} // namespace cuda_cub
|
| 81 |
+
THRUST_NAMESPACE_END
|
| 82 |
+
#endif
|
miniCUDA124/include/thrust/system/cuda/detail/error.inl
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <thrust/detail/config.h>
|
| 21 |
+
|
| 22 |
+
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
| 23 |
+
# pragma GCC system_header
|
| 24 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
| 25 |
+
# pragma clang system_header
|
| 26 |
+
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
| 27 |
+
# pragma system_header
|
| 28 |
+
#endif // no system header
|
| 29 |
+
|
| 30 |
+
#include <thrust/system/cuda/error.h>
|
| 31 |
+
#include <thrust/system/cuda/detail/guarded_cuda_runtime_api.h>
|
| 32 |
+
|
| 33 |
+
THRUST_NAMESPACE_BEGIN
|
| 34 |
+
|
| 35 |
+
namespace system
|
| 36 |
+
{
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
error_code make_error_code(cuda::errc::errc_t e)
|
| 40 |
+
{
|
| 41 |
+
return error_code(static_cast<int>(e), cuda_category());
|
| 42 |
+
} // end make_error_code()
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
error_condition make_error_condition(cuda::errc::errc_t e)
|
| 46 |
+
{
|
| 47 |
+
return error_condition(static_cast<int>(e), cuda_category());
|
| 48 |
+
} // end make_error_condition()
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
namespace cuda_cub
|
| 52 |
+
{
|
| 53 |
+
|
| 54 |
+
namespace detail
|
| 55 |
+
{
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class cuda_error_category
|
| 59 |
+
: public error_category
|
| 60 |
+
{
|
| 61 |
+
public:
|
| 62 |
+
inline cuda_error_category(void) {}
|
| 63 |
+
|
| 64 |
+
inline virtual const char *name(void) const
|
| 65 |
+
{
|
| 66 |
+
return "cuda";
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
inline virtual std::string message(int ev) const
|
| 70 |
+
{
|
| 71 |
+
char const* const unknown_str = "unknown error";
|
| 72 |
+
char const* const unknown_name = "cudaErrorUnknown";
|
| 73 |
+
char const* c_str = ::cudaGetErrorString(static_cast<cudaError_t>(ev));
|
| 74 |
+
char const* c_name = ::cudaGetErrorName(static_cast<cudaError_t>(ev));
|
| 75 |
+
return std::string(c_name ? c_name : unknown_name)
|
| 76 |
+
+ ": " + (c_str ? c_str : unknown_str);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
inline virtual error_condition default_error_condition(int ev) const
|
| 80 |
+
{
|
| 81 |
+
using namespace cuda::errc;
|
| 82 |
+
|
| 83 |
+
if(ev < ::cudaErrorUnknown)
|
| 84 |
+
{
|
| 85 |
+
return make_error_condition(static_cast<errc_t>(ev));
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
return system_category().default_error_condition(ev);
|
| 89 |
+
}
|
| 90 |
+
}; // end cuda_error_category
|
| 91 |
+
|
| 92 |
+
} // end detail
|
| 93 |
+
|
| 94 |
+
} // end namespace cuda_cub
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
const error_category &cuda_category(void)
|
| 98 |
+
{
|
| 99 |
+
static const thrust::system::cuda_cub::detail::cuda_error_category result;
|
| 100 |
+
return result;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
} // end namespace system
|
| 105 |
+
|
| 106 |
+
THRUST_NAMESPACE_END
|
| 107 |
+
|