From 363c35274b28798659cd4264ff9a945ac824871d Mon Sep 17 00:00:00 2001 From: Allison Vacanti Date: Thu, 17 Jun 2021 14:02:39 -0400 Subject: [PATCH] Add ability to place Thrust in a custom namespace. This provides a workaround for downstream projects that encounter a variety of issues from dynamically linking multiple libraries that use Thrust. See the new `thrust/detail/config/namespace.h` header for details. Added several tests and checks to validate that this behavior is correct, and the `__THRUST_DEFINE_HAS_MEMBER_FUNCTION` utility has been rewritten to WAR an nvcc bug when the old implementation was used with objects in an anonymous namespace. New tests: - testing/namespace_wrapped.cu - testing/cmake/check_namespace.cmake --- cmake/ThrustHeaderTesting.cmake | 5 + dependencies/cub | 2 +- testing/cmake/CMakeLists.txt | 9 ++ testing/cmake/check_namespace.cmake | 93 ++++++++++++++ testing/copy.cu | 8 +- testing/mr_disjoint_pool.cu | 8 +- testing/namespace_wrapped.cu | 43 +++++++ testing/scan.cu | 8 +- testing/unittest/assertions.h | 108 +++++++++------- testing/unittest/random.h | 54 ++++---- testing/unittest/special_types.h | 26 ++-- testing/unittest/testframework.h | 8 +- testing/unittest/util.h | 16 ++- thrust/addressof.h | 6 +- thrust/adjacent_difference.h | 6 +- thrust/advance.h | 5 +- thrust/allocate_unique.h | 5 +- thrust/async/copy.h | 5 +- thrust/async/for_each.h | 6 +- thrust/async/reduce.h | 5 +- thrust/async/scan.h | 5 +- thrust/async/sort.h | 5 +- thrust/async/transform.h | 6 +- thrust/binary_search.h | 7 +- thrust/complex.h | 5 +- thrust/copy.h | 7 +- thrust/count.h | 8 +- thrust/detail/adjacent_difference.inl | 7 +- thrust/detail/advance.inl | 6 +- thrust/detail/alignment.h | 6 +- thrust/detail/allocator/allocator_traits.h | 5 +- thrust/detail/allocator/allocator_traits.inl | 5 +- .../detail/allocator/copy_construct_range.h | 5 +- .../detail/allocator/copy_construct_range.inl | 5 +- .../allocator/default_construct_range.h | 5 +- .../allocator/default_construct_range.inl | 5 +- thrust/detail/allocator/destroy_range.h | 5 +- thrust/detail/allocator/destroy_range.inl | 7 +- .../detail/allocator/fill_construct_range.h | 5 +- .../detail/allocator/fill_construct_range.inl | 5 +- thrust/detail/allocator/malloc_allocator.h | 5 +- thrust/detail/allocator/malloc_allocator.inl | 5 +- thrust/detail/allocator/no_throw_allocator.h | 5 +- thrust/detail/allocator/tagged_allocator.h | 5 +- thrust/detail/allocator/tagged_allocator.inl | 5 +- thrust/detail/allocator/temporary_allocator.h | 5 +- .../detail/allocator/temporary_allocator.inl | 5 +- .../detail/allocator_aware_execution_policy.h | 8 +- thrust/detail/binary_search.inl | 7 +- thrust/detail/caching_allocator.h | 8 +- thrust/detail/complex/arithmetic.h | 9 +- thrust/detail/complex/c99math.h | 7 +- thrust/detail/complex/catrig.h | 4 +- thrust/detail/complex/catrigf.h | 4 +- thrust/detail/complex/ccosh.h | 6 +- thrust/detail/complex/ccoshf.h | 6 +- thrust/detail/complex/cexp.h | 6 +- thrust/detail/complex/cexpf.h | 6 +- thrust/detail/complex/clog.h | 6 +- thrust/detail/complex/clogf.h | 6 +- thrust/detail/complex/complex.inl | 7 +- thrust/detail/complex/cpow.h | 6 +- thrust/detail/complex/cproj.h | 7 +- thrust/detail/complex/csinh.h | 6 +- thrust/detail/complex/csinhf.h | 6 +- thrust/detail/complex/csqrt.h | 6 +- thrust/detail/complex/csqrtf.h | 6 +- thrust/detail/complex/ctanh.h | 6 +- thrust/detail/complex/ctanhf.h | 6 +- thrust/detail/complex/math_private.h | 4 +- thrust/detail/complex/stream.h | 9 +- thrust/detail/config/config.h | 1 + thrust/detail/config/memory_resource.h | 3 +- thrust/detail/config/namespace.h | 120 ++++++++++++++++++ thrust/detail/contiguous_storage.h | 5 +- thrust/detail/contiguous_storage.inl | 6 +- thrust/detail/copy.h | 7 +- thrust/detail/copy.inl | 8 +- thrust/detail/copy_if.h | 8 +- thrust/detail/copy_if.inl | 8 +- thrust/detail/count.inl | 8 +- thrust/detail/cstdint.h | 8 +- .../dependencies_aware_execution_policy.h | 7 +- thrust/detail/device_delete.inl | 8 +- thrust/detail/device_free.inl | 6 +- thrust/detail/device_malloc.inl | 8 +- thrust/detail/device_new.inl | 7 +- thrust/detail/device_ptr.inl | 6 +- thrust/detail/distance.inl | 9 +- thrust/detail/equal.inl | 9 +- thrust/detail/event_error.h | 5 +- thrust/detail/execute_with_allocator.h | 7 +- thrust/detail/execute_with_allocator_fwd.h | 8 +- thrust/detail/execute_with_dependencies.h | 8 +- thrust/detail/execution_policy.h | 7 +- thrust/detail/extrema.inl | 8 +- thrust/detail/fill.inl | 10 +- thrust/detail/find.inl | 26 ++-- thrust/detail/for_each.inl | 7 +- thrust/detail/function.h | 7 +- thrust/detail/functional.inl | 8 +- thrust/detail/functional/actor.h | 5 +- thrust/detail/functional/actor.inl | 5 +- thrust/detail/functional/argument.h | 5 +- thrust/detail/functional/composite.h | 7 +- .../operators/arithmetic_operators.h | 5 +- .../operators/assignment_operator.h | 5 +- .../functional/operators/bitwise_operators.h | 5 +- .../operators/compound_assignment_operators.h | 5 +- .../functional/operators/logical_operators.h | 5 +- .../functional/operators/operator_adaptors.h | 5 +- .../operators/relational_operators.h | 5 +- thrust/detail/functional/placeholder.h | 5 +- thrust/detail/functional/value.h | 5 +- thrust/detail/gather.inl | 10 +- thrust/detail/generate.inl | 10 +- thrust/detail/get_iterator_value.h | 6 +- thrust/detail/inner_product.inl | 8 +- thrust/detail/integer_math.h | 6 +- thrust/detail/integer_traits.h | 14 +- thrust/detail/internal_functional.h | 7 +- thrust/detail/logical.inl | 8 +- thrust/detail/malloc_and_free.h | 6 +- thrust/detail/memory_algorithms.h | 6 +- thrust/detail/merge.inl | 10 +- thrust/detail/minmax.h | 8 +- thrust/detail/mismatch.inl | 8 +- thrust/detail/mpl/math.h | 7 +- thrust/detail/numeric_traits.h | 7 +- thrust/detail/overlapped_copy.h | 6 +- thrust/detail/pair.inl | 8 +- thrust/detail/partition.inl | 8 +- thrust/detail/pointer.h | 16 +-- thrust/detail/pointer.inl | 8 +- thrust/detail/range/head_flags.h | 5 +- thrust/detail/range/tail_flags.h | 5 +- thrust/detail/raw_pointer_cast.h | 6 +- thrust/detail/raw_reference_cast.h | 5 +- thrust/detail/reduce.inl | 7 +- thrust/detail/reference.h | 5 +- thrust/detail/reference_forward_declaration.h | 5 +- thrust/detail/remove.inl | 5 +- thrust/detail/replace.inl | 5 +- thrust/detail/reverse.inl | 5 +- thrust/detail/scan.inl | 5 +- thrust/detail/scatter.inl | 8 +- thrust/detail/select_system.h | 5 +- thrust/detail/seq.h | 5 +- thrust/detail/sequence.inl | 5 +- thrust/detail/set_operations.inl | 5 +- thrust/detail/shuffle.inl | 4 +- thrust/detail/sort.inl | 5 +- thrust/detail/static_assert.h | 13 +- thrust/detail/static_map.h | 5 +- thrust/detail/swap.h | 5 +- thrust/detail/swap_ranges.inl | 7 +- thrust/detail/tabulate.inl | 5 +- thrust/detail/temporary_array.h | 12 +- thrust/detail/temporary_array.inl | 7 +- thrust/detail/temporary_buffer.h | 5 +- thrust/detail/transform.inl | 7 +- thrust/detail/transform_reduce.inl | 5 +- thrust/detail/transform_scan.inl | 7 +- thrust/detail/trivial_sequence.h | 7 +- thrust/detail/tuple.inl | 7 +- thrust/detail/tuple_algorithms.h | 5 +- thrust/detail/tuple_meta_transform.h | 7 +- thrust/detail/tuple_transform.h | 7 +- thrust/detail/type_traits.h | 5 +- thrust/detail/type_traits/function_traits.h | 7 +- .../detail/type_traits/has_member_function.h | 116 +++-------------- .../detail/type_traits/has_trivial_assign.h | 5 +- thrust/detail/type_traits/is_call_possible.h | 7 +- .../type_traits/is_metafunction_defined.h | 7 +- .../iterator/is_discard_iterator.h | 5 +- .../type_traits/iterator/is_output_iterator.h | 5 +- thrust/detail/type_traits/minimum_type.h | 11 +- thrust/detail/type_traits/pointer_traits.h | 5 +- .../result_of_adaptable_function.h | 5 +- thrust/detail/uninitialized_copy.inl | 7 +- thrust/detail/uninitialized_fill.inl | 7 +- thrust/detail/unique.inl | 5 +- thrust/detail/use_default.h | 5 +- thrust/detail/util/align.h | 7 +- thrust/detail/vector_base.h | 5 +- thrust/detail/vector_base.inl | 5 +- thrust/device_allocator.h | 6 +- thrust/device_delete.h | 5 +- thrust/device_free.h | 5 +- thrust/device_make_unique.h | 5 +- thrust/device_malloc.h | 5 +- thrust/device_malloc_allocator.h | 7 +- thrust/device_new.h | 6 +- thrust/device_new_allocator.h | 6 +- thrust/device_ptr.h | 6 +- thrust/device_reference.h | 6 +- thrust/device_vector.h | 7 +- thrust/distance.h | 7 +- thrust/equal.h | 7 +- thrust/execution_policy.h | 7 +- thrust/extrema.h | 7 +- thrust/fill.h | 7 +- thrust/find.h | 8 +- thrust/for_each.h | 6 +- thrust/functional.h | 6 +- thrust/future.h | 6 +- thrust/gather.h | 6 +- thrust/generate.h | 6 +- thrust/host_vector.h | 6 +- thrust/inner_product.h | 6 +- thrust/iterator/constant_iterator.h | 5 +- thrust/iterator/counting_iterator.h | 5 +- thrust/iterator/detail/any_assign.h | 5 +- thrust/iterator/detail/any_system_tag.h | 5 +- .../iterator/detail/constant_iterator_base.h | 7 +- thrust/iterator/detail/counting_iterator.inl | 7 +- thrust/iterator/detail/device_system_tag.h | 5 +- .../iterator/detail/discard_iterator_base.h | 5 +- thrust/iterator/detail/distance_from_result.h | 5 +- thrust/iterator/detail/host_system_tag.h | 5 +- thrust/iterator/detail/is_iterator_category.h | 5 +- .../iterator/detail/iterator_adaptor_base.h | 7 +- .../detail/iterator_category_to_system.h | 5 +- .../detail/iterator_category_to_traversal.h | 5 +- ...rator_category_with_system_and_traversal.h | 5 +- .../detail/iterator_facade_category.h | 5 +- thrust/iterator/detail/iterator_traits.inl | 7 +- .../iterator/detail/iterator_traversal_tags.h | 7 +- thrust/iterator/detail/join_iterator.h | 5 +- thrust/iterator/detail/minimum_category.h | 7 +- thrust/iterator/detail/minimum_system.h | 5 +- thrust/iterator/detail/normal_iterator.h | 7 +- .../detail/permutation_iterator_base.h | 7 +- thrust/iterator/detail/retag.h | 5 +- thrust/iterator/detail/reverse_iterator.inl | 7 +- .../iterator/detail/reverse_iterator_base.h | 7 +- thrust/iterator/detail/tagged_iterator.h | 5 +- .../transform_input_output_iterator.inl | 7 +- thrust/iterator/detail/transform_iterator.inl | 7 +- .../detail/transform_output_iterator.inl | 7 +- .../detail/tuple_of_iterator_references.h | 5 +- thrust/iterator/detail/universal_categories.h | 5 +- thrust/iterator/detail/zip_iterator.inl | 7 +- thrust/iterator/detail/zip_iterator_base.h | 7 +- thrust/iterator/discard_iterator.h | 5 +- thrust/iterator/iterator_adaptor.h | 5 +- thrust/iterator/iterator_categories.h | 5 +- thrust/iterator/iterator_facade.h | 5 +- thrust/iterator/iterator_traits.h | 5 +- thrust/iterator/permutation_iterator.h | 5 +- thrust/iterator/retag.h | 5 +- thrust/iterator/reverse_iterator.h | 5 +- .../transform_input_output_iterator.h | 5 +- thrust/iterator/transform_iterator.h | 5 +- thrust/iterator/transform_output_iterator.h | 5 +- thrust/iterator/zip_iterator.h | 5 +- thrust/limits.h | 7 +- thrust/logical.h | 8 +- thrust/memory.h | 6 +- thrust/merge.h | 7 +- thrust/mismatch.h | 7 +- thrust/mr/allocator.h | 6 +- thrust/mr/device_memory_resource.h | 5 +- thrust/mr/disjoint_pool.h | 6 +- thrust/mr/disjoint_sync_pool.h | 6 +- thrust/mr/disjoint_tls_pool.h | 6 +- thrust/mr/fancy_pointer_resource.h | 6 +- thrust/mr/host_memory_resource.h | 5 +- thrust/mr/memory_resource.h | 6 +- thrust/mr/new.h | 7 +- thrust/mr/polymorphic_adaptor.h | 7 +- thrust/mr/pool.h | 7 +- thrust/mr/pool_options.h | 6 +- thrust/mr/sync_pool.h | 6 +- thrust/mr/tls_pool.h | 6 +- thrust/mr/validator.h | 7 +- thrust/optional.h | 19 ++- thrust/pair.h | 6 +- thrust/partition.h | 7 +- thrust/per_device_resource.h | 6 +- thrust/random.h | 7 +- thrust/random/detail/discard_block_engine.inl | 7 +- .../detail/linear_congruential_engine.inl | 7 +- .../linear_congruential_engine_discard.h | 7 +- .../detail/linear_feedback_shift_engine.inl | 7 +- .../linear_feedback_shift_engine_wordmask.h | 7 +- thrust/random/detail/mod.h | 5 +- thrust/random/detail/normal_distribution.inl | 7 +- .../random/detail/normal_distribution_base.h | 5 +- thrust/random/detail/random_core_access.h | 7 +- .../detail/subtract_with_carry_engine.inl | 7 +- .../detail/uniform_int_distribution.inl | 7 +- .../detail/uniform_real_distribution.inl | 7 +- thrust/random/detail/xor_combine_engine.inl | 7 +- thrust/random/detail/xor_combine_engine_max.h | 7 +- thrust/random/discard_block_engine.h | 5 +- thrust/random/linear_congruential_engine.h | 5 +- thrust/random/linear_feedback_shift_engine.h | 5 +- thrust/random/normal_distribution.h | 5 +- thrust/random/subtract_with_carry_engine.h | 5 +- thrust/random/uniform_int_distribution.h | 8 +- thrust/random/uniform_real_distribution.h | 5 +- thrust/random/xor_combine_engine.h | 5 +- thrust/reduce.h | 8 +- thrust/remove.h | 8 +- thrust/replace.h | 8 +- thrust/reverse.h | 8 +- thrust/scan.h | 8 +- thrust/scatter.h | 8 +- thrust/sequence.h | 7 +- thrust/set_operations.h | 8 +- thrust/shuffle.h | 4 +- thrust/sort.h | 8 +- thrust/swap.h | 11 +- thrust/system/cpp/detail/execution_policy.h | 5 +- thrust/system/cpp/detail/memory.inl | 5 +- thrust/system/cpp/detail/par.h | 5 +- thrust/system/cpp/detail/vector.inl | 5 +- thrust/system/cpp/execution_policy.h | 5 +- thrust/system/cpp/memory.h | 5 +- thrust/system/cpp/memory_resource.h | 8 +- thrust/system/cpp/pointer.h | 5 +- thrust/system/cpp/vector.h | 5 +- thrust/system/cuda/config.h | 3 - .../system/cuda/detail/adjacent_difference.h | 42 +++--- thrust/system/cuda/detail/assign_value.h | 8 +- thrust/system/cuda/detail/async/copy.h | 5 +- .../system/cuda/detail/async/customization.h | 5 +- .../system/cuda/detail/async/exclusive_scan.h | 25 ++-- thrust/system/cuda/detail/async/for_each.h | 5 +- .../system/cuda/detail/async/inclusive_scan.h | 17 ++- thrust/system/cuda/detail/async/reduce.h | 13 +- thrust/system/cuda/detail/async/sort.h | 15 +-- thrust/system/cuda/detail/async/transform.h | 5 +- thrust/system/cuda/detail/binary_search.h | 31 ++--- thrust/system/cuda/detail/copy.h | 11 +- thrust/system/cuda/detail/copy_if.h | 50 ++++---- .../system/cuda/detail/core/agent_launcher.h | 10 +- thrust/system/cuda/detail/core/alignment.h | 7 +- .../cuda/detail/core/triple_chevron_launch.h | 5 +- thrust/system/cuda/detail/core/util.h | 68 +++++----- thrust/system/cuda/detail/count.h | 6 +- thrust/system/cuda/detail/cross_system.h | 7 +- thrust/system/cuda/detail/equal.h | 6 +- thrust/system/cuda/detail/error.inl | 7 +- thrust/system/cuda/detail/execution_policy.h | 7 +- thrust/system/cuda/detail/extrema.h | 30 ++--- thrust/system/cuda/detail/fill.h | 7 +- thrust/system/cuda/detail/find.h | 11 +- thrust/system/cuda/detail/for_each.h | 6 +- thrust/system/cuda/detail/future.inl | 5 +- thrust/system/cuda/detail/gather.h | 6 +- thrust/system/cuda/detail/generate.h | 6 +- thrust/system/cuda/detail/get_value.h | 8 +- thrust/system/cuda/detail/inner_product.h | 6 +- .../cuda/detail/internal/copy_cross_system.h | 7 +- .../detail/internal/copy_device_to_device.h | 6 +- thrust/system/cuda/detail/iter_swap.h | 9 +- .../cuda/detail/make_unsigned_special.h | 7 +- thrust/system/cuda/detail/malloc_and_free.h | 13 +- thrust/system/cuda/detail/memory.inl | 5 +- thrust/system/cuda/detail/merge.h | 43 ++++--- thrust/system/cuda/detail/mismatch.h | 11 +- thrust/system/cuda/detail/par.h | 5 +- thrust/system/cuda/detail/par_to_seq.h | 7 +- thrust/system/cuda/detail/parallel_for.h | 6 +- thrust/system/cuda/detail/partition.h | 60 ++++----- .../system/cuda/detail/per_device_resource.h | 5 +- thrust/system/cuda/detail/reduce.h | 104 +++++++-------- thrust/system/cuda/detail/reduce_by_key.h | 56 ++++---- thrust/system/cuda/detail/remove.h | 6 +- thrust/system/cuda/detail/replace.h | 6 +- thrust/system/cuda/detail/reverse.h | 11 +- thrust/system/cuda/detail/scan.h | 51 ++++---- thrust/system/cuda/detail/scan_by_key.h | 67 +++++----- thrust/system/cuda/detail/scatter.h | 6 +- thrust/system/cuda/detail/set_operations.h | 47 +++---- thrust/system/cuda/detail/sort.h | 71 ++++++----- thrust/system/cuda/detail/swap_ranges.h | 6 +- thrust/system/cuda/detail/tabulate.h | 6 +- thrust/system/cuda/detail/terminate.h | 5 +- thrust/system/cuda/detail/transform.h | 6 +- thrust/system/cuda/detail/transform_reduce.h | 6 +- thrust/system/cuda/detail/transform_scan.h | 6 +- .../system/cuda/detail/uninitialized_copy.h | 6 +- .../system/cuda/detail/uninitialized_fill.h | 6 +- thrust/system/cuda/detail/unique.h | 54 ++++---- thrust/system/cuda/detail/unique_by_key.h | 54 ++++---- thrust/system/cuda/detail/util.h | 5 +- thrust/system/cuda/error.h | 5 +- .../cuda/experimental/pinned_allocator.h | 5 +- thrust/system/cuda/future.h | 5 +- thrust/system/cuda/memory.h | 5 +- thrust/system/cuda/memory_resource.h | 7 +- thrust/system/cuda/pointer.h | 5 +- thrust/system/cuda/vector.h | 5 +- thrust/system/detail/bad_alloc.h | 7 +- thrust/system/detail/errno.h | 5 +- thrust/system/detail/error_category.inl | 7 +- thrust/system/detail/error_code.inl | 7 +- thrust/system/detail/error_condition.inl | 7 +- .../detail/generic/adjacent_difference.h | 5 +- .../detail/generic/adjacent_difference.inl | 5 +- thrust/system/detail/generic/advance.h | 5 +- thrust/system/detail/generic/advance.inl | 5 +- thrust/system/detail/generic/binary_search.h | 5 +- .../system/detail/generic/binary_search.inl | 5 +- thrust/system/detail/generic/copy.h | 5 +- thrust/system/detail/generic/copy.inl | 5 +- thrust/system/detail/generic/copy_if.h | 5 +- thrust/system/detail/generic/copy_if.inl | 5 +- thrust/system/detail/generic/count.h | 5 +- thrust/system/detail/generic/count.inl | 5 +- thrust/system/detail/generic/distance.h | 5 +- thrust/system/detail/generic/distance.inl | 5 +- thrust/system/detail/generic/equal.h | 5 +- thrust/system/detail/generic/equal.inl | 5 +- thrust/system/detail/generic/extrema.h | 5 +- thrust/system/detail/generic/extrema.inl | 5 +- thrust/system/detail/generic/fill.h | 7 +- thrust/system/detail/generic/find.h | 5 +- thrust/system/detail/generic/find.inl | 5 +- thrust/system/detail/generic/for_each.h | 5 +- thrust/system/detail/generic/gather.h | 5 +- thrust/system/detail/generic/gather.inl | 5 +- thrust/system/detail/generic/generate.h | 5 +- thrust/system/detail/generic/generate.inl | 5 +- thrust/system/detail/generic/inner_product.h | 5 +- .../system/detail/generic/inner_product.inl | 5 +- thrust/system/detail/generic/logical.h | 5 +- thrust/system/detail/generic/memory.h | 5 +- thrust/system/detail/generic/memory.inl | 5 +- thrust/system/detail/generic/merge.h | 5 +- thrust/system/detail/generic/merge.inl | 5 +- thrust/system/detail/generic/mismatch.h | 5 +- thrust/system/detail/generic/mismatch.inl | 5 +- thrust/system/detail/generic/partition.h | 5 +- thrust/system/detail/generic/partition.inl | 5 +- .../detail/generic/per_device_resource.h | 5 +- thrust/system/detail/generic/reduce.h | 5 +- thrust/system/detail/generic/reduce.inl | 7 +- thrust/system/detail/generic/reduce_by_key.h | 5 +- .../system/detail/generic/reduce_by_key.inl | 7 +- thrust/system/detail/generic/remove.h | 5 +- thrust/system/detail/generic/remove.inl | 5 +- thrust/system/detail/generic/replace.h | 5 +- thrust/system/detail/generic/replace.inl | 5 +- thrust/system/detail/generic/reverse.h | 5 +- thrust/system/detail/generic/reverse.inl | 5 +- .../detail/generic/scalar/binary_search.h | 5 +- .../detail/generic/scalar/binary_search.inl | 5 +- thrust/system/detail/generic/scan.h | 5 +- thrust/system/detail/generic/scan.inl | 5 +- thrust/system/detail/generic/scan_by_key.h | 5 +- thrust/system/detail/generic/scan_by_key.inl | 5 +- thrust/system/detail/generic/scatter.h | 5 +- thrust/system/detail/generic/scatter.inl | 5 +- thrust/system/detail/generic/select_system.h | 5 +- .../system/detail/generic/select_system.inl | 5 +- .../detail/generic/select_system_exists.h | 5 +- thrust/system/detail/generic/sequence.h | 5 +- thrust/system/detail/generic/sequence.inl | 5 +- thrust/system/detail/generic/set_operations.h | 5 +- .../system/detail/generic/set_operations.inl | 5 +- thrust/system/detail/generic/shuffle.h | 4 +- thrust/system/detail/generic/shuffle.inl | 4 +- thrust/system/detail/generic/sort.h | 5 +- thrust/system/detail/generic/sort.inl | 5 +- thrust/system/detail/generic/swap_ranges.h | 5 +- thrust/system/detail/generic/swap_ranges.inl | 5 +- thrust/system/detail/generic/tabulate.h | 5 +- thrust/system/detail/generic/tabulate.inl | 5 +- thrust/system/detail/generic/tag.h | 5 +- .../system/detail/generic/temporary_buffer.h | 5 +- .../detail/generic/temporary_buffer.inl | 5 +- thrust/system/detail/generic/transform.h | 5 +- thrust/system/detail/generic/transform.inl | 5 +- .../system/detail/generic/transform_reduce.h | 5 +- .../detail/generic/transform_reduce.inl | 5 +- thrust/system/detail/generic/transform_scan.h | 5 +- .../system/detail/generic/transform_scan.inl | 5 +- .../detail/generic/uninitialized_copy.h | 5 +- .../detail/generic/uninitialized_copy.inl | 5 +- .../detail/generic/uninitialized_fill.h | 5 +- .../detail/generic/uninitialized_fill.inl | 5 +- thrust/system/detail/generic/unique.h | 5 +- thrust/system/detail/generic/unique.inl | 5 +- thrust/system/detail/generic/unique_by_key.h | 5 +- .../system/detail/generic/unique_by_key.inl | 5 +- thrust/system/detail/internal/decompose.h | 5 +- .../detail/sequential/adjacent_difference.h | 5 +- .../system/detail/sequential/assign_value.h | 5 +- .../system/detail/sequential/binary_search.h | 7 +- thrust/system/detail/sequential/copy.h | 5 +- thrust/system/detail/sequential/copy.inl | 5 +- .../system/detail/sequential/copy_backward.h | 5 +- thrust/system/detail/sequential/copy_if.h | 5 +- .../detail/sequential/execution_policy.h | 5 +- thrust/system/detail/sequential/extrema.h | 5 +- thrust/system/detail/sequential/find.h | 5 +- thrust/system/detail/sequential/for_each.h | 5 +- .../system/detail/sequential/general_copy.h | 5 +- thrust/system/detail/sequential/get_value.h | 5 +- .../system/detail/sequential/insertion_sort.h | 5 +- thrust/system/detail/sequential/iter_swap.h | 5 +- .../detail/sequential/malloc_and_free.h | 5 +- thrust/system/detail/sequential/merge.h | 5 +- thrust/system/detail/sequential/merge.inl | 5 +- thrust/system/detail/sequential/partition.h | 9 +- thrust/system/detail/sequential/reduce.h | 5 +- .../system/detail/sequential/reduce_by_key.h | 5 +- thrust/system/detail/sequential/remove.h | 5 +- thrust/system/detail/sequential/scan.h | 5 +- thrust/system/detail/sequential/scan_by_key.h | 5 +- .../system/detail/sequential/set_operations.h | 5 +- thrust/system/detail/sequential/sort.h | 5 +- thrust/system/detail/sequential/sort.inl | 6 +- .../detail/sequential/stable_merge_sort.h | 5 +- .../detail/sequential/stable_merge_sort.inl | 6 +- .../detail/sequential/stable_primitive_sort.h | 5 +- .../sequential/stable_primitive_sort.inl | 5 +- .../detail/sequential/stable_radix_sort.h | 5 +- .../detail/sequential/stable_radix_sort.inl | 6 +- .../system/detail/sequential/trivial_copy.h | 5 +- thrust/system/detail/sequential/unique.h | 5 +- .../system/detail/sequential/unique_by_key.h | 5 +- thrust/system/detail/system_error.inl | 7 +- thrust/system/error_code.h | 5 +- .../system/omp/detail/adjacent_difference.h | 5 +- thrust/system/omp/detail/binary_search.h | 5 +- thrust/system/omp/detail/copy.h | 5 +- thrust/system/omp/detail/copy.inl | 5 +- thrust/system/omp/detail/copy_if.h | 5 +- thrust/system/omp/detail/copy_if.inl | 5 +- .../system/omp/detail/default_decomposition.h | 5 +- .../omp/detail/default_decomposition.inl | 5 +- thrust/system/omp/detail/execution_policy.h | 5 +- thrust/system/omp/detail/extrema.h | 5 +- thrust/system/omp/detail/find.h | 5 +- thrust/system/omp/detail/for_each.h | 5 +- thrust/system/omp/detail/for_each.inl | 5 +- thrust/system/omp/detail/memory.inl | 5 +- thrust/system/omp/detail/par.h | 5 +- thrust/system/omp/detail/partition.h | 5 +- thrust/system/omp/detail/partition.inl | 5 +- thrust/system/omp/detail/reduce.h | 5 +- thrust/system/omp/detail/reduce.inl | 5 +- thrust/system/omp/detail/reduce_by_key.h | 5 +- thrust/system/omp/detail/reduce_by_key.inl | 5 +- thrust/system/omp/detail/reduce_intervals.h | 5 +- thrust/system/omp/detail/reduce_intervals.inl | 5 +- thrust/system/omp/detail/remove.h | 5 +- thrust/system/omp/detail/remove.inl | 5 +- thrust/system/omp/detail/sort.h | 5 +- thrust/system/omp/detail/sort.inl | 5 +- thrust/system/omp/detail/unique.h | 5 +- thrust/system/omp/detail/unique.inl | 5 +- thrust/system/omp/detail/unique_by_key.h | 5 +- thrust/system/omp/detail/unique_by_key.inl | 5 +- thrust/system/omp/execution_policy.h | 5 +- thrust/system/omp/memory.h | 5 +- thrust/system/omp/memory_resource.h | 6 +- thrust/system/omp/pointer.h | 5 +- thrust/system/omp/vector.h | 5 +- thrust/system/system_error.h | 5 +- .../system/tbb/detail/adjacent_difference.h | 5 +- thrust/system/tbb/detail/copy.h | 5 +- thrust/system/tbb/detail/copy.inl | 5 +- thrust/system/tbb/detail/copy_if.h | 5 +- thrust/system/tbb/detail/copy_if.inl | 5 +- thrust/system/tbb/detail/execution_policy.h | 5 +- thrust/system/tbb/detail/extrema.h | 5 +- thrust/system/tbb/detail/find.h | 5 +- thrust/system/tbb/detail/for_each.h | 5 +- thrust/system/tbb/detail/for_each.inl | 5 +- thrust/system/tbb/detail/memory.inl | 5 +- thrust/system/tbb/detail/merge.h | 5 +- thrust/system/tbb/detail/merge.inl | 7 +- thrust/system/tbb/detail/par.h | 5 +- thrust/system/tbb/detail/partition.h | 5 +- thrust/system/tbb/detail/partition.inl | 5 +- thrust/system/tbb/detail/reduce.h | 5 +- thrust/system/tbb/detail/reduce.inl | 5 +- thrust/system/tbb/detail/reduce_by_key.h | 5 +- thrust/system/tbb/detail/reduce_by_key.inl | 5 +- thrust/system/tbb/detail/reduce_intervals.h | 5 +- thrust/system/tbb/detail/remove.h | 5 +- thrust/system/tbb/detail/remove.inl | 5 +- thrust/system/tbb/detail/scan.h | 5 +- thrust/system/tbb/detail/scan.inl | 5 +- thrust/system/tbb/detail/sort.h | 5 +- thrust/system/tbb/detail/sort.inl | 5 +- thrust/system/tbb/detail/unique.h | 5 +- thrust/system/tbb/detail/unique.inl | 5 +- thrust/system/tbb/detail/unique_by_key.h | 5 +- thrust/system/tbb/detail/unique_by_key.inl | 5 +- thrust/system/tbb/execution_policy.h | 5 +- thrust/system/tbb/memory.h | 5 +- thrust/system/tbb/memory_resource.h | 6 +- thrust/system/tbb/pointer.h | 5 +- thrust/system/tbb/vector.h | 5 +- thrust/system_error.h | 6 +- thrust/tabulate.h | 8 +- thrust/transform.h | 8 +- thrust/transform_reduce.h | 8 +- thrust/transform_scan.h | 8 +- thrust/tuple.h | 6 +- thrust/type_traits/integer_sequence.h | 5 +- thrust/type_traits/is_contiguous_iterator.h | 12 +- thrust/type_traits/is_execution_policy.h | 5 +- ...operator_less_or_greater_function_object.h | 5 +- .../is_operator_plus_function_object.h | 5 +- thrust/type_traits/is_trivially_relocatable.h | 12 +- thrust/type_traits/logical_metafunctions.h | 5 +- thrust/type_traits/remove_cvref.h | 8 +- thrust/type_traits/void_t.h | 5 +- thrust/uninitialized_copy.h | 8 +- thrust/uninitialized_fill.h | 7 +- thrust/unique.h | 7 +- thrust/universal_allocator.h | 6 +- thrust/universal_vector.h | 6 +- thrust/version.h | 9 -- thrust/zip_function.h | 5 +- 623 files changed, 2397 insertions(+), 2639 deletions(-) create mode 100644 testing/cmake/check_namespace.cmake create mode 100644 testing/namespace_wrapped.cu create mode 100644 thrust/detail/config/namespace.h diff --git a/cmake/ThrustHeaderTesting.cmake b/cmake/ThrustHeaderTesting.cmake index 560c0a95a..1c4ee003d 100644 --- a/cmake/ThrustHeaderTesting.cmake +++ b/cmake/ThrustHeaderTesting.cmake @@ -118,6 +118,11 @@ foreach(thrust_target IN LISTS THRUST_TARGETS) set(headertest_target ${config_prefix}.headers) add_library(${headertest_target} OBJECT ${headertest_srcs}) target_link_libraries(${headertest_target} PUBLIC ${thrust_target}) + # Wrap Thrust/CUB in a custom namespace to check proper use of ns macros: + target_compile_definitions(${headertest_target} PRIVATE + "THRUST_WRAPPED_NAMESPACE=wrapped_thrust" + "CUB_WRAPPED_NAMESPACE=wrapped_cub" + ) thrust_clone_target_properties(${headertest_target} ${thrust_target}) # Disable macro checks on TBB; the TBB atomic implementation uses `I` and diff --git a/dependencies/cub b/dependencies/cub index ea01b53d6..6631c7263 160000 --- a/dependencies/cub +++ b/dependencies/cub @@ -1 +1 @@ -Subproject commit ea01b53d637360407b653666ca5fb63547dca2f1 +Subproject commit 6631c72630f10e370d93814a59146b12f7620d85 diff --git a/testing/cmake/CMakeLists.txt b/testing/cmake/CMakeLists.txt index 007c0cbae..ea0238172 100644 --- a/testing/cmake/CMakeLists.txt +++ b/testing/cmake/CMakeLists.txt @@ -26,3 +26,12 @@ if (THRUST_CPP_FOUND AND THRUST_CUDA_FOUND) ${extra_cmake_flags} ) endif() + +# Check that namespace macros are used correctly: +add_test( + NAME thrust.test.cmake.check_namespace + COMMAND + "${CMAKE_COMMAND}" + -D "Thrust_SOURCE_DIR=${Thrust_SOURCE_DIR}" + -P "${CMAKE_CURRENT_LIST_DIR}/check_namespace.cmake" +) diff --git a/testing/cmake/check_namespace.cmake b/testing/cmake/check_namespace.cmake new file mode 100644 index 000000000..594ab551a --- /dev/null +++ b/testing/cmake/check_namespace.cmake @@ -0,0 +1,93 @@ +# Check all files in thrust to make sure that they use +# THRUST_NAMESPACE_BEGIN/END instead of bare `namespace thrust {}` declarations. +# +# This is run as a ctest test named `thrust.test.cmake.check_namespace`, or +# manually with: +# cmake -D "Thrust_SOURCE_DIR=" -P check_namespace.cmake + +cmake_minimum_required(VERSION 3.15) + +set(exclusions + # This defines the macros and must have bare namespace declarations: + thrust/detail/config/namespace.h +) + +function(count_substrings input search_regex output_var) + string(REGEX MATCHALL "${search_regex}" matches "${input}") + list(LENGTH matches num_matches) + set(${output_var} ${num_matches} PARENT_SCOPE) +endfunction() + +set(bare_ns_regex "namespace[ \n\r\t]+thrust[ \n\r\t]*\\{") + +# Validation check for the above regex: +count_substrings([=[ +namespace thrust{ +namespace thrust { +namespace thrust { + namespace thrust { +namespace thrust +{ +namespace +thrust +{ +]=] + ${bare_ns_regex} valid_count) +if (NOT valid_count EQUAL 6) + message(FATAL_ERROR "Validation of bare namespace regex failed: " + "Matched ${valid_count} times, expected 6.") +endif() + +set(found_errors 0) +file(GLOB_RECURSE thrust_srcs + RELATIVE "${Thrust_SOURCE_DIR}" + "${Thrust_SOURCE_DIR}/*.h" + "${Thrust_SOURCE_DIR}/*.inl" + "${Thrust_SOURCE_DIR}/*.cu" +) + +foreach(src ${thrust_srcs}) + if (${src} IN_LIST exclusions) + continue() + endif() + + file(READ "${Thrust_SOURCE_DIR}/${src}" src_contents) + + count_substrings("${src_contents}" "${bare_ns_regex}" bare_ns_count) + count_substrings("${src_contents}" THRUST_NS_PREFIX prefix_count) + count_substrings("${src_contents}" THRUST_NS_POSTFIX postfix_count) + count_substrings("${src_contents}" THRUST_NAMESPACE_BEGIN begin_count) + count_substrings("${src_contents}" THRUST_NAMESPACE_END end_count) + count_substrings("${src_contents}" "#include " header_count) + + if (NOT bare_ns_count EQUAL 0) + message("'${src}' contains 'namespace thrust {...}'. Replace with THRUST_NAMESPACE macros.") + set(found_errors 1) + endif() + + if (NOT prefix_count EQUAL 0) + message("'${src}' contains 'THRUST_NS_PREFIX'. Replace with THRUST_NAMESPACE macros.") + set(found_errors 1) + endif() + + if (NOT postfix_count EQUAL 0) + message("'${src}' contains 'THRUST_NS_POSTFIX'. Replace with THRUST_NAMESPACE macros.") + set(found_errors 1) + endif() + + if (NOT begin_count EQUAL end_count) + message("'${src}' namespace macros are unbalanced:") + message(" - THRUST_NAMESPACE_BEGIN occurs ${begin_count} times.") + message(" - THRUST_NAMESPACE_END occurs ${end_count} times.") + set(found_errors 1) + endif() + + if (begin_count GREATER 0 AND header_count EQUAL 0) + message("'${src}' uses Thrust namespace macros, but does not (directly) `#include `.") + set(found_errors 1) + endif() +endforeach() + +if (NOT found_errors EQUAL 0) + message(FATAL_ERROR "Errors detected.") +endif() diff --git a/testing/copy.cu b/testing/copy.cu index a93bf1c09..661e379a2 100644 --- a/testing/copy.cu +++ b/testing/copy.cu @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -733,15 +734,14 @@ struct only_set_when_expected_it } }; -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { // We need this type to pass as a non-const ref for unary_transform_functor // to compile: template <> struct is_non_const_reference : thrust::true_type {}; -} +} // end namespace detail template<> struct iterator_traits @@ -750,7 +750,7 @@ struct iterator_traits typedef only_set_when_expected_it reference; typedef thrust::random_access_device_iterator_tag iterator_category; }; -} +THRUST_NAMESPACE_END void TestCopyWithBigIndexesHelper(int magnitude) { diff --git a/testing/mr_disjoint_pool.cu b/testing/mr_disjoint_pool.cu index b9a35e8cb..69a6005ec 100644 --- a/testing/mr_disjoint_pool.cu +++ b/testing/mr_disjoint_pool.cu @@ -32,7 +32,8 @@ struct alloc_id } }; -namespace thrust { namespace detail { +THRUST_NAMESPACE_BEGIN +namespace detail { template<> struct pointer_traits { @@ -48,7 +49,10 @@ struct pointer_traits return reinterpret_cast(id.alignment); } }; -}} + +} // end namespace detail + +THRUST_NAMESPACE_END class dummy_resource final : public thrust::mr::memory_resource { diff --git a/testing/namespace_wrapped.cu b/testing/namespace_wrapped.cu new file mode 100644 index 000000000..b6bcb3dbb --- /dev/null +++ b/testing/namespace_wrapped.cu @@ -0,0 +1,43 @@ +// Wrap thrust and cub in different enclosing namespaces +// (In practice, you probably want these to be the same, in which case just +// set THRUST_CUB_WRAPPED_NAMESPACE to set both). +#define THRUST_WRAPPED_NAMESPACE wrap_thrust +#define CUB_WRAPPED_NAMESPACE wrap_cub + +#include +#include +#include +#include +#include + +#include + +// Test that we can use a few common utilities and algorithms from a wrapped +// namespace at runtime. More extensive testing is performed by the header +// tests and the check_namespace.cmake test. +void TestWrappedNamespace() +{ + const std::size_t n = 2048; + + const auto in_1_begin = + ::wrap_thrust::thrust::make_constant_iterator(12); + const auto in_2_begin = + ::wrap_thrust::thrust::make_counting_iterator(1024); + + // Check that the qualifier resolves properly: + THRUST_NS_QUALIFIER::device_vector d_out(n); + + ::wrap_thrust::thrust::transform(in_1_begin, + in_1_begin + n, + in_2_begin, + d_out.begin(), + ::wrap_thrust::thrust::plus<>{}); + + ::wrap_thrust::thrust::host_vector h_out(d_out); + + for (std::size_t i = 0; i < n; ++i) + { + ASSERT_EQUAL(h_out[i], static_cast(i) + 1024 + 12); + } +} +DECLARE_UNITTEST(TestWrappedNamespace); diff --git a/testing/scan.cu b/testing/scan.cu index 0cf38d308..3422841b0 100644 --- a/testing/scan.cu +++ b/testing/scan.cu @@ -1,4 +1,7 @@ #include + +#include + #include #include #include @@ -583,15 +586,14 @@ struct only_set_when_expected_it } }; -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template<> struct iterator_traits { typedef long long value_type; typedef only_set_when_expected_it reference; }; -} +THRUST_NAMESPACE_END void TestInclusiveScanWithBigIndexesHelper(int magnitude) { diff --git a/testing/unittest/assertions.h b/testing/unittest/assertions.h index ad72b5d6a..855d705a4 100644 --- a/testing/unittest/assertions.h +++ b/testing/unittest/assertions.h @@ -99,15 +99,15 @@ double const DEFAULT_ABSOLUTE_TOL = 1e-4; template struct value_type { - typedef typename thrust::detail::remove_const< - typename thrust::detail::remove_reference< + typedef typename THRUST_NS_QUALIFIER::detail::remove_const< + typename THRUST_NS_QUALIFIER::detail::remove_reference< T >::type >::type type; }; template - struct value_type< thrust::device_reference > + struct value_type< THRUST_NS_QUALIFIER::device_reference > { typedef typename value_type::type type; }; @@ -328,7 +328,7 @@ void assert_almost_equal(T1 a, T2 b, template -void assert_almost_equal(thrust::complex a, thrust::complex b, +void assert_almost_equal(THRUST_NS_QUALIFIER::complex a, THRUST_NS_QUALIFIER::complex b, const std::string& filename = "unknown", int lineno = -1, double a_tol = DEFAULT_ABSOLUTE_TOL, double r_tol = DEFAULT_RELATIVE_TOL) @@ -344,7 +344,7 @@ void assert_almost_equal(thrust::complex a, thrust::complex b, template - void assert_almost_equal(const thrust::complex& a, const std::complex& b, + void assert_almost_equal(const THRUST_NS_QUALIFIER::complex& a, const std::complex& b, const std::string& filename = "unknown", int lineno = -1, double a_tol = DEFAULT_ABSOLUTE_TOL, double r_tol = DEFAULT_RELATIVE_TOL) @@ -371,12 +371,12 @@ class almost_equal_to template -class almost_equal_to > +class almost_equal_to > { public: double a_tol, r_tol; almost_equal_to(double _a_tol = DEFAULT_ABSOLUTE_TOL, double _r_tol = DEFAULT_RELATIVE_TOL) : a_tol(_a_tol), r_tol(_r_tol) {} - bool operator()(const thrust::complex& a, const thrust::complex& b) const { + bool operator()(const THRUST_NS_QUALIFIER::complex& a, const THRUST_NS_QUALIFIER::complex& b) const { return almost_equal((double) a.real(), (double) b.real(), a_tol, r_tol) && almost_equal((double) a.imag(), (double) b.imag(), a_tol, r_tol); } @@ -389,15 +389,15 @@ template ::type difference_type; - typedef typename thrust::iterator_value::type InputType; + typedef typename THRUST_NS_QUALIFIER::iterator_difference::type difference_type; + typedef typename THRUST_NS_QUALIFIER::iterator_value::type InputType; bool failure = false; - difference_type length1 = thrust::distance(first1, last1); - difference_type length2 = thrust::distance(first2, last2); + difference_type length1 = THRUST_NS_QUALIFIER::distance(first1, last1); + difference_type length2 = THRUST_NS_QUALIFIER::distance(first2, last2); - difference_type min_length = thrust::min(length1, length2); + difference_type min_length = THRUST_NS_QUALIFIER::min(length1, length2); unittest::UnitTestFailure f; f << "[" << filename << ":" << lineno << "] "; @@ -463,8 +463,8 @@ template void assert_equal(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, const std::string& filename = "unknown", int lineno = -1) { - typedef typename thrust::iterator_traits::value_type InputType; - assert_equal(first1, last1, first2, last2, thrust::equal_to(), filename, lineno); + typedef typename THRUST_NS_QUALIFIER::iterator_traits::value_type InputType; + assert_equal(first1, last1, first2, last2, THRUST_NS_QUALIFIER::equal_to(), filename, lineno); } @@ -473,76 +473,85 @@ void assert_almost_equal(ForwardIterator1 first1, ForwardIterator1 last1, Forwar const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { - typedef typename thrust::iterator_traits::value_type InputType; + typedef typename THRUST_NS_QUALIFIER::iterator_traits::value_type InputType; assert_equal(first1, last1, first2, last2, almost_equal_to(a_tol, r_tol), filename, lineno); } template -void assert_equal(const thrust::host_vector& A, const thrust::host_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::host_vector& A, + const THRUST_NS_QUALIFIER::host_vector& B, const std::string& filename = "unknown", int lineno = -1) { assert_equal(A.begin(), A.end(), B.begin(), B.end(), filename, lineno); } template -void assert_equal(const thrust::host_vector& A, const thrust::device_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::host_vector& A, + const THRUST_NS_QUALIFIER::device_vector& B, const std::string& filename = "unknown", int lineno = -1) { - thrust::host_vector B_host = B; + THRUST_NS_QUALIFIER::host_vector B_host = B; assert_equal(A, B_host, filename, lineno); } template -void assert_equal(const thrust::device_vector& A, const thrust::host_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::device_vector& A, + const THRUST_NS_QUALIFIER::host_vector& B, const std::string& filename = "unknown", int lineno = -1) { - thrust::host_vector A_host = A; + THRUST_NS_QUALIFIER::host_vector A_host = A; assert_equal(A_host, B, filename, lineno); } template -void assert_equal(const thrust::device_vector& A, const thrust::device_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::device_vector& A, + const THRUST_NS_QUALIFIER::device_vector& B, const std::string& filename = "unknown", int lineno = -1) { - thrust::host_vector A_host = A; - thrust::host_vector B_host = B; + THRUST_NS_QUALIFIER::host_vector A_host = A; + THRUST_NS_QUALIFIER::host_vector B_host = B; assert_equal(A_host, B_host, filename, lineno); } template -void assert_equal(const thrust::universal_vector& A, const thrust::universal_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::universal_vector& A, + const THRUST_NS_QUALIFIER::universal_vector& B, const std::string& filename = "unknown", int lineno = -1) { assert_equal(A.begin(), A.end(), B.begin(), B.end(), filename, lineno); } template -void assert_equal(const thrust::host_vector& A, const thrust::universal_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::host_vector& A, + const THRUST_NS_QUALIFIER::universal_vector& B, const std::string& filename = "unknown", int lineno = -1) { assert_equal(A.begin(), A.end(), B.begin(), B.end(), filename, lineno); } template -void assert_equal(const thrust::universal_vector& A, const thrust::host_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::universal_vector& A, + const THRUST_NS_QUALIFIER::host_vector& B, const std::string& filename = "unknown", int lineno = -1) { assert_equal(A.begin(), A.end(), B.begin(), B.end(), filename, lineno); } template -void assert_equal(const thrust::device_vector& A, const thrust::universal_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::device_vector& A, + const THRUST_NS_QUALIFIER::universal_vector& B, const std::string& filename = "unknown", int lineno = -1) { - thrust::host_vector A_host = A; + THRUST_NS_QUALIFIER::host_vector A_host = A; assert_equal(A_host, B, filename, lineno); } template -void assert_equal(const thrust::universal_vector& A, const thrust::device_vector& B, +void assert_equal(const THRUST_NS_QUALIFIER::universal_vector& A, + const THRUST_NS_QUALIFIER::device_vector& B, const std::string& filename = "unknown", int lineno = -1) { - thrust::host_vector B_host = B; + THRUST_NS_QUALIFIER::host_vector B_host = B; assert_equal(A, B_host, filename, lineno); } @@ -554,7 +563,8 @@ void assert_equal(const std::vector& A, const std::vector& B } template -void assert_almost_equal(const thrust::host_vector& A, const thrust::host_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::host_vector& A, + const THRUST_NS_QUALIFIER::host_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { @@ -562,35 +572,39 @@ void assert_almost_equal(const thrust::host_vector& A, const thrust::h } template -void assert_almost_equal(const thrust::host_vector& A, const thrust::device_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::host_vector& A, + const THRUST_NS_QUALIFIER::device_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { - thrust::host_vector B_host = B; + THRUST_NS_QUALIFIER::host_vector B_host = B; assert_almost_equal(A, B_host, filename, lineno, a_tol, r_tol); } template -void assert_almost_equal(const thrust::device_vector& A, const thrust::host_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::device_vector& A, + const THRUST_NS_QUALIFIER::host_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { - thrust::host_vector A_host = A; + THRUST_NS_QUALIFIER::host_vector A_host = A; assert_almost_equal(A_host, B, filename, lineno, a_tol, r_tol); } template -void assert_almost_equal(const thrust::device_vector& A, const thrust::device_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::device_vector& A, + const THRUST_NS_QUALIFIER::device_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { - thrust::host_vector A_host = A; - thrust::host_vector B_host = B; + THRUST_NS_QUALIFIER::host_vector A_host = A; + THRUST_NS_QUALIFIER::host_vector B_host = B; assert_almost_equal(A_host, B_host, filename, lineno, a_tol, r_tol); } template -void assert_almost_equal(const thrust::universal_vector& A, const thrust::universal_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::universal_vector& A, + const THRUST_NS_QUALIFIER::universal_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { @@ -598,7 +612,8 @@ void assert_almost_equal(const thrust::universal_vector& A, const thru } template -void assert_almost_equal(const thrust::host_vector& A, const thrust::universal_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::host_vector& A, + const THRUST_NS_QUALIFIER::universal_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { @@ -606,7 +621,8 @@ void assert_almost_equal(const thrust::host_vector& A, const thrust::u } template -void assert_almost_equal(const thrust::universal_vector& A, const thrust::host_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::universal_vector& A, + const THRUST_NS_QUALIFIER::host_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { @@ -614,20 +630,22 @@ void assert_almost_equal(const thrust::universal_vector& A, const thru } template -void assert_almost_equal(const thrust::device_vector& A, const thrust::universal_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::device_vector& A, + const THRUST_NS_QUALIFIER::universal_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { - thrust::host_vector A_host = A; + THRUST_NS_QUALIFIER::host_vector A_host = A; assert_almost_equal(A_host, B, filename, lineno, a_tol, r_tol); } template -void assert_almost_equal(const thrust::universal_vector& A, const thrust::device_vector& B, +void assert_almost_equal(const THRUST_NS_QUALIFIER::universal_vector& A, + const THRUST_NS_QUALIFIER::device_vector& B, const std::string& filename = "unknown", int lineno = -1, const double a_tol = DEFAULT_ABSOLUTE_TOL, const double r_tol = DEFAULT_RELATIVE_TOL) { - thrust::host_vector B_host = B; + THRUST_NS_QUALIFIER::host_vector B_host = B; assert_almost_equal(A, B_host, filename, lineno, a_tol, r_tol); } diff --git a/testing/unittest/random.h b/testing/unittest/random.h index 924c0f0e1..c94c3fecb 100644 --- a/testing/unittest/random.h +++ b/testing/unittest/random.h @@ -25,14 +25,14 @@ template template struct generate_random_integer::value + typename THRUST_NS_QUALIFIER::detail::disable_if< + THRUST_NS_QUALIFIER::detail::is_non_bool_arithmetic::value >::type > { T operator()(unsigned int i) const { - thrust::default_random_engine rng(hash(i)); + THRUST_NS_QUALIFIER::default_random_engine rng(hash(i)); return static_cast(rng()); } @@ -40,15 +40,15 @@ template template struct generate_random_integer::value + typename THRUST_NS_QUALIFIER::detail::enable_if< + THRUST_NS_QUALIFIER::detail::is_non_bool_integral::value >::type > { T operator()(unsigned int i) const { - thrust::default_random_engine rng(hash(i)); - thrust::uniform_int_distribution dist; + THRUST_NS_QUALIFIER::default_random_engine rng(hash(i)); + THRUST_NS_QUALIFIER::uniform_int_distribution dist; return static_cast(dist(rng)); } @@ -56,8 +56,8 @@ template template struct generate_random_integer::value + typename THRUST_NS_QUALIFIER::detail::enable_if< + THRUST_NS_QUALIFIER::detail::is_floating_point::value >::type > { @@ -66,8 +66,8 @@ template T const min = std::numeric_limits::min(); T const max = std::numeric_limits::max(); - thrust::default_random_engine rng(hash(i)); - thrust::uniform_real_distribution dist(min, max); + THRUST_NS_QUALIFIER::default_random_engine rng(hash(i)); + THRUST_NS_QUALIFIER::uniform_real_distribution dist(min, max); return static_cast(dist(rng)); } @@ -78,8 +78,8 @@ template<> { bool operator()(unsigned int i) const { - thrust::default_random_engine rng(hash(i)); - thrust::uniform_int_distribution dist(0,1); + THRUST_NS_QUALIFIER::default_random_engine rng(hash(i)); + THRUST_NS_QUALIFIER::uniform_int_distribution dist(0,1); return dist(rng) == 1; } @@ -91,8 +91,8 @@ template { T operator()(unsigned int i) const { - thrust::default_random_engine rng(hash(i)); - thrust::uniform_int_distribution dist(0,20); + THRUST_NS_QUALIFIER::default_random_engine rng(hash(i)); + THRUST_NS_QUALIFIER::uniform_int_distribution dist(0,20); return static_cast(dist(rng)); } @@ -101,13 +101,13 @@ template template -thrust::host_vector random_integers(const size_t N) +THRUST_NS_QUALIFIER::host_vector random_integers(const size_t N) { - thrust::host_vector vec(N); - thrust::transform(thrust::counting_iterator(static_cast(0)), - thrust::counting_iterator(static_cast(N)), - vec.begin(), - generate_random_integer()); + THRUST_NS_QUALIFIER::host_vector vec(N); + THRUST_NS_QUALIFIER::transform(THRUST_NS_QUALIFIER::counting_iterator(static_cast(0)), + THRUST_NS_QUALIFIER::counting_iterator(static_cast(N)), + vec.begin(), + generate_random_integer()); return vec; } @@ -119,13 +119,13 @@ T random_integer() } template -thrust::host_vector random_samples(const size_t N) +THRUST_NS_QUALIFIER::host_vector random_samples(const size_t N) { - thrust::host_vector vec(N); - thrust::transform(thrust::counting_iterator(static_cast(0)), - thrust::counting_iterator(static_cast(N)), - vec.begin(), - generate_random_sample()); + THRUST_NS_QUALIFIER::host_vector vec(N); + THRUST_NS_QUALIFIER::transform(THRUST_NS_QUALIFIER::counting_iterator(static_cast(0)), + THRUST_NS_QUALIFIER::counting_iterator(static_cast(N)), + vec.begin(), + generate_random_sample()); return vec; } diff --git a/testing/unittest/special_types.h b/testing/unittest/special_types.h index b046a96ee..9e4b0b743 100644 --- a/testing/unittest/special_types.h +++ b/testing/unittest/special_types.h @@ -128,7 +128,11 @@ void swap(user_swappable &x, user_swappable &y) y.was_swapped = false; } -class my_system : public thrust::device_execution_policy +// Inheriting from classes in anonymous namespaces is not allowed. +// The anonymous namespace tests don't use these, so just disable them: +#ifndef THRUST_USE_ANON_NAMESPACE + +class my_system : public THRUST_NS_QUALIFIER::device_execution_policy { public: my_system(int) @@ -163,21 +167,23 @@ class my_system : public thrust::device_execution_policy my_system(); }; -struct my_tag : thrust::device_execution_policy {}; +struct my_tag : THRUST_NS_QUALIFIER::device_execution_policy {}; + +#endif // THRUST_USE_ANON_NAMESPACE namespace unittest { -using thrust::detail::int8_t; -using thrust::detail::int16_t; -using thrust::detail::int32_t; -using thrust::detail::int64_t; +using THRUST_NS_QUALIFIER::detail::int8_t; +using THRUST_NS_QUALIFIER::detail::int16_t; +using THRUST_NS_QUALIFIER::detail::int32_t; +using THRUST_NS_QUALIFIER::detail::int64_t; -using thrust::detail::uint8_t; -using thrust::detail::uint16_t; -using thrust::detail::uint32_t; -using thrust::detail::uint64_t; +using THRUST_NS_QUALIFIER::detail::uint8_t; +using THRUST_NS_QUALIFIER::detail::uint16_t; +using THRUST_NS_QUALIFIER::detail::uint32_t; +using THRUST_NS_QUALIFIER::detail::uint64_t; } diff --git a/testing/unittest/testframework.h b/testing/unittest/testframework.h index 79ff8c7de..c6ced96e7 100644 --- a/testing/unittest/testframework.h +++ b/testing/unittest/testframework.h @@ -12,6 +12,7 @@ #include "util.h" #include +#include #include #include #include @@ -228,8 +229,7 @@ class custom_numeric } }; -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template <> struct numeric_limits : numeric_limits {}; @@ -243,7 +243,9 @@ class integer_traits : public integer_traits_base {}; -}} // namespace thrust::detail +} // namespace detail + +THRUST_NAMESPACE_END typedef unittest::type_list // Use this with counting_iterator to avoid generating a range larger than we // can represent. template -typename thrust::detail::disable_if< - thrust::detail::is_floating_point::value +typename THRUST_NS_QUALIFIER::detail::disable_if< + THRUST_NS_QUALIFIER::detail::is_floating_point::value , T >::type truncate_to_max_representable(std::size_t n) { - return static_cast(thrust::min( + return static_cast(THRUST_NS_QUALIFIER::min( n, - static_cast(thrust::numeric_limits::max()))); + static_cast(THRUST_NS_QUALIFIER::numeric_limits::max()))); } // TODO: This probably won't work for `half`. template -typename thrust::detail::enable_if< - thrust::detail::is_floating_point::value +typename THRUST_NS_QUALIFIER::detail::enable_if< + THRUST_NS_QUALIFIER::detail::is_floating_point::value , T >::type truncate_to_max_representable(std::size_t n) { - return thrust::min(static_cast(n), thrust::numeric_limits::max()); + return THRUST_NS_QUALIFIER::min( + static_cast(n), + THRUST_NS_QUALIFIER::numeric_limits::max()); } } // end unittest diff --git a/thrust/addressof.h b/thrust/addressof.h index fa9e41c8e..d21df0c76 100644 --- a/thrust/addressof.h +++ b/thrust/addressof.h @@ -11,8 +11,7 @@ # include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /////////////////////////////////////////////////////////////////////////////// @@ -29,5 +28,4 @@ T* addressof(T& arg) /////////////////////////////////////////////////////////////////////////////// -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/adjacent_difference.h b/thrust/adjacent_difference.h index adddd7b2b..e8385c240 100644 --- a/thrust/adjacent_difference.h +++ b/thrust/adjacent_difference.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup transformations Transformations * \{ @@ -240,7 +238,7 @@ OutputIterator adjacent_difference(InputIterator first, InputIterator last, /*! \} */ -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/advance.h b/thrust/advance.h index 20d2c3908..a5162e203 100644 --- a/thrust/advance.h +++ b/thrust/advance.h @@ -23,8 +23,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -135,7 +134,7 @@ BidirectionalIterator prev( /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/allocate_unique.h b/thrust/allocate_unique.h index 6e67d1b18..ff10cb51c 100644 --- a/thrust/allocate_unique.h +++ b/thrust/allocate_unique.h @@ -18,8 +18,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // wg21.link/p0316r0 @@ -438,7 +437,7 @@ uninitialized_allocate_unique_n( /////////////////////////////////////////////////////////////////////////////// -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/async/copy.h b/thrust/async/copy.h index a6d792d55..a88f46905 100644 --- a/thrust/async/copy.h +++ b/thrust/async/copy.h @@ -32,8 +32,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace async { @@ -143,7 +142,7 @@ THRUST_INLINE_CONSTANT copy_detail::copy_fn copy{}; } // namespace async -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/async/for_each.h b/thrust/async/for_each.h index df8e14118..6d4c4130a 100644 --- a/thrust/async/for_each.h +++ b/thrust/async/for_each.h @@ -32,8 +32,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace async { @@ -113,7 +112,6 @@ THRUST_INLINE_CONSTANT for_each_detail::for_each_fn for_each{}; } // namespace async -} // end namespace thrust +THRUST_NAMESPACE_END #endif - diff --git a/thrust/async/reduce.h b/thrust/async/reduce.h index da2b1195d..57d955d16 100644 --- a/thrust/async/reduce.h +++ b/thrust/async/reduce.h @@ -34,8 +34,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace async { @@ -435,7 +434,7 @@ THRUST_INLINE_CONSTANT reduce_into_detail::reduce_into_fn reduce_into{}; } // namespace async -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/async/scan.h b/thrust/async/scan.h index 5c20f8481..1bcf81257 100644 --- a/thrust/async/scan.h +++ b/thrust/async/scan.h @@ -37,8 +37,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace async { @@ -340,6 +339,6 @@ THRUST_INLINE_CONSTANT exclusive_scan_detail::exclusive_scan_fn exclusive_scan{} } // namespace async -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/async/sort.h b/thrust/async/sort.h index c665c6467..2820f75bd 100644 --- a/thrust/async/sort.h +++ b/thrust/async/sort.h @@ -34,8 +34,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace async { @@ -269,7 +268,7 @@ THRUST_INLINE_CONSTANT sort_detail::sort_fn sort{}; } // namespace async -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/async/transform.h b/thrust/async/transform.h index 89687e93a..59ea32661 100644 --- a/thrust/async/transform.h +++ b/thrust/async/transform.h @@ -32,8 +32,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace async { @@ -128,7 +127,6 @@ THRUST_INLINE_CONSTANT transform_detail::transform_fn transform{}; } // namespace async -} // end namespace thrust +THRUST_NAMESPACE_END #endif - diff --git a/thrust/binary_search.h b/thrust/binary_search.h index c74a1ece0..7a4746e0b 100644 --- a/thrust/binary_search.h +++ b/thrust/binary_search.h @@ -25,10 +25,8 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN - /*! \addtogroup algorithms */ @@ -1895,8 +1893,7 @@ OutputIterator binary_search(ForwardIterator first, /*! \} // end searching */ - -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/complex.h b/thrust/complex.h index badacb467..ea3647ad5 100644 --- a/thrust/complex.h +++ b/thrust/complex.h @@ -44,8 +44,7 @@ # define THRUST_STD_COMPLEX_DEVICE #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /* * Calls to the standard math library from inside the thrust namespace @@ -1026,7 +1025,7 @@ template __host__ __device__ bool operator!=(const complex& x, const T1& y); -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/copy.h b/thrust/copy.h index 46e03ab1a..99d488174 100644 --- a/thrust/copy.h +++ b/thrust/copy.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup algorithms */ @@ -505,8 +504,8 @@ template #include diff --git a/thrust/count.h b/thrust/count.h index cd75afb71..52b22d205 100644 --- a/thrust/count.h +++ b/thrust/count.h @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup algorithms */ @@ -228,8 +226,6 @@ template * \} // end reductions */ - -} // end thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/detail/adjacent_difference.inl b/thrust/detail/adjacent_difference.inl index f8099450f..5d7cc3ffa 100644 --- a/thrust/detail/adjacent_difference.inl +++ b/thrust/detail/adjacent_difference.inl @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -88,5 +86,4 @@ OutputIterator adjacent_difference(InputIterator first, InputIterator last, } // end adjacent_difference() -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/advance.inl b/thrust/detail/advance.inl index 2694a7ec6..09f3f0fd1 100644 --- a/thrust/detail/advance.inl +++ b/thrust/detail/advance.inl @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __THRUST_DEFINE_HAS_NESTED_TYPE(has_difference_type, difference_type) @@ -75,5 +74,4 @@ typename detail::disable_if< return i; } -} // namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/alignment.h b/thrust/detail/alignment.h index 89c8afcd8..08f73501e 100644 --- a/thrust/detail/alignment.h +++ b/thrust/detail/alignment.h @@ -29,8 +29,8 @@ #include // For `std::alignment_of` and `std::aligned_storage`. #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -226,5 +226,5 @@ inline std::size_t aligned_storage_size(std::size_t n, std::size_t align) } } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/allocator_traits.h b/thrust/detail/allocator/allocator_traits.h index c2557b57e..cc710ed4a 100644 --- a/thrust/detail/allocator/allocator_traits.h +++ b/thrust/detail/allocator/allocator_traits.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -416,7 +415,7 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/allocator_traits.inl b/thrust/detail/allocator/allocator_traits.inl index 0818941f6..1d8d92a9c 100644 --- a/thrust/detail/allocator/allocator_traits.inl +++ b/thrust/detail/allocator/allocator_traits.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -460,5 +459,5 @@ __host__ __device__ } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/copy_construct_range.h b/thrust/detail/allocator/copy_construct_range.h index 491c8ef41..b3c2de324 100644 --- a/thrust/detail/allocator/copy_construct_range.h +++ b/thrust/detail/allocator/copy_construct_range.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -41,7 +40,7 @@ __host__ __device__ Pointer result); } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/copy_construct_range.inl b/thrust/detail/allocator/copy_construct_range.inl index 2f0f03c36..6c879ca41 100644 --- a/thrust/detail/allocator/copy_construct_range.inl +++ b/thrust/detail/allocator/copy_construct_range.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace allocator_traits_detail @@ -305,5 +304,5 @@ __host__ __device__ } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/default_construct_range.h b/thrust/detail/allocator/default_construct_range.h index 6c3856c14..8b5026c05 100644 --- a/thrust/detail/allocator/default_construct_range.h +++ b/thrust/detail/allocator/default_construct_range.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -30,7 +29,7 @@ inline void default_construct_range(Allocator &a, Pointer p, Size n); } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/default_construct_range.inl b/thrust/detail/allocator/default_construct_range.inl index 0f65d4806..95ffb70ed 100644 --- a/thrust/detail/allocator/default_construct_range.inl +++ b/thrust/detail/allocator/default_construct_range.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace allocator_traits_detail @@ -107,5 +106,5 @@ __host__ __device__ } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/destroy_range.h b/thrust/detail/allocator/destroy_range.h index bf00037ce..cfc7e3f6e 100644 --- a/thrust/detail/allocator/destroy_range.h +++ b/thrust/detail/allocator/destroy_range.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -28,7 +27,7 @@ __host__ __device__ inline void destroy_range(Allocator &a, Pointer p, Size n); } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/destroy_range.inl b/thrust/detail/allocator/destroy_range.inl index f34159dc3..8f4cf603d 100644 --- a/thrust/detail/allocator/destroy_range.inl +++ b/thrust/detail/allocator/destroy_range.inl @@ -14,14 +14,15 @@ * limitations under the License. */ +#include + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace allocator_traits_detail @@ -160,5 +161,5 @@ __host__ __device__ } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/fill_construct_range.h b/thrust/detail/allocator/fill_construct_range.h index 9de0f7bcb..a7572cb2d 100644 --- a/thrust/detail/allocator/fill_construct_range.h +++ b/thrust/detail/allocator/fill_construct_range.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -30,7 +29,7 @@ inline void fill_construct_range(Allocator &a, Pointer p, Size n, const T &value } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/fill_construct_range.inl b/thrust/detail/allocator/fill_construct_range.inl index 7f2adafc7..f5f8b72ea 100644 --- a/thrust/detail/allocator/fill_construct_range.inl +++ b/thrust/detail/allocator/fill_construct_range.inl @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace allocator_traits_detail @@ -109,5 +108,5 @@ __host__ __device__ } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/malloc_allocator.h b/thrust/detail/allocator/malloc_allocator.h index 2c01c66bd..af3d0fccb 100644 --- a/thrust/detail/allocator/malloc_allocator.h +++ b/thrust/detail/allocator/malloc_allocator.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -46,7 +45,7 @@ template }; } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/malloc_allocator.inl b/thrust/detail/allocator/malloc_allocator.inl index e7b7503ba..ff0ea8ec6 100644 --- a/thrust/detail/allocator/malloc_allocator.inl +++ b/thrust/detail/allocator/malloc_allocator.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -60,5 +59,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/no_throw_allocator.h b/thrust/detail/allocator/no_throw_allocator.h index ba8c3d852..ea158d77f 100644 --- a/thrust/detail/allocator/no_throw_allocator.h +++ b/thrust/detail/allocator/no_throw_allocator.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -66,6 +65,6 @@ template }; // end no_throw_allocator } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/tagged_allocator.h b/thrust/detail/allocator/tagged_allocator.h index a29115c6c..804c4e42e 100644 --- a/thrust/detail/allocator/tagged_allocator.h +++ b/thrust/detail/allocator/tagged_allocator.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -95,7 +94,7 @@ __host__ __device__ bool operator!=(const tagged_allocator &, const tagged_allocator &); } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/tagged_allocator.inl b/thrust/detail/allocator/tagged_allocator.inl index 5f4ed9596..e552dbca8 100644 --- a/thrust/detail/allocator/tagged_allocator.inl +++ b/thrust/detail/allocator/tagged_allocator.inl @@ -18,8 +18,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -99,5 +98,5 @@ bool operator!=(const tagged_allocator &, const tagged_allocato } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator/temporary_allocator.h b/thrust/detail/allocator/temporary_allocator.h index 4d2ac429c..c8ef60625 100644 --- a/thrust/detail/allocator/temporary_allocator.h +++ b/thrust/detail/allocator/temporary_allocator.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -79,7 +78,7 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/allocator/temporary_allocator.inl b/thrust/detail/allocator/temporary_allocator.inl index 673ed272f..28056414b 100644 --- a/thrust/detail/allocator/temporary_allocator.inl +++ b/thrust/detail/allocator/temporary_allocator.inl @@ -25,8 +25,7 @@ #include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -71,5 +70,5 @@ __host__ __device__ } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/allocator_aware_execution_policy.h b/thrust/detail/allocator_aware_execution_policy.h index 28fd54f9b..eea93c035 100644 --- a/thrust/detail/allocator_aware_execution_policy.h +++ b/thrust/detail/allocator_aware_execution_policy.h @@ -24,8 +24,7 @@ #include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -97,5 +96,6 @@ struct allocator_aware_execution_policy #endif }; -} -} +} // end namespace detail + +THRUST_NAMESPACE_END diff --git a/thrust/detail/binary_search.inl b/thrust/detail/binary_search.inl index 5703226dc..b8826dfec 100644 --- a/thrust/detail/binary_search.inl +++ b/thrust/detail/binary_search.inl @@ -26,9 +26,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -482,5 +480,4 @@ OutputIterator binary_search(ForwardIterator first, return thrust::binary_search(select_system(system1,system2,system3), first, last, values_first, values_last, output, comp); } -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/caching_allocator.h b/thrust/detail/caching_allocator.h index 13df1d33f..941f52755 100644 --- a/thrust/detail/caching_allocator.h +++ b/thrust/detail/caching_allocator.h @@ -16,13 +16,14 @@ #pragma once +#include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { inline @@ -42,4 +43,5 @@ thrust::mr::allocator< }; } } -} + +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/arithmetic.h b/thrust/detail/complex/arithmetic.h index 448166e98..0538e02cf 100644 --- a/thrust/detail/complex/arithmetic.h +++ b/thrust/detail/complex/arithmetic.h @@ -15,13 +15,16 @@ * limitations under the License. */ +#pragma once + +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /* --- Binary Arithmetic Operators --- */ @@ -296,5 +299,5 @@ polar(const T0& m, const T1& theta) return complex(m * cos(theta), m * sin(theta)); } -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/c99math.h b/thrust/detail/complex/c99math.h index 99748823b..f6875b74a 100644 --- a/thrust/detail/complex/c99math.h +++ b/thrust/detail/complex/c99math.h @@ -16,12 +16,13 @@ */ #pragma once +#include + #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace complex @@ -192,5 +193,5 @@ inline double hypot(double x, double y){ } // namespace detail -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/catrig.h b/thrust/detail/complex/catrig.h index 6549fbb2e..48068e85a 100644 --- a/thrust/detail/complex/catrig.h +++ b/thrust/detail/complex/catrig.h @@ -54,7 +54,7 @@ #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -782,4 +782,4 @@ inline complex atanh(const complex& z){ } #endif -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/catrigf.h b/thrust/detail/complex/catrigf.h index aa924717a..1847ebaa6 100644 --- a/thrust/detail/complex/catrigf.h +++ b/thrust/detail/complex/catrigf.h @@ -54,7 +54,7 @@ #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -497,4 +497,4 @@ inline complex atanh(const complex& z){ } #endif -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/ccosh.h b/thrust/detail/complex/ccosh.h index 300f08afc..722dfcd84 100644 --- a/thrust/detail/complex/ccosh.h +++ b/thrust/detail/complex/ccosh.h @@ -47,10 +47,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -210,4 +212,4 @@ inline thrust::complex cosh(const thrust::complex& z){ return detail::complex::ccosh(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/ccoshf.h b/thrust/detail/complex/ccoshf.h index d33af7c4c..aa43f1208 100644 --- a/thrust/detail/complex/ccoshf.h +++ b/thrust/detail/complex/ccoshf.h @@ -48,10 +48,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -138,4 +140,4 @@ inline complex cosh(const complex& z){ return detail::complex::ccoshf(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/cexp.h b/thrust/detail/complex/cexp.h index 151df397b..c0c8c07d2 100644 --- a/thrust/detail/complex/cexp.h +++ b/thrust/detail/complex/cexp.h @@ -49,10 +49,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ /* @@ -180,4 +182,4 @@ inline complex exp(const complex& z){ return detail::complex::cexp(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/cexpf.h b/thrust/detail/complex/cexpf.h index 6d85c45ed..cae030fe7 100644 --- a/thrust/detail/complex/cexpf.h +++ b/thrust/detail/complex/cexpf.h @@ -49,10 +49,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -158,4 +160,4 @@ inline complex exp(const complex& z){ return detail::complex::cexpf(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/clog.h b/thrust/detail/complex/clog.h index 8d288df02..0523bda38 100644 --- a/thrust/detail/complex/clog.h +++ b/thrust/detail/complex/clog.h @@ -46,10 +46,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -208,5 +210,5 @@ inline complex log10(const complex& z){ return thrust::log(z)/ValueType(2.30258509299404568402); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/clogf.h b/thrust/detail/complex/clogf.h index 7f3314ed2..debafd2f4 100644 --- a/thrust/detail/complex/clogf.h +++ b/thrust/detail/complex/clogf.h @@ -45,10 +45,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -194,5 +196,5 @@ inline complex log(const complex& z){ return detail::complex::clogf(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/complex.inl b/thrust/detail/complex/complex.inl index 2e2a106bc..bc786e199 100644 --- a/thrust/detail/complex/complex.inl +++ b/thrust/detail/complex/complex.inl @@ -15,12 +15,13 @@ * limitations under the License. */ +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /* --- Constructors --- */ @@ -330,7 +331,7 @@ bool operator!=(const complex& x, const T1& y) template struct proclaim_trivially_relocatable > : thrust::true_type {}; -} // end namespace thrust +THRUST_NAMESPACE_END #include #include diff --git a/thrust/detail/complex/cpow.h b/thrust/detail/complex/cpow.h index 2d6ad051e..c204c451f 100644 --- a/thrust/detail/complex/cpow.h +++ b/thrust/detail/complex/cpow.h @@ -17,10 +17,12 @@ #pragma once +#include + #include #include -namespace thrust { +THRUST_NAMESPACE_BEGIN template __host__ __device__ @@ -51,5 +53,5 @@ pow(const T0& x, const complex& y) return exp(log(T(x)) * complex(y)); } -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/cproj.h b/thrust/detail/complex/cproj.h index 563c92f69..7537c99fd 100644 --- a/thrust/detail/complex/cproj.h +++ b/thrust/detail/complex/cproj.h @@ -17,11 +17,13 @@ #pragma once +#include + #include #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ __host__ __device__ @@ -67,5 +69,4 @@ inline thrust::complex proj(const thrust::complex& z){ return detail::complex::cprojf(z); } -} - +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/csinh.h b/thrust/detail/complex/csinh.h index 869f367f2..b5a22af01 100644 --- a/thrust/detail/complex/csinh.h +++ b/thrust/detail/complex/csinh.h @@ -48,10 +48,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -202,4 +204,4 @@ inline complex sinh(const complex& z){ return detail::complex::csinh(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/csinhf.h b/thrust/detail/complex/csinhf.h index bf4fb0816..d271081c6 100644 --- a/thrust/detail/complex/csinhf.h +++ b/thrust/detail/complex/csinhf.h @@ -48,10 +48,12 @@ #pragma once +#include + #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -139,4 +141,4 @@ inline complex sinh(const complex& z){ return detail::complex::csinhf(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/csqrt.h b/thrust/detail/complex/csqrt.h index dcffbee95..eb4da5289 100644 --- a/thrust/detail/complex/csqrt.h +++ b/thrust/detail/complex/csqrt.h @@ -49,11 +49,13 @@ #pragma once +#include + #include #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -149,4 +151,4 @@ inline complex sqrt(const complex& z){ return detail::complex::csqrt(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/csqrtf.h b/thrust/detail/complex/csqrtf.h index 125d4b60d..dba489a33 100644 --- a/thrust/detail/complex/csqrtf.h +++ b/thrust/detail/complex/csqrtf.h @@ -49,11 +49,13 @@ #pragma once +#include + #include #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -144,4 +146,4 @@ inline complex sqrt(const complex& z){ return detail::complex::csqrtf(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/ctanh.h b/thrust/detail/complex/ctanh.h index 6ef159092..3275c0343 100644 --- a/thrust/detail/complex/ctanh.h +++ b/thrust/detail/complex/ctanh.h @@ -87,11 +87,13 @@ #pragma once +#include + #include #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -197,4 +199,4 @@ inline complex tanh(const complex& z){ return detail::complex::ctanh(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/ctanhf.h b/thrust/detail/complex/ctanhf.h index f6923d1df..221b5ce47 100644 --- a/thrust/detail/complex/ctanhf.h +++ b/thrust/detail/complex/ctanhf.h @@ -52,11 +52,13 @@ #pragma once +#include + #include #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -121,4 +123,4 @@ inline complex tanh(const complex& z){ return detail::complex::ctanhf(z); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/complex/math_private.h b/thrust/detail/complex/math_private.h index bc2d6357f..3a40c8e72 100644 --- a/thrust/detail/complex/math_private.h +++ b/thrust/detail/complex/math_private.h @@ -35,7 +35,7 @@ #include #include -namespace thrust{ +THRUST_NAMESPACE_BEGIN namespace detail{ namespace complex{ @@ -130,7 +130,7 @@ void extract_words(int32_t & ix0,int32_t & ix1, double d){ } // namespace detail -} // namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/complex/stream.h b/thrust/detail/complex/stream.h index 9d87bbd54..42069897a 100644 --- a/thrust/detail/complex/stream.h +++ b/thrust/detail/complex/stream.h @@ -15,10 +15,13 @@ * limitations under the License. */ +#pragma once + +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template std::basic_ostream& operator<<(std::basic_ostream& os, const complex& z) { @@ -68,4 +71,4 @@ operator>>(std::basic_istream& is, complex& z) return is; } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/config/config.h b/thrust/detail/config/config.h index 800bc4c51..797f6605b 100644 --- a/thrust/detail/config/config.h +++ b/thrust/detail/config/config.h @@ -36,4 +36,5 @@ #include #include #include +#include diff --git a/thrust/detail/config/memory_resource.h b/thrust/detail/config/memory_resource.h index 4cfc50d3e..ab719c9bd 100644 --- a/thrust/detail/config/memory_resource.h +++ b/thrust/detail/config/memory_resource.h @@ -22,7 +22,7 @@ #include #include -#define THRUST_MR_DEFAULT_ALIGNMENT THRUST_ALIGNOF(::thrust::detail::max_align_t) +#define THRUST_MR_DEFAULT_ALIGNMENT THRUST_ALIGNOF(THRUST_NS_QUALIFIER::detail::max_align_t) #if THRUST_CPP_DIALECT >= 2017 # if __has_include() @@ -33,4 +33,3 @@ # define THRUST_MR_STD_MR_NS std::experimental::pmr # endif #endif - diff --git a/thrust/detail/config/namespace.h b/thrust/detail/config/namespace.h new file mode 100644 index 000000000..9c7904616 --- /dev/null +++ b/thrust/detail/config/namespace.h @@ -0,0 +1,120 @@ +/* + * Copyright 2021 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +/** + * \file namespace.h + * \brief Utilities that allow `thrust::` to be placed inside an + * application-specific namespace. + */ + +/** + * \def THRUST_CUB_WRAPPED_NAMESPACE + * If defined, this value will be used as the name of a namespace that wraps the + * `thrust::` and `cub::` namespaces. + * This macro should not be used with any other Thrust namespace macros. + */ +#ifdef THRUST_CUB_WRAPPED_NAMESPACE +#define THRUST_WRAPPED_NAMESPACE THRUST_CUB_WRAPPED_NAMESPACE +#endif + +/** + * \def THRUST_WRAPPED_NAMESPACE + * If defined, this value will be used as the name of a namespace that wraps the + * `thrust::` namespace. + * If THRUST_CUB_WRAPPED_NAMESPACE is set, this will inherit that macro's value. + * This macro should not be used with any other Thrust namespace macros. + */ +#ifdef THRUST_WRAPPED_NAMESPACE +#define THRUST_NS_PREFIX \ + namespace THRUST_WRAPPED_NAMESPACE \ + { + +#define THRUST_NS_POSTFIX } + +#define THRUST_NS_QUALIFIER ::THRUST_WRAPPED_NAMESPACE::thrust +#endif + +/** + * \def THRUST_NS_PREFIX + * This macro is inserted prior to all `namespace thrust { ... }` blocks. It is + * derived from THRUST_WRAPPED_NAMESPACE, if set, and will be empty otherwise. + * It may be defined by users, in which case THRUST_NS_PREFIX, + * THRUST_NS_POSTFIX, and THRUST_NS_QUALIFIER must all be set consistently. + */ +#ifndef THRUST_NS_PREFIX +#define THRUST_NS_PREFIX +#endif + +/** + * \def THRUST_NS_POSTFIX + * This macro is inserted following the closing braces of all + * `namespace thrust { ... }` block. It is defined appropriately when + * THRUST_WRAPPED_NAMESPACE is set, and will be empty otherwise. It may be + * defined by users, in which case THRUST_NS_PREFIX, THRUST_NS_POSTFIX, and + * THRUST_NS_QUALIFIER must all be set consistently. + */ +#ifndef THRUST_NS_POSTFIX +#define THRUST_NS_POSTFIX +#endif + +/** + * \def THRUST_NS_QUALIFIER + * This macro is used to qualify members of thrust:: when accessing them from + * outside of their namespace. By default, this is just `::thrust`, and will be + * set appropriately when THRUST_WRAPPED_NAMESPACE is defined. This macro may be + * defined by users, in which case THRUST_NS_PREFIX, THRUST_NS_POSTFIX, and + * THRUST_NS_QUALIFIER must all be set consistently. + */ +#ifndef THRUST_NS_QUALIFIER +#define THRUST_NS_QUALIFIER ::thrust +#endif + +/** + * \def THRUST_NAMESPACE_BEGIN + * This macro is used to open a `thrust::` namespace block, along with any + * enclosing namespaces requested by THRUST_WRAPPED_NAMESPACE, etc. + * This macro is defined by Thrust and may not be overridden. + */ +#define THRUST_NAMESPACE_BEGIN \ + THRUST_NS_PREFIX \ + namespace thrust \ + { + +/** + * \def THRUST_NAMESPACE_END + * This macro is used to close a `thrust::` namespace block, along with any + * enclosing namespaces requested by THRUST_WRAPPED_NAMESPACE, etc. + * This macro is defined by Thrust and may not be overridden. + */ +#define THRUST_NAMESPACE_END \ + } /* end namespace thrust */ \ + THRUST_NS_POSTFIX + +// The following is just here to add docs for the thrust namespace: + +THRUST_NS_PREFIX + +/*! \namespace thrust + * \brief \p thrust is the top-level namespace which contains all Thrust + * functions and types. + */ +namespace thrust +{ +} + +THRUST_NS_POSTFIX diff --git a/thrust/detail/contiguous_storage.h b/thrust/detail/contiguous_storage.h index a128223a9..536c1c27c 100644 --- a/thrust/detail/contiguous_storage.h +++ b/thrust/detail/contiguous_storage.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -230,7 +229,7 @@ template __host__ __device__ void swap(detail::contiguous_storage &lhs, detail::contiguous_storage &rhs); -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/contiguous_storage.inl b/thrust/detail/contiguous_storage.inl index 89f78e0b2..b82b83399 100644 --- a/thrust/detail/contiguous_storage.inl +++ b/thrust/detail/contiguous_storage.inl @@ -28,8 +28,7 @@ #include // for std::runtime_error #include // for use of std::swap in the WAR below -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -549,5 +548,4 @@ __host__ __device__ lhs.swap(rhs); } // end swap() -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/copy.h b/thrust/detail/copy.h index 5e9feb0f9..d6c5bc805 100644 --- a/thrust/detail/copy.h +++ b/thrust/detail/copy.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template +THRUST_NAMESPACE_END +#include diff --git a/thrust/detail/copy.inl b/thrust/detail/copy.inl index 85701fde7..125037f12 100644 --- a/thrust/detail/copy.inl +++ b/thrust/detail/copy.inl @@ -21,9 +21,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -127,6 +125,4 @@ template #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN template - diff --git a/thrust/detail/copy_if.inl b/thrust/detail/copy_if.inl index f4c22f8a5..83c1237fd 100644 --- a/thrust/detail/copy_if.inl +++ b/thrust/detail/copy_if.inl @@ -21,9 +21,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -79,6 +77,4 @@ count_if(InputIterator first, InputIterator last, Predicate pred) return thrust::count_if(select_system(system), first, last, pred); } // end count_if() - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/cstdint.h b/thrust/detail/cstdint.h index 248390a52..52096d3b1 100644 --- a/thrust/detail/cstdint.h +++ b/thrust/detail/cstdint.h @@ -16,12 +16,14 @@ #pragma once +#include + #if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) || (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_CLANG) #include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -75,5 +77,5 @@ typedef divine_intptr_t<>::type intptr_t; typedef divine_uintptr_t<>::type uintptr_t; } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/dependencies_aware_execution_policy.h b/thrust/detail/dependencies_aware_execution_policy.h index 1806276f9..a7567a3fa 100644 --- a/thrust/detail/dependencies_aware_execution_policy.h +++ b/thrust/detail/dependencies_aware_execution_policy.h @@ -25,8 +25,8 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -99,7 +99,8 @@ struct dependencies_aware_execution_policy }; } // end detail -} // end thrust + +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/detail/device_delete.inl b/thrust/detail/device_delete.inl index f1a67f91b..238e4d94d 100644 --- a/thrust/detail/device_delete.inl +++ b/thrust/detail/device_delete.inl @@ -19,12 +19,13 @@ * \brief Inline file for device_delete.h. */ +#include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -43,5 +44,4 @@ template thrust::device_free(ptr); } // end device_delete() -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/device_free.inl b/thrust/detail/device_free.inl index 7a1b6c123..2f2cf8730 100644 --- a/thrust/detail/device_free.inl +++ b/thrust/detail/device_free.inl @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN void device_free(thrust::device_ptr ptr) { @@ -40,5 +39,4 @@ void device_free(thrust::device_ptr ptr) thrust::free(s, ptr); } // end device_free() -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/device_malloc.inl b/thrust/detail/device_malloc.inl index 938c3c807..b40db02b1 100644 --- a/thrust/detail/device_malloc.inl +++ b/thrust/detail/device_malloc.inl @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN thrust::device_ptr device_malloc(const std::size_t n) { @@ -55,6 +53,4 @@ template return thrust::device_ptr(thrust::malloc(s,n).get()); } // end device_malloc() - -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/device_new.inl b/thrust/detail/device_new.inl index 2551badb4..90d6736fa 100644 --- a/thrust/detail/device_new.inl +++ b/thrust/detail/device_new.inl @@ -19,12 +19,12 @@ * \brief Inline file for device_new.h. */ +#include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template device_ptr device_new(device_ptr p, @@ -56,5 +56,4 @@ template return device_new(thrust::device_malloc(n)); } // end device_new() -} // thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/device_ptr.inl b/thrust/detail/device_ptr.inl index d1058ca6a..9723f16a9 100644 --- a/thrust/detail/device_ptr.inl +++ b/thrust/detail/device_ptr.inl @@ -21,11 +21,11 @@ #include #include +#include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template __host__ __device__ @@ -63,5 +63,5 @@ template } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/distance.inl b/thrust/detail/distance.inl index f12ef204c..0d01da2da 100644 --- a/thrust/detail/distance.inl +++ b/thrust/detail/distance.inl @@ -20,12 +20,11 @@ */ #include +#include #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -36,6 +35,4 @@ inline __host__ __device__ return thrust::system::detail::generic::distance(first, last); } // end distance() - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/equal.inl b/thrust/detail/equal.inl index 08bfbab0b..1417f847e 100644 --- a/thrust/detail/equal.inl +++ b/thrust/detail/equal.inl @@ -19,15 +19,14 @@ * \brief Inline file for equal.h. */ +#include #include #include #include #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -81,6 +80,4 @@ bool equal(InputIterator1 first1, InputIterator1 last1, return thrust::equal(select_system(system1,system2), first1, last1, first2, binary_pred); } - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/event_error.h b/thrust/detail/event_error.h index cd4d8e7d9..b928e0650 100644 --- a/thrust/detail/event_error.h +++ b/thrust/detail/event_error.h @@ -29,8 +29,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN enum class event_errc { @@ -159,7 +158,7 @@ inline bool operator<(event_error const& lhs, event_error const& rhs) noexcept return lhs.code() < rhs.code(); } -} // end namespace thrust +THRUST_NAMESPACE_END #endif // C++14 diff --git a/thrust/detail/execute_with_allocator.h b/thrust/detail/execute_with_allocator.h index 93dee663c..430fe739c 100644 --- a/thrust/detail/execute_with_allocator.h +++ b/thrust/detail/execute_with_allocator.h @@ -25,8 +25,8 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -144,5 +144,6 @@ return_temporary_buffer( #endif -}} // namespace thrust::detail +} // namespace detail +THRUST_NAMESPACE_END diff --git a/thrust/detail/execute_with_allocator_fwd.h b/thrust/detail/execute_with_allocator_fwd.h index 22d78fdd6..1d5899a7d 100644 --- a/thrust/detail/execute_with_allocator_fwd.h +++ b/thrust/detail/execute_with_allocator_fwd.h @@ -24,8 +24,8 @@ #include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -101,4 +101,6 @@ struct execute_with_allocator #endif }; -}} // namespace thrust::detail +} // namespace detail + +THRUST_NAMESPACE_END diff --git a/thrust/detail/execute_with_dependencies.h b/thrust/detail/execute_with_dependencies.h index cb92b1ba2..ec54010b0 100644 --- a/thrust/detail/execute_with_dependencies.h +++ b/thrust/detail/execute_with_dependencies.h @@ -27,8 +27,8 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -261,7 +261,7 @@ extract_dependencies(System &&) } } // end detail -} // end thrust -#endif // THRUST_CPP_DIALECT >= 2011 +THRUST_NAMESPACE_END +#endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/detail/execution_policy.h b/thrust/detail/execution_policy.h index e410d8c28..dcc11a770 100644 --- a/thrust/detail/execution_policy.h +++ b/thrust/detail/execution_policy.h @@ -18,8 +18,8 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -73,5 +73,4 @@ template : thrust::detail::execution_policy_base {}; -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/extrema.inl b/thrust/detail/extrema.inl index 3f60743e6..91b6da739 100644 --- a/thrust/detail/extrema.inl +++ b/thrust/detail/extrema.inl @@ -22,9 +22,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -167,6 +165,4 @@ minmax_element(ForwardIterator first, ForwardIterator last, BinaryPredicate comp return thrust::minmax_element(select_system(system), first, last, comp); } // end minmax_element() - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/fill.inl b/thrust/detail/fill.inl index 6e957ca1f..1df713e29 100644 --- a/thrust/detail/fill.inl +++ b/thrust/detail/fill.inl @@ -19,15 +19,15 @@ * \brief Inline file for fill.h. */ +#include + #include #include #include #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -86,6 +86,4 @@ __host__ __device__ return thrust::fill_n(select_system(system), first, n, value); } // end fill() - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/find.inl b/thrust/detail/find.inl index f42ff4650..f024960dc 100644 --- a/thrust/detail/find.inl +++ b/thrust/detail/find.inl @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -74,11 +72,11 @@ InputIterator find(InputIterator first, const T& value) { using thrust::system::detail::generic::select_system; - + typedef typename thrust::iterator_system::type System; - + System system; - + return thrust::find(select_system(system), first, last, value); } @@ -88,11 +86,11 @@ InputIterator find_if(InputIterator first, Predicate pred) { using thrust::system::detail::generic::select_system; - + typedef typename thrust::iterator_system::type System; - + System system; - + return thrust::find_if(select_system(system), first, last, pred); } @@ -102,14 +100,12 @@ InputIterator find_if_not(InputIterator first, Predicate pred) { using thrust::system::detail::generic::select_system; - + typedef typename thrust::iterator_system::type System; - + System system; - + return thrust::find_if_not(select_system(system), first, last, pred); } - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/for_each.inl b/thrust/detail/for_each.inl index 3365ce2e0..d4a36e27f 100644 --- a/thrust/detail/for_each.inl +++ b/thrust/detail/for_each.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -157,4 +157,5 @@ struct wrapped_function }; // end wrapped_function } // namespace detail -} // namespace thrust + +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional.inl b/thrust/detail/functional.inl index ea1322797..7d13738d9 100644 --- a/thrust/detail/functional.inl +++ b/thrust/detail/functional.inl @@ -14,10 +14,11 @@ * limitations under the License. */ +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -120,5 +121,4 @@ template return binary_negate(pred); } // end not2() -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/actor.h b/thrust/detail/functional/actor.h index 751120662..cee0770a4 100644 --- a/thrust/detail/functional/actor.h +++ b/thrust/detail/functional/actor.h @@ -33,8 +33,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -150,7 +149,7 @@ template }; // end result_of } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/functional/actor.inl b/thrust/detail/functional/actor.inl index f4588b800..d8a5c9f5a 100644 --- a/thrust/detail/functional/actor.inl +++ b/thrust/detail/functional/actor.inl @@ -31,8 +31,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -110,4 +109,4 @@ template } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/argument.h b/thrust/detail/functional/argument.h index 6940ddad1..aac29f537 100644 --- a/thrust/detail/functional/argument.h +++ b/thrust/detail/functional/argument.h @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -71,5 +70,5 @@ template } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/composite.h b/thrust/detail/functional/composite.h index 6cf095bf1..41ee74739 100644 --- a/thrust/detail/functional/composite.h +++ b/thrust/detail/functional/composite.h @@ -25,11 +25,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -159,5 +160,5 @@ __host__ __device__ } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/operators/arithmetic_operators.h b/thrust/detail/functional/operators/arithmetic_operators.h index bd5b707e3..d8c962a3a 100644 --- a/thrust/detail/functional/operators/arithmetic_operators.h +++ b/thrust/detail/functional/operators/arithmetic_operators.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -428,5 +427,5 @@ operator--(const actor &_1, int) } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/operators/assignment_operator.h b/thrust/detail/functional/operators/assignment_operator.h index a2f18339b..950e335f4 100644 --- a/thrust/detail/functional/operators/assignment_operator.h +++ b/thrust/detail/functional/operators/assignment_operator.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // XXX WAR circular inclusion with this forward declaration template struct binary_function; @@ -76,5 +75,5 @@ template } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/operators/bitwise_operators.h b/thrust/detail/functional/operators/bitwise_operators.h index a6461f9d4..38f4bf72a 100644 --- a/thrust/detail/functional/operators/bitwise_operators.h +++ b/thrust/detail/functional/operators/bitwise_operators.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -334,5 +333,5 @@ operator>>(const actor &_1, const actor &_2) } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/operators/compound_assignment_operators.h b/thrust/detail/functional/operators/compound_assignment_operators.h index 737d6abd0..2324869bf 100644 --- a/thrust/detail/functional/operators/compound_assignment_operators.h +++ b/thrust/detail/functional/operators/compound_assignment_operators.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -509,5 +508,5 @@ operator>>=(const actor &_1, const actor &_2) } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/operators/logical_operators.h b/thrust/detail/functional/operators/logical_operators.h index 85a2e5e04..e1e4ff719 100644 --- a/thrust/detail/functional/operators/logical_operators.h +++ b/thrust/detail/functional/operators/logical_operators.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -140,5 +139,5 @@ operator!(const actor &_1) } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/operators/operator_adaptors.h b/thrust/detail/functional/operators/operator_adaptors.h index 67a1f6e37..67326c5c1 100644 --- a/thrust/detail/functional/operators/operator_adaptors.h +++ b/thrust/detail/functional/operators/operator_adaptors.h @@ -25,8 +25,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -133,5 +132,5 @@ struct transparent_binary_operator } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/operators/relational_operators.h b/thrust/detail/functional/operators/relational_operators.h index 51fd4640a..6c58325e2 100644 --- a/thrust/detail/functional/operators/relational_operators.h +++ b/thrust/detail/functional/operators/relational_operators.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -319,5 +318,5 @@ operator<=(const actor &_1, const actor &_2) } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/placeholder.h b/thrust/detail/functional/placeholder.h index d0832cfec..e3c083553 100644 --- a/thrust/detail/functional/placeholder.h +++ b/thrust/detail/functional/placeholder.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -35,5 +34,5 @@ template } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/functional/value.h b/thrust/detail/functional/value.h index 27a584676..d6b1563b1 100644 --- a/thrust/detail/functional/value.h +++ b/thrust/detail/functional/value.h @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace functional @@ -76,5 +75,5 @@ actor > val(const T &x) } // end functional } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/gather.inl b/thrust/detail/gather.inl index 4550742c5..f2a0d8794 100644 --- a/thrust/detail/gather.inl +++ b/thrust/detail/gather.inl @@ -19,15 +19,15 @@ * \brief Inline file for gather.h. */ +#include + #include #include #include #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template + #include #include #include #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template #include // for get_value() -namespace thrust { +THRUST_NAMESPACE_BEGIN + namespace detail { // get_iterator_value specialization on iterators @@ -50,4 +51,5 @@ get_iterator_value(thrust::execution_policy &exec, Pointer* ptr) } // get_iterator_value(exec,Pointer*) } // namespace detail -} // namespace thrust + +THRUST_NAMESPACE_END diff --git a/thrust/detail/inner_product.inl b/thrust/detail/inner_product.inl index 37247e68e..c431ed431 100644 --- a/thrust/detail/inner_product.inl +++ b/thrust/detail/inner_product.inl @@ -26,9 +26,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -151,5 +151,5 @@ Integer0 round_z(Integer0 const x, Integer1 const y) #endif } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/integer_traits.h b/thrust/detail/integer_traits.h index 97ab4f94d..853af20b8 100644 --- a/thrust/detail/integer_traits.h +++ b/thrust/detail/integer_traits.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -30,16 +29,16 @@ template class integer_traits { public: - static const bool is_integral = false; + static constexpr bool is_integral = false; }; template class integer_traits_base { public: - static const bool is_integral = true; - static const T const_min = min_val; - static const T const_max = max_val; + static constexpr bool is_integral = true; + static constexpr T const_min = min_val; + static constexpr T const_max = max_val; }; @@ -128,5 +127,4 @@ template<> } // end detail -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/internal_functional.h b/thrust/detail/internal_functional.h index dba2f8f79..74ff23741 100644 --- a/thrust/detail/internal_functional.h +++ b/thrust/detail/internal_functional.h @@ -23,14 +23,15 @@ #include #include +#include #include #include #include #include #include // for ::new -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -553,5 +554,5 @@ template } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/logical.inl b/thrust/detail/logical.inl index 2f428bc5f..e6d9e4f36 100644 --- a/thrust/detail/logical.inl +++ b/thrust/detail/logical.inl @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -97,6 +95,4 @@ bool none_of(InputIterator first, InputIterator last, Predicate pred) return thrust::none_of(select_system(system), first, last, pred); } - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/malloc_and_free.h b/thrust/detail/malloc_and_free.h index 6dc238adb..143518893 100644 --- a/thrust/detail/malloc_and_free.h +++ b/thrust/detail/malloc_and_free.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -81,5 +80,4 @@ void free(const thrust::detail::execution_policy_base &exec, Poin // XXX consider another form of free which does not take a system argument and // instead infers the system from the pointer -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/memory_algorithms.h b/thrust/detail/memory_algorithms.h index ffa25aff8..bc50f307c 100644 --- a/thrust/detail/memory_algorithms.h +++ b/thrust/detail/memory_algorithms.h @@ -18,8 +18,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /////////////////////////////////////////////////////////////////////////////// @@ -206,5 +205,4 @@ void uninitialized_construct_n_with_allocator( /////////////////////////////////////////////////////////////////////////////// -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/merge.inl b/thrust/detail/merge.inl index d42475709..eb922994b 100644 --- a/thrust/detail/merge.inl +++ b/thrust/detail/merge.inl @@ -18,15 +18,15 @@ * \brief Inline file for merge.h. */ +#include + #include #include #include #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN template __host__ __device__ @@ -50,6 +48,4 @@ __host__ __device__ return lhs < rhs ? rhs : lhs; } // end max() - -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/mismatch.inl b/thrust/detail/mismatch.inl index 6c39aab86..e211fa37a 100644 --- a/thrust/detail/mismatch.inl +++ b/thrust/detail/mismatch.inl @@ -27,9 +27,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -92,6 +90,4 @@ thrust::pair mismatch(InputIterator1 first1, return thrust::mismatch(select_system(system1,system2), first1, last1, first2, pred); } // end mismatch() - -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/mpl/math.h b/thrust/detail/mpl/math.h index 5356c9c15..bda98003c 100644 --- a/thrust/detail/mpl/math.h +++ b/thrust/detail/mpl/math.h @@ -22,8 +22,9 @@ #pragma once -namespace thrust -{ +#include + +THRUST_NAMESPACE_BEGIN namespace detail { @@ -170,5 +171,5 @@ template } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/numeric_traits.h b/thrust/detail/numeric_traits.h index 168b9ad0f..e728adcaf 100644 --- a/thrust/detail/numeric_traits.h +++ b/thrust/detail/numeric_traits.h @@ -16,13 +16,13 @@ #pragma once +#include #include #include //#include // for intmax_t (not provided on MSVS 2005) -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -126,5 +126,4 @@ numeric_distance(Number x, Number y) } // end detail -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/overlapped_copy.h b/thrust/detail/overlapped_copy.h index f6bb85a91..418497de8 100644 --- a/thrust/detail/overlapped_copy.h +++ b/thrust/detail/overlapped_copy.h @@ -23,8 +23,8 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + namespace detail { @@ -127,5 +127,5 @@ template #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template __host__ __device__ @@ -225,6 +225,4 @@ template return detail::pair_get >()(p); } // end get() - -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/partition.inl b/thrust/detail/partition.inl index a667264c6..db39c0513 100644 --- a/thrust/detail/partition.inl +++ b/thrust/detail/partition.inl @@ -26,9 +26,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template return thrust::is_partitioned(select_system(system), first, last, pred); } // end is_partitioned() - -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/pointer.h b/thrust/detail/pointer.h index 72cf184c6..da8686f5e 100644 --- a/thrust/detail/pointer.h +++ b/thrust/detail/pointer.h @@ -25,9 +25,7 @@ #include #include - -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template class pointer; @@ -46,15 +44,15 @@ struct iterator_traits> using reference = typename pointer::reference; }; -} // namespace thrust +THRUST_NAMESPACE_END namespace std { template -struct iterator_traits> +struct iterator_traits> { - using pointer = thrust::pointer; + using pointer = THRUST_NS_QUALIFIER::pointer; using iterator_category = typename pointer::iterator_category; using value_type = typename pointer::value_type; using difference_type = typename pointer::difference_type; @@ -63,7 +61,9 @@ struct iterator_traits> } // namespace std -namespace thrust { namespace detail +THRUST_NAMESPACE_BEGIN + +namespace detail { // this metafunction computes the type of iterator_adaptor thrust::pointer should inherit from @@ -243,7 +243,7 @@ template __host__ __device__ bool operator!=(pointer p, decltype(nullptr)); -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/pointer.inl b/thrust/detail/pointer.inl index bd5e340db..8af289198 100644 --- a/thrust/detail/pointer.inl +++ b/thrust/detail/pointer.inl @@ -18,10 +18,7 @@ #include #include - -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN template __host__ __device__ @@ -206,5 +203,4 @@ bool operator!=(pointer p, decltype(nullptr)) return !(nullptr == p); } -} // namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/range/head_flags.h b/thrust/detail/range/head_flags.h index b193651cf..b755840c9 100644 --- a/thrust/detail/range/head_flags.h +++ b/thrust/detail/range/head_flags.h @@ -24,8 +24,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -226,5 +225,5 @@ head_flags } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/range/tail_flags.h b/thrust/detail/range/tail_flags.h index 32ccb53c6..41ee5dd29 100644 --- a/thrust/detail/range/tail_flags.h +++ b/thrust/detail/range/tail_flags.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -130,5 +129,5 @@ tail_flags } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/raw_pointer_cast.h b/thrust/detail/raw_pointer_cast.h index 33f87849d..53a77861e 100644 --- a/thrust/detail/raw_pointer_cast.h +++ b/thrust/detail/raw_pointer_cast.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template __host__ __device__ @@ -48,5 +47,4 @@ static_pointer_cast(FromPointer ptr) return ToPointer(static_cast(thrust::raw_pointer_cast(ptr))); } -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/detail/raw_reference_cast.h b/thrust/detail/raw_reference_cast.h index aea317c52..8a77edfea 100644 --- a/thrust/detail/raw_reference_cast.h +++ b/thrust/detail/raw_reference_cast.h @@ -29,8 +29,7 @@ // raw_reference_cast depends on metafunctions such as is_unwrappable and raw_reference // we need to be sure that these metafunctions are completely defined (including specializations) before they are instantiated by raw_reference_cast -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -329,5 +328,5 @@ raw_reference_cast(thrust::detail::tuple_of_iterator_references t) } // end raw_reference_cast -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/reduce.inl b/thrust/detail/reduce.inl index 2ecedc7a2..3b9171d76 100644 --- a/thrust/detail/reduce.inl +++ b/thrust/detail/reduce.inl @@ -19,6 +19,8 @@ * \brief Inline file for reduce.h. */ +#include + #include #include #include @@ -27,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -274,5 +275,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -507,5 +506,5 @@ void swap(tagged_reference& x, tagged_reference& y) x.swap(y); } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/reference_forward_declaration.h b/thrust/detail/reference_forward_declaration.h index aa0168e53..6f2b99949 100644 --- a/thrust/detail/reference_forward_declaration.h +++ b/thrust/detail/reference_forward_declaration.h @@ -19,11 +19,10 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template class reference; -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/remove.inl b/thrust/detail/remove.inl index f5951fa91..f77b35e89 100644 --- a/thrust/detail/remove.inl +++ b/thrust/detail/remove.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -246,5 +245,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -218,5 +217,5 @@ template } // end replace() -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/reverse.inl b/thrust/detail/reverse.inl index e8a018cd6..6d6704254 100644 --- a/thrust/detail/reverse.inl +++ b/thrust/detail/reverse.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -87,5 +86,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -522,5 +521,5 @@ template + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -161,6 +162,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -79,7 +78,7 @@ THRUST_INLINE_CONSTANT select_system_detail::select_system_fn select_system{}; } // detail -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/detail/seq.h b/thrust/detail/seq.h index 8268ad05a..ba18c2dbf 100644 --- a/thrust/detail/seq.h +++ b/thrust/detail/seq.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -48,6 +47,6 @@ struct seq_t : thrust::system::detail::sequential::execution_policy, THRUST_INLINE_CONSTANT detail::seq_t seq; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/sequence.inl b/thrust/detail/sequence.inl index fff7cbb63..681fe6414 100644 --- a/thrust/detail/sequence.inl +++ b/thrust/detail/sequence.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -114,5 +113,5 @@ template } // end sequence() -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/set_operations.inl b/thrust/detail/set_operations.inl index 42cf5ed35..e44c16f86 100644 --- a/thrust/detail/set_operations.inl +++ b/thrust/detail/set_operations.inl @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -864,5 +863,5 @@ template #include -namespace thrust { +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -80,6 +80,6 @@ __host__ __device__ void shuffle_copy(RandomIterator first, RandomIterator last, result, g); } -} // namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/detail/sort.inl b/thrust/detail/sort.inl index d4a7901e6..8b25f390d 100644 --- a/thrust/detail/sort.inl +++ b/thrust/detail/sort.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -404,5 +403,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -66,16 +65,16 @@ template struct static_assert_test {}; // Clang and GCC 4.8+ will complain about this typedef being unused unless we // annotate it as such. # define THRUST_STATIC_ASSERT(B) \ - typedef ::thrust::detail::static_assert_test< \ - sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE<(bool)(B)>) \ + typedef THRUST_NS_QUALIFIER::detail::static_assert_test< \ + sizeof(THRUST_NS_QUALIFIER::detail::STATIC_ASSERTION_FAILURE<(bool)(B)>)\ > \ THRUST_PP_CAT2(thrust_static_assert_typedef_, __LINE__) \ __attribute__((unused)) \ /**/ #else # define THRUST_STATIC_ASSERT(B) \ - typedef ::thrust::detail::static_assert_test< \ - sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE<(bool)(B)>) \ + typedef THRUST_NS_QUALIFIER::detail::static_assert_test< \ + sizeof(THRUST_NS_QUALIFIER::detail::STATIC_ASSERTION_FAILURE<(bool)(B)>)\ > \ THRUST_PP_CAT2(thrust_static_assert_typedef_, __LINE__) \ /**/ @@ -87,6 +86,6 @@ template struct static_assert_test {}; } // namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/static_map.h b/thrust/detail/static_map.h index 872a73aef..9f0d79e83 100644 --- a/thrust/detail/static_map.h +++ b/thrust/detail/static_map.h @@ -20,8 +20,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace static_map_detail @@ -166,5 +165,5 @@ unsigned int lookup(unsigned int key) } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/swap.h b/thrust/detail/swap.h index 96783c762..305750f8a 100644 --- a/thrust/detail/swap.h +++ b/thrust/detail/swap.h @@ -19,8 +19,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ template @@ -32,5 +31,5 @@ inline void swap(Assignable1 &a, Assignable2 &b) b = temp; } // end swap() -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/swap_ranges.inl b/thrust/detail/swap_ranges.inl index 8ed97cc74..815921920 100644 --- a/thrust/detail/swap_ranges.inl +++ b/thrust/detail/swap_ranges.inl @@ -19,14 +19,15 @@ * \brief Inline file for swap_ranges.h. */ +#include + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -62,5 +63,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -53,5 +52,5 @@ template } // end tabulate() -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/temporary_array.h b/thrust/detail/temporary_array.h index 8f4120083..cf4bc7d2d 100644 --- a/thrust/detail/temporary_array.h +++ b/thrust/detail/temporary_array.h @@ -20,8 +20,9 @@ #pragma once -namespace thrust -{ +#include + +THRUST_NAMESPACE_BEGIN namespace detail { @@ -31,7 +32,7 @@ template class temporary_array; } // end detail -} // end thrust +THRUST_NAMESPACE_END #include #include @@ -41,8 +42,7 @@ template #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -175,7 +175,7 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/temporary_array.inl b/thrust/detail/temporary_array.inl index e730966c0..3bd76bc0b 100644 --- a/thrust/detail/temporary_array.inl +++ b/thrust/detail/temporary_array.inl @@ -14,14 +14,15 @@ * limitations under the License. */ +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -162,5 +163,5 @@ __host__ __device__ } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/temporary_buffer.h b/thrust/detail/temporary_buffer.h index 4dca3be3b..be95e7180 100644 --- a/thrust/detail/temporary_buffer.h +++ b/thrust/detail/temporary_buffer.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -72,5 +71,5 @@ __host__ __device__ } // end return_temporary_buffer() -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/transform.inl b/thrust/detail/transform.inl index c27e4de27..bb8db695f 100644 --- a/thrust/detail/transform.inl +++ b/thrust/detail/transform.inl @@ -19,14 +19,15 @@ * \brief Inline file for transform.h. */ +#include + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -245,5 +246,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -68,5 +67,5 @@ template + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -115,5 +116,5 @@ template + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -91,5 +92,5 @@ struct trivial_sequence } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/tuple.inl b/thrust/detail/tuple.inl index 447ee3b37..73367ed44 100644 --- a/thrust/detail/tuple.inl +++ b/thrust/detail/tuple.inl @@ -14,11 +14,12 @@ * limitations under the License. */ +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // define null_type struct null_type {}; @@ -997,5 +998,5 @@ inline bool operator>=(const detail::cons& lhs, const detail::cons=() -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/tuple_algorithms.h b/thrust/detail/tuple_algorithms.h index 530de4b3f..2e49f4281 100644 --- a/thrust/detail/tuple_algorithms.h +++ b/thrust/detail/tuple_algorithms.h @@ -26,8 +26,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template auto tuple_subset(Tuple&& t, index_sequence) @@ -105,7 +104,7 @@ THRUST_DECLTYPE_RETURNS( ) ); -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/detail/tuple_meta_transform.h b/thrust/detail/tuple_meta_transform.h index ebf0b9bf0..285cae8b4 100644 --- a/thrust/detail/tuple_meta_transform.h +++ b/thrust/detail/tuple_meta_transform.h @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -53,5 +54,5 @@ template + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -79,5 +80,5 @@ tuple_host_device_transform(const Tuple &t, UnaryFunction f) } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/type_traits.h b/thrust/detail/type_traits.h index fc26bc4f2..58a175ad5 100644 --- a/thrust/detail/type_traits.h +++ b/thrust/detail/type_traits.h @@ -28,8 +28,7 @@ # include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declaration of device_reference template class device_reference; @@ -730,7 +729,7 @@ using detail::integral_constant; using detail::true_type; using detail::false_type; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/type_traits/function_traits.h b/thrust/detail/type_traits/function_traits.h index 0c7775c0d..109820136 100644 --- a/thrust/detail/type_traits/function_traits.h +++ b/thrust/detail/type_traits/function_traits.h @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward definitions for is_commutative template struct plus; @@ -92,5 +93,5 @@ template struct is_commutative< typename thrust::bit_and > : template struct is_commutative< typename thrust::bit_xor > : public thrust::detail::is_arithmetic {}; } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/type_traits/has_member_function.h b/thrust/detail/type_traits/has_member_function.h index 03ed61b6d..c33fe28f6 100644 --- a/thrust/detail/type_traits/has_member_function.h +++ b/thrust/detail/type_traits/has_member_function.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2013 NVIDIA Corporation + * Copyright 2008-2021 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,101 +18,21 @@ #include -#define __THRUST_DEFINE_HAS_MEMBER_FUNCTION(trait_name, member_function_name) \ -template class trait_name; \ - \ -template \ -class trait_name \ -{ \ - class yes { char m; }; \ - class no { yes m[2]; }; \ - struct base_mixin \ - { \ - Result member_function_name(); \ - }; \ - struct base : public T, public base_mixin {}; \ - template class helper{}; \ - template \ - static no deduce(U*, helper* = 0); \ - static yes deduce(...); \ -public: \ - static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ - typedef thrust::detail::integral_constant type; \ -}; \ - \ -template \ -class trait_name \ -{ \ - class yes { char m; }; \ - class no { yes m[2]; }; \ - struct base_mixin \ - { \ - Result member_function_name(Arg); \ - }; \ - struct base : public T, public base_mixin {}; \ - template class helper{}; \ - template \ - static no deduce(U*, helper* = 0); \ - static yes deduce(...); \ -public: \ - static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ - typedef thrust::detail::integral_constant type; \ -}; \ - \ -template \ -class trait_name \ -{ \ - class yes { char m; }; \ - class no { yes m[2]; }; \ - struct base_mixin \ - { \ - Result member_function_name(Arg1,Arg2); \ - }; \ - struct base : public T, public base_mixin {}; \ - template class helper{}; \ - template \ - static no deduce(U*, helper* = 0); \ - static yes deduce(...); \ -public: \ - static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ - typedef thrust::detail::integral_constant type; \ -}; \ - \ -template \ -class trait_name \ -{ \ - class yes { char m; }; \ - class no { yes m[2]; }; \ - struct base_mixin \ - { \ - Result member_function_name(Arg1,Arg2,Arg3); \ - }; \ - struct base : public T, public base_mixin {}; \ - template class helper{}; \ - template \ - static no deduce(U*, helper* = 0); \ - static yes deduce(...); \ -public: \ - static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ - typedef thrust::detail::integral_constant type; \ -}; \ - \ -template \ -class trait_name \ -{ \ - class yes { char m; }; \ - class no { yes m[2]; }; \ - struct base_mixin \ - { \ - Result member_function_name(Arg1,Arg2,Arg3,Arg4); \ - }; \ - struct base : public T, public base_mixin {}; \ - template class helper{}; \ - template \ - static no deduce(U*, helper* = 0); \ - static yes deduce(...); \ -public: \ - static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ - typedef thrust::detail::integral_constant type; \ -}; +#include // for std::declval +#define __THRUST_DEFINE_HAS_MEMBER_FUNCTION(trait_name, member_function_name) \ + template \ + struct trait_name : thrust::false_type \ + {}; \ + \ + template \ + struct trait_name::value || \ + thrust::detail::is_convertible< \ + ResultT, \ + decltype(std::declval().member_function_name( \ + std::declval()...))>::value>::type> \ + : thrust::true_type \ + {}; diff --git a/thrust/detail/type_traits/has_trivial_assign.h b/thrust/detail/type_traits/has_trivial_assign.h index 01f26c7ef..8aa551651 100644 --- a/thrust/detail/type_traits/has_trivial_assign.h +++ b/thrust/detail/type_traits/has_trivial_assign.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -50,5 +49,5 @@ template struct has_trivial_assign } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/type_traits/is_call_possible.h b/thrust/detail/type_traits/is_call_possible.h index bff049377..58c1aca4d 100644 --- a/thrust/detail/type_traits/is_call_possible.h +++ b/thrust/detail/type_traits/is_call_possible.h @@ -16,14 +16,15 @@ #pragma once +#include + #include #include // inspired by Roman Perepelitsa's presentation from comp.lang.c++.moderated // based on the implementation here: http://www.rsdn.ru/forum/cpp/2759773.1.aspx -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace is_call_possible_detail @@ -51,7 +52,7 @@ struct clone_constness } // end is_call_possible_detail } // end detail -} // end thrust +THRUST_NAMESPACE_END #define __THRUST_DEFINE_IS_CALL_POSSIBLE(trait_name, member_function_name) \ __THRUST_DEFINE_HAS_MEMBER_FUNCTION(trait_name##_has_member, member_function_name) \ diff --git a/thrust/detail/type_traits/is_metafunction_defined.h b/thrust/detail/type_traits/is_metafunction_defined.h index c278e5bdb..2c7a4be52 100644 --- a/thrust/detail/type_traits/is_metafunction_defined.h +++ b/thrust/detail/type_traits/is_metafunction_defined.h @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -37,5 +38,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/type_traits/iterator/is_discard_iterator.h b/thrust/detail/type_traits/iterator/is_discard_iterator.h index 0a5900de2..210409d62 100644 --- a/thrust/detail/type_traits/iterator/is_discard_iterator.h +++ b/thrust/detail/type_traits/iterator/is_discard_iterator.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -36,5 +35,5 @@ struct is_discard_iterator< thrust::discard_iterator > {}; } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/type_traits/iterator/is_output_iterator.h b/thrust/detail/type_traits/iterator/is_output_iterator.h index d6801305b..555b67400 100644 --- a/thrust/detail/type_traits/iterator/is_output_iterator.h +++ b/thrust/detail/type_traits/iterator/is_output_iterator.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -62,5 +61,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/type_traits/minimum_type.h b/thrust/detail/type_traits/minimum_type.h index 7e34f4f8a..2417e327d 100644 --- a/thrust/detail/type_traits/minimum_type.h +++ b/thrust/detail/type_traits/minimum_type.h @@ -16,10 +16,11 @@ #pragma once +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -56,8 +57,8 @@ struct primitive_minimum_type : minimum_type_detail::minimum_type_impl< T1, T2, - ::thrust::detail::is_convertible::value, - ::thrust::detail::is_convertible::value + THRUST_NS_QUALIFIER::detail::is_convertible::value, + THRUST_NS_QUALIFIER::detail::is_convertible::value > { }; // end primitive_minimum_type @@ -158,5 +159,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -392,5 +391,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/type_traits/result_of_adaptable_function.h b/thrust/detail/type_traits/result_of_adaptable_function.h index a849cd029..908c8abea 100644 --- a/thrust/detail/type_traits/result_of_adaptable_function.h +++ b/thrust/detail/type_traits/result_of_adaptable_function.h @@ -22,8 +22,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -62,4 +61,4 @@ struct result_of_adaptable_function< }; } // namespace detail -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/uninitialized_copy.inl b/thrust/detail/uninitialized_copy.inl index 660df76d5..71c22b45f 100644 --- a/thrust/detail/uninitialized_copy.inl +++ b/thrust/detail/uninitialized_copy.inl @@ -19,14 +19,15 @@ * \brief Inline file for uninitialized_copy.h. */ +#include + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -92,6 +93,6 @@ template + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -88,5 +89,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN __thrust_exec_check_disable__ @@ -332,5 +331,5 @@ template -namespace thrust -{ +THRUST_NAMESPACE_BEGIN struct use_default {}; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/util/align.h b/thrust/detail/util/align.h index af97cd44a..a3aa75bfe 100644 --- a/thrust/detail/util/align.h +++ b/thrust/detail/util/align.h @@ -17,12 +17,13 @@ #pragma once +#include + #include // functions to handle memory alignment -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { namespace util @@ -55,5 +56,5 @@ bool is_aligned(T * ptr, detail::uintptr_t bytes = sizeof(T)) } // end namespace util } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/detail/vector_base.h b/thrust/detail/vector_base.h index 6b49d3817..b05f35194 100644 --- a/thrust/detail/vector_base.h +++ b/thrust/detail/vector_base.h @@ -30,8 +30,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -582,7 +581,7 @@ template& lhs, const detail::vector_base& rhs); -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/detail/vector_base.inl b/thrust/detail/vector_base.inl index e5a9b5046..915f37699 100644 --- a/thrust/detail/vector_base.inl +++ b/thrust/detail/vector_base.inl @@ -33,8 +33,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -1317,5 +1316,5 @@ bool operator!=(const std::vector& lhs, return !(lhs == rhs); } -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/device_allocator.h b/thrust/device_allocator.h index 8844eb2d3..d61627068 100644 --- a/thrust/device_allocator.h +++ b/thrust/device_allocator.h @@ -30,8 +30,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /** \addtogroup memory_resources Memory Resources * \ingroup memory_management_classes @@ -140,5 +139,4 @@ class device_allocator /*! \} */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/device_delete.h b/thrust/device_delete.h index ce822f09d..01d4ad428 100644 --- a/thrust/device_delete.h +++ b/thrust/device_delete.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup deallocation_functions Deallocation Functions * \ingroup memory_management_functions @@ -50,7 +49,7 @@ template /*! \} */ -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/device_free.h b/thrust/device_free.h index 38d4424c7..7432772d8 100644 --- a/thrust/device_free.h +++ b/thrust/device_free.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup deallocation_functions Deallocation Functions * \ingroup memory_management_functions @@ -62,7 +61,7 @@ inline void device_free(thrust::device_ptr ptr); /*! \} */ -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/device_make_unique.h b/thrust/device_make_unique.h index 939006f27..ca1707603 100644 --- a/thrust/device_make_unique.h +++ b/thrust/device_make_unique.h @@ -32,8 +32,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /////////////////////////////////////////////////////////////////////////////// @@ -54,6 +53,6 @@ auto device_make_unique(Args&&... args) /////////////////////////////////////////////////////////////////////////////// -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/device_malloc.h b/thrust/device_malloc.h index 75194491e..9b33ac1cc 100644 --- a/thrust/device_malloc.h +++ b/thrust/device_malloc.h @@ -25,8 +25,7 @@ #include #include // for std::size_t -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup allocation_functions Allocation Functions * \ingroup memory_management_functions @@ -97,7 +96,7 @@ template /*! \} */ -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/device_malloc_allocator.h b/thrust/device_malloc_allocator.h index 2af28047e..b3101c692 100644 --- a/thrust/device_malloc_allocator.h +++ b/thrust/device_malloc_allocator.h @@ -29,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declarations to WAR circular #includes template class device_ptr; @@ -180,6 +179,4 @@ template /*! \} */ -} // end thrust - - +THRUST_NAMESPACE_END diff --git a/thrust/device_new.h b/thrust/device_new.h index 1ae4ce5a4..aa03a603b 100644 --- a/thrust/device_new.h +++ b/thrust/device_new.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! * \addtogroup allocation_functions Allocation Functions @@ -82,7 +81,6 @@ template /*! \} */ -} // end thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/device_new_allocator.h b/thrust/device_new_allocator.h index 28eeabd1d..972cab32a 100644 --- a/thrust/device_new_allocator.h +++ b/thrust/device_new_allocator.h @@ -29,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup memory_management_classes Memory Management Classes * \ingroup memory_management @@ -168,5 +167,4 @@ template /*! \} */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/device_ptr.h b/thrust/device_ptr.h index f9149da14..917919725 100644 --- a/thrust/device_ptr.h +++ b/thrust/device_ptr.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup memory_management Memory Management * \addtogroup memory_management_classes Memory Management Classes @@ -185,8 +184,7 @@ inline device_ptr device_pointer_cast(const device_ptr &ptr); /*! \} */ -} // end thrust +THRUST_NAMESPACE_END #include #include - diff --git a/thrust/device_reference.h b/thrust/device_reference.h index 6cd98292c..5eff9f218 100644 --- a/thrust/device_reference.h +++ b/thrust/device_reference.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup memory_management_classes Memory Management Classes * \ingroup memory_management @@ -986,5 +985,4 @@ operator<<(std::basic_ostream &os, const device_reference &y); /*! \} */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/device_vector.h b/thrust/device_vector.h index b46fa2f2d..b8e6bb65b 100644 --- a/thrust/device_vector.h +++ b/thrust/device_vector.h @@ -29,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup container_classes Container Classes * \addtogroup device_containers Device Containers @@ -489,6 +488,4 @@ template /*! \} */ -} // namespace thrust - - +THRUST_NAMESPACE_END diff --git a/thrust/distance.h b/thrust/distance.h index ba0c53b3c..890879115 100644 --- a/thrust/distance.h +++ b/thrust/distance.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -71,7 +69,6 @@ inline __host__ __device__ /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/equal.h b/thrust/equal.h index 73baaf2e7..2f3518907 100644 --- a/thrust/equal.h +++ b/thrust/equal.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup reductions * \{ @@ -232,7 +230,6 @@ bool equal(InputIterator1 first1, InputIterator1 last1, * \} // end reductions */ -} // end namespace thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/execution_policy.h b/thrust/execution_policy.h index 60a4caba0..1e5dfa8f7 100644 --- a/thrust/execution_policy.h +++ b/thrust/execution_policy.h @@ -39,9 +39,7 @@ //! \endcond -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \cond */ @@ -392,5 +390,4 @@ static const detail::seq_t seq; */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/extrema.h b/thrust/extrema.h index 080cb8472..ca419a0aa 100644 --- a/thrust/extrema.h +++ b/thrust/extrema.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! This version of \p min returns the smaller of two values, given a comparison operation. * \param lhs The first value to compare. @@ -797,8 +795,7 @@ thrust::pair minmax_element(ForwardIterator fir * \} // end reductions */ -} // end thrust +THRUST_NAMESPACE_END #include #include - diff --git a/thrust/fill.h b/thrust/fill.h index 1431b82f9..bd9e40268 100644 --- a/thrust/fill.h +++ b/thrust/fill.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup transformations * \addtogroup filling @@ -203,7 +201,6 @@ __host__ __device__ * \} // transformations */ -} // end namespace thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/find.h b/thrust/find.h index 0e4aaafe1..5ab9b0a2d 100644 --- a/thrust/find.h +++ b/thrust/find.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup algorithms */ @@ -378,8 +376,6 @@ InputIterator find_if_not(InputIterator first, /*! \} // end searching */ - -} // end namespace thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/for_each.h b/thrust/for_each.h index e750e2923..db569d444 100644 --- a/thrust/for_each.h +++ b/thrust/for_each.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup modifying * \ingroup transformations @@ -274,7 +272,7 @@ InputIterator for_each_n(InputIterator first, /*! \} // end modifying */ -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/functional.h b/thrust/functional.h index 741f63934..fed0c17e1 100644 --- a/thrust/functional.h +++ b/thrust/functional.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup function_objects Function Objects */ @@ -1712,8 +1711,7 @@ THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<9>::type _10; #undef THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION #undef THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP -} // end thrust +THRUST_NAMESPACE_END #include #include - diff --git a/thrust/future.h b/thrust/future.h index 25a231fbe..d8fb7544b 100644 --- a/thrust/future.h +++ b/thrust/future.h @@ -54,8 +54,7 @@ #include __THRUST_DEVICE_SYSTEM_FUTURE_HEADER #undef __THRUST_DEVICE_SYSTEM_FUTURE_HEADER -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /////////////////////////////////////////////////////////////////////////////// @@ -172,7 +171,6 @@ using thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::when_all; /////////////////////////////////////////////////////////////////////////////// -} // end namespace thrust +THRUST_NAMESPACE_END #endif - diff --git a/thrust/gather.h b/thrust/gather.h index 90cfad746..41acc22a3 100644 --- a/thrust/gather.h +++ b/thrust/gather.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup gathering * \ingroup copying @@ -441,7 +439,7 @@ template diff --git a/thrust/generate.h b/thrust/generate.h index 8bdb5791d..d47295344 100644 --- a/thrust/generate.h +++ b/thrust/generate.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup transformations * \{ @@ -207,7 +205,7 @@ template diff --git a/thrust/host_vector.h b/thrust/host_vector.h index 5f9c6d929..2a4d9f22f 100644 --- a/thrust/host_vector.h +++ b/thrust/host_vector.h @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup container_classes Container Classes * \addtogroup host_containers Host Containers @@ -508,5 +507,4 @@ template /*! \} */ -} // namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/inner_product.h b/thrust/inner_product.h index dd20c196c..80068cf0c 100644 --- a/thrust/inner_product.h +++ b/thrust/inner_product.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup reductions * \{ @@ -258,7 +256,7 @@ OutputType inner_product(InputIterator1 first1, InputIterator1 last1, * \} // end reductions */ -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/iterator/constant_iterator.h b/thrust/iterator/constant_iterator.h index 802d8b34b..c6eec28e7 100644 --- a/thrust/iterator/constant_iterator.h +++ b/thrust/iterator/constant_iterator.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -247,5 +246,5 @@ constant_iterator make_constant_iterator(V x) /*! \} // end iterators */ -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/counting_iterator.h b/thrust/iterator/counting_iterator.h index 25d495db0..a7ef2ec7c 100644 --- a/thrust/iterator/counting_iterator.h +++ b/thrust/iterator/counting_iterator.h @@ -39,8 +39,7 @@ // #include the details first #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -243,5 +242,5 @@ counting_iterator make_counting_iterator(Incrementable x) /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/any_assign.h b/thrust/iterator/detail/any_assign.h index 4e7f2cf20..87192215c 100644 --- a/thrust/iterator/detail/any_assign.h +++ b/thrust/iterator/detail/any_assign.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -51,5 +50,5 @@ struct any_assign } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/any_system_tag.h b/thrust/iterator/detail/any_system_tag.h index 27640b5e0..2c5ce6448 100644 --- a/thrust/iterator/detail/any_system_tag.h +++ b/thrust/iterator/detail/any_system_tag.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN struct any_system_tag : thrust::execution_policy @@ -30,5 +29,5 @@ struct any_system_tag template operator T () const {return T();} }; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/constant_iterator_base.h b/thrust/iterator/detail/constant_iterator_base.h index 56b1cc4f4..56bb7a5d0 100644 --- a/thrust/iterator/detail/constant_iterator_base.h +++ b/thrust/iterator/detail/constant_iterator_base.h @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declaration of constant_iterator template class constant_iterator; @@ -66,5 +67,5 @@ template + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declaration of counting_iterator template @@ -137,5 +138,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/device_system_tag.h b/thrust/iterator/detail/device_system_tag.h index df20389e9..b86109d21 100644 --- a/thrust/iterator/detail/device_system_tag.h +++ b/thrust/iterator/detail/device_system_tag.h @@ -23,9 +23,8 @@ #include __THRUST_DEVICE_SYSTEM_TAG_HEADER #undef __THRUST_DEVICE_SYSTEM_TAG_HEADER -namespace thrust -{ +THRUST_NAMESPACE_BEGIN typedef thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::tag device_system_tag; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/discard_iterator_base.h b/thrust/iterator/detail/discard_iterator_base.h index a4a8c312b..38f77b378 100644 --- a/thrust/iterator/detail/discard_iterator_base.h +++ b/thrust/iterator/detail/discard_iterator_base.h @@ -22,8 +22,7 @@ #include #include // for std::ptrdiff_t -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declaration of discard_iterator template class discard_iterator; @@ -60,6 +59,6 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/distance_from_result.h b/thrust/iterator/detail/distance_from_result.h index 2b7e0d60e..fe140344d 100644 --- a/thrust/iterator/detail/distance_from_result.h +++ b/thrust/iterator/detail/distance_from_result.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -38,5 +37,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/host_system_tag.h b/thrust/iterator/detail/host_system_tag.h index 379882f2b..58478f8d9 100644 --- a/thrust/iterator/detail/host_system_tag.h +++ b/thrust/iterator/detail/host_system_tag.h @@ -23,9 +23,8 @@ #include __THRUST_HOST_SYSTEM_TAG_HEADER #undef __THRUST_HOST_SYSTEM_TAG_HEADER -namespace thrust -{ +THRUST_NAMESPACE_BEGIN typedef thrust::system::__THRUST_HOST_SYSTEM_NAMESPACE::tag host_system_tag; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/is_iterator_category.h b/thrust/iterator/detail/is_iterator_category.h index b538358be..e520452a3 100644 --- a/thrust/iterator/detail/is_iterator_category.h +++ b/thrust/iterator/detail/is_iterator_category.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -56,5 +55,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/iterator_adaptor_base.h b/thrust/iterator/detail/iterator_adaptor_base.h index d9dbfaae6..1173e414c 100644 --- a/thrust/iterator/detail/iterator_adaptor_base.h +++ b/thrust/iterator/detail/iterator_adaptor_base.h @@ -16,13 +16,14 @@ #pragma once +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declaration of iterator_adaptor for iterator_adaptor_base below @@ -107,5 +108,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -76,5 +75,5 @@ template }; // end iterator_category_or_traversal_to_system } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/iterator_category_to_traversal.h b/thrust/iterator/detail/iterator_category_to_traversal.h index 7596682e2..46db4410b 100644 --- a/thrust/iterator/detail/iterator_category_to_traversal.h +++ b/thrust/iterator/detail/iterator_category_to_traversal.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -127,5 +126,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/iterator_category_with_system_and_traversal.h b/thrust/iterator/detail/iterator_category_with_system_and_traversal.h index 8f5374b16..cdd8a6d36 100644 --- a/thrust/iterator/detail/iterator_category_with_system_and_traversal.h +++ b/thrust/iterator/detail/iterator_category_with_system_and_traversal.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -53,5 +52,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/iterator_facade_category.h b/thrust/iterator/detail/iterator_facade_category.h index e00d3ef05..81b518002 100644 --- a/thrust/iterator/detail/iterator_facade_category.h +++ b/thrust/iterator/detail/iterator_facade_category.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -249,5 +248,5 @@ template + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template struct iterator_value @@ -134,5 +135,5 @@ template } // end namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/iterator_traversal_tags.h b/thrust/iterator/detail/iterator_traversal_tags.h index 73cd1f76a..1fbc8a1e4 100644 --- a/thrust/iterator/detail/iterator_traversal_tags.h +++ b/thrust/iterator/detail/iterator_traversal_tags.h @@ -16,8 +16,9 @@ #pragma once -namespace thrust -{ +#include + +THRUST_NAMESPACE_BEGIN // define Boost's traversal tags struct no_traversal_tag {}; @@ -37,5 +38,5 @@ struct bidirectional_traversal_tag struct random_access_traversal_tag : bidirectional_traversal_tag {}; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/join_iterator.h b/thrust/iterator/detail/join_iterator.h index 1ab99ce47..83f143dc0 100644 --- a/thrust/iterator/detail/join_iterator.h +++ b/thrust/iterator/detail/join_iterator.h @@ -23,8 +23,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -130,5 +129,5 @@ join_iterator make_join_iterat } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/minimum_category.h b/thrust/iterator/detail/minimum_category.h index abb80d8c1..01e7e82c5 100644 --- a/thrust/iterator/detail/minimum_category.h +++ b/thrust/iterator/detail/minimum_category.h @@ -16,10 +16,11 @@ #pragma once +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -47,6 +48,6 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -78,5 +77,5 @@ template + #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -74,5 +75,5 @@ struct proclaim_contiguous_iterator< thrust::detail::normal_iterator > : true_type {}; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/permutation_iterator_base.h b/thrust/iterator/detail/permutation_iterator_base.h index 2610cfdfa..d586cabb7 100644 --- a/thrust/iterator/detail/permutation_iterator_base.h +++ b/thrust/iterator/detail/permutation_iterator_base.h @@ -16,13 +16,14 @@ #pragma once +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template class permutation_iterator; @@ -49,5 +50,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -144,5 +143,5 @@ __host__ __device__ } // end retag() -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/reverse_iterator.inl b/thrust/iterator/detail/reverse_iterator.inl index bb96c497f..e616df510 100644 --- a/thrust/iterator/detail/reverse_iterator.inl +++ b/thrust/iterator/detail/reverse_iterator.inl @@ -14,11 +14,12 @@ * limitations under the License. */ +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -111,5 +112,5 @@ reverse_iterator make_reverse_iterator(BidirectionalItera } // end make_reverse_iterator() -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/reverse_iterator_base.h b/thrust/iterator/detail/reverse_iterator_base.h index 68fa1f2f8..de3bafde9 100644 --- a/thrust/iterator/detail/reverse_iterator_base.h +++ b/thrust/iterator/detail/reverse_iterator_base.h @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template class reverse_iterator; @@ -38,5 +39,5 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/tagged_iterator.h b/thrust/iterator/detail/tagged_iterator.h index 125a4675e..4ac030644 100644 --- a/thrust/iterator/detail/tagged_iterator.h +++ b/thrust/iterator/detail/tagged_iterator.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -67,5 +66,5 @@ struct proclaim_contiguous_iterator< detail::tagged_iterator > : is_contiguous_iterator {}; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/transform_input_output_iterator.inl b/thrust/iterator/detail/transform_input_output_iterator.inl index b3c9e1bc5..318c9ab98 100644 --- a/thrust/iterator/detail/transform_input_output_iterator.inl +++ b/thrust/iterator/detail/transform_input_output_iterator.inl @@ -14,10 +14,11 @@ * limitations under the License. */ +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template class transform_input_output_iterator; @@ -110,5 +111,5 @@ struct is_proxy_reference< : public thrust::detail::true_type {}; } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/transform_iterator.inl b/thrust/iterator/detail/transform_iterator.inl index 65eee8687..d6f5ea078 100644 --- a/thrust/iterator/detail/transform_iterator.inl +++ b/thrust/iterator/detail/transform_iterator.inl @@ -14,14 +14,15 @@ * limitations under the License. */ +#include + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template class transform_iterator; @@ -68,5 +69,5 @@ struct transform_iterator_base } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/transform_output_iterator.inl b/thrust/iterator/detail/transform_output_iterator.inl index 91f657ca7..71921101b 100644 --- a/thrust/iterator/detail/transform_output_iterator.inl +++ b/thrust/iterator/detail/transform_output_iterator.inl @@ -14,11 +14,12 @@ * limitations under the License. */ +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template class transform_output_iterator; @@ -74,5 +75,5 @@ struct is_proxy_reference< : public thrust::detail::true_type {}; } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/tuple_of_iterator_references.h b/thrust/iterator/detail/tuple_of_iterator_references.h index 7ec59f390..78c5e8a28 100644 --- a/thrust/iterator/detail/tuple_of_iterator_references.h +++ b/thrust/iterator/detail/tuple_of_iterator_references.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -143,5 +142,5 @@ struct tuple_element> }; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/universal_categories.h b/thrust/iterator/detail/universal_categories.h index 2389796b1..d2abd7f55 100644 --- a/thrust/iterator/detail/universal_categories.h +++ b/thrust/iterator/detail/universal_categories.h @@ -21,8 +21,7 @@ // XXX eliminate this file -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // define these types without inheritance to avoid ambiguous conversion to base classes @@ -83,5 +82,5 @@ struct random_access_universal_iterator_tag }; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/zip_iterator.inl b/thrust/iterator/detail/zip_iterator.inl index d1ead2c42..a2bc98afe 100644 --- a/thrust/iterator/detail/zip_iterator.inl +++ b/thrust/iterator/detail/zip_iterator.inl @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template @@ -147,5 +148,5 @@ __host__ __device__ } // end make_zip_iterator() -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/detail/zip_iterator_base.h b/thrust/iterator/detail/zip_iterator_base.h index eddae23ae..030153b65 100644 --- a/thrust/iterator/detail/zip_iterator_base.h +++ b/thrust/iterator/detail/zip_iterator_base.h @@ -16,6 +16,8 @@ #pragma once +#include + #include #include #include @@ -29,8 +31,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declare zip_iterator for zip_iterator_base template class zip_iterator; @@ -347,6 +348,6 @@ template } // end detail -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/discard_iterator.h b/thrust/iterator/discard_iterator.h index c1613694d..eb5156eda 100644 --- a/thrust/iterator/discard_iterator.h +++ b/thrust/iterator/discard_iterator.h @@ -27,8 +27,7 @@ THRUST_DISABLE_MSVC_POSSIBLE_LOSS_OF_DATA_WARNING_BEGIN -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -169,7 +168,7 @@ discard_iterator<> make_discard_iterator(discard_iterator<>::difference_type i = /*! \} // end iterators */ -} // end namespace thrust +THRUST_NAMESPACE_END THRUST_DISABLE_MSVC_POSSIBLE_LOSS_OF_DATA_WARNING_END diff --git a/thrust/iterator/iterator_adaptor.h b/thrust/iterator/iterator_adaptor.h index f9f06a89a..67d4866b9 100644 --- a/thrust/iterator/iterator_adaptor.h +++ b/thrust/iterator/iterator_adaptor.h @@ -37,8 +37,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -239,5 +238,5 @@ template -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \addtogroup iterator_tags Iterator Tags @@ -218,7 +217,7 @@ typedef std::random_access_iterator_tag random_access_host_iterator_tag; /*! \} // end iterator_tag_classes */ -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/iterator/iterator_facade.h b/thrust/iterator/iterator_facade.h index 86757d712..f6920c5c8 100644 --- a/thrust/iterator/iterator_facade.h +++ b/thrust/iterator/iterator_facade.h @@ -37,8 +37,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -539,5 +538,5 @@ Derived operator+ (typename Derived::difference_type n, /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/iterator_traits.h b/thrust/iterator/iterator_traits.h index 5a33658c2..93df41291 100644 --- a/thrust/iterator/iterator_traits.h +++ b/thrust/iterator/iterator_traits.h @@ -35,8 +35,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -104,7 +103,7 @@ template struct iterator_traversal; template struct iterator_system; -} // namespace thrust +THRUST_NAMESPACE_END #include #include diff --git a/thrust/iterator/permutation_iterator.h b/thrust/iterator/permutation_iterator.h index 73827040a..2a07499c5 100644 --- a/thrust/iterator/permutation_iterator.h +++ b/thrust/iterator/permutation_iterator.h @@ -37,8 +37,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators @@ -213,5 +212,5 @@ permutation_iterator make_permutation_iterator(El /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/retag.h b/thrust/iterator/retag.h index 6adf5e244..1eb770ae3 100644 --- a/thrust/iterator/retag.h +++ b/thrust/iterator/retag.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \ingroup iterator_tags @@ -66,5 +65,5 @@ unspecified_iterator_type retag(Iterator iter); */ -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/reverse_iterator.h b/thrust/iterator/reverse_iterator.h index 365bc34d2..fe8bbe0cf 100644 --- a/thrust/iterator/reverse_iterator.h +++ b/thrust/iterator/reverse_iterator.h @@ -37,8 +37,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -232,7 +231,7 @@ reverse_iterator make_reverse_iterator(BidirectionalItera /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/iterator/transform_input_output_iterator.h b/thrust/iterator/transform_input_output_iterator.h index 25c10eb58..f512a36cb 100644 --- a/thrust/iterator/transform_input_output_iterator.h +++ b/thrust/iterator/transform_input_output_iterator.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -159,5 +158,5 @@ make_transform_input_output_iterator(Iterator io, InputFunction input_function, /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/transform_iterator.h b/thrust/iterator/transform_iterator.h index 5520b2a1f..5afb5f37b 100644 --- a/thrust/iterator/transform_iterator.h +++ b/thrust/iterator/transform_iterator.h @@ -40,8 +40,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -352,5 +351,5 @@ make_transform_iterator(Iterator it, AdaptableUnaryFunction fun) /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/transform_output_iterator.h b/thrust/iterator/transform_output_iterator.h index 4c6683ae5..66fb46a37 100644 --- a/thrust/iterator/transform_output_iterator.h +++ b/thrust/iterator/transform_output_iterator.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -159,5 +158,5 @@ make_transform_output_iterator(OutputIterator out, UnaryFunction fun) /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/iterator/zip_iterator.h b/thrust/iterator/zip_iterator.h index 14f7e873a..c2dd5ddc4 100644 --- a/thrust/iterator/zip_iterator.h +++ b/thrust/iterator/zip_iterator.h @@ -36,8 +36,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup iterators * \{ @@ -253,7 +252,7 @@ zip_iterator> make_zip_iterator(Iterators... its); /*! \} // end iterators */ -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/limits.h b/thrust/limits.h index f83dde9c3..52f38b1fc 100644 --- a/thrust/limits.h +++ b/thrust/limits.h @@ -7,13 +7,12 @@ #include +#include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template struct numeric_limits : std::numeric_limits {}; -} // end namespace thrust - +THRUST_NAMESPACE_END diff --git a/thrust/logical.h b/thrust/logical.h index 7ad30b8d2..5a8dbbecf 100644 --- a/thrust/logical.h +++ b/thrust/logical.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup reductions * \{ @@ -272,8 +270,6 @@ bool none_of(InputIterator first, InputIterator last, Predicate pred); * \} // end reductions */ - -} // end namespace thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/memory.h b/thrust/memory.h index 9ef8833f5..bb57d9bd0 100644 --- a/thrust/memory.h +++ b/thrust/memory.h @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \defgroup memory_management Memory Management * @@ -543,5 +542,4 @@ typename detail::raw_reference::type /*! \} */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/merge.h b/thrust/merge.h index 3c0d349e4..724f4c167 100644 --- a/thrust/merge.h +++ b/thrust/merge.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup merging Merging * \ingroup algorithms @@ -674,7 +672,6 @@ template - diff --git a/thrust/mismatch.h b/thrust/mismatch.h index 8dbe9a0d5..bbdf2923a 100644 --- a/thrust/mismatch.h +++ b/thrust/mismatch.h @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup algorithms */ @@ -254,7 +252,6 @@ thrust::pair mismatch(InputIterator1 first1, /*! \} // end searching */ -} // end namespace thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/mr/allocator.h b/thrust/mr/allocator.h index 148d77e65..31665c22e 100644 --- a/thrust/mr/allocator.h +++ b/thrust/mr/allocator.h @@ -22,6 +22,7 @@ #include +#include #include #include #include @@ -29,8 +30,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -246,5 +246,5 @@ class stateless_resource_allocator : public thrust::mr::allocator }; } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/device_memory_resource.h b/thrust/mr/device_memory_resource.h index 223084309..3a671142a 100644 --- a/thrust/mr/device_memory_resource.h +++ b/thrust/mr/device_memory_resource.h @@ -23,8 +23,7 @@ #include __THRUST_DEVICE_SYSTEM_MEMORY_HEADER #undef __THRUST_DEVICE_SYSTEM_MEMORY_HEADER -namespace thrust -{ +THRUST_NAMESPACE_BEGIN typedef thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::memory_resource @@ -35,5 +34,5 @@ typedef thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::universal_host_pinned_ universal_host_pinned_memory_resource; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/disjoint_pool.h b/thrust/mr/disjoint_pool.h index 32a59f4bc..a8dae54b1 100644 --- a/thrust/mr/disjoint_pool.h +++ b/thrust/mr/disjoint_pool.h @@ -22,6 +22,7 @@ #pragma once #include +#include #include #include @@ -33,8 +34,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -485,5 +485,5 @@ class disjoint_unsynchronized_pool_resource final */ } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/disjoint_sync_pool.h b/thrust/mr/disjoint_sync_pool.h index a97b935bd..1be927a06 100644 --- a/thrust/mr/disjoint_sync_pool.h +++ b/thrust/mr/disjoint_sync_pool.h @@ -20,6 +20,7 @@ #pragma once +#include #include #if THRUST_CPP_DIALECT >= 2011 @@ -28,8 +29,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -113,7 +113,7 @@ struct disjoint_synchronized_pool_resource : public memory_resource= 2011 diff --git a/thrust/mr/disjoint_tls_pool.h b/thrust/mr/disjoint_tls_pool.h index e50eba762..9fc7917ca 100644 --- a/thrust/mr/disjoint_tls_pool.h +++ b/thrust/mr/disjoint_tls_pool.h @@ -20,14 +20,14 @@ #pragma once +#include #include #if THRUST_CPP_DIALECT >= 2011 #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -63,7 +63,7 @@ thrust::mr::disjoint_unsynchronized_pool_resource & tls_di */ } // end mr -} // end thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/mr/fancy_pointer_resource.h b/thrust/mr/fancy_pointer_resource.h index e6e0bd240..b88107564 100644 --- a/thrust/mr/fancy_pointer_resource.h +++ b/thrust/mr/fancy_pointer_resource.h @@ -16,13 +16,13 @@ #pragma once +#include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -57,5 +57,5 @@ class fancy_pointer_resource final : public memory_resource, private va }; } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/host_memory_resource.h b/thrust/mr/host_memory_resource.h index 755c1b319..9359a97a7 100644 --- a/thrust/mr/host_memory_resource.h +++ b/thrust/mr/host_memory_resource.h @@ -23,11 +23,10 @@ #include __THRUST_HOST_SYSTEM_MEMORY_HEADER #undef __THRUST_HOST_SYSTEM_MEMORY_HEADER -namespace thrust -{ +THRUST_NAMESPACE_BEGIN typedef thrust::system::__THRUST_HOST_SYSTEM_NAMESPACE::memory_resource host_memory_resource; -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/memory_resource.h b/thrust/mr/memory_resource.h index 573d5eeb8..4d6955995 100644 --- a/thrust/mr/memory_resource.h +++ b/thrust/mr/memory_resource.h @@ -21,13 +21,13 @@ #pragma once +#include #include #ifdef THRUST_MR_STD_MR_HEADER # include THRUST_MR_STD_MR_HEADER #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \brief \p thrust::mr is the namespace containing system agnostic types and functions for \p memory_resource related functionalities. */ namespace mr @@ -213,5 +213,5 @@ MR * get_global_resource() */ } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/new.h b/thrust/mr/new.h index 996432485..61f6e61ba 100644 --- a/thrust/mr/new.h +++ b/thrust/mr/new.h @@ -20,10 +20,11 @@ #pragma once +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -84,5 +85,5 @@ class new_delete_resource final : public memory_resource<> */ } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/polymorphic_adaptor.h b/thrust/mr/polymorphic_adaptor.h index 5a3cdedd3..0562a8f82 100644 --- a/thrust/mr/polymorphic_adaptor.h +++ b/thrust/mr/polymorphic_adaptor.h @@ -16,10 +16,11 @@ #pragma once +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -52,5 +53,5 @@ class polymorphic_adaptor_resource final : public memory_resource }; } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/pool.h b/thrust/mr/pool.h index 8886688aa..64244c3f2 100644 --- a/thrust/mr/pool.h +++ b/thrust/mr/pool.h @@ -21,6 +21,8 @@ #pragma once +#include + #include #include @@ -31,8 +33,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -501,5 +502,5 @@ class unsynchronized_pool_resource final */ } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/pool_options.h b/thrust/mr/pool_options.h index 7994e914a..1d7fb5732 100644 --- a/thrust/mr/pool_options.h +++ b/thrust/mr/pool_options.h @@ -24,10 +24,10 @@ #include +#include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -123,5 +123,5 @@ struct pool_options */ } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/mr/sync_pool.h b/thrust/mr/sync_pool.h index 1ecb10b0a..9609dab71 100644 --- a/thrust/mr/sync_pool.h +++ b/thrust/mr/sync_pool.h @@ -20,6 +20,7 @@ #pragma once +#include #include #if THRUST_CPP_DIALECT >= 2011 @@ -28,8 +29,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -110,7 +110,7 @@ struct synchronized_pool_resource : public memory_resource= 2011 diff --git a/thrust/mr/tls_pool.h b/thrust/mr/tls_pool.h index c732f022f..8ee8127a3 100644 --- a/thrust/mr/tls_pool.h +++ b/thrust/mr/tls_pool.h @@ -20,14 +20,14 @@ #pragma once +#include #include #if THRUST_CPP_DIALECT >= 2011 #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -58,7 +58,7 @@ thrust::mr::unsynchronized_pool_resource & tls_pool(Upstream * upstrea */ } // end mr -} // end thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/mr/validator.h b/thrust/mr/validator.h index 8f8676d11..10e964821 100644 --- a/thrust/mr/validator.h +++ b/thrust/mr/validator.h @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace mr { @@ -46,5 +47,5 @@ struct validator2 : private validator }; } // end mr -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/optional.h b/thrust/optional.h index e8dc91b7f..9b0c6ef01 100644 --- a/thrust/optional.h +++ b/thrust/optional.h @@ -1,6 +1,6 @@ /// // optional - An implementation of std::optional with extensions -// Written in 2017 by Simon Brand (@TartanLlama) +// Written in 2017 by Sy Brand (@TartanLlama) // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to the @@ -73,8 +73,7 @@ !defined(__clang__)) #ifndef THRUST_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX #define THRUST_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible{}; @@ -84,7 +83,7 @@ namespace thrust : std::is_trivially_copy_constructible{}; #endif } -} // end namespace thrust +THRUST_NAMESPACE_END #endif #define THRUST_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \ @@ -163,8 +162,8 @@ namespace thrust #define THRUST_OPTIONAL_CPP11_CONSTEXPR constexpr #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN + #ifndef THRUST_MONOSTATE_INPLACE_MUTEX #define THRUST_MONOSTATE_INPLACE_MUTEX /// \brief Used to represent an optional with no data; essentially a bool @@ -2866,18 +2865,18 @@ template class optional { T *m_value; }; -} // end namespace thrust +THRUST_NAMESPACE_END namespace std { // TODO SFINAE -template struct hash> { +template struct hash> { __thrust_exec_check_disable__ __host__ __device__ - ::std::size_t operator()(const thrust::optional &o) const { + ::std::size_t operator()(const THRUST_NS_QUALIFIER::optional &o) const { if (!o.has_value()) return 0; - return std::hash>()(*o); + return std::hash>()(*o); } }; } // namespace std diff --git a/thrust/pair.h b/thrust/pair.h index d3c30daf8..eb2138aaf 100644 --- a/thrust/pair.h +++ b/thrust/pair.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup utility * \{ @@ -277,7 +276,6 @@ template struct tuple_size; /*! \} // utility */ -} // end thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/partition.h b/thrust/partition.h index d3f0db83f..90768f246 100644 --- a/thrust/partition.h +++ b/thrust/partition.h @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup reordering * \ingroup algorithms @@ -1432,8 +1430,7 @@ template * \} // end reductions */ - -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/per_device_resource.h b/thrust/per_device_resource.h index 3c0158aee..12e0409f6 100644 --- a/thrust/per_device_resource.h +++ b/thrust/per_device_resource.h @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! Returns a global instance of \p MR for the current device of the provided system. * @@ -98,7 +97,6 @@ class per_device_allocator : public thrust::mr::allocator ~per_device_allocator() {} }; - -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/random.h b/thrust/random.h index c0e9e2282..7463620b7 100644 --- a/thrust/random.h +++ b/thrust/random.h @@ -35,9 +35,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup random Random Number Generation * \{ @@ -116,5 +114,4 @@ using random::ranlux48; using random::taus88; using random::default_random_engine; -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/discard_block_engine.inl b/thrust/random/detail/discard_block_engine.inl index fca16c2bf..660b9f6cb 100644 --- a/thrust/random/detail/discard_block_engine.inl +++ b/thrust/random/detail/discard_block_engine.inl @@ -14,10 +14,11 @@ * limitations under the License. */ +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -208,5 +209,5 @@ bool operator!=(const discard_block_engine &lhs, } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/linear_congruential_engine.inl b/thrust/random/detail/linear_congruential_engine.inl index da0b03e15..b5e9bbf41 100644 --- a/thrust/random/detail/linear_congruential_engine.inl +++ b/thrust/random/detail/linear_congruential_engine.inl @@ -14,12 +14,13 @@ * limitations under the License. */ +#include + #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -165,5 +166,5 @@ operator>>(std::basic_istream &is, } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/linear_congruential_engine_discard.h b/thrust/random/detail/linear_congruential_engine_discard.h index 381595144..c8103d9dc 100644 --- a/thrust/random/detail/linear_congruential_engine_discard.h +++ b/thrust/random/detail/linear_congruential_engine_discard.h @@ -16,11 +16,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -103,5 +104,5 @@ struct linear_congruential_engine_discard } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/linear_feedback_shift_engine.inl b/thrust/random/detail/linear_feedback_shift_engine.inl index b5d55be15..355d45887 100644 --- a/thrust/random/detail/linear_feedback_shift_engine.inl +++ b/thrust/random/detail/linear_feedback_shift_engine.inl @@ -14,10 +14,11 @@ * limitations under the License. */ +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -161,5 +162,5 @@ operator>>(std::basic_istream &is, } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/linear_feedback_shift_engine_wordmask.h b/thrust/random/detail/linear_feedback_shift_engine_wordmask.h index 6669350ea..73c8ae83e 100644 --- a/thrust/random/detail/linear_feedback_shift_engine_wordmask.h +++ b/thrust/random/detail/linear_feedback_shift_engine_wordmask.h @@ -16,8 +16,9 @@ #pragma once -namespace thrust -{ +#include + +THRUST_NAMESPACE_BEGIN namespace random { @@ -43,5 +44,5 @@ template } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/mod.h b/thrust/random/detail/mod.h index 62f2d56d5..f0637582d 100644 --- a/thrust/random/detail/mod.h +++ b/thrust/random/detail/mod.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -95,5 +94,5 @@ __host__ __device__ } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/normal_distribution.inl b/thrust/random/detail/normal_distribution.inl index 099a977f3..fea424159 100644 --- a/thrust/random/detail/normal_distribution.inl +++ b/thrust/random/detail/normal_distribution.inl @@ -15,6 +15,8 @@ * limitations under the License. */ +#include + #include #include #include @@ -27,8 +29,7 @@ #include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -251,5 +252,5 @@ operator>>(std::basic_istream &is, } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/normal_distribution_base.h b/thrust/random/detail/normal_distribution_base.h index 94b966351..f67cb7152 100644 --- a/thrust/random/detail/normal_distribution_base.h +++ b/thrust/random/detail/normal_distribution_base.h @@ -29,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { namespace detail @@ -145,5 +144,5 @@ template } // end detail } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/random_core_access.h b/thrust/random/detail/random_core_access.h index f03060e0a..a3e34e02b 100644 --- a/thrust/random/detail/random_core_access.h +++ b/thrust/random/detail/random_core_access.h @@ -16,8 +16,9 @@ #pragma once -namespace thrust -{ +#include + +THRUST_NAMESPACE_BEGIN namespace random { @@ -53,5 +54,5 @@ static bool equal(const EngineOrDistribution &lhs, const EngineOrDistribution &r } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/subtract_with_carry_engine.inl b/thrust/random/detail/subtract_with_carry_engine.inl index cb7383588..0cd60960f 100644 --- a/thrust/random/detail/subtract_with_carry_engine.inl +++ b/thrust/random/detail/subtract_with_carry_engine.inl @@ -14,13 +14,14 @@ * limitations under the License. */ +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -206,5 +207,5 @@ template } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/uniform_int_distribution.inl b/thrust/random/detail/uniform_int_distribution.inl index 18eb5194c..e9b74e3f2 100644 --- a/thrust/random/detail/uniform_int_distribution.inl +++ b/thrust/random/detail/uniform_int_distribution.inl @@ -14,12 +14,13 @@ * limitations under the License. */ +#include + #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -242,5 +243,5 @@ operator>>(std::basic_istream &is, } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/uniform_real_distribution.inl b/thrust/random/detail/uniform_real_distribution.inl index ec4f21e9e..246e27e92 100644 --- a/thrust/random/detail/uniform_real_distribution.inl +++ b/thrust/random/detail/uniform_real_distribution.inl @@ -14,10 +14,11 @@ * limitations under the License. */ +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -227,5 +228,5 @@ operator>>(std::basic_istream &is, } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/xor_combine_engine.inl b/thrust/random/detail/xor_combine_engine.inl index d24865f68..b7792cd51 100644 --- a/thrust/random/detail/xor_combine_engine.inl +++ b/thrust/random/detail/xor_combine_engine.inl @@ -14,11 +14,12 @@ * limitations under the License. */ +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -211,5 +212,5 @@ bool operator!=(const xor_combine_engine &lhs, } // end random -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/random/detail/xor_combine_engine_max.h b/thrust/random/detail/xor_combine_engine_max.h index cfb5bdc83..0756ff9e0 100644 --- a/thrust/random/detail/xor_combine_engine_max.h +++ b/thrust/random/detail/xor_combine_engine_max.h @@ -16,13 +16,14 @@ #pragma once +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -320,5 +321,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -246,7 +245,7 @@ operator>>(std::basic_istream &is, // import names into thrust:: using random::discard_block_engine; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/random/linear_congruential_engine.h b/thrust/random/linear_congruential_engine.h index 0dc72b3b1..dac03d90e 100644 --- a/thrust/random/linear_congruential_engine.h +++ b/thrust/random/linear_congruential_engine.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -289,7 +288,7 @@ using random::linear_congruential_engine; using random::minstd_rand; using random::minstd_rand0; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/random/linear_feedback_shift_engine.h b/thrust/random/linear_feedback_shift_engine.h index 90c572c9b..a46c6d8ab 100644 --- a/thrust/random/linear_feedback_shift_engine.h +++ b/thrust/random/linear_feedback_shift_engine.h @@ -35,8 +35,7 @@ #include // for size_t #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random @@ -224,7 +223,7 @@ operator>>(std::basic_istream &is, // import names into thrust:: using random::linear_feedback_shift_engine; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/random/normal_distribution.h b/thrust/random/normal_distribution.h index ac45e161a..36b985cb6 100644 --- a/thrust/random/normal_distribution.h +++ b/thrust/random/normal_distribution.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -269,7 +268,7 @@ operator>>(std::basic_istream &is, using random::normal_distribution; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/random/subtract_with_carry_engine.h b/thrust/random/subtract_with_carry_engine.h index 0b12ca353..69ee841fd 100644 --- a/thrust/random/subtract_with_carry_engine.h +++ b/thrust/random/subtract_with_carry_engine.h @@ -28,8 +28,7 @@ #include // for size_t #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -250,7 +249,7 @@ using random::subtract_with_carry_engine; using random::ranlux24_base; using random::ranlux48_base; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/random/uniform_int_distribution.h b/thrust/random/uniform_int_distribution.h index 42d745781..18f369fc2 100644 --- a/thrust/random/uniform_int_distribution.h +++ b/thrust/random/uniform_int_distribution.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -110,7 +109,8 @@ template * the platform. */ __host__ __device__ - explicit uniform_int_distribution(IntType a = 0, IntType b = thrust::detail::integer_traits::const_max); + explicit uniform_int_distribution(IntType a = 0, + IntType b = THRUST_NS_QUALIFIER::detail::integer_traits::const_max); /*! This constructor creates a new \p uniform_int_distribution from a \p param_type object * encapsulating the range of the distribution. @@ -270,7 +270,7 @@ operator>>(std::basic_istream &is, using random::uniform_int_distribution; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/random/uniform_real_distribution.h b/thrust/random/uniform_real_distribution.h index 312104570..e6c5a7d88 100644 --- a/thrust/random/uniform_real_distribution.h +++ b/thrust/random/uniform_real_distribution.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -268,7 +267,7 @@ operator>>(std::basic_istream &is, using random::uniform_real_distribution; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/random/xor_combine_engine.h b/thrust/random/xor_combine_engine.h index d5e86b7a9..321f04033 100644 --- a/thrust/random/xor_combine_engine.h +++ b/thrust/random/xor_combine_engine.h @@ -29,8 +29,7 @@ #include #include // for size_t -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace random { @@ -265,7 +264,7 @@ operator>>(std::basic_istream &is, // import names into thrust:: using random::xor_combine_engine; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/reduce.h b/thrust/reduce.h index 96f683dc0..c7b378f72 100644 --- a/thrust/reduce.h +++ b/thrust/reduce.h @@ -26,9 +26,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup reductions * \{ @@ -778,8 +776,6 @@ template - diff --git a/thrust/remove.h b/thrust/remove.h index b6000a0ba..a57fcf211 100644 --- a/thrust/remove.h +++ b/thrust/remove.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup stream_compaction Stream Compaction * \ingroup reordering @@ -799,8 +797,6 @@ template - diff --git a/thrust/replace.h b/thrust/replace.h index d80a66ad2..a5c0320c4 100644 --- a/thrust/replace.h +++ b/thrust/replace.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup transformations * \addtogroup replacing @@ -816,8 +814,6 @@ template - diff --git a/thrust/reverse.h b/thrust/reverse.h index b65a5d309..056be200a 100644 --- a/thrust/reverse.h +++ b/thrust/reverse.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup reordering * \ingroup algorithms @@ -208,8 +206,6 @@ template /*! \} // end reordering */ - -} // end thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/scan.h b/thrust/scan.h index 340d258c0..668db7247 100644 --- a/thrust/scan.h +++ b/thrust/scan.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup algorithms */ @@ -1557,8 +1555,6 @@ template - diff --git a/thrust/scatter.h b/thrust/scatter.h index 4ad984482..b8b0bd84f 100644 --- a/thrust/scatter.h +++ b/thrust/scatter.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup scattering * \ingroup copying @@ -416,8 +414,6 @@ template - diff --git a/thrust/sequence.h b/thrust/sequence.h index d40fc553c..fb3959e3c 100644 --- a/thrust/sequence.h +++ b/thrust/sequence.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup transformations * \{ @@ -289,8 +287,7 @@ template /*! \} // end transformations */ - -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/set_operations.h b/thrust/set_operations.h index 117112924..65a48d1b6 100644 --- a/thrust/set_operations.h +++ b/thrust/set_operations.h @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup set_operations Set Operations * \ingroup algorithms @@ -2956,8 +2954,6 @@ template - diff --git a/thrust/shuffle.h b/thrust/shuffle.h index 25b9046d5..d95327e29 100644 --- a/thrust/shuffle.h +++ b/thrust/shuffle.h @@ -28,7 +28,7 @@ #include #include -namespace thrust { +THRUST_NAMESPACE_BEGIN /*! \addtogroup reordering * \ingroup algorithms @@ -173,7 +173,7 @@ template __host__ __device__ void shuffle_copy(RandomIterator first, RandomIterator last, OutputIterator result, URBG&& g); -} // namespace thrust +THRUST_NAMESPACE_END #include #endif diff --git a/thrust/sort.h b/thrust/sort.h index a6c17fc94..5cf9d6217 100644 --- a/thrust/sort.h +++ b/thrust/sort.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup sorting * \ingroup algorithms @@ -1355,8 +1353,6 @@ template * \} // end reductions */ - -} // end namespace thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/swap.h b/thrust/swap.h index 500868f11..d8a8be73c 100644 --- a/thrust/swap.h +++ b/thrust/swap.h @@ -23,12 +23,7 @@ #include #include -// empty Doxygen comment below so namespace thrust's documentation will be extracted - -/*! - */ -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup utility * \{ @@ -184,8 +179,6 @@ template - diff --git a/thrust/system/cpp/detail/execution_policy.h b/thrust/system/cpp/detail/execution_policy.h index 27e4db862..1a8193bf3 100644 --- a/thrust/system/cpp/detail/execution_policy.h +++ b/thrust/system/cpp/detail/execution_policy.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { // put the canonical tag in the same ns as the backend's entry points @@ -77,5 +76,5 @@ using thrust::system::cpp::execution_policy; using thrust::system::cpp::tag; } // end cpp -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cpp/detail/memory.inl b/thrust/system/cpp/detail/memory.inl index bbb0bab78..6361394d7 100644 --- a/thrust/system/cpp/detail/memory.inl +++ b/thrust/system/cpp/detail/memory.inl @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cpp @@ -47,5 +46,5 @@ void free(pointer ptr) } // end cpp } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cpp/detail/par.h b/thrust/system/cpp/detail/par.h index b884e7bba..c56921327 100644 --- a/thrust/system/cpp/detail/par.h +++ b/thrust/system/cpp/detail/par.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cpp @@ -58,5 +57,5 @@ using thrust::system::cpp::par; } // end cpp -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cpp/detail/vector.inl b/thrust/system/cpp/detail/vector.inl index 55a1fa4ba..d27cdad64 100644 --- a/thrust/system/cpp/detail/vector.inl +++ b/thrust/system/cpp/detail/vector.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cpp @@ -122,5 +121,5 @@ template } // end cpp } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cpp/execution_policy.h b/thrust/system/cpp/execution_policy.h index d22b4ceeb..0d8a9a367 100644 --- a/thrust/system/cpp/execution_policy.h +++ b/thrust/system/cpp/execution_policy.h @@ -76,8 +76,7 @@ // define these entities here for the purpose of Doxygenating them // they are actually defined elsewhere #if 0 -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cpp @@ -151,7 +150,7 @@ static const unspecified par; } // end cpp } // end system -} // end thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cpp/memory.h b/thrust/system/cpp/memory.h index 376b8f4f5..a18abeb8e 100644 --- a/thrust/system/cpp/memory.h +++ b/thrust/system/cpp/memory.h @@ -27,7 +27,8 @@ #include #include -namespace thrust { namespace system { namespace cpp +THRUST_NAMESPACE_BEGIN +namespace system { namespace cpp { /*! Allocates an area of memory available to Thrust's cpp system. @@ -93,7 +94,7 @@ using thrust::system::cpp::free; using thrust::system::cpp::allocator; } // namespace cpp -} // namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/cpp/memory_resource.h b/thrust/system/cpp/memory_resource.h index e803583e9..9f5d1e4cc 100644 --- a/thrust/system/cpp/memory_resource.h +++ b/thrust/system/cpp/memory_resource.h @@ -26,7 +26,8 @@ #include -namespace thrust { namespace system { namespace cpp +THRUST_NAMESPACE_BEGIN +namespace system { namespace cpp { //! \cond @@ -63,5 +64,8 @@ typedef detail::native_resource universal_host_pinned_memory_resource; /*! \} */ -}}} // namespace thrust::system::cpp + +}} // namespace system::cpp + +THRUST_NAMESPACE_END diff --git a/thrust/system/cpp/pointer.h b/thrust/system/cpp/pointer.h index dac60a7e3..f204fa375 100644 --- a/thrust/system/cpp/pointer.h +++ b/thrust/system/cpp/pointer.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace system { namespace cpp +THRUST_NAMESPACE_BEGIN +namespace system { namespace cpp { /*! \p cpp::pointer stores a pointer to an object allocated in memory accessible @@ -112,5 +113,5 @@ using thrust::system::cpp::universal_pointer; using thrust::system::cpp::reference; } // namespace cpp -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cpp/vector.h b/thrust/system/cpp/vector.h index 0d328f134..2a418dbc3 100644 --- a/thrust/system/cpp/vector.h +++ b/thrust/system/cpp/vector.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace system { namespace cpp +THRUST_NAMESPACE_BEGIN +namespace system { namespace cpp { /*! \p cpp::vector is a container that supports random access to elements, @@ -78,4 +79,4 @@ using thrust::system::cpp::vector; using thrust::system::cpp::universal_vector; } -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/config.h b/thrust/system/cuda/config.h index 38b3dba56..a0da41624 100644 --- a/thrust/system/cuda/config.h +++ b/thrust/system/cuda/config.h @@ -68,9 +68,6 @@ #define THRUST_DEBUG_SYNC_FLAG false #endif -#define THRUST_CUB_NS_PREFIX namespace thrust { namespace cuda_cub { -#define THRUST_CUB_NS_POSTFIX } } - #ifndef THRUST_IGNORE_CUB_VERSION_CHECK #include #include // This includes in newer releases. diff --git a/thrust/system/cuda/detail/adjacent_difference.h b/thrust/system/cuda/detail/adjacent_difference.h index 92fba765e..f942e3a5b 100644 --- a/thrust/system/cuda/detail/adjacent_difference.h +++ b/thrust/system/cuda/detail/adjacent_difference.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -45,8 +46,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template __host__ __device__ OutputIterator @@ -65,9 +65,9 @@ namespace __adjacent_difference { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BlockStoreAlgorithm _STORE_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_STORE_DIRECT> struct PtxPolicy { enum @@ -77,9 +77,9 @@ namespace __adjacent_difference { ITEMS_PER_TILE = BLOCK_THREADS * ITEMS_PER_THREAD }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; }; template @@ -115,9 +115,9 @@ namespace __adjacent_difference { }; typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; template @@ -131,9 +131,9 @@ namespace __adjacent_difference { }; typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; @@ -159,11 +159,11 @@ namespace __adjacent_difference { typedef typename core::BlockStore::type BlockStore; - typedef cub::BlockAdjacentDifference + typedef CUB_NS_QUALIFIER::BlockAdjacentDifference BlockAdjacentDifference; union TempStorage @@ -396,7 +396,7 @@ namespace __adjacent_difference { Size tile_size = difference_plan.items_per_tile; - Size num_tiles = cub::DivideAndRoundUp(num_items, tile_size); + Size num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, tile_size); size_t tmp1 = num_tiles * sizeof(input_type); size_t vshmem_size = core::vshmem_size(difference_plan.shared_memory_size, @@ -533,7 +533,7 @@ adjacent_difference(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END // #include diff --git a/thrust/system/cuda/detail/assign_value.h b/thrust/system/cuda/detail/assign_value.h index f6fd987bf..195493a4f 100644 --- a/thrust/system/cuda/detail/assign_value.h +++ b/thrust/system/cuda/detail/assign_value.h @@ -16,16 +16,16 @@ #pragma once -#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include + +#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -98,5 +98,5 @@ inline __host__ __device__ } // end cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/async/copy.h b/thrust/system/cuda/detail/async/copy.h index 9b317cbb5..6f2970759 100644 --- a/thrust/system/cuda/detail/async/copy.h +++ b/thrust/system/cuda/detail/async/copy.h @@ -53,8 +53,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda { namespace detail { @@ -530,7 +529,7 @@ THRUST_RETURNS( } // cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/async/customization.h b/thrust/system/cuda/detail/async/customization.h index aead7b12b..6f125a6f4 100644 --- a/thrust/system/cuda/detail/async/customization.h +++ b/thrust/system/cuda/detail/async/customization.h @@ -48,8 +48,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda { namespace detail { @@ -120,7 +119,7 @@ THRUST_RETURNS( }}} // namespace system::cuda::detail -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/async/exclusive_scan.h b/thrust/system/cuda/detail/async/exclusive_scan.h index 1ac46ecb5..0f35249b6 100644 --- a/thrust/system/cuda/detail/async/exclusive_scan.h +++ b/thrust/system/cuda/detail/async/exclusive_scan.h @@ -52,8 +52,7 @@ // fixed in CUB first). // - Need to check if CUB actually optimizes for sums before putting in effort -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda @@ -75,16 +74,16 @@ async_exclusive_scan_n(execution_policy& policy, InitialValueType init, BinaryOp op) { - using Dispatch32 = cub::DispatchScan; - using Dispatch64 = cub::DispatchScan; + using Dispatch32 = CUB_NS_QUALIFIER::DispatchScan; + using Dispatch64 = CUB_NS_QUALIFIER::DispatchScan; auto const device_alloc = get_async_device_allocator(policy); unique_eager_event ev; @@ -191,7 +190,7 @@ THRUST_RETURNS( } // namespace cuda_cub -} // namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/async/for_each.h b/thrust/system/cuda/detail/async/for_each.h index 750b7e829..9f26883d0 100644 --- a/thrust/system/cuda/detail/async/for_each.h +++ b/thrust/system/cuda/detail/async/for_each.h @@ -47,8 +47,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda { namespace detail { @@ -151,7 +150,7 @@ THRUST_RETURNS( } // cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/async/inclusive_scan.h b/thrust/system/cuda/detail/async/inclusive_scan.h index 6b3dcef91..8321141a4 100644 --- a/thrust/system/cuda/detail/async/inclusive_scan.h +++ b/thrust/system/cuda/detail/async/inclusive_scan.h @@ -52,8 +52,7 @@ // fixed in CUB first). // - Need to check if CUB actually optimizes for sums before putting in effort -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda @@ -73,15 +72,15 @@ async_inclusive_scan_n(execution_policy& policy, OutputIt out, BinaryOp op) { - using Dispatch32 = cub::DispatchScan; - using Dispatch64 = cub::DispatchScan; auto const device_alloc = get_async_device_allocator(policy); @@ -100,7 +99,7 @@ async_inclusive_scan_n(execution_policy& policy, first, out, op, - cub::NullType{}, + CUB_NS_QUALIFIER::NullType{}, n_fixed, nullptr, THRUST_DEBUG_SYNC_FLAG)); @@ -147,7 +146,7 @@ async_inclusive_scan_n(execution_policy& policy, first, out, op, - cub::NullType{}, + CUB_NS_QUALIFIER::NullType{}, n_fixed, user_raw_stream, THRUST_DEBUG_SYNC_FLAG)); @@ -186,7 +185,7 @@ THRUST_RETURNS( } // namespace cuda_cub -} // namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/async/reduce.h b/thrust/system/cuda/detail/async/reduce.h index 906928b27..efd08b743 100644 --- a/thrust/system/cuda/detail/async/reduce.h +++ b/thrust/system/cuda/detail/async/reduce.h @@ -49,8 +49,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda { namespace detail { @@ -81,7 +80,7 @@ auto async_reduce_n( size_t tmp_size = 0; thrust::cuda_cub::throw_on_error( - cub::DeviceReduce::Reduce( + CUB_NS_QUALIFIER::DeviceReduce::Reduce( nullptr , tmp_size , first @@ -163,7 +162,7 @@ auto async_reduce_n( // Run reduction. thrust::cuda_cub::throw_on_error( - cub::DeviceReduce::Reduce( + CUB_NS_QUALIFIER::DeviceReduce::Reduce( tmp_ptr , tmp_size , first @@ -234,7 +233,7 @@ auto async_reduce_into_n( size_t tmp_size = 0; thrust::cuda_cub::throw_on_error( - cub::DeviceReduce::Reduce( + CUB_NS_QUALIFIER::DeviceReduce::Reduce( nullptr , tmp_size , first @@ -298,7 +297,7 @@ auto async_reduce_into_n( // Run reduction. thrust::cuda_cub::throw_on_error( - cub::DeviceReduce::Reduce( + CUB_NS_QUALIFIER::DeviceReduce::Reduce( tmp_ptr , tmp_size , first @@ -342,7 +341,7 @@ THRUST_RETURNS( } // cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/async/sort.h b/thrust/system/cuda/detail/async/sort.h index 3e357fde6..12c78292a 100644 --- a/thrust/system/cuda/detail/async/sort.h +++ b/thrust/system/cuda/detail/async/sort.h @@ -53,8 +53,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda { namespace detail { @@ -294,12 +293,12 @@ invoke_radix_sort( cudaStream_t stream , void* tmp_ptr , std::size_t& tmp_size -, cub::DoubleBuffer& keys +, CUB_NS_QUALIFIER::DoubleBuffer& keys , Size& n , StrictWeakOrdering ) { - return cub::DeviceRadixSort::SortKeys( + return CUB_NS_QUALIFIER::DeviceRadixSort::SortKeys( tmp_ptr , tmp_size , keys @@ -320,12 +319,12 @@ invoke_radix_sort( cudaStream_t stream , void* tmp_ptr , std::size_t& tmp_size -, cub::DoubleBuffer& keys +, CUB_NS_QUALIFIER::DoubleBuffer& keys , Size& n , StrictWeakOrdering ) { - return cub::DeviceRadixSort::SortKeysDescending( + return CUB_NS_QUALIFIER::DeviceRadixSort::SortKeysDescending( tmp_ptr , tmp_size , keys @@ -367,7 +366,7 @@ auto async_stable_sort_n( unique_eager_event e; - cub::DoubleBuffer keys( + CUB_NS_QUALIFIER::DoubleBuffer keys( raw_pointer_cast(&*first), nullptr ); @@ -514,7 +513,7 @@ THRUST_DECLTYPE_RETURNS( } // cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/async/transform.h b/thrust/system/cuda/detail/async/transform.h index 544da5cb9..26703bc77 100644 --- a/thrust/system/cuda/detail/async/transform.h +++ b/thrust/system/cuda/detail/async/transform.h @@ -47,8 +47,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda { namespace detail { @@ -155,7 +154,7 @@ THRUST_RETURNS( } // cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC diff --git a/thrust/system/cuda/detail/binary_search.h b/thrust/system/cuda/detail/binary_search.h index 1859824b8..41ee6cd60 100644 --- a/thrust/system/cuda/detail/binary_search.h +++ b/thrust/system/cuda/detail/binary_search.h @@ -28,6 +28,8 @@ #if 0 +#include + #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include @@ -44,8 +46,7 @@ # define BS_SIMPLE #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __binary_search { @@ -186,9 +187,9 @@ namespace __binary_search { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockStoreAlgorithm _STORE_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_STORE_DIRECT> struct PtxPolicy { enum @@ -198,9 +199,9 @@ namespace __binary_search { ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; }; // PtxPolicy template @@ -217,9 +218,9 @@ namespace __binary_search { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_STORE_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_STORE_TRANSPOSE> type; }; @@ -236,9 +237,9 @@ namespace __binary_search { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; @@ -775,7 +776,7 @@ lower_bound(execution_policy& policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif #endif diff --git a/thrust/system/cuda/detail/copy.h b/thrust/system/cuda/detail/copy.h index ef51e4a5b..949fe9b2a 100644 --- a/thrust/system/cuda/detail/copy.h +++ b/thrust/system/cuda/detail/copy.h @@ -26,13 +26,13 @@ ******************************************************************************/ #pragma once +#include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template __host__ __device__ OutputIt @@ -92,7 +92,7 @@ copy_n(cross_system systems, OutputIterator result); } // namespace cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END @@ -100,8 +100,7 @@ copy_n(cross_system systems, #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -192,7 +191,7 @@ copy_n(cross_system systems, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #include #include diff --git a/thrust/system/cuda/detail/copy_if.h b/thrust/system/cuda/detail/copy_if.h index 747a3a83b..b3000a928 100644 --- a/thrust/system/cuda/detail/copy_if.h +++ b/thrust/system/cuda/detail/copy_if.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -43,8 +44,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // XXX declare generic copy_if interface // to avoid circulular dependency from thrust/copy.h template @@ -72,9 +72,9 @@ namespace __copy_if { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockScanAlgorithm _SCAN_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> struct PtxPolicy { enum @@ -83,9 +83,9 @@ namespace __copy_if { ITEMS_PER_THREAD = _ITEMS_PER_THREAD, ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD, }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; }; // struct PtxPolicy template @@ -104,9 +104,9 @@ namespace __copy_if { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning<350> @@ -124,9 +124,9 @@ namespace __copy_if { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning<350> @@ -143,9 +143,9 @@ namespace __copy_if { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning<300> @@ -162,7 +162,7 @@ namespace __copy_if { typedef typename iterator_traits::value_type item_type; typedef typename iterator_traits::value_type stencil_type; - typedef cub::ScanTileState ScanTileState; + typedef CUB_NS_QUALIFIER::ScanTileState ScanTileState; template struct PtxPlan : Tuning::type @@ -175,13 +175,13 @@ namespace __copy_if { typedef typename core::BlockLoad::type BlockLoadItems; typedef typename core::BlockLoad::type BlockLoadStencil; - typedef cub::TilePrefixCallbackOp TilePrefixCallback; - typedef cub::BlockScan::type copy_if_plan = copy_if_agent::get_plan(stream); int tile_size = copy_if_plan.items_per_tile; - size_t num_tiles = cub::DivideAndRoundUp(num_items, tile_size); + size_t num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, tile_size); size_t vshmem_size = core::vshmem_size(copy_if_plan.shared_memory_size, num_tiles); @@ -653,7 +653,7 @@ namespace __copy_if { void* allocations[2] = {NULL, NULL}; - status = cub::AliasTemporaries(d_temp_storage, + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, temp_storage_bytes, allocations, allocation_sizes); @@ -853,7 +853,7 @@ copy_if(execution_policy &policy, } // func copy_if } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #include #endif diff --git a/thrust/system/cuda/detail/core/agent_launcher.h b/thrust/system/cuda/detail/core/agent_launcher.h index 7788481c7..f7243a6ba 100644 --- a/thrust/system/cuda/detail/core/agent_launcher.h +++ b/thrust/system/cuda/detail/core/agent_launcher.h @@ -26,8 +26,9 @@ ******************************************************************************/ #pragma once -#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include + +#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include #include @@ -42,8 +43,7 @@ template class ID_impl; template class Foo { ID_impl t;}; #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace core { @@ -536,7 +536,7 @@ namespace core { max_blocks_per_sm_impl(K k, int block_threads) { int occ; - cudaError_t status = cub::MaxSmOccupancy(occ, k, block_threads); + cudaError_t status = CUB_NS_QUALIFIER::MaxSmOccupancy(occ, k, block_threads); return cuda_optional(status == cudaSuccess ? occ : -1, status); } @@ -1180,5 +1180,5 @@ namespace core { } // namespace core } -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/core/alignment.h b/thrust/system/cuda/detail/core/alignment.h index 1dc21ebce..4b807ebc1 100644 --- a/thrust/system/cuda/detail/core/alignment.h +++ b/thrust/system/cuda/detail/core/alignment.h @@ -18,10 +18,11 @@ #pragma once +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace alignment_of_detail { @@ -246,4 +247,4 @@ struct aligned_storage } // end cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/core/triple_chevron_launch.h b/thrust/system/cuda/detail/core/triple_chevron_launch.h index deeffac9d..b6d408669 100644 --- a/thrust/system/cuda/detail/core/triple_chevron_launch.h +++ b/thrust/system/cuda/detail/core/triple_chevron_launch.h @@ -32,8 +32,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace launcher { @@ -973,4 +972,4 @@ namespace launcher { } // namespace launcher } // namespace cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/core/util.h b/thrust/system/cuda/detail/core/util.h index ea4ed6400..201cec31f 100644 --- a/thrust/system/cuda/detail/core/util.h +++ b/thrust/system/cuda/detail/core/util.h @@ -36,8 +36,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace core { @@ -419,7 +418,7 @@ namespace core { #ifdef __CUDA_ARCH__ plan = get_agent_plan_dev(); #else - static cub::Mutex mutex; + static CUB_NS_QUALIFIER::Mutex mutex; bool lock = false; if (d_ptr == 0) { @@ -532,10 +531,10 @@ namespace core { typedef typename thrust::detail::conditional< is_contiguous_iterator::value, - cub::CacheModifiedInputIterator, - It>::type type; + CUB_NS_QUALIFIER::CacheModifiedInputIterator, + It>::type type; }; // struct Iterator template @@ -574,16 +573,13 @@ namespace core { class T = typename iterator_traits::value_type> struct BlockLoad { - typedef cub::BlockLoad::type::ver> - - - type; + using type = CUB_NS_QUALIFIER::BlockLoad::type::ver>; }; // BlockStore @@ -594,16 +590,16 @@ namespace core { class T = typename iterator_traits::value_type> struct BlockStore { - typedef cub::BlockStore::type::ver> - type; + using type = CUB_NS_QUALIFIER::BlockStore::type::ver>; }; - // cuda_otional + + // cuda_optional // -------------- // used for function that return cudaError_t along with the result // @@ -636,25 +632,25 @@ namespace core { get_ptx_version() { int ptx_version = 0; - cudaError_t status = cub::PtxVersion(ptx_version); + cudaError_t status = CUB_NS_QUALIFIER::PtxVersion(ptx_version); return cuda_optional(ptx_version, status); } cudaError_t THRUST_RUNTIME_FUNCTION sync_stream(cudaStream_t stream) { - return cub::SyncStream(stream); + return CUB_NS_QUALIFIER::SyncStream(stream); } inline void __device__ sync_threadblock() { - cub::CTA_SYNC(); + CUB_NS_QUALIFIER::CTA_SYNC(); } #define CUDA_CUB_RET_IF_FAIL(e) \ { \ auto const error = (e); \ - if (cub::Debug(error, __FILE__, __LINE__)) return error; \ + if (CUB_NS_QUALIFIER::Debug(error, __FILE__, __LINE__)) return error; \ } // uninitialized @@ -664,7 +660,7 @@ namespace core { template struct uninitialized { - typedef typename cub::UnitWord::DeviceWord DeviceWord; + typedef typename CUB_NS_QUALIFIER::UnitWord::DeviceWord DeviceWord; enum { @@ -756,10 +752,10 @@ namespace core { void* (&allocations)[ALLOCATIONS], size_t (&allocation_sizes)[ALLOCATIONS]) { - return cub::AliasTemporaries(storage_ptr, - storage_size, - allocations, - allocation_sizes); + return CUB_NS_QUALIFIER::AliasTemporaries(storage_ptr, + storage_size, + allocations, + allocation_sizes); } @@ -770,4 +766,4 @@ using core::sm35; using core::sm30; } // namespace cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/count.h b/thrust/system/cuda/detail/count.h index 0d8f0c02d..b624f39dc 100644 --- a/thrust/system/cuda/detail/count.h +++ b/thrust/system/cuda/detail/count.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -34,8 +35,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template &policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/cross_system.h b/thrust/system/cuda/detail/cross_system.h index 8ffdfd94f..c83e9e625 100644 --- a/thrust/system/cuda/detail/cross_system.h +++ b/thrust/system/cuda/detail/cross_system.h @@ -26,12 +26,13 @@ ******************************************************************************/ #pragma once +#include + #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template @@ -340,5 +341,5 @@ namespace cuda_cub { } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/equal.h b/thrust/system/cuda/detail/equal.h index dd5e7d686..aec608245 100644 --- a/thrust/system/cuda/detail/equal.h +++ b/thrust/system/cuda/detail/equal.h @@ -26,14 +26,14 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template & policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/error.inl b/thrust/system/cuda/detail/error.inl index 5c689b499..c208c462b 100644 --- a/thrust/system/cuda/detail/error.inl +++ b/thrust/system/cuda/detail/error.inl @@ -17,11 +17,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -94,5 +95,5 @@ const error_category &cuda_category(void) } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/execution_policy.h b/thrust/system/cuda/detail/execution_policy.h index ee49a60cb..4202424c5 100644 --- a/thrust/system/cuda/detail/execution_policy.h +++ b/thrust/system/cuda/detail/execution_policy.h @@ -27,6 +27,8 @@ #pragma once +#include + #include #include #include @@ -38,8 +40,7 @@ #include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -95,5 +96,5 @@ using thrust::cuda_cub::execution_policy; } // namespace cuda -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/extrema.h b/thrust/system/cuda/detail/extrema.h index 683dd521b..499046f9b 100644 --- a/thrust/system/cuda/detail/extrema.h +++ b/thrust/system/cuda/detail/extrema.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -39,8 +40,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __extrema { @@ -206,8 +206,8 @@ namespace __extrema { template get_max_blocks_per_sm, - cub::GridQueue, + CUB_NS_QUALIFIER::GridEvenShare, + CUB_NS_QUALIFIER::GridQueue, ReductionOp>(reduce_plan); CUDA_CUB_RET_IF_FAIL(max_blocks_per_sm.status()); @@ -218,7 +218,7 @@ namespace __extrema { int sm_oversubscription = 5; int max_blocks = reduce_device_occupancy * sm_oversubscription; - cub::GridEvenShare even_share; + CUB_NS_QUALIFIER::GridEvenShare even_share; even_share.DispatchInit(num_items, max_blocks, reduce_plan.items_per_tile); @@ -233,13 +233,13 @@ namespace __extrema { size_t allocation_sizes[3] = { max_blocks * sizeof(T), // bytes needed for privatized block reductions - cub::GridQueue::AllocationSize(), // bytes needed for grid queue descriptor0 + CUB_NS_QUALIFIER::GridQueue::AllocationSize(), // bytes needed for grid queue descriptor0 vshmem_size // size of virtualized shared memory storage }; - status = cub::AliasTemporaries(d_temp_storage, - temp_storage_bytes, - allocations, - allocation_sizes); + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, + temp_storage_bytes, + allocations, + allocation_sizes); CUDA_CUB_RET_IF_FAIL(status); if (d_temp_storage == NULL) { @@ -247,21 +247,21 @@ namespace __extrema { } T *d_block_reductions = (T*) allocations[0]; - cub::GridQueue queue(allocations[1]); + CUB_NS_QUALIFIER::GridQueue queue(allocations[1]); char *vshmem_ptr = vshmem_size > 0 ? (char *)allocations[2] : NULL; // Get grid size for device_reduce_sweep_kernel int reduce_grid_size = 0; - if (reduce_plan.grid_mapping == cub::GRID_MAPPING_RAKE) + if (reduce_plan.grid_mapping == CUB_NS_QUALIFIER::GRID_MAPPING_RAKE) { // Work is distributed evenly reduce_grid_size = even_share.grid_size; } - else if (reduce_plan.grid_mapping == cub::GRID_MAPPING_DYNAMIC) + else if (reduce_plan.grid_mapping == CUB_NS_QUALIFIER::GRID_MAPPING_DYNAMIC) { // Work is distributed dynamically - size_t num_tiles = cub::DivideAndRoundUp(num_items, reduce_plan.items_per_tile); + size_t num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, reduce_plan.items_per_tile); // if not enough to fill the device with threadblocks // then fill the device with threadblocks @@ -565,5 +565,5 @@ minmax_element(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/fill.h b/thrust/system/cuda/detail/fill.h index 078e1b378..3d012af13 100644 --- a/thrust/system/cuda/detail/fill.h +++ b/thrust/system/cuda/detail/fill.h @@ -26,13 +26,14 @@ ******************************************************************************/ #pragma once +#include + #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __fill { @@ -90,5 +91,5 @@ fill(execution_policy& policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/find.h b/thrust/system/cuda/detail/find.h index f6a1e59d1..b7d2b748f 100644 --- a/thrust/system/cuda/detail/find.h +++ b/thrust/system/cuda/detail/find.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -34,8 +35,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { // XXX forward declare to circumvent circular depedency @@ -67,13 +67,12 @@ find(execution_policy &policy, T const& value); }; // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __find_if { @@ -215,5 +214,5 @@ find(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/for_each.h b/thrust/system/cuda/detail/for_each.h index 542dcf754..128f3cfba 100644 --- a/thrust/system/cuda/detail/for_each.h +++ b/thrust/system/cuda/detail/for_each.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -36,8 +37,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -105,5 +105,5 @@ namespace cuda_cub { } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/future.inl b/thrust/system/cuda/detail/future.inl index 606a0cec5..f23184aae 100644 --- a/thrust/system/cuda/detail/future.inl +++ b/thrust/system/cuda/detail/future.inl @@ -31,8 +31,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // Forward declaration. struct new_stream_t; @@ -1367,7 +1366,7 @@ THRUST_DECLTYPE_RETURNS(std::move(dependency)) }} // namespace system::cuda -} // end namespace thrust +THRUST_NAMESPACE_END #endif // C++14 diff --git a/thrust/system/cuda/detail/gather.h b/thrust/system/cuda/detail/gather.h index 31ca3fd56..56ff3aecf 100644 --- a/thrust/system/cuda/detail/gather.h +++ b/thrust/system/cuda/detail/gather.h @@ -26,13 +26,13 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template & policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/generate.h b/thrust/system/cuda/detail/generate.h index df77901e2..ad6340f83 100644 --- a/thrust/system/cuda/detail/generate.h +++ b/thrust/system/cuda/detail/generate.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -34,8 +35,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { // for_each functor @@ -86,5 +86,5 @@ generate(execution_policy &policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/get_value.h b/thrust/system/cuda/detail/get_value.h index 9fbb0b548..c609a707d 100644 --- a/thrust/system/cuda/detail/get_value.h +++ b/thrust/system/cuda/detail/get_value.h @@ -16,15 +16,15 @@ #pragma once -#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include + +#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -93,6 +93,6 @@ inline __host__ __device__ } // end cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/inner_product.h b/thrust/system/cuda/detail/inner_product.h index bd6aec606..98e9064d2 100644 --- a/thrust/system/cuda/detail/inner_product.h +++ b/thrust/system/cuda/detail/inner_product.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -33,8 +34,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -90,5 +90,5 @@ inner_product(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/internal/copy_cross_system.h b/thrust/system/cuda/detail/internal/copy_cross_system.h index e17d99ea4..a1208c67c 100644 --- a/thrust/system/cuda/detail/internal/copy_cross_system.h +++ b/thrust/system/cuda/detail/internal/copy_cross_system.h @@ -30,6 +30,8 @@ // this file must not be included on its own, ever, // but must be part of include in thrust/system/cuda/detail/copy.h +#include + #include #include @@ -40,8 +42,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __copy { @@ -240,4 +241,4 @@ namespace __copy { } // namespace __copy } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/internal/copy_device_to_device.h b/thrust/system/cuda/detail/internal/copy_device_to_device.h index 7a6631d90..69c4e20df 100644 --- a/thrust/system/cuda/detail/internal/copy_device_to_device.h +++ b/thrust/system/cuda/detail/internal/copy_device_to_device.h @@ -27,6 +27,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -34,8 +35,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __copy { @@ -60,5 +60,5 @@ namespace __copy { } // namespace __copy } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/iter_swap.h b/thrust/system/cuda/detail/iter_swap.h index 353bb1851..60c40231c 100644 --- a/thrust/system/cuda/detail/iter_swap.h +++ b/thrust/system/cuda/detail/iter_swap.h @@ -16,16 +16,17 @@ #pragma once -#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include + +#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -62,5 +63,5 @@ void iter_swap(thrust::cuda::execution_policy &, Pointer1 a, Poin } // end cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/make_unsigned_special.h b/thrust/system/cuda/detail/make_unsigned_special.h index 683647cbe..dda735767 100644 --- a/thrust/system/cuda/detail/make_unsigned_special.h +++ b/thrust/system/cuda/detail/make_unsigned_special.h @@ -16,8 +16,9 @@ #pragma once -namespace thrust -{ +#include + +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace detail { @@ -38,5 +39,5 @@ namespace detail { } } -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/malloc_and_free.h b/thrust/system/cuda/detail/malloc_and_free.h index 3d72381b5..121a76637 100644 --- a/thrust/system/cuda/detail/malloc_and_free.h +++ b/thrust/system/cuda/detail/malloc_and_free.h @@ -30,16 +30,15 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { #ifdef THRUST_CACHING_DEVICE_MALLOC #define __CUB_CACHING_MALLOC #ifndef __CUDA_ARCH__ -inline cub::CachingDeviceAllocator &get_allocator() +inline CUB_NS_QUALIFIER::CachingDeviceAllocator &get_allocator() { - static cub::CachingDeviceAllocator g_allocator(true); + static CUB_NS_QUALIFIER::CachingDeviceAllocator g_allocator(true); return g_allocator; } #endif @@ -57,7 +56,7 @@ void *malloc(execution_policy &, std::size_t n) if (THRUST_IS_HOST_CODE) { #if THRUST_INCLUDE_HOST_CODE #ifdef __CUB_CACHING_MALLOC - cub::CachingDeviceAllocator &alloc = get_allocator(); + CUB_NS_QUALIFIER::CachingDeviceAllocator &alloc = get_allocator(); cudaError_t status = alloc.DeviceAllocate(&result, n); #else cudaError_t status = cudaMalloc(&result, n); @@ -86,7 +85,7 @@ void free(execution_policy &, Pointer ptr) if (THRUST_IS_HOST_CODE) { #if THRUST_INCLUDE_HOST_CODE #ifdef __CUB_CACHING_MALLOC - cub::CachingDeviceAllocator &alloc = get_allocator(); + CUB_NS_QUALIFIER::CachingDeviceAllocator &alloc = get_allocator(); cudaError_t status = alloc.DeviceFree(thrust::raw_pointer_cast(ptr)); #else cudaError_t status = cudaFree(thrust::raw_pointer_cast(ptr)); @@ -101,4 +100,4 @@ void free(execution_policy &, Pointer ptr) } // end free() } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/memory.inl b/thrust/system/cuda/detail/memory.inl index 82a04b67d..f6fc98359 100644 --- a/thrust/system/cuda/detail/memory.inl +++ b/thrust/system/cuda/detail/memory.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -49,5 +48,5 @@ void free(pointer ptr) } // end free() } // end cuda_cub -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/merge.h b/thrust/system/cuda/detail/merge.h index 5a223b606..0cb3a20fe 100644 --- a/thrust/system/cuda/detail/merge.h +++ b/thrust/system/cuda/detail/merge.h @@ -26,6 +26,8 @@ j * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. ******************************************************************************/ #pragma once +#include + #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include @@ -43,8 +45,7 @@ j * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __merge { @@ -128,9 +129,9 @@ namespace __merge { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockStoreAlgorithm _STORE_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_STORE_DIRECT> struct PtxPolicy { enum @@ -140,9 +141,9 @@ namespace __merge { ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD, }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; }; // PtxPolicy template + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; // Tuning sm300 @@ -241,9 +242,9 @@ namespace __merge { typedef PtxPolicy<512, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; // Tuning sm52 @@ -259,9 +260,9 @@ namespace __merge { typedef PtxPolicy<512, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; // Tuning sm52 @@ -279,9 +280,9 @@ namespace __merge { typedef PtxPolicy<256, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; // Tuning sm350 @@ -1014,5 +1015,5 @@ merge_by_key(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/mismatch.h b/thrust/system/cuda/detail/mismatch.h index 98c462e84..b1e2f44d2 100644 --- a/thrust/system/cuda/detail/mismatch.h +++ b/thrust/system/cuda/detail/mismatch.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -33,8 +34,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template & policy, InputIt1 last1, InputIt2 first2); } // namespace cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template & policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/par.h b/thrust/system/cuda/detail/par.h index 48a2e19d4..adbc48d4b 100644 --- a/thrust/system/cuda/detail/par.h +++ b/thrust/system/cuda/detail/par.h @@ -38,8 +38,7 @@ #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template @@ -121,5 +120,5 @@ namespace cuda { using thrust::cuda_cub::par; } // namespace cuda -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/par_to_seq.h b/thrust/system/cuda/detail/par_to_seq.h index 22c4e5838..833634982 100644 --- a/thrust/system/cuda/detail/par_to_seq.h +++ b/thrust/system/cuda/detail/par_to_seq.h @@ -26,11 +26,12 @@ ******************************************************************************/ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template @@ -88,4 +89,4 @@ cvt_to_seq(Policy& policy) #endif } // namespace cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/parallel_for.h b/thrust/system/cuda/detail/parallel_for.h index 17fa7e7a8..be4ff14a5 100644 --- a/thrust/system/cuda/detail/parallel_for.h +++ b/thrust/system/cuda/detail/parallel_for.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -36,8 +37,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -174,5 +174,5 @@ parallel_for(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/partition.h b/thrust/system/cuda/detail/partition.h index e656e04f7..8065f0fd4 100644 --- a/thrust/system/cuda/detail/partition.h +++ b/thrust/system/cuda/detail/partition.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -45,17 +46,16 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __partition { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockScanAlgorithm _SCAN_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> struct PtxPolicy { enum @@ -64,9 +64,9 @@ namespace __partition { ITEMS_PER_THREAD = _ITEMS_PER_THREAD, ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; }; // struct PtxPolicy template @@ -85,9 +85,9 @@ namespace __partition { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning<350> @@ -104,9 +104,9 @@ namespace __partition { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning<300> @@ -137,7 +137,7 @@ namespace __partition { typedef typename iterator_traits::value_type stencil_type; - typedef cub::ScanTileState ScanTileState; + typedef CUB_NS_QUALIFIER::ScanTileState ScanTileState; template struct PtxPlan : Tuning::type @@ -150,17 +150,17 @@ namespace __partition { typedef typename core::BlockLoad::type BlockLoadItems; typedef typename core::BlockLoad::type BlockLoadStencil; - typedef cub::TilePrefixCallbackOp TilePrefixCallback; - typedef cub::BlockScan + typedef CUB_NS_QUALIFIER::BlockScan BlockScan; @@ -441,7 +441,7 @@ namespace __partition { { TilePrefixCallback prefix_cb(tile_state, temp_storage.scan_storage.prefix, - cub::Sum(), + CUB_NS_QUALIFIER::Sum(), tile_idx); BlockScan(temp_storage.scan_storage.scan) .ExclusiveSum(selection_flags, @@ -647,7 +647,7 @@ namespace __partition { typename get_plan::type partition_plan = partition_agent::get_plan(stream); int tile_size = partition_plan.items_per_tile; - size_t num_tiles = cub::DivideAndRoundUp(num_items, tile_size); + size_t num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, tile_size); size_t vshmem_storage = core::vshmem_size(partition_plan.shared_memory_size, num_tiles); @@ -662,10 +662,10 @@ namespace __partition { void* allocations[2] = {NULL, NULL}; - status = cub::AliasTemporaries(d_temp_storage, - temp_storage_bytes, - allocations, - allocation_sizes); + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, + temp_storage_bytes, + allocations, + allocation_sizes); CUDA_CUB_RET_IF_FAIL(status); if (d_temp_storage == NULL) @@ -1144,5 +1144,5 @@ is_partitioned(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/per_device_resource.h b/thrust/system/cuda/detail/per_device_resource.h index 68f7194af..414ea7788 100644 --- a/thrust/system/cuda/detail/per_device_resource.h +++ b/thrust/system/cuda/detail/per_device_resource.h @@ -43,8 +43,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -65,7 +64,7 @@ MR * get_per_device_resource(execution_policy&) } -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/reduce.h b/thrust/system/cuda/detail/reduce.h index fac2b1d7a..a238baf21 100644 --- a/thrust/system/cuda/detail/reduce.h +++ b/thrust/system/cuda/detail/reduce.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -48,8 +49,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declare generic reduce // to circumvent circular dependency @@ -76,9 +76,9 @@ namespace __reduce { template + CUB_NS_QUALIFIER::BlockReduceAlgorithm _BLOCK_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_REDUCE_RAKING, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::GridMappingStrategy _GRID_MAPPING = CUB_NS_QUALIFIER::GRID_MAPPING_DYNAMIC> struct PtxPolicy { enum @@ -89,9 +89,9 @@ namespace __reduce { ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD }; - static const cub::BlockReduceAlgorithm BLOCK_ALGORITHM = _BLOCK_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::GridMappingStrategy GRID_MAPPING = _GRID_MAPPING; + static const CUB_NS_QUALIFIER::BlockReduceAlgorithm BLOCK_ALGORITHM = _BLOCK_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::GridMappingStrategy GRID_MAPPING = _GRID_MAPPING; }; // struct PtxPolicy template @@ -111,9 +111,9 @@ namespace __reduce { typedef PtxPolicy<256, CUB_MAX(1, 20 / SCALE_FACTOR_4B), 2, - cub::BLOCK_REDUCE_WARP_REDUCTIONS, - cub::LOAD_DEFAULT, - cub::GRID_MAPPING_RAKE> + CUB_NS_QUALIFIER::BLOCK_REDUCE_WARP_REDUCTIONS, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::GRID_MAPPING_RAKE> type; }; // Tuning sm30 @@ -124,18 +124,18 @@ namespace __reduce { typedef PtxPolicy<128, CUB_MAX(1, 24 / Tuning::SCALE_FACTOR_1B), 4, - cub::BLOCK_REDUCE_WARP_REDUCTIONS, - cub::LOAD_LDG, - cub::GRID_MAPPING_DYNAMIC> + CUB_NS_QUALIFIER::BLOCK_REDUCE_WARP_REDUCTIONS, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::GRID_MAPPING_DYNAMIC> ReducePolicy1B; // ReducePolicy4B types (GTX Titan: 255.1 GB/s @ 48M 4B items) typedef PtxPolicy<256, CUB_MAX(1, 20 / Tuning::SCALE_FACTOR_4B), 4, - cub::BLOCK_REDUCE_WARP_REDUCTIONS, - cub::LOAD_LDG, - cub::GRID_MAPPING_DYNAMIC> + CUB_NS_QUALIFIER::BLOCK_REDUCE_WARP_REDUCTIONS, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::GRID_MAPPING_DYNAMIC> ReducePolicy4B; typedef typename thrust::detail::conditional<(sizeof(T) < 4), @@ -161,9 +161,9 @@ namespace __reduce { // typedef Tuning tuning; - typedef typename cub::CubVector Vector; + typedef typename CUB_NS_QUALIFIER::CubVector Vector; typedef typename core::LoadIterator::type LoadIt; - typedef cub::BlockReduce BlockReduce; - typedef cub::CacheModifiedInputIterator VectorLoadIt; @@ -194,7 +194,7 @@ namespace __reduce { // struct Plan : core::AgentPlan { - cub::GridMappingStrategy grid_mapping; + CUB_NS_QUALIFIER::GridMappingStrategy grid_mapping; template THRUST_RUNTIME_FUNCTION @@ -297,14 +297,14 @@ namespace __reduce { T items[ITEMS_PER_THREAD]; // Load items in striped fashion - cub::LoadDirectStriped(threadIdx.x, + CUB_NS_QUALIFIER::LoadDirectStriped(threadIdx.x, load_it + block_offset, items); // Reduce items within each thread stripe thread_aggregate = - (IS_FIRST_TILE) ? cub::internal::ThreadReduce(items, reduction_op) - : cub::internal::ThreadReduce(items, reduction_op, + (IS_FIRST_TILE) ? CUB_NS_QUALIFIER::internal::ThreadReduce(items, reduction_op) + : CUB_NS_QUALIFIER::internal::ThreadReduce(items, reduction_op, thread_aggregate); } @@ -343,8 +343,8 @@ namespace __reduce { // Reduce items within each thread stripe thread_aggregate = - (IS_FIRST_TILE) ? cub::internal::ThreadReduce(items, reduction_op) - : cub::internal::ThreadReduce(items, reduction_op, + (IS_FIRST_TILE) ? CUB_NS_QUALIFIER::internal::ThreadReduce(items, reduction_op) + : CUB_NS_QUALIFIER::internal::ThreadReduce(items, reduction_op, thread_aggregate); } @@ -460,9 +460,9 @@ namespace __reduce { // THRUST_DEVICE_FUNCTION T consume_tiles(Size /*num_items*/, - cub::GridEvenShare &even_share, - cub::GridQueue & /*queue*/, - thrust::detail::integral_constant /*is_rake*/) + CUB_NS_QUALIFIER::GridEvenShare &even_share, + CUB_NS_QUALIFIER::GridQueue & /*queue*/, + thrust::detail::integral_constant /*is_rake*/) { typedef is_true attempt_vec; typedef is_true path_a; @@ -470,7 +470,7 @@ namespace __reduce { // Initialize even-share descriptor for this thread block even_share - .template BlockInit(); + .template BlockInit(); return is_aligned(input_it, attempt_vec()) ? consume_range_impl(even_share.block_offset, @@ -491,7 +491,7 @@ namespace __reduce { template THRUST_DEVICE_FUNCTION T consume_tiles_impl(Size num_items, - cub::GridQueue queue, + CUB_NS_QUALIFIER::GridQueue queue, CAN_VECTORIZE can_vectorize) { using core::sync_threadblock; @@ -578,9 +578,9 @@ namespace __reduce { THRUST_DEVICE_FUNCTION T consume_tiles( Size num_items, - cub::GridEvenShare &/*even_share*/, - cub::GridQueue & queue, - thrust::detail::integral_constant) + CUB_NS_QUALIFIER::GridEvenShare &/*even_share*/, + CUB_NS_QUALIFIER::GridQueue & queue, + thrust::detail::integral_constant) { typedef is_true attempt_vec; typedef is_true path_a; @@ -646,14 +646,14 @@ namespace __reduce { THRUST_AGENT_ENTRY(InputIt input_it, OutputIt output_it, Size num_items, - cub::GridEvenShare even_share, - cub::GridQueue queue, + CUB_NS_QUALIFIER::GridEvenShare even_share, + CUB_NS_QUALIFIER::GridQueue queue, ReductionOp reduction_op, char * shmem) { TempStorage& storage = *reinterpret_cast(shmem); - typedef thrust::detail::integral_constant grid_mapping; + typedef thrust::detail::integral_constant grid_mapping; T block_aggregate = impl(storage, input_it, reduction_op) @@ -677,7 +677,7 @@ namespace __reduce { // Agent entry point //--------------------------------------------------------------------- - THRUST_AGENT_ENTRY(cub::GridQueue grid_queue, + THRUST_AGENT_ENTRY(CUB_NS_QUALIFIER::GridQueue grid_queue, Size num_items, char * /*shmem*/) { @@ -749,8 +749,8 @@ namespace __reduce { template get_max_blocks_per_sm, - cub::GridQueue, + CUB_NS_QUALIFIER::GridEvenShare, + CUB_NS_QUALIFIER::GridQueue, ReductionOp>(reduce_plan); CUDA_CUB_RET_IF_FAIL(max_blocks_per_sm.status()); @@ -761,7 +761,7 @@ namespace __reduce { int sm_oversubscription = 5; int max_blocks = reduce_device_occupancy * sm_oversubscription; - cub::GridEvenShare even_share; + CUB_NS_QUALIFIER::GridEvenShare even_share; even_share.DispatchInit(static_cast(num_items), max_blocks, reduce_plan.items_per_tile); @@ -776,10 +776,10 @@ namespace __reduce { size_t allocation_sizes[3] = { max_blocks * sizeof(T), // bytes needed for privatized block reductions - cub::GridQueue::AllocationSize(), // bytes needed for grid queue descriptor0 + CUB_NS_QUALIFIER::GridQueue::AllocationSize(), // bytes needed for grid queue descriptor0 vshmem_size // size of virtualized shared memory storage }; - status = cub::AliasTemporaries(d_temp_storage, + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, temp_storage_bytes, allocations, allocation_sizes); @@ -790,21 +790,21 @@ namespace __reduce { } T *d_block_reductions = (T*) allocations[0]; - cub::GridQueue queue(allocations[1]); + CUB_NS_QUALIFIER::GridQueue queue(allocations[1]); char *vshmem_ptr = vshmem_size > 0 ? (char *)allocations[2] : NULL; // Get grid size for device_reduce_sweep_kernel int reduce_grid_size = 0; - if (reduce_plan.grid_mapping == cub::GRID_MAPPING_RAKE) + if (reduce_plan.grid_mapping == CUB_NS_QUALIFIER::GRID_MAPPING_RAKE) { // Work is distributed evenly reduce_grid_size = even_share.grid_size; } - else if (reduce_plan.grid_mapping == cub::GRID_MAPPING_DYNAMIC) + else if (reduce_plan.grid_mapping == CUB_NS_QUALIFIER::GRID_MAPPING_DYNAMIC) { // Work is distributed dynamically - size_t num_tiles = cub::DivideAndRoundUp(num_items, reduce_plan.items_per_tile); + size_t num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, reduce_plan.items_per_tile); // if not enough to fill the device with threadblocks // then fill the device with threadblocks @@ -944,8 +944,8 @@ T reduce_n_impl(execution_policy& policy, size_t tmp_size = 0; THRUST_INDEX_TYPE_DISPATCH2(status, - cub::DeviceReduce::Reduce, - (cub::DispatchReduce< + CUB_NS_QUALIFIER::DeviceReduce::Reduce, + (CUB_NS_QUALIFIER::DispatchReduce< InputIt, T*, Size, BinaryOp >::Dispatch), num_items, @@ -972,8 +972,8 @@ T reduce_n_impl(execution_policy& policy, T* ret_ptr = thrust::detail::aligned_reinterpret_cast(tmp.data().get()); void* tmp_ptr = static_cast((tmp.data() + sizeof(T)).get()); THRUST_INDEX_TYPE_DISPATCH2(status, - cub::DeviceReduce::Reduce, - (cub::DispatchReduce< + CUB_NS_QUALIFIER::DeviceReduce::Reduce, + (CUB_NS_QUALIFIER::DispatchReduce< InputIt, T*, Size, BinaryOp >::Dispatch), num_items, @@ -1069,7 +1069,7 @@ reduce(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #include #include diff --git a/thrust/system/cuda/detail/reduce_by_key.h b/thrust/system/cuda/detail/reduce_by_key.h index e24c5cc05..53e039e3e 100644 --- a/thrust/system/cuda/detail/reduce_by_key.h +++ b/thrust/system/cuda/detail/reduce_by_key.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -49,8 +50,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BlockScanAlgorithm _SCAN_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> struct PtxPolicy { enum @@ -91,9 +91,9 @@ namespace __reduce_by_key { ITEMS_PER_TILE = BLOCK_THREADS * ITEMS_PER_THREAD }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; }; // struct PtxPolicy template @@ -122,9 +122,9 @@ namespace __reduce_by_key { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning sm30 @@ -151,9 +151,9 @@ namespace __reduce_by_key { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning sm35 @@ -180,9 +180,9 @@ namespace __reduce_by_key { typedef PtxPolicy<256, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning sm52 @@ -200,11 +200,11 @@ namespace __reduce_by_key { typedef typename iterator_traits::value_type value_type; typedef Size size_type; - typedef cub::KeyValuePair size_value_pair_t; - typedef cub::KeyValuePair key_value_pair_t; + typedef CUB_NS_QUALIFIER::KeyValuePair size_value_pair_t; + typedef CUB_NS_QUALIFIER::KeyValuePair key_value_pair_t; - typedef cub::ReduceByKeyScanTileState ScanTileState; - typedef cub::ReduceBySegmentOp ReduceBySegmentOp; + typedef CUB_NS_QUALIFIER::ReduceByKeyScanTileState ScanTileState; + typedef CUB_NS_QUALIFIER::ReduceBySegmentOp ReduceBySegmentOp; template struct PtxPlan : Tuning::type @@ -217,19 +217,19 @@ namespace __reduce_by_key { typedef typename core::BlockLoad::type BlockLoadKeys; typedef typename core::BlockLoad::type BlockLoadValues; - typedef cub::BlockDiscontinuity BlockDiscontinuityKeys; - typedef cub::TilePrefixCallbackOp TilePrefixCallback; - typedef cub::BlockScan inequality_op; + CUB_NS_QUALIFIER::InequalityWrapper inequality_op; ReduceBySegmentOp scan_op; //--------------------------------------------------------------------- @@ -911,7 +911,7 @@ namespace __reduce_by_key { // Number of input tiles int tile_size = reduce_by_key_plan.items_per_tile; - Size num_tiles = cub::DivideAndRoundUp(num_items, tile_size); + Size num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, tile_size); size_t vshmem_size = core::vshmem_size(reduce_by_key_plan.shared_memory_size, num_tiles); @@ -921,7 +921,7 @@ namespace __reduce_by_key { CUDA_CUB_RET_IF_FAIL(status); void *allocations[2] = {NULL, NULL}; - status = cub::AliasTemporaries(d_temp_storage, + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, temp_storage_bytes, allocations, allocation_sizes); @@ -1162,7 +1162,7 @@ reduce_by_key(execution_policy &policy, } // namespace cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END #include #include diff --git a/thrust/system/cuda/detail/remove.h b/thrust/system/cuda/detail/remove.h index 700c95f23..836d8f5ea 100644 --- a/thrust/system/cuda/detail/remove.h +++ b/thrust/system/cuda/detail/remove.h @@ -26,12 +26,12 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { // in-place @@ -130,5 +130,5 @@ remove_copy(execution_policy &policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/replace.h b/thrust/system/cuda/detail/replace.h index 3bd685108..af8b8fa95 100644 --- a/thrust/system/cuda/detail/replace.h +++ b/thrust/system/cuda/detail/replace.h @@ -26,13 +26,13 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __replace @@ -209,5 +209,5 @@ replace_copy(execution_policy &policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/reverse.h b/thrust/system/cuda/detail/reverse.h index 43cdf77fd..7c4cb867e 100644 --- a/thrust/system/cuda/detail/reverse.h +++ b/thrust/system/cuda/detail/reverse.h @@ -26,12 +26,12 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template @@ -48,7 +48,7 @@ reverse(execution_policy &policy, ItemsIt last); } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #include #include @@ -56,8 +56,7 @@ reverse(execution_policy &policy, #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/scan.h b/thrust/system/cuda/detail/scan.h index ebfc61546..28aa98699 100644 --- a/thrust/system/cuda/detail/scan.h +++ b/thrust/system/cuda/detail/scan.h @@ -26,6 +26,8 @@ ******************************************************************************/ #pragma once +#include + #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -38,8 +40,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace detail @@ -58,16 +59,16 @@ OutputIt inclusive_scan_n_impl(thrust::cuda_cub::execution_policy &poli OutputIt result, ScanOp scan_op) { - using Dispatch32 = cub::DispatchScan; - using Dispatch64 = cub::DispatchScan; + using Dispatch32 = CUB_NS_QUALIFIER::DispatchScan; + using Dispatch64 = CUB_NS_QUALIFIER::DispatchScan; cudaStream_t stream = thrust::cuda_cub::stream(policy); cudaError_t status; @@ -84,7 +85,7 @@ OutputIt inclusive_scan_n_impl(thrust::cuda_cub::execution_policy &poli first, result, scan_op, - cub::NullType{}, + CUB_NS_QUALIFIER::NullType{}, num_items_fixed, stream, THRUST_DEBUG_SYNC_FLAG)); @@ -108,7 +109,7 @@ OutputIt inclusive_scan_n_impl(thrust::cuda_cub::execution_policy &poli first, result, scan_op, - cub::NullType{}, + CUB_NS_QUALIFIER::NullType{}, num_items_fixed, stream, THRUST_DEBUG_SYNC_FLAG)); @@ -136,16 +137,16 @@ OutputIt exclusive_scan_n_impl(thrust::cuda_cub::execution_policy &poli InitValueT init, ScanOp scan_op) { - using Dispatch32 = cub::DispatchScan; - using Dispatch64 = cub::DispatchScan; + using Dispatch32 = CUB_NS_QUALIFIER::DispatchScan; + using Dispatch64 = CUB_NS_QUALIFIER::DispatchScan; cudaStream_t stream = thrust::cuda_cub::stream(policy); cudaError_t status; @@ -361,7 +362,7 @@ OutputIt exclusive_scan(thrust::cuda_cub::execution_policy &policy, }; } // namespace cuda_cub -} // namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/cuda/detail/scan_by_key.h b/thrust/system/cuda/detail/scan_by_key.h index fe4b321c0..2bbe8b189 100644 --- a/thrust/system/cuda/detail/scan_by_key.h +++ b/thrust/system/cuda/detail/scan_by_key.h @@ -26,6 +26,8 @@ ******************************************************************************/ #pragma once +#include + #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include @@ -40,8 +42,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __scan_by_key { @@ -49,10 +50,10 @@ namespace __scan_by_key { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BlockScanAlgorithm _SCAN_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS, + CUB_NS_QUALIFIER::BlockStoreAlgorithm _STORE_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_STORE_DIRECT> struct PtxPolicy { enum @@ -62,10 +63,10 @@ namespace __scan_by_key { ITEMS_PER_TILE = BLOCK_THREADS * ITEMS_PER_THREAD, }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; - static const cub::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; }; // struct PtxPolicy template @@ -94,10 +95,10 @@ namespace __scan_by_key { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; // Tuning sm30 @@ -124,10 +125,10 @@ namespace __scan_by_key { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; // Tuning sm35 @@ -154,10 +155,10 @@ namespace __scan_by_key { typedef PtxPolicy<256, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; // Tuning sm52 @@ -176,11 +177,11 @@ namespace __scan_by_key { typedef T value_type; typedef Size size_type; - typedef cub::KeyValuePair size_value_pair_t; - typedef cub::KeyValuePair key_value_pair_t; + typedef CUB_NS_QUALIFIER::KeyValuePair size_value_pair_t; + typedef CUB_NS_QUALIFIER::KeyValuePair key_value_pair_t; - typedef cub::ReduceByKeyScanTileState ScanTileState; - typedef cub::ReduceBySegmentOp ReduceBySegmentOp; + typedef CUB_NS_QUALIFIER::ReduceByKeyScanTileState ScanTileState; + typedef CUB_NS_QUALIFIER::ReduceBySegmentOp ReduceBySegmentOp; template struct PtxPlan : Tuning::type @@ -197,19 +198,19 @@ namespace __scan_by_key { ValuesOutputIt, value_type>::type BlockStoreValues; - typedef cub::BlockDiscontinuity BlockDiscontinuityKeys; - typedef cub::TilePrefixCallbackOp TilePrefixCallback; - typedef cub::BlockScan inequality_op; + CUB_NS_QUALIFIER::InequalityWrapper inequality_op; ReduceBySegmentOp scan_op; @@ -672,7 +673,7 @@ namespace __scan_by_key { AgentPlan init_plan = init_agent::get_plan(); int tile_size = scan_by_key_plan.items_per_tile; - size_t num_tiles = cub::DivideAndRoundUp(num_items, tile_size); + size_t num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, tile_size); size_t vshmem_size = core::vshmem_size(scan_by_key_plan.shared_memory_size, num_tiles); @@ -682,7 +683,7 @@ namespace __scan_by_key { CUDA_CUB_RET_IF_FAIL(status); void *allocations[2] = {NULL, NULL}; - status = cub::AliasTemporaries(d_temp_storage, + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, temp_storage_bytes, allocations, allocation_sizes); @@ -999,7 +1000,7 @@ exclusive_scan_by_key(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/cuda/detail/scatter.h b/thrust/system/cuda/detail/scatter.h index 3ba0a4b74..e297d782d 100644 --- a/thrust/system/cuda/detail/scatter.h +++ b/thrust/system/cuda/detail/scatter.h @@ -26,13 +26,13 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template & policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/set_operations.h b/thrust/system/cuda/detail/set_operations.h index a86289de2..34cc02a16 100644 --- a/thrust/system/cuda/detail/set_operations.h +++ b/thrust/system/cuda/detail/set_operations.h @@ -26,6 +26,8 @@ ******************************************************************************/ #pragma once +#include + #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -42,8 +44,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -202,9 +203,9 @@ namespace __set_operations { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockScanAlgorithm _SCAN_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> struct PtxPolicy { enum @@ -214,9 +215,9 @@ namespace __set_operations { ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD - 1 }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; }; // PtxPolicy template @@ -245,9 +246,9 @@ namespace __set_operations { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // tuning sm30 @@ -272,9 +273,9 @@ namespace __set_operations { typedef PtxPolicy<256, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // tuning sm52 @@ -299,9 +300,9 @@ namespace __set_operations { typedef PtxPolicy<512, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // tuning sm60 @@ -325,7 +326,7 @@ namespace __set_operations { typedef key1_type key_type; typedef value1_type value_type; - typedef cub::ScanTileState ScanTileState; + typedef CUB_NS_QUALIFIER::ScanTileState ScanTileState; template struct PtxPlan : Tuning::type @@ -342,13 +343,13 @@ namespace __set_operations { typedef typename core::BlockLoad::type BlockLoadValues1; typedef typename core::BlockLoad::type BlockLoadValues2; - typedef cub::TilePrefixCallbackOp TilePrefixCallback; - typedef cub::BlockScan &policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/sort.h b/thrust/system/cuda/detail/sort.h index 4a1be80cd..37b896646 100644 --- a/thrust/system/cuda/detail/sort.h +++ b/thrust/system/cuda/detail/sort.h @@ -26,6 +26,8 @@ ******************************************************************************/ #pragma once +#include + #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include @@ -46,8 +48,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __merge_sort { @@ -131,9 +132,9 @@ namespace __merge_sort { template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockStoreAlgorithm _STORE_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_STORE_DIRECT> struct PtxPolicy { enum @@ -143,9 +144,9 @@ namespace __merge_sort { ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD, }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockStoreAlgorithm STORE_ALGORITHM = _STORE_ALGORITHM; }; // PtxPolicy @@ -165,9 +166,9 @@ namespace __merge_sort { typedef PtxPolicy<256, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; @@ -184,9 +185,9 @@ namespace __merge_sort { typedef PtxPolicy<512, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; @@ -203,9 +204,9 @@ namespace __merge_sort { typedef PtxPolicy<256, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; @@ -220,9 +221,9 @@ namespace __merge_sort { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_STORE_WARP_TRANSPOSE> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_STORE_WARP_TRANSPOSE> type; }; @@ -1334,13 +1335,13 @@ namespace __radix_sort { THRUST_RUNTIME_FUNCTION static cudaError_t doit(void* d_temp_storage, size_t& temp_storage_bytes, - cub::DoubleBuffer& keys_buffer, - cub::DoubleBuffer& /*items_buffer*/, + CUB_NS_QUALIFIER::DoubleBuffer& keys_buffer, + CUB_NS_QUALIFIER::DoubleBuffer& /*items_buffer*/, Size count, cudaStream_t stream, bool debug_sync) { - return cub::DeviceRadixSort::SortKeys(d_temp_storage, + return CUB_NS_QUALIFIER::DeviceRadixSort::SortKeys(d_temp_storage, temp_storage_bytes, keys_buffer, static_cast(count), @@ -1359,13 +1360,13 @@ namespace __radix_sort { THRUST_RUNTIME_FUNCTION static cudaError_t doit(void* d_temp_storage, size_t& temp_storage_bytes, - cub::DoubleBuffer& keys_buffer, - cub::DoubleBuffer& /*items_buffer*/, + CUB_NS_QUALIFIER::DoubleBuffer& keys_buffer, + CUB_NS_QUALIFIER::DoubleBuffer& /*items_buffer*/, Size count, cudaStream_t stream, bool debug_sync) { - return cub::DeviceRadixSort::SortKeysDescending(d_temp_storage, + return CUB_NS_QUALIFIER::DeviceRadixSort::SortKeysDescending(d_temp_storage, temp_storage_bytes, keys_buffer, static_cast(count), @@ -1384,13 +1385,13 @@ namespace __radix_sort { THRUST_RUNTIME_FUNCTION static cudaError_t doit(void* d_temp_storage, size_t& temp_storage_bytes, - cub::DoubleBuffer& keys_buffer, - cub::DoubleBuffer& items_buffer, + CUB_NS_QUALIFIER::DoubleBuffer& keys_buffer, + CUB_NS_QUALIFIER::DoubleBuffer& items_buffer, Size count, cudaStream_t stream, bool debug_sync) { - return cub::DeviceRadixSort::SortPairs(d_temp_storage, + return CUB_NS_QUALIFIER::DeviceRadixSort::SortPairs(d_temp_storage, temp_storage_bytes, keys_buffer, items_buffer, @@ -1410,13 +1411,13 @@ namespace __radix_sort { THRUST_RUNTIME_FUNCTION static cudaError_t doit(void* d_temp_storage, size_t& temp_storage_bytes, - cub::DoubleBuffer& keys_buffer, - cub::DoubleBuffer& items_buffer, + CUB_NS_QUALIFIER::DoubleBuffer& keys_buffer, + CUB_NS_QUALIFIER::DoubleBuffer& items_buffer, Size count, cudaStream_t stream, bool debug_sync) { - return cub::DeviceRadixSort::SortPairsDescending(d_temp_storage, + return CUB_NS_QUALIFIER::DeviceRadixSort::SortPairsDescending(d_temp_storage, temp_storage_bytes, keys_buffer, items_buffer, @@ -1445,8 +1446,8 @@ namespace __radix_sort { cudaStream_t stream = cuda_cub::stream(policy); bool debug_sync = THRUST_DEBUG_SYNC_FLAG; - cub::DoubleBuffer keys_buffer(keys, NULL); - cub::DoubleBuffer items_buffer(items, NULL); + CUB_NS_QUALIFIER::DoubleBuffer keys_buffer(keys, NULL); + CUB_NS_QUALIFIER::DoubleBuffer items_buffer(items, NULL); Size keys_count = count; Size items_count = SORT_ITEMS::value ? count : 0; @@ -1755,5 +1756,5 @@ stable_sort_by_key( } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/swap_ranges.h b/thrust/system/cuda/detail/swap_ranges.h index ba3b47d9b..52b73a434 100644 --- a/thrust/system/cuda/detail/swap_ranges.h +++ b/thrust/system/cuda/detail/swap_ranges.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -35,8 +36,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -103,5 +103,5 @@ swap_ranges(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/tabulate.h b/thrust/system/cuda/detail/tabulate.h index 70b2720d9..9c9baaf7e 100644 --- a/thrust/system/cuda/detail/tabulate.h +++ b/thrust/system/cuda/detail/tabulate.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -34,8 +35,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { namespace __tabulate { @@ -84,5 +84,5 @@ tabulate(execution_policy& policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/terminate.h b/thrust/system/cuda/detail/terminate.h index d14bed2ab..226c9d5ac 100644 --- a/thrust/system/cuda/detail/terminate.h +++ b/thrust/system/cuda/detail/terminate.h @@ -31,8 +31,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda @@ -59,5 +58,5 @@ void terminate_with_message(const char* message) } // end detail } // end cuda } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/detail/transform.h b/thrust/system/cuda/detail/transform.h index 053fe9095..8419de2e8 100644 --- a/thrust/system/cuda/detail/transform.h +++ b/thrust/system/cuda/detail/transform.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -35,8 +36,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -422,5 +422,5 @@ transform(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/transform_reduce.h b/thrust/system/cuda/detail/transform_reduce.h index e9a193f24..60efaae5a 100644 --- a/thrust/system/cuda/detail/transform_reduce.h +++ b/thrust/system/cuda/detail/transform_reduce.h @@ -26,14 +26,14 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { template &policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/transform_scan.h b/thrust/system/cuda/detail/transform_scan.h index d8814a9ed..cb81a1ab0 100644 --- a/thrust/system/cuda/detail/transform_scan.h +++ b/thrust/system/cuda/detail/transform_scan.h @@ -26,14 +26,14 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -109,5 +109,5 @@ transform_exclusive_scan(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/uninitialized_copy.h b/thrust/system/cuda/detail/uninitialized_copy.h index 8d916e33b..6ad3cf698 100644 --- a/thrust/system/cuda/detail/uninitialized_copy.h +++ b/thrust/system/cuda/detail/uninitialized_copy.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -34,8 +35,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -112,5 +112,5 @@ uninitialized_copy(execution_policy& policy, } // namespace cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/uninitialized_fill.h b/thrust/system/cuda/detail/uninitialized_fill.h index a8f5fa809..23aa7b899 100644 --- a/thrust/system/cuda/detail/uninitialized_fill.h +++ b/thrust/system/cuda/detail/uninitialized_fill.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -34,8 +35,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -110,5 +110,5 @@ uninitialized_fill(execution_policy& policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #endif diff --git a/thrust/system/cuda/detail/unique.h b/thrust/system/cuda/detail/unique.h index 5dfcc7aec..a0e7ca0aa 100644 --- a/thrust/system/cuda/detail/unique.h +++ b/thrust/system/cuda/detail/unique.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -44,8 +45,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockScanAlgorithm _SCAN_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> struct PtxPolicy { enum @@ -89,9 +89,9 @@ namespace __unique { ITEMS_PER_THREAD = _ITEMS_PER_THREAD, ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD, }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; }; // struct PtxPolicy template @@ -128,9 +128,9 @@ namespace __unique { typedef PtxPolicy<64, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning for sm52 @@ -149,9 +149,9 @@ namespace __unique { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning for sm35 @@ -169,9 +169,9 @@ namespace __unique { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning for sm30 @@ -184,7 +184,7 @@ namespace __unique { { typedef typename iterator_traits::value_type item_type; - typedef cub::ScanTileState ScanTileState; + typedef CUB_NS_QUALIFIER::ScanTileState ScanTileState; template struct PtxPlan : Tuning::type @@ -195,19 +195,19 @@ namespace __unique { typedef typename core::BlockLoad::type BlockLoadItems; - typedef cub::BlockDiscontinuity BlockDiscontinuityItems; - typedef cub::TilePrefixCallbackOp TilePrefixCallback; - typedef cub::BlockScan predicate; + CUB_NS_QUALIFIER::InequalityWrapper predicate; Size num_items; //--------------------------------------------------------------------- @@ -393,7 +393,7 @@ namespace __unique { { TilePrefixCallback prefix_cb(tile_state, temp_storage.scan_storage.prefix, - cub::Sum(), + CUB_NS_QUALIFIER::Sum(), tile_idx); BlockScan(temp_storage.scan_storage.scan) .ExclusiveSum(selection_flags, @@ -580,7 +580,7 @@ namespace __unique { int tile_size = unique_plan.items_per_tile; - size_t num_tiles = cub::DivideAndRoundUp(num_items, tile_size); + size_t num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, tile_size); size_t vshmem_size = core::vshmem_size(unique_plan.shared_memory_size, num_tiles); @@ -592,7 +592,7 @@ namespace __unique { void *allocations[2] = {NULL, NULL}; // - status = cub::AliasTemporaries(d_temp_storage, + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, temp_storage_bytes, allocations, allocation_sizes); @@ -795,7 +795,7 @@ unique(execution_policy &policy, } } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END // #include diff --git a/thrust/system/cuda/detail/unique_by_key.h b/thrust/system/cuda/detail/unique_by_key.h index 605e88cfc..7df41f3ca 100644 --- a/thrust/system/cuda/detail/unique_by_key.h +++ b/thrust/system/cuda/detail/unique_by_key.h @@ -26,6 +26,7 @@ ******************************************************************************/ #pragma once +#include #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC #include @@ -46,8 +47,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN template + CUB_NS_QUALIFIER::BlockLoadAlgorithm _LOAD_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_LOAD_DIRECT, + CUB_NS_QUALIFIER::CacheLoadModifier _LOAD_MODIFIER = CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BlockScanAlgorithm _SCAN_ALGORITHM = CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> struct PtxPolicy { enum @@ -93,9 +93,9 @@ namespace __unique_by_key { ITEMS_PER_THREAD = _ITEMS_PER_THREAD, ITEMS_PER_TILE = _BLOCK_THREADS * _ITEMS_PER_THREAD, }; - static const cub::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; - static const cub::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; - static const cub::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; + static const CUB_NS_QUALIFIER::BlockLoadAlgorithm LOAD_ALGORITHM = _LOAD_ALGORITHM; + static const CUB_NS_QUALIFIER::CacheLoadModifier LOAD_MODIFIER = _LOAD_MODIFIER; + static const CUB_NS_QUALIFIER::BlockScanAlgorithm SCAN_ALGORITHM = _SCAN_ALGORITHM; }; // struct PtxPolicy template @@ -133,9 +133,9 @@ namespace __unique_by_key { typedef PtxPolicy<64, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning for sm52 @@ -153,9 +153,9 @@ namespace __unique_by_key { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_LDG, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_LDG, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning for sm35 @@ -173,9 +173,9 @@ namespace __unique_by_key { typedef PtxPolicy<128, ITEMS_PER_THREAD, - cub::BLOCK_LOAD_WARP_TRANSPOSE, - cub::LOAD_DEFAULT, - cub::BLOCK_SCAN_WARP_SCANS> + CUB_NS_QUALIFIER::BLOCK_LOAD_WARP_TRANSPOSE, + CUB_NS_QUALIFIER::LOAD_DEFAULT, + CUB_NS_QUALIFIER::BLOCK_SCAN_WARP_SCANS> type; }; // Tuning for sm30 @@ -191,7 +191,7 @@ namespace __unique_by_key { typedef typename iterator_traits::value_type key_type; typedef typename iterator_traits::value_type value_type; - typedef cub::ScanTileState ScanTileState; + typedef CUB_NS_QUALIFIER::ScanTileState ScanTileState; template struct PtxPlan : Tuning::type @@ -204,19 +204,19 @@ namespace __unique_by_key { typedef typename core::BlockLoad::type BlockLoadKeys; typedef typename core::BlockLoad::type BlockLoadValues; - typedef cub::BlockDiscontinuity BlockDiscontinuityKeys; - typedef cub::TilePrefixCallbackOp TilePrefixCallback; - typedef cub::BlockScan predicate; + CUB_NS_QUALIFIER::InequalityWrapper predicate; Size num_items; //--------------------------------------------------------------------- @@ -443,7 +443,7 @@ namespace __unique_by_key { { TilePrefixCallback prefix_cb(tile_state, temp_storage.scan_storage.prefix, - cub::Sum(), + CUB_NS_QUALIFIER::Sum(), tile_idx); BlockScan(temp_storage.scan_storage.scan) .ExclusiveSum(selection_flags, @@ -662,7 +662,7 @@ namespace __unique_by_key { int tile_size = unique_plan.items_per_tile; - size_t num_tiles = cub::DivideAndRoundUp(num_items, tile_size); + size_t num_tiles = CUB_NS_QUALIFIER::DivideAndRoundUp(num_items, tile_size); size_t vshmem_size = core::vshmem_size(unique_plan.shared_memory_size, num_tiles); @@ -674,7 +674,7 @@ namespace __unique_by_key { void *allocations[2] = {NULL, NULL}; // - status = cub::AliasTemporaries(d_temp_storage, + status = CUB_NS_QUALIFIER::AliasTemporaries(d_temp_storage, temp_storage_bytes, allocations, allocation_sizes); @@ -928,7 +928,7 @@ unique_by_key(execution_policy &policy, } // namespace cuda_cub -} // end namespace thrust +THRUST_NAMESPACE_END #include #include diff --git a/thrust/system/cuda/detail/util.h b/thrust/system/cuda/detail/util.h index 07ee7d9a1..47aaec11d 100644 --- a/thrust/system/cuda/detail/util.h +++ b/thrust/system/cuda/detail/util.h @@ -34,8 +34,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace cuda_cub { @@ -586,4 +585,4 @@ struct counting_iterator_t } // cuda_ -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/error.h b/thrust/system/cuda/error.h index dcbadd855..09a0f0b68 100644 --- a/thrust/system/cuda/error.h +++ b/thrust/system/cuda/error.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -177,7 +176,7 @@ namespace errc = system::cuda::errc; using system::cuda_category; -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/cuda/experimental/pinned_allocator.h b/thrust/system/cuda/experimental/pinned_allocator.h index 62a366323..e821468fc 100644 --- a/thrust/system/cuda/experimental/pinned_allocator.h +++ b/thrust/system/cuda/experimental/pinned_allocator.h @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -240,5 +239,5 @@ using thrust::system::cuda::experimental::pinned_allocator; } // end cuda -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/future.h b/thrust/system/cuda/future.h index e42437e93..79bfc9134 100644 --- a/thrust/system/cuda/future.h +++ b/thrust/system/cuda/future.h @@ -13,8 +13,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace cuda { @@ -66,7 +65,7 @@ unique_eager_future_type( thrust::cuda::execution_policy const& ) noexcept; -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/cuda/memory.h b/thrust/system/cuda/memory.h index 4d94a0885..eb8020adb 100644 --- a/thrust/system/cuda/memory.h +++ b/thrust/system/cuda/memory.h @@ -27,7 +27,8 @@ #include #include -namespace thrust { namespace cuda_cub +THRUST_NAMESPACE_BEGIN +namespace cuda_cub { /*! Allocates an area of memory available to Thrust's cuda system. @@ -102,7 +103,7 @@ using thrust::cuda_cub::allocator; using thrust::cuda_cub::universal_allocator; } // namespace cuda -} // namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/cuda/memory_resource.h b/thrust/system/cuda/memory_resource.h index a8558d061..d13ac7adb 100644 --- a/thrust/system/cuda/memory_resource.h +++ b/thrust/system/cuda/memory_resource.h @@ -20,6 +20,8 @@ #pragma once +#include + #include #include #include @@ -29,8 +31,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -121,5 +122,5 @@ using thrust::system::cuda::universal_memory_resource; using thrust::system::cuda::universal_host_pinned_memory_resource; } -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/pointer.h b/thrust/system/cuda/pointer.h index c586eb9dc..a5bccf03f 100644 --- a/thrust/system/cuda/pointer.h +++ b/thrust/system/cuda/pointer.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace cuda_cub +THRUST_NAMESPACE_BEGIN +namespace cuda_cub { /*! \p cuda::pointer stores a pointer to an object allocated in memory @@ -132,5 +133,5 @@ using thrust::cuda_cub::universal_pointer; using thrust::cuda_cub::reference; } // namespace cuda -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/cuda/vector.h b/thrust/system/cuda/vector.h index 7a90a07fb..fafc7bf17 100644 --- a/thrust/system/cuda/vector.h +++ b/thrust/system/cuda/vector.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace cuda_cub +THRUST_NAMESPACE_BEGIN +namespace cuda_cub { /*! \p cuda::vector is a container that supports random access to elements, @@ -84,5 +85,5 @@ using thrust::cuda_cub::vector; using thrust::cuda_cub::universal_vector; } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/bad_alloc.h b/thrust/system/detail/bad_alloc.h index 461704fd6..d568b0283 100644 --- a/thrust/system/detail/bad_alloc.h +++ b/thrust/system/detail/bad_alloc.h @@ -20,8 +20,9 @@ #include #include -namespace thrust -{ +#include + +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -53,5 +54,5 @@ class bad_alloc } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/errno.h b/thrust/system/detail/errno.h index 78aec2ace..69cb2bd98 100644 --- a/thrust/system/detail/errno.h +++ b/thrust/system/detail/errno.h @@ -24,8 +24,7 @@ // pollute the global namespace. These identifiers are in lowercase to avoid // colliding with the real macros in errno.h. -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -116,5 +115,5 @@ static const int emlink = 9979; } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/error_category.inl b/thrust/system/detail/error_category.inl index 4602b0f30..45fd15a3f 100644 --- a/thrust/system/detail/error_category.inl +++ b/thrust/system/detail/error_category.inl @@ -17,13 +17,14 @@ #pragma once +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -232,5 +233,5 @@ const error_category &system_category(void) } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/error_code.inl b/thrust/system/detail/error_code.inl index 6631f486f..2b819c048 100644 --- a/thrust/system/detail/error_code.inl +++ b/thrust/system/detail/error_code.inl @@ -17,10 +17,11 @@ #pragma once +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -193,5 +194,5 @@ bool operator!=(const error_condition &lhs, const error_condition &rhs) } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/error_condition.inl b/thrust/system/detail/error_condition.inl index 9dc493bcc..0daf1f293 100644 --- a/thrust/system/detail/error_condition.inl +++ b/thrust/system/detail/error_condition.inl @@ -17,11 +17,12 @@ #pragma once +#include + #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -129,5 +130,5 @@ bool operator<(const error_condition &lhs, } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/adjacent_difference.h b/thrust/system/detail/generic/adjacent_difference.h index 6e4caaa88..43592e15b 100644 --- a/thrust/system/detail/generic/adjacent_difference.h +++ b/thrust/system/detail/generic/adjacent_difference.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -52,7 +51,7 @@ OutputIterator adjacent_difference(thrust::execution_policy &exec } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/adjacent_difference.inl b/thrust/system/detail/generic/adjacent_difference.inl index ad4ad1cd4..7a16a7a04 100644 --- a/thrust/system/detail/generic/adjacent_difference.inl +++ b/thrust/system/detail/generic/adjacent_difference.inl @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -77,5 +76,5 @@ OutputIterator adjacent_difference(thrust::execution_policy &exec } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/advance.h b/thrust/system/detail/generic/advance.h index f9cab587b..4d6562e00 100644 --- a/thrust/system/detail/generic/advance.h +++ b/thrust/system/detail/generic/advance.h @@ -19,8 +19,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -35,7 +34,7 @@ void advance(InputIterator& i, Distance n); } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/advance.inl b/thrust/system/detail/generic/advance.inl index ae98d596b..9cd77ea37 100644 --- a/thrust/system/detail/generic/advance.inl +++ b/thrust/system/detail/generic/advance.inl @@ -18,8 +18,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -63,5 +62,5 @@ void advance(InputIterator& i, Distance n) } // end namespace detail } // end namespace generic } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/binary_search.h b/thrust/system/detail/generic/binary_search.h index 8cd85c63f..6603f6c30 100644 --- a/thrust/system/detail/generic/binary_search.h +++ b/thrust/system/detail/generic/binary_search.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -168,7 +167,7 @@ equal_range(thrust::execution_policy &exec, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/binary_search.inl b/thrust/system/detail/generic/binary_search.inl index b7c72f1cb..3807b79e7 100644 --- a/thrust/system/detail/generic/binary_search.inl +++ b/thrust/system/detail/generic/binary_search.inl @@ -36,8 +36,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -398,5 +397,5 @@ equal_range(thrust::execution_policy &exec, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/copy.h b/thrust/system/detail/generic/copy.h index e22535618..36ac71899 100644 --- a/thrust/system/detail/generic/copy.h +++ b/thrust/system/detail/generic/copy.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -53,7 +52,7 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/copy.inl b/thrust/system/detail/generic/copy.inl index 9763a0682..34d66baa6 100644 --- a/thrust/system/detail/generic/copy.inl +++ b/thrust/system/detail/generic/copy.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -77,5 +76,5 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/copy_if.h b/thrust/system/detail/generic/copy_if.h index 6e3fb73a6..6a13edfda 100644 --- a/thrust/system/detail/generic/copy_if.h +++ b/thrust/system/detail/generic/copy_if.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -58,7 +57,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/copy_if.inl b/thrust/system/detail/generic/copy_if.inl index 4bdafe382..5a6edd72e 100644 --- a/thrust/system/detail/generic/copy_if.inl +++ b/thrust/system/detail/generic/copy_if.inl @@ -32,8 +32,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -157,5 +156,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/count.h b/thrust/system/detail/generic/count.h index 218369e38..295d36e6b 100644 --- a/thrust/system/detail/generic/count.h +++ b/thrust/system/detail/generic/count.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -45,7 +44,7 @@ count_if(thrust::execution_policy &exec, InputIterator first, Inp } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/count.inl b/thrust/system/detail/generic/count.inl index f12f0122e..fb8cf981b 100644 --- a/thrust/system/detail/generic/count.inl +++ b/thrust/system/detail/generic/count.inl @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -77,5 +76,5 @@ count_if(thrust::execution_policy &exec, InputIterator first, Inp } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/distance.h b/thrust/system/detail/generic/distance.h index 03b0fb556..4627376b5 100644 --- a/thrust/system/detail/generic/distance.h +++ b/thrust/system/detail/generic/distance.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -37,7 +36,7 @@ inline __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/distance.inl b/thrust/system/detail/generic/distance.inl index 930d0844c..66ad64bb2 100644 --- a/thrust/system/detail/generic/distance.inl +++ b/thrust/system/detail/generic/distance.inl @@ -18,8 +18,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -75,5 +74,5 @@ inline __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/equal.h b/thrust/system/detail/generic/equal.h index 8962b1bd1..4afd88d00 100644 --- a/thrust/system/detail/generic/equal.h +++ b/thrust/system/detail/generic/equal.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -42,7 +41,7 @@ bool equal(thrust::execution_policy &exec, InputIterator1 first1, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/equal.inl b/thrust/system/detail/generic/equal.inl index 7c9dec4bc..7828cb1ea 100644 --- a/thrust/system/detail/generic/equal.inl +++ b/thrust/system/detail/generic/equal.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -54,5 +53,5 @@ bool equal(thrust::execution_policy &exec, InputIterator1 first1, } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/extrema.h b/thrust/system/detail/generic/extrema.h index a3ee81889..e3b447958 100644 --- a/thrust/system/detail/generic/extrema.h +++ b/thrust/system/detail/generic/extrema.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -83,7 +82,7 @@ thrust::pair minmax_element(thrust::execution_p } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/extrema.inl b/thrust/system/detail/generic/extrema.inl index 22183db9a..744d137de 100644 --- a/thrust/system/detail/generic/extrema.inl +++ b/thrust/system/detail/generic/extrema.inl @@ -33,8 +33,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -259,5 +258,5 @@ thrust::pair minmax_element(thrust::execution_p } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/fill.h b/thrust/system/detail/generic/fill.h index 6c4f2ed4e..5a881359b 100644 --- a/thrust/system/detail/generic/fill.h +++ b/thrust/system/detail/generic/fill.h @@ -16,12 +16,13 @@ #pragma once +#include + #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -56,5 +57,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/find.h b/thrust/system/detail/generic/find.h index 00e11e53c..6db441d02 100644 --- a/thrust/system/detail/generic/find.h +++ b/thrust/system/detail/generic/find.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -57,7 +56,7 @@ InputIterator find_if_not(thrust::execution_policy &exec, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/find.inl b/thrust/system/detail/generic/find.inl index a7126825d..e1c295343 100644 --- a/thrust/system/detail/generic/find.inl +++ b/thrust/system/detail/generic/find.inl @@ -28,8 +28,7 @@ // Contributed by Erich Elsen -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -146,5 +145,5 @@ InputIterator find_if_not(thrust::execution_policy &exec, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/for_each.h b/thrust/system/detail/generic/for_each.h index c4add4305..3c2ec12cd 100644 --- a/thrust/system/detail/generic/for_each.h +++ b/thrust/system/detail/generic/for_each.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -74,5 +73,5 @@ InputIterator for_each_n(thrust::execution_policy &, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/gather.h b/thrust/system/detail/generic/gather.h index d587572f0..5b6b41831 100644 --- a/thrust/system/detail/generic/gather.h +++ b/thrust/system/detail/generic/gather.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -75,7 +74,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/gather.inl b/thrust/system/detail/generic/gather.inl index 4f4289ecb..218ca8577 100644 --- a/thrust/system/detail/generic/gather.inl +++ b/thrust/system/detail/generic/gather.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -103,5 +102,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/generate.h b/thrust/system/detail/generic/generate.h index edc2cc5eb..a9846c5be 100644 --- a/thrust/system/detail/generic/generate.h +++ b/thrust/system/detail/generic/generate.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -51,7 +50,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/generate.inl b/thrust/system/detail/generic/generate.inl index 9ca319b99..dd750dd51 100644 --- a/thrust/system/detail/generic/generate.inl +++ b/thrust/system/detail/generic/generate.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -95,5 +94,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/inner_product.h b/thrust/system/detail/generic/inner_product.h index 71e1a9270..62d10d31f 100644 --- a/thrust/system/detail/generic/inner_product.h +++ b/thrust/system/detail/generic/inner_product.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -53,7 +52,7 @@ OutputType inner_product(thrust::execution_policy &exec, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/inner_product.inl b/thrust/system/detail/generic/inner_product.inl index 0a50386be..2b1026b46 100644 --- a/thrust/system/detail/generic/inner_product.inl +++ b/thrust/system/detail/generic/inner_product.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -68,5 +67,5 @@ OutputType inner_product(thrust::execution_policy &exec, } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/logical.h b/thrust/system/detail/generic/logical.h index 702dbad85..e261154e2 100644 --- a/thrust/system/detail/generic/logical.h +++ b/thrust/system/detail/generic/logical.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -59,5 +58,5 @@ bool none_of(thrust::execution_policy &exec, InputIterator firs } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/memory.h b/thrust/system/detail/generic/memory.h index 344b3673d..675cc7302 100644 --- a/thrust/system/detail/generic/memory.h +++ b/thrust/system/detail/generic/memory.h @@ -29,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -65,7 +64,7 @@ void iter_swap(thrust::execution_policy&, Pointer1, Pointer2); } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/memory.inl b/thrust/system/detail/generic/memory.inl index eadf39ae9..c873363f3 100644 --- a/thrust/system/detail/generic/memory.inl +++ b/thrust/system/detail/generic/memory.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -100,5 +99,5 @@ void iter_swap(thrust::execution_policy &, Pointer1, Pointer2) } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/merge.h b/thrust/system/detail/generic/merge.h index d80906e3d..6e8246407 100644 --- a/thrust/system/detail/generic/merge.h +++ b/thrust/system/detail/generic/merge.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -85,7 +84,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/merge.inl b/thrust/system/detail/generic/merge.inl index 2938e8c92..03b77e623 100644 --- a/thrust/system/detail/generic/merge.inl +++ b/thrust/system/detail/generic/merge.inl @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -127,5 +126,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/mismatch.h b/thrust/system/detail/generic/mismatch.h index 50e9f678b..4a71cd344 100644 --- a/thrust/system/detail/generic/mismatch.h +++ b/thrust/system/detail/generic/mismatch.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -52,7 +51,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/mismatch.inl b/thrust/system/detail/generic/mismatch.inl index 8348374a5..5a6078137 100644 --- a/thrust/system/detail/generic/mismatch.inl +++ b/thrust/system/detail/generic/mismatch.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -70,5 +69,5 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/partition.h b/thrust/system/detail/generic/partition.h index fdd158c4c..113d6ecbc 100644 --- a/thrust/system/detail/generic/partition.h +++ b/thrust/system/detail/generic/partition.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -164,7 +163,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/partition.inl b/thrust/system/detail/generic/partition.inl index 73a8a286e..32d45727d 100644 --- a/thrust/system/detail/generic/partition.inl +++ b/thrust/system/detail/generic/partition.inl @@ -29,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -244,5 +243,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/per_device_resource.h b/thrust/system/detail/generic/per_device_resource.h index 9378940f3..606f91f36 100644 --- a/thrust/system/detail/generic/per_device_resource.h +++ b/thrust/system/detail/generic/per_device_resource.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -43,5 +42,5 @@ MR * get_per_device_resource(thrust::detail::execution_policy_base #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -53,7 +52,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/reduce.inl b/thrust/system/detail/generic/reduce.inl index b866e86dc..d673d0cf8 100644 --- a/thrust/system/detail/generic/reduce.inl +++ b/thrust/system/detail/generic/reduce.inl @@ -16,14 +16,15 @@ #pragma once +#include + #include #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -75,5 +76,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/reduce_by_key.h b/thrust/system/detail/generic/reduce_by_key.h index aaa5959a4..8ba47e11f 100644 --- a/thrust/system/detail/generic/reduce_by_key.h +++ b/thrust/system/detail/generic/reduce_by_key.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -83,7 +82,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/reduce_by_key.inl b/thrust/system/detail/generic/reduce_by_key.inl index 86640ea9f..8b3d4d3f1 100644 --- a/thrust/system/detail/generic/reduce_by_key.inl +++ b/thrust/system/detail/generic/reduce_by_key.inl @@ -21,6 +21,8 @@ #pragma once +#include + #include #include #include @@ -35,8 +37,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -193,5 +194,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/remove.h b/thrust/system/detail/generic/remove.h index 343f643e9..37354ef80 100644 --- a/thrust/system/detail/generic/remove.h +++ b/thrust/system/detail/generic/remove.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -107,7 +106,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/remove.inl b/thrust/system/detail/generic/remove.inl index 6cb5a694b..0ca81b143 100644 --- a/thrust/system/detail/generic/remove.inl +++ b/thrust/system/detail/generic/remove.inl @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -146,5 +145,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/replace.h b/thrust/system/detail/generic/replace.h index 6167f711a..0821d6c07 100644 --- a/thrust/system/detail/generic/replace.h +++ b/thrust/system/detail/generic/replace.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -92,7 +91,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/replace.inl b/thrust/system/detail/generic/replace.inl index eea70ccd1..711c5fd24 100644 --- a/thrust/system/detail/generic/replace.inl +++ b/thrust/system/detail/generic/replace.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -174,5 +173,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/reverse.h b/thrust/system/detail/generic/reverse.h index 11421d41b..65c77ae75 100644 --- a/thrust/system/detail/generic/reverse.h +++ b/thrust/system/detail/generic/reverse.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -50,7 +49,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/reverse.inl b/thrust/system/detail/generic/reverse.inl index b77c75b6f..b6909a4ba 100644 --- a/thrust/system/detail/generic/reverse.inl +++ b/thrust/system/detail/generic/reverse.inl @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -70,6 +69,6 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/scalar/binary_search.h b/thrust/system/detail/generic/scalar/binary_search.h index 373b59a60..3e019c223 100644 --- a/thrust/system/detail/generic/scalar/binary_search.h +++ b/thrust/system/detail/generic/scalar/binary_search.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -79,7 +78,7 @@ bool binary_search(RandomAccessIterator first, RandomAccessIterator last, const } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/scalar/binary_search.inl b/thrust/system/detail/generic/scalar/binary_search.inl index 83b5f59f8..61c71fba4 100644 --- a/thrust/system/detail/generic/scalar/binary_search.inl +++ b/thrust/system/detail/generic/scalar/binary_search.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -153,6 +152,6 @@ bool binary_search(RandomAccessIterator first, RandomAccessIterator last, const } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/scan.h b/thrust/system/detail/generic/scan.h index c32b0f2b9..476441ab6 100644 --- a/thrust/system/detail/generic/scan.h +++ b/thrust/system/detail/generic/scan.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -93,7 +92,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/scan.inl b/thrust/system/detail/generic/scan.inl index 83d272c3e..45a2aadd0 100644 --- a/thrust/system/detail/generic/scan.inl +++ b/thrust/system/detail/generic/scan.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -124,5 +123,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/scan_by_key.h b/thrust/system/detail/generic/scan_by_key.h index 3c2ea7931..9e38ac933 100644 --- a/thrust/system/detail/generic/scan_by_key.h +++ b/thrust/system/detail/generic/scan_by_key.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -138,7 +137,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/scan_by_key.inl b/thrust/system/detail/generic/scan_by_key.inl index cb05ea007..338e863e0 100644 --- a/thrust/system/detail/generic/scan_by_key.inl +++ b/thrust/system/detail/generic/scan_by_key.inl @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -241,5 +240,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/scatter.h b/thrust/system/detail/generic/scatter.h index 4a65a4cc0..6bb7949ef 100644 --- a/thrust/system/detail/generic/scatter.h +++ b/thrust/system/detail/generic/scatter.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -75,7 +74,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/scatter.inl b/thrust/system/detail/generic/scatter.inl index 7a1f52298..9062d4684 100644 --- a/thrust/system/detail/generic/scatter.inl +++ b/thrust/system/detail/generic/scatter.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -92,5 +91,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/select_system.h b/thrust/system/detail/generic/select_system.h index 3b5d77503..7619b80e5 100644 --- a/thrust/system/detail/generic/select_system.h +++ b/thrust/system/detail/generic/select_system.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -120,6 +119,6 @@ thrust::device_system_tag select_system(thrust::any_system_tag); } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/select_system.inl b/thrust/system/detail/generic/select_system.inl index fbe3094be..b69d17c45 100644 --- a/thrust/system/detail/generic/select_system.inl +++ b/thrust/system/detail/generic/select_system.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -175,5 +174,5 @@ thrust::device_system_tag select_system(thrust::any_system_tag) } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/select_system_exists.h b/thrust/system/detail/generic/select_system_exists.h index ba8ef8bb7..29d05781d 100644 --- a/thrust/system/detail/generic/select_system_exists.h +++ b/thrust/system/detail/generic/select_system_exists.h @@ -23,8 +23,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN // forward declaration of any_system_tag for any_conversion below struct any_system_tag; @@ -164,5 +163,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -58,7 +57,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/sequence.inl b/thrust/system/detail/generic/sequence.inl index 1ffbf9868..711fb5c7e 100644 --- a/thrust/system/detail/generic/sequence.inl +++ b/thrust/system/detail/generic/sequence.inl @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -88,5 +87,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/set_operations.h b/thrust/system/detail/generic/set_operations.h index 4dbee0ae4..37665d78d 100644 --- a/thrust/system/detail/generic/set_operations.h +++ b/thrust/system/detail/generic/set_operations.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -313,7 +312,7 @@ thrust::pair } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/set_operations.inl b/thrust/system/detail/generic/set_operations.inl index 6264aff16..4363be5c0 100644 --- a/thrust/system/detail/generic/set_operations.inl +++ b/thrust/system/detail/generic/set_operations.inl @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -473,5 +472,5 @@ OutputIterator set_union(thrust::execution_policy &, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/shuffle.h b/thrust/system/detail/generic/shuffle.h index a690c11c5..8f8e21afd 100644 --- a/thrust/system/detail/generic/shuffle.h +++ b/thrust/system/detail/generic/shuffle.h @@ -28,7 +28,7 @@ #include -namespace thrust { +THRUST_NAMESPACE_BEGIN namespace system { namespace detail { namespace generic { @@ -47,7 +47,7 @@ __host__ __device__ void shuffle_copy( } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/shuffle.inl b/thrust/system/detail/generic/shuffle.inl index 45c087ea8..91b77351d 100644 --- a/thrust/system/detail/generic/shuffle.inl +++ b/thrust/system/detail/generic/shuffle.inl @@ -25,7 +25,7 @@ #include -namespace thrust { +THRUST_NAMESPACE_BEGIN namespace system { namespace detail { namespace generic { @@ -214,4 +214,4 @@ __host__ __device__ void shuffle_copy( } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/sort.h b/thrust/system/detail/generic/sort.h index 9d4ac1998..cd8d45562 100644 --- a/thrust/system/detail/generic/sort.h +++ b/thrust/system/detail/generic/sort.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -148,7 +147,7 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/sort.inl b/thrust/system/detail/generic/sort.inl index 5f0fb7ebf..632cab435 100644 --- a/thrust/system/detail/generic/sort.inl +++ b/thrust/system/detail/generic/sort.inl @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -216,5 +215,5 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/swap_ranges.h b/thrust/system/detail/generic/swap_ranges.h index 78769715c..edb5acf31 100644 --- a/thrust/system/detail/generic/swap_ranges.h +++ b/thrust/system/detail/generic/swap_ranges.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -41,7 +40,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/swap_ranges.inl b/thrust/system/detail/generic/swap_ranges.inl index 81977adc2..0afd51c6f 100644 --- a/thrust/system/detail/generic/swap_ranges.inl +++ b/thrust/system/detail/generic/swap_ranges.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -74,5 +73,5 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/tabulate.h b/thrust/system/detail/generic/tabulate.h index 5cb75e928..041093e82 100644 --- a/thrust/system/detail/generic/tabulate.h +++ b/thrust/system/detail/generic/tabulate.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -43,7 +42,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/tabulate.inl b/thrust/system/detail/generic/tabulate.inl index 1a740d26a..122819e6e 100644 --- a/thrust/system/detail/generic/tabulate.inl +++ b/thrust/system/detail/generic/tabulate.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -55,6 +54,6 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/tag.h b/thrust/system/detail/generic/tag.h index 4da1e79ce..48f094797 100644 --- a/thrust/system/detail/generic/tag.h +++ b/thrust/system/detail/generic/tag.h @@ -23,8 +23,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -44,5 +43,5 @@ struct tag } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/temporary_buffer.h b/thrust/system/detail/generic/temporary_buffer.h index 7cf389ca1..6b7e01ff2 100644 --- a/thrust/system/detail/generic/temporary_buffer.h +++ b/thrust/system/detail/generic/temporary_buffer.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -52,7 +51,7 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/temporary_buffer.inl b/thrust/system/detail/generic/temporary_buffer.inl index 20f33bdaa..660bc3ee6 100644 --- a/thrust/system/detail/generic/temporary_buffer.inl +++ b/thrust/system/detail/generic/temporary_buffer.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -81,5 +80,5 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/transform.h b/thrust/system/detail/generic/transform.h index 1aa2f4993..30e032696 100644 --- a/thrust/system/detail/generic/transform.h +++ b/thrust/system/detail/generic/transform.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -100,7 +99,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/transform.inl b/thrust/system/detail/generic/transform.inl index 589eb65c7..16791e298 100644 --- a/thrust/system/detail/generic/transform.inl +++ b/thrust/system/detail/generic/transform.inl @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -186,5 +185,5 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/transform_reduce.h b/thrust/system/detail/generic/transform_reduce.h index 23123fa49..af510296e 100644 --- a/thrust/system/detail/generic/transform_reduce.h +++ b/thrust/system/detail/generic/transform_reduce.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -47,7 +46,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/transform_reduce.inl b/thrust/system/detail/generic/transform_reduce.inl index 7340f8355..fae504b9f 100644 --- a/thrust/system/detail/generic/transform_reduce.inl +++ b/thrust/system/detail/generic/transform_reduce.inl @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -52,5 +51,5 @@ __host__ __device__ } // end generic } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/transform_scan.h b/thrust/system/detail/generic/transform_scan.h index 3f81434fc..05054c965 100644 --- a/thrust/system/detail/generic/transform_scan.h +++ b/thrust/system/detail/generic/transform_scan.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -62,7 +61,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/transform_scan.inl b/thrust/system/detail/generic/transform_scan.inl index e91331736..68b9031c7 100644 --- a/thrust/system/detail/generic/transform_scan.inl +++ b/thrust/system/detail/generic/transform_scan.inl @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -92,5 +91,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/uninitialized_copy.h b/thrust/system/detail/generic/uninitialized_copy.h index 2d1b0010d..bac5bcf96 100644 --- a/thrust/system/detail/generic/uninitialized_copy.h +++ b/thrust/system/detail/generic/uninitialized_copy.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -51,7 +50,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/uninitialized_copy.inl b/thrust/system/detail/generic/uninitialized_copy.inl index d6babf65c..3960e127e 100644 --- a/thrust/system/detail/generic/uninitialized_copy.inl +++ b/thrust/system/detail/generic/uninitialized_copy.inl @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -189,5 +188,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/uninitialized_fill.h b/thrust/system/detail/generic/uninitialized_fill.h index 6acc65d08..4f5404508 100644 --- a/thrust/system/detail/generic/uninitialized_fill.h +++ b/thrust/system/detail/generic/uninitialized_fill.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -51,7 +50,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/uninitialized_fill.inl b/thrust/system/detail/generic/uninitialized_fill.inl index 0d4cf3f54..1d0e9fbd0 100644 --- a/thrust/system/detail/generic/uninitialized_fill.inl +++ b/thrust/system/detail/generic/uninitialized_fill.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -130,5 +129,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/unique.h b/thrust/system/detail/generic/unique.h index 04388cbc0..5f008978f 100644 --- a/thrust/system/detail/generic/unique.h +++ b/thrust/system/detail/generic/unique.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -72,7 +71,7 @@ OutputIterator unique_copy(thrust::execution_policy &exec, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/unique.inl b/thrust/system/detail/generic/unique.inl index 4cd3459fd..35d0162f9 100644 --- a/thrust/system/detail/generic/unique.inl +++ b/thrust/system/detail/generic/unique.inl @@ -33,8 +33,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -109,5 +108,5 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/generic/unique_by_key.h b/thrust/system/detail/generic/unique_by_key.h index cb03179de..0ea9e7cc8 100644 --- a/thrust/system/detail/generic/unique_by_key.h +++ b/thrust/system/detail/generic/unique_by_key.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -89,7 +88,7 @@ __host__ __device__ } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/generic/unique_by_key.inl b/thrust/system/detail/generic/unique_by_key.inl index ff8c5b554..ffcf1dd0c 100644 --- a/thrust/system/detail/generic/unique_by_key.inl +++ b/thrust/system/detail/generic/unique_by_key.inl @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -136,5 +135,5 @@ unique_by_key_copy(thrust::execution_policy &exec, } // end namespace generic } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/internal/decompose.h b/thrust/system/detail/internal/decompose.h index e949f2024..58af7c551 100644 --- a/thrust/system/detail/internal/decompose.h +++ b/thrust/system/detail/internal/decompose.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -110,5 +109,5 @@ namespace internal } // end namespace internal } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/adjacent_difference.h b/thrust/system/detail/sequential/adjacent_difference.h index c6b0ee1b2..4a9dad82c 100644 --- a/thrust/system/detail/sequential/adjacent_difference.h +++ b/thrust/system/detail/sequential/adjacent_difference.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -70,5 +69,5 @@ OutputIterator adjacent_difference(sequential::execution_policy & } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/assign_value.h b/thrust/system/detail/sequential/assign_value.h index 699bcbcd7..0eb145d13 100644 --- a/thrust/system/detail/sequential/assign_value.h +++ b/thrust/system/detail/sequential/assign_value.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -39,5 +38,5 @@ __host__ __device__ } // end sequential } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/binary_search.h b/thrust/system/detail/sequential/binary_search.h index 54534143e..2da5080f4 100644 --- a/thrust/system/detail/sequential/binary_search.h +++ b/thrust/system/detail/sequential/binary_search.h @@ -21,13 +21,14 @@ #pragma once +#include + #include #include #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -153,5 +154,5 @@ bool binary_search(sequential::execution_policy &exec, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/copy.h b/thrust/system/detail/sequential/copy.h index 80853f670..0dd2cdad5 100644 --- a/thrust/system/detail/sequential/copy.h +++ b/thrust/system/detail/sequential/copy.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -57,7 +56,7 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/sequential/copy.inl b/thrust/system/detail/sequential/copy.inl index 8027681d0..4f33ec8d8 100644 --- a/thrust/system/detail/sequential/copy.inl +++ b/thrust/system/detail/sequential/copy.inl @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -141,5 +140,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/copy_backward.h b/thrust/system/detail/sequential/copy_backward.h index e825436b1..d127ac80d 100644 --- a/thrust/system/detail/sequential/copy_backward.h +++ b/thrust/system/detail/sequential/copy_backward.h @@ -18,8 +18,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -50,5 +49,5 @@ BidirectionalIterator2 copy_backward(BidirectionalIterator1 first, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/copy_if.h b/thrust/system/detail/sequential/copy_if.h index bb29ccdeb..3c00956de 100644 --- a/thrust/system/detail/sequential/copy_if.h +++ b/thrust/system/detail/sequential/copy_if.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -69,5 +68,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/execution_policy.h b/thrust/system/detail/sequential/execution_policy.h index b1f526b19..99d78fc27 100644 --- a/thrust/system/detail/sequential/execution_policy.h +++ b/thrust/system/detail/sequential/execution_policy.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -72,5 +71,5 @@ THRUST_INLINE_CONSTANT tag seq; } // end sequential } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/extrema.h b/thrust/system/detail/sequential/extrema.h index 7bfa5a17d..5e5c62da6 100644 --- a/thrust/system/detail/sequential/extrema.h +++ b/thrust/system/detail/sequential/extrema.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -135,5 +134,5 @@ thrust::pair minmax_element(sequential::executi } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/find.h b/thrust/system/detail/sequential/find.h index 5e551b74a..54c238c71 100644 --- a/thrust/system/detail/sequential/find.h +++ b/thrust/system/detail/sequential/find.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -67,5 +66,5 @@ InputIterator find_if(execution_policy &, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/for_each.h b/thrust/system/detail/sequential/for_each.h index 6e83d18c1..7058c56f2 100644 --- a/thrust/system/detail/sequential/for_each.h +++ b/thrust/system/detail/sequential/for_each.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -91,5 +90,5 @@ InputIterator for_each_n(sequential::execution_policy &, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/general_copy.h b/thrust/system/detail/sequential/general_copy.h index 9546b72e5..6ea87bbac 100644 --- a/thrust/system/detail/sequential/general_copy.h +++ b/thrust/system/detail/sequential/general_copy.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -143,5 +142,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/get_value.h b/thrust/system/detail/sequential/get_value.h index 5f3f8eb04..90752d867 100644 --- a/thrust/system/detail/sequential/get_value.h +++ b/thrust/system/detail/sequential/get_value.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -42,5 +41,5 @@ __host__ __device__ } // end sequential } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/insertion_sort.h b/thrust/system/detail/sequential/insertion_sort.h index f0bb9bc5f..9acccd8e9 100644 --- a/thrust/system/detail/sequential/insertion_sort.h +++ b/thrust/system/detail/sequential/insertion_sort.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -149,5 +148,5 @@ void insertion_sort_by_key(RandomAccessIterator1 first1, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/iter_swap.h b/thrust/system/detail/sequential/iter_swap.h index 1c8fde6e7..7a5c481fc 100644 --- a/thrust/system/detail/sequential/iter_swap.h +++ b/thrust/system/detail/sequential/iter_swap.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -43,5 +42,5 @@ __host__ __device__ } // end sequential } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/malloc_and_free.h b/thrust/system/detail/sequential/malloc_and_free.h index 7c545250e..b250140e0 100644 --- a/thrust/system/detail/sequential/malloc_and_free.h +++ b/thrust/system/detail/sequential/malloc_and_free.h @@ -21,8 +21,7 @@ #include // for malloc & free #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -50,5 +49,5 @@ void free(sequential::execution_policy &, Pointer ptr) } // end sequential } // end detail } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/merge.h b/thrust/system/detail/sequential/merge.h index 6cd314dc7..a45e18004 100644 --- a/thrust/system/detail/sequential/merge.h +++ b/thrust/system/detail/sequential/merge.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -74,7 +73,7 @@ thrust::pair } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/sequential/merge.inl b/thrust/system/detail/sequential/merge.inl index ae28ba97d..7073c6d4a 100644 --- a/thrust/system/detail/sequential/merge.inl +++ b/thrust/system/detail/sequential/merge.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -149,5 +148,5 @@ thrust::pair } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/partition.h b/thrust/system/detail/sequential/partition.h index 4604fecfa..43d5b0e23 100644 --- a/thrust/system/detail/sequential/partition.h +++ b/thrust/system/detail/sequential/partition.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -96,7 +95,7 @@ __host__ __device__ if(wrapped_pred(*next)) { // Fully qualify name to disambiguate overloads found via ADL. - ::thrust::system::detail::sequential::iter_swap(first, next); + THRUST_NS_QUALIFIER::system::detail::sequential::iter_swap(first, next); ++first; } } @@ -145,7 +144,7 @@ __host__ __device__ if(wrapped_pred(*stencil_first)) { // Fully qualify name to disambiguate overloads found via ADL. - ::thrust::system::detail::sequential::iter_swap(first, next); + THRUST_NS_QUALIFIER::system::detail::sequential::iter_swap(first, next); ++first; } @@ -337,5 +336,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/reduce.h b/thrust/system/detail/sequential/reduce.h index 55e92acb9..a532f71b2 100644 --- a/thrust/system/detail/sequential/reduce.h +++ b/thrust/system/detail/sequential/reduce.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -69,5 +68,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/reduce_by_key.h b/thrust/system/detail/sequential/reduce_by_key.h index 6e0741365..ef17ac5b0 100644 --- a/thrust/system/detail/sequential/reduce_by_key.h +++ b/thrust/system/detail/sequential/reduce_by_key.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -99,5 +98,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/remove.h b/thrust/system/detail/sequential/remove.h index 48de522df..df564f15b 100644 --- a/thrust/system/detail/sequential/remove.h +++ b/thrust/system/detail/sequential/remove.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -198,5 +197,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/scan.h b/thrust/system/detail/sequential/scan.h index 3bffc93d7..c5fce2475 100644 --- a/thrust/system/detail/sequential/scan.h +++ b/thrust/system/detail/sequential/scan.h @@ -29,8 +29,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -118,5 +117,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/scan_by_key.h b/thrust/system/detail/sequential/scan_by_key.h index 5bf48febd..c428c1050 100644 --- a/thrust/system/detail/sequential/scan_by_key.h +++ b/thrust/system/detail/sequential/scan_by_key.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -146,5 +145,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/set_operations.h b/thrust/system/detail/sequential/set_operations.h index a9b1cc688..678754b45 100644 --- a/thrust/system/detail/sequential/set_operations.h +++ b/thrust/system/detail/sequential/set_operations.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -220,5 +219,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/sort.h b/thrust/system/detail/sequential/sort.h index 0900743d8..34cc7a8ba 100644 --- a/thrust/system/detail/sequential/sort.h +++ b/thrust/system/detail/sequential/sort.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -58,7 +57,7 @@ void stable_sort_by_key(sequential::execution_policy &exec, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/sequential/sort.inl b/thrust/system/detail/sequential/sort.inl index bbc18a0b2..fea1a4c78 100644 --- a/thrust/system/detail/sequential/sort.inl +++ b/thrust/system/detail/sequential/sort.inl @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include @@ -21,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -200,5 +200,5 @@ void stable_sort_by_key(sequential::execution_policy &exec, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/stable_merge_sort.h b/thrust/system/detail/sequential/stable_merge_sort.h index 359ba8d7b..64aa2bf96 100644 --- a/thrust/system/detail/sequential/stable_merge_sort.h +++ b/thrust/system/detail/sequential/stable_merge_sort.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -54,7 +53,7 @@ void stable_merge_sort_by_key(sequential::execution_policy &exec, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/sequential/stable_merge_sort.inl b/thrust/system/detail/sequential/stable_merge_sort.inl index 2939e0668..631b3c73a 100644 --- a/thrust/system/detail/sequential/stable_merge_sort.inl +++ b/thrust/system/detail/sequential/stable_merge_sort.inl @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include @@ -21,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -393,5 +393,5 @@ void stable_merge_sort_by_key(sequential::execution_policy &exec, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/stable_primitive_sort.h b/thrust/system/detail/sequential/stable_primitive_sort.h index 3426f953a..acbb81217 100644 --- a/thrust/system/detail/sequential/stable_primitive_sort.h +++ b/thrust/system/detail/sequential/stable_primitive_sort.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -50,7 +49,7 @@ void stable_primitive_sort_by_key(sequential::execution_policy &e } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/sequential/stable_primitive_sort.inl b/thrust/system/detail/sequential/stable_primitive_sort.inl index e5cea4ad3..9897d6798 100644 --- a/thrust/system/detail/sequential/stable_primitive_sort.inl +++ b/thrust/system/detail/sequential/stable_primitive_sort.inl @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -157,5 +156,5 @@ void stable_primitive_sort_by_key(sequential::execution_policy &e } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/stable_radix_sort.h b/thrust/system/detail/sequential/stable_radix_sort.h index 9f7482ccf..1e9713a2c 100644 --- a/thrust/system/detail/sequential/stable_radix_sort.h +++ b/thrust/system/detail/sequential/stable_radix_sort.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -50,7 +49,7 @@ void stable_radix_sort_by_key(sequential::execution_policy &exec, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/detail/sequential/stable_radix_sort.inl b/thrust/system/detail/sequential/stable_radix_sort.inl index 2bb841242..4a062e9ed 100644 --- a/thrust/system/detail/sequential/stable_radix_sort.inl +++ b/thrust/system/detail/sequential/stable_radix_sort.inl @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include @@ -26,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -591,5 +591,5 @@ void stable_radix_sort_by_key(sequential::execution_policy &exec, } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/trivial_copy.h b/thrust/system/detail/sequential/trivial_copy.h index 8fbd0a987..cefb18938 100644 --- a/thrust/system/detail/sequential/trivial_copy.h +++ b/thrust/system/detail/sequential/trivial_copy.h @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -58,5 +57,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/unique.h b/thrust/system/detail/sequential/unique.h index 11168f0b4..e4953e9ae 100644 --- a/thrust/system/detail/sequential/unique.h +++ b/thrust/system/detail/sequential/unique.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -93,5 +92,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/sequential/unique_by_key.h b/thrust/system/detail/sequential/unique_by_key.h index 899ce02db..d30cc7c71 100644 --- a/thrust/system/detail/sequential/unique_by_key.h +++ b/thrust/system/detail/sequential/unique_by_key.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace detail @@ -112,5 +111,5 @@ __host__ __device__ } // end namespace sequential } // end namespace detail } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/detail/system_error.inl b/thrust/system/detail/system_error.inl index 3e59458aa..787bf30d3 100644 --- a/thrust/system/detail/system_error.inl +++ b/thrust/system/detail/system_error.inl @@ -17,10 +17,11 @@ #pragma once +#include + #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -107,5 +108,5 @@ const char *system_error } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/error_code.h b/thrust/system/error_code.h index faa81bbca..d460a315b 100644 --- a/thrust/system/error_code.h +++ b/thrust/system/error_code.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -515,7 +514,7 @@ namespace errc = system::errc; using system::generic_category; using system::system_category; -} // end thrust +THRUST_NAMESPACE_END #include #include diff --git a/thrust/system/omp/detail/adjacent_difference.h b/thrust/system/omp/detail/adjacent_difference.h index 7f314eaeb..622ee61ba 100644 --- a/thrust/system/omp/detail/adjacent_difference.h +++ b/thrust/system/omp/detail/adjacent_difference.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -46,5 +45,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -69,5 +68,5 @@ bool binary_search(execution_policy &exec, } // end detail } // end omp } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/copy.h b/thrust/system/omp/detail/copy.h index e2b6661e8..ae7b1eed7 100644 --- a/thrust/system/omp/detail/copy.h +++ b/thrust/system/omp/detail/copy.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -51,7 +50,7 @@ OutputIterator copy_n(execution_policy &exec, } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/omp/detail/copy.inl b/thrust/system/omp/detail/copy.inl index 4d104e5ec..47f606dda 100644 --- a/thrust/system/omp/detail/copy.inl +++ b/thrust/system/omp/detail/copy.inl @@ -23,8 +23,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -133,5 +132,5 @@ OutputIterator copy_n(execution_policy &exec, } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/copy_if.h b/thrust/system/omp/detail/copy_if.h index a5c28704d..b33fd96df 100644 --- a/thrust/system/omp/detail/copy_if.h +++ b/thrust/system/omp/detail/copy_if.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -45,7 +44,7 @@ template diff --git a/thrust/system/omp/detail/copy_if.inl b/thrust/system/omp/detail/copy_if.inl index 7f2516a74..8e597d4fc 100644 --- a/thrust/system/omp/detail/copy_if.inl +++ b/thrust/system/omp/detail/copy_if.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -50,5 +49,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -39,7 +38,7 @@ thrust::system::detail::internal::uniform_decomposition default_decom } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/omp/detail/default_decomposition.inl b/thrust/system/omp/detail/default_decomposition.inl index 53f4b428f..f63ddf125 100644 --- a/thrust/system/omp/detail/default_decomposition.inl +++ b/thrust/system/omp/detail/default_decomposition.inl @@ -22,8 +22,7 @@ #include #endif // omp support -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -56,5 +55,5 @@ thrust::system::detail::internal::uniform_decomposition default_decom } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/execution_policy.h b/thrust/system/omp/detail/execution_policy.h index 52c879a16..f9b45312b 100644 --- a/thrust/system/omp/detail/execution_policy.h +++ b/thrust/system/omp/detail/execution_policy.h @@ -22,8 +22,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { // put the canonical tag in the same ns as the backend's entry points @@ -103,5 +102,5 @@ using thrust::system::omp::execution_policy; using thrust::system::omp::tag; } // end omp -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/extrema.h b/thrust/system/omp/detail/extrema.h index 96661180d..bde4e5f80 100644 --- a/thrust/system/omp/detail/extrema.h +++ b/thrust/system/omp/detail/extrema.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -62,6 +61,6 @@ thrust::pair minmax_element(execution_policy #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -47,5 +46,5 @@ InputIterator find_if(execution_policy &exec, } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/for_each.h b/thrust/system/omp/detail/for_each.h index 4e6955ea2..a2030f374 100644 --- a/thrust/system/omp/detail/for_each.h +++ b/thrust/system/omp/detail/for_each.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -54,7 +53,7 @@ template diff --git a/thrust/system/omp/detail/for_each.inl b/thrust/system/omp/detail/for_each.inl index 6be6435e6..cb51bd0e0 100644 --- a/thrust/system/omp/detail/for_each.inl +++ b/thrust/system/omp/detail/for_each.inl @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -96,5 +95,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -80,5 +79,5 @@ inline void free(pointer ptr) } // end omp } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/par.h b/thrust/system/omp/detail/par.h index 1d38df2cf..b81a5d489 100644 --- a/thrust/system/omp/detail/par.h +++ b/thrust/system/omp/detail/par.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -58,5 +57,5 @@ using thrust::system::omp::par; } // end omp -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/partition.h b/thrust/system/omp/detail/partition.h index 64a76e278..7a6f4a934 100644 --- a/thrust/system/omp/detail/partition.h +++ b/thrust/system/omp/detail/partition.h @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -85,7 +84,7 @@ template diff --git a/thrust/system/omp/detail/partition.inl b/thrust/system/omp/detail/partition.inl index b81c17cbf..ba0a09eaf 100644 --- a/thrust/system/omp/detail/partition.inl +++ b/thrust/system/omp/detail/partition.inl @@ -25,8 +25,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -104,5 +103,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -48,7 +47,7 @@ template diff --git a/thrust/system/omp/detail/reduce.inl b/thrust/system/omp/detail/reduce.inl index 4609922a9..e295be892 100644 --- a/thrust/system/omp/detail/reduce.inl +++ b/thrust/system/omp/detail/reduce.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -68,5 +67,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -55,7 +54,7 @@ template diff --git a/thrust/system/omp/detail/reduce_by_key.inl b/thrust/system/omp/detail/reduce_by_key.inl index afd4c8e51..a4e944b53 100644 --- a/thrust/system/omp/detail/reduce_by_key.inl +++ b/thrust/system/omp/detail/reduce_by_key.inl @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -53,5 +52,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -47,7 +46,7 @@ void reduce_intervals(execution_policy &exec, } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/omp/detail/reduce_intervals.inl b/thrust/system/omp/detail/reduce_intervals.inl index 961f2757a..9b89af4f1 100644 --- a/thrust/system/omp/detail/reduce_intervals.inl +++ b/thrust/system/omp/detail/reduce_intervals.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -93,5 +92,5 @@ void reduce_intervals(execution_policy &, } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/remove.h b/thrust/system/omp/detail/remove.h index ca4eab845..9b2d46e75 100644 --- a/thrust/system/omp/detail/remove.h +++ b/thrust/system/omp/detail/remove.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -75,7 +74,7 @@ template diff --git a/thrust/system/omp/detail/remove.inl b/thrust/system/omp/detail/remove.inl index aa8289476..5330f1407 100644 --- a/thrust/system/omp/detail/remove.inl +++ b/thrust/system/omp/detail/remove.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -90,5 +89,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -49,7 +48,7 @@ void stable_sort_by_key(execution_policy &exec, } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/omp/detail/sort.inl b/thrust/system/omp/detail/sort.inl index 587017ca6..4e37ee1ff 100644 --- a/thrust/system/omp/detail/sort.inl +++ b/thrust/system/omp/detail/sort.inl @@ -30,8 +30,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -261,5 +260,5 @@ void stable_sort_by_key(execution_policy &exec, } // end namespace detail } // end namespace omp } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/detail/unique.h b/thrust/system/omp/detail/unique.h index 433e7689b..304caf66d 100644 --- a/thrust/system/omp/detail/unique.h +++ b/thrust/system/omp/detail/unique.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -53,7 +52,7 @@ template diff --git a/thrust/system/omp/detail/unique.inl b/thrust/system/omp/detail/unique.inl index 70f026dbb..c03203efe 100644 --- a/thrust/system/omp/detail/unique.inl +++ b/thrust/system/omp/detail/unique.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -62,5 +61,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -61,7 +60,7 @@ template diff --git a/thrust/system/omp/detail/unique_by_key.inl b/thrust/system/omp/detail/unique_by_key.inl index 0a4367b7b..6610c8a00 100644 --- a/thrust/system/omp/detail/unique_by_key.inl +++ b/thrust/system/omp/detail/unique_by_key.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -70,5 +69,5 @@ template #include -namespace thrust { namespace system { namespace omp +THRUST_NAMESPACE_BEGIN +namespace system { namespace omp { /*! Allocates an area of memory available to Thrust's omp system. @@ -94,7 +95,7 @@ using thrust::system::omp::allocator; using thrust::system::omp::universal_allocator; } // namespace omp -} // namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/omp/memory_resource.h b/thrust/system/omp/memory_resource.h index 7d74d7b9e..7660113be 100644 --- a/thrust/system/omp/memory_resource.h +++ b/thrust/system/omp/memory_resource.h @@ -26,7 +26,8 @@ #include -namespace thrust { namespace system { namespace omp +THRUST_NAMESPACE_BEGIN +namespace system { namespace omp { //! \cond @@ -63,5 +64,6 @@ typedef detail::native_resource universal_host_pinned_memory_resource; /*! \} */ -}}} // namespace thrust::system::omp +}} // namespace system::omp +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/pointer.h b/thrust/system/omp/pointer.h index d72069bd8..2be42e4fc 100644 --- a/thrust/system/omp/pointer.h +++ b/thrust/system/omp/pointer.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace system { namespace omp +THRUST_NAMESPACE_BEGIN +namespace system { namespace omp { /*! \p omp::pointer stores a pointer to an object allocated in memory accessible @@ -112,5 +113,5 @@ using thrust::system::omp::universal_pointer; using thrust::system::omp::reference; } // namespace omp -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/omp/vector.h b/thrust/system/omp/vector.h index dead9f592..179b5207d 100644 --- a/thrust/system/omp/vector.h +++ b/thrust/system/omp/vector.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace system { namespace omp +THRUST_NAMESPACE_BEGIN +namespace system { namespace omp { /*! \p omp::vector is a container that supports random access to elements, @@ -78,4 +79,4 @@ using thrust::system::omp::vector; using thrust::system::omp::universal_vector; } -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/system_error.h b/thrust/system/system_error.h index 84e453dc6..cf6139330 100644 --- a/thrust/system/system_error.h +++ b/thrust/system/system_error.h @@ -28,8 +28,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { @@ -173,7 +172,7 @@ class system_error // import names into thrust:: using system::system_error; -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/tbb/detail/adjacent_difference.h b/thrust/system/tbb/detail/adjacent_difference.h index d22b4aac3..ab519d11e 100644 --- a/thrust/system/tbb/detail/adjacent_difference.h +++ b/thrust/system/tbb/detail/adjacent_difference.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -46,5 +45,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -51,7 +50,7 @@ OutputIterator copy_n(execution_policy &exec, } // end namespace detail } // end namespace tbb } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/tbb/detail/copy.inl b/thrust/system/tbb/detail/copy.inl index 0d96ad48b..1016f40d4 100644 --- a/thrust/system/tbb/detail/copy.inl +++ b/thrust/system/tbb/detail/copy.inl @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -133,5 +132,5 @@ OutputIterator copy_n(execution_policy &exec, } // end namespace detail } // end namespace tbb } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/detail/copy_if.h b/thrust/system/tbb/detail/copy_if.h index 0420893ba..db860f377 100644 --- a/thrust/system/tbb/detail/copy_if.h +++ b/thrust/system/tbb/detail/copy_if.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -44,7 +43,7 @@ template diff --git a/thrust/system/tbb/detail/copy_if.inl b/thrust/system/tbb/detail/copy_if.inl index 9c074a9fc..aa2379b8d 100644 --- a/thrust/system/tbb/detail/copy_if.inl +++ b/thrust/system/tbb/detail/copy_if.inl @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -127,5 +126,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { // put the canonical tag in the same ns as the backend's entry points @@ -79,5 +78,5 @@ using thrust::system::tbb::execution_policy; using thrust::system::tbb::tag; } // end tbb -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/detail/extrema.h b/thrust/system/tbb/detail/extrema.h index e0dd4c042..c6c747f42 100644 --- a/thrust/system/tbb/detail/extrema.h +++ b/thrust/system/tbb/detail/extrema.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -62,6 +61,6 @@ thrust::pair minmax_element(execution_policy #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -42,5 +41,5 @@ InputIterator find_if(execution_policy &exec, } // end namespace detail } // end namespace tbb } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/detail/for_each.h b/thrust/system/tbb/detail/for_each.h index dfe5329b8..26c4b539b 100644 --- a/thrust/system/tbb/detail/for_each.h +++ b/thrust/system/tbb/detail/for_each.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -48,7 +47,7 @@ template diff --git a/thrust/system/tbb/detail/for_each.inl b/thrust/system/tbb/detail/for_each.inl index 00e025ea0..688b71723 100644 --- a/thrust/system/tbb/detail/for_each.inl +++ b/thrust/system/tbb/detail/for_each.inl @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -96,5 +95,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -82,5 +81,5 @@ inline void free(pointer ptr) } // end tbb } // end system -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/detail/merge.h b/thrust/system/tbb/detail/merge.h index 44608959c..014e2eb8b 100644 --- a/thrust/system/tbb/detail/merge.h +++ b/thrust/system/tbb/detail/merge.h @@ -19,8 +19,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -64,7 +63,7 @@ thrust::pair } // end detail } // end tbb } // end system -} // end thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/tbb/detail/merge.inl b/thrust/system/tbb/detail/merge.inl index a85bee163..bd5945158 100644 --- a/thrust/system/tbb/detail/merge.inl +++ b/thrust/system/tbb/detail/merge.inl @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include #include #include @@ -22,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -282,5 +283,5 @@ thrust::pair } // end namespace detail } // end namespace tbb } // end namespace system -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/detail/par.h b/thrust/system/tbb/detail/par.h index daabb537e..308d41e13 100644 --- a/thrust/system/tbb/detail/par.h +++ b/thrust/system/tbb/detail/par.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -58,5 +57,5 @@ using thrust::system::tbb::par; } // end tbb -} // end thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/detail/partition.h b/thrust/system/tbb/detail/partition.h index 80323535c..f9c56b92b 100644 --- a/thrust/system/tbb/detail/partition.h +++ b/thrust/system/tbb/detail/partition.h @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -81,7 +80,7 @@ template diff --git a/thrust/system/tbb/detail/partition.inl b/thrust/system/tbb/detail/partition.inl index 5085ed906..74ad809da 100644 --- a/thrust/system/tbb/detail/partition.inl +++ b/thrust/system/tbb/detail/partition.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -98,5 +97,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -48,7 +47,7 @@ template diff --git a/thrust/system/tbb/detail/reduce.inl b/thrust/system/tbb/detail/reduce.inl index bef54f5e2..47fe6616d 100644 --- a/thrust/system/tbb/detail/reduce.inl +++ b/thrust/system/tbb/detail/reduce.inl @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -127,5 +126,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -51,7 +50,7 @@ template diff --git a/thrust/system/tbb/detail/reduce_by_key.inl b/thrust/system/tbb/detail/reduce_by_key.inl index 70933f307..55a94a9b9 100644 --- a/thrust/system/tbb/detail/reduce_by_key.inl +++ b/thrust/system/tbb/detail/reduce_by_key.inl @@ -32,8 +32,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -338,5 +337,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -121,5 +120,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace omp @@ -75,7 +74,7 @@ template diff --git a/thrust/system/tbb/detail/remove.inl b/thrust/system/tbb/detail/remove.inl index 0a937799d..76d77e64b 100644 --- a/thrust/system/tbb/detail/remove.inl +++ b/thrust/system/tbb/detail/remove.inl @@ -20,8 +20,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -90,5 +89,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -58,7 +57,7 @@ template diff --git a/thrust/system/tbb/detail/scan.inl b/thrust/system/tbb/detail/scan.inl index 613b02872..d6e894983 100644 --- a/thrust/system/tbb/detail/scan.inl +++ b/thrust/system/tbb/detail/scan.inl @@ -28,8 +28,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -256,4 +255,4 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -49,7 +48,7 @@ template diff --git a/thrust/system/tbb/detail/sort.inl b/thrust/system/tbb/detail/sort.inl index 907fa2089..070fb8225 100644 --- a/thrust/system/tbb/detail/sort.inl +++ b/thrust/system/tbb/detail/sort.inl @@ -24,8 +24,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -261,5 +260,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -53,7 +52,7 @@ template diff --git a/thrust/system/tbb/detail/unique.inl b/thrust/system/tbb/detail/unique.inl index 4ee3c0d9a..0c3c16f2e 100644 --- a/thrust/system/tbb/detail/unique.inl +++ b/thrust/system/tbb/detail/unique.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -62,5 +61,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -61,7 +60,7 @@ template diff --git a/thrust/system/tbb/detail/unique_by_key.inl b/thrust/system/tbb/detail/unique_by_key.inl index 9c1a150e1..dbd5922b0 100644 --- a/thrust/system/tbb/detail/unique_by_key.inl +++ b/thrust/system/tbb/detail/unique_by_key.inl @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -70,5 +69,5 @@ template #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace system { namespace tbb @@ -98,7 +97,7 @@ using thrust::system::tbb::allocator; using thrust::system::tbb::universal_allocator; } // namsespace tbb -} // namespace thrust +THRUST_NAMESPACE_END #include diff --git a/thrust/system/tbb/memory_resource.h b/thrust/system/tbb/memory_resource.h index 4e534407c..e4b98c239 100644 --- a/thrust/system/tbb/memory_resource.h +++ b/thrust/system/tbb/memory_resource.h @@ -26,7 +26,8 @@ #include -namespace thrust { namespace system { namespace tbb +THRUST_NAMESPACE_BEGIN +namespace system { namespace tbb { //! \cond @@ -63,5 +64,6 @@ typedef detail::native_resource universal_host_pinned_memory_resource; /*! \} */ -}}} // namespace thrust::system::tbb +}} // namespace system::tbb +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/pointer.h b/thrust/system/tbb/pointer.h index ad01f44a7..065e1a548 100644 --- a/thrust/system/tbb/pointer.h +++ b/thrust/system/tbb/pointer.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace system { namespace tbb +THRUST_NAMESPACE_BEGIN +namespace system { namespace tbb { /*! \p tbb::pointer stores a pointer to an object allocated in memory accessible @@ -112,5 +113,5 @@ using thrust::system::tbb::universal_pointer; using thrust::system::tbb::reference; } // namespace tbb -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system/tbb/vector.h b/thrust/system/tbb/vector.h index e5d148416..8cbbabbd2 100644 --- a/thrust/system/tbb/vector.h +++ b/thrust/system/tbb/vector.h @@ -26,7 +26,8 @@ #include #include -namespace thrust { namespace system { namespace tbb +THRUST_NAMESPACE_BEGIN +namespace system { namespace tbb { /*! \p tbb::vector is a container that supports random access to elements, @@ -78,4 +79,4 @@ using thrust::system::tbb::vector; using thrust::system::tbb::universal_vector; } -} // namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/system_error.h b/thrust/system_error.h index 7119ac4b6..674ec3da9 100644 --- a/thrust/system_error.h +++ b/thrust/system_error.h @@ -22,8 +22,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup system * \{ @@ -44,8 +43,7 @@ namespace system /*! \} // end system */ -} // end thrust +THRUST_NAMESPACE_END #include #include - diff --git a/thrust/tabulate.h b/thrust/tabulate.h index 1ed714455..7cb794550 100644 --- a/thrust/tabulate.h +++ b/thrust/tabulate.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup transformations * \{ @@ -122,8 +120,6 @@ template /*! \} // end transformations */ - -} // end namespace thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/transform.h b/thrust/transform.h index b78b38579..2d064c13b 100644 --- a/thrust/transform.h +++ b/thrust/transform.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup algorithms */ @@ -718,8 +716,6 @@ template - diff --git a/thrust/transform_reduce.h b/thrust/transform_reduce.h index 488ead6b6..11d6b84c3 100644 --- a/thrust/transform_reduce.h +++ b/thrust/transform_reduce.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup reductions * \{ @@ -191,8 +189,6 @@ template - diff --git a/thrust/transform_scan.h b/thrust/transform_scan.h index faa6a7791..6c0fe8116 100644 --- a/thrust/transform_scan.h +++ b/thrust/transform_scan.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup algorithms */ @@ -317,8 +315,6 @@ template - diff --git a/thrust/tuple.h b/thrust/tuple.h index 37f5210ef..76dc1f013 100644 --- a/thrust/tuple.h +++ b/thrust/tuple.h @@ -34,8 +34,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup utility * \{ @@ -566,5 +565,4 @@ bool operator>(const null_type&, const null_type&); /*! \} // utility */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/type_traits/integer_sequence.h b/thrust/type_traits/integer_sequence.h index dda3db342..77d6fa500 100644 --- a/thrust/type_traits/integer_sequence.h +++ b/thrust/type_traits/integer_sequence.h @@ -23,8 +23,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN #if THRUST_CPP_DIALECT >= 2014 @@ -256,7 +255,7 @@ struct integer_sequence_push_back_impl > } // namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/type_traits/is_contiguous_iterator.h b/thrust/type_traits/is_contiguous_iterator.h index 3e075bd28..ebd2845b6 100644 --- a/thrust/type_traits/is_contiguous_iterator.h +++ b/thrust/type_traits/is_contiguous_iterator.h @@ -38,8 +38,7 @@ #endif #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -85,10 +84,11 @@ struct proclaim_contiguous_iterator : false_type {}; /// ContiguousIterator /// by specializing `thrust::proclaim_contiguous_iterator`. #define THRUST_PROCLAIM_CONTIGUOUS_ITERATOR(Iterator) \ - namespace thrust { \ + THRUST_NAMESPACE_BEGIN \ template <> \ - struct proclaim_contiguous_iterator : ::thrust::true_type {}; \ - } /* end namespace thrust */ \ + struct proclaim_contiguous_iterator \ + : THRUST_NS_QUALIFIER::true_type {}; \ + THRUST_NAMESPACE_END \ /**/ /////////////////////////////////////////////////////////////////////////////// @@ -181,5 +181,5 @@ struct is_contiguous_iterator_impl } // namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/type_traits/is_execution_policy.h b/thrust/type_traits/is_execution_policy.h index 3f2f7ef80..cab434b0c 100644 --- a/thrust/type_traits/is_execution_policy.h +++ b/thrust/type_traits/is_execution_policy.h @@ -21,8 +21,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /// Unary metafunction that is \c true if \c T is an \a ExecutionPolicy and /// \c false otherwise. @@ -45,6 +44,6 @@ template constexpr bool is_execution_policy_v = is_execution_policy::value; #endif -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/type_traits/is_operator_less_or_greater_function_object.h b/thrust/type_traits/is_operator_less_or_greater_function_object.h index 6efc00223..58c795de5 100644 --- a/thrust/type_traits/is_operator_less_or_greater_function_object.h +++ b/thrust/type_traits/is_operator_less_or_greater_function_object.h @@ -27,8 +27,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -132,5 +131,5 @@ struct is_operator_greater_function_object_impl > : true_type } // namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/type_traits/is_operator_plus_function_object.h b/thrust/type_traits/is_operator_plus_function_object.h index 0b2ebb107..1af764ddf 100644 --- a/thrust/type_traits/is_operator_plus_function_object.h +++ b/thrust/type_traits/is_operator_plus_function_object.h @@ -26,8 +26,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -73,5 +72,5 @@ struct is_operator_plus_function_object_impl > : true_type {}; } // namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/type_traits/is_trivially_relocatable.h b/thrust/type_traits/is_trivially_relocatable.h index de38735d2..14fae0f7d 100644 --- a/thrust/type_traits/is_trivially_relocatable.h +++ b/thrust/type_traits/is_trivially_relocatable.h @@ -22,8 +22,7 @@ #include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN namespace detail { @@ -124,10 +123,11 @@ struct proclaim_trivially_relocatable : false_type {}; /// Declares that the type \c T is \a TriviallyRelocatable by specializing /// `thrust::proclaim_trivially_relocatable`. #define THRUST_PROCLAIM_TRIVIALLY_RELOCATABLE(T) \ - namespace thrust { \ + THRUST_NAMESPACE_BEGIN \ template <> \ - struct proclaim_trivially_relocatable : ::thrust::true_type {}; \ - } /* end namespace thrust */ \ + struct proclaim_trivially_relocatable : THRUST_NS_QUALIFIER::true_type \ + {}; \ + THRUST_NAMESPACE_END \ /**/ /////////////////////////////////////////////////////////////////////////////// @@ -186,7 +186,7 @@ struct is_trivially_relocatable_impl : is_trivially_relocatable_impl {} } // namespace detail -} // end namespace thrust +THRUST_NAMESPACE_END #if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA diff --git a/thrust/type_traits/logical_metafunctions.h b/thrust/type_traits/logical_metafunctions.h index 5f86ee6a8..97297e93c 100644 --- a/thrust/type_traits/logical_metafunctions.h +++ b/thrust/type_traits/logical_metafunctions.h @@ -19,8 +19,7 @@ #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN #if THRUST_CPP_DIALECT >= 2017 @@ -173,7 +172,7 @@ constexpr bool negation_value_v = negation_value::value; template struct negation_value : std::integral_constant {}; -} // end namespace thrust +THRUST_NAMESPACE_END #endif // THRUST_CPP_DIALECT >= 2011 diff --git a/thrust/type_traits/remove_cvref.h b/thrust/type_traits/remove_cvref.h index 0fb7fc32a..765dad332 100644 --- a/thrust/type_traits/remove_cvref.h +++ b/thrust/type_traits/remove_cvref.h @@ -16,17 +16,17 @@ #pragma once +#include + #if THRUST_CPP_DIALECT >= 2017 #if __has_include() # include #endif #endif -#include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN #if defined(__cpp_lib_remove_cvref) && (__cpp_lib_remove_cvref >= 201711L) @@ -50,5 +50,5 @@ using remove_cvref_t = typename remove_cvref::type; #endif // THRUST_CPP_DIALECT >= 2020 -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/type_traits/void_t.h b/thrust/type_traits/void_t.h index 8ab56a3e8..df9b0965c 100644 --- a/thrust/type_traits/void_t.h +++ b/thrust/type_traits/void_t.h @@ -26,8 +26,7 @@ # include #endif -namespace thrust -{ +THRUST_NAMESPACE_BEGIN #if THRUST_CPP_DIALECT >= 2011 @@ -60,5 +59,5 @@ struct voider #endif -} // end namespace thrust +THRUST_NAMESPACE_END diff --git a/thrust/uninitialized_copy.h b/thrust/uninitialized_copy.h index 1214f5fb5..94c2763e3 100644 --- a/thrust/uninitialized_copy.h +++ b/thrust/uninitialized_copy.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup copying * \{ @@ -296,8 +294,6 @@ template /*! \} // copying */ - -} // end thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/uninitialized_fill.h b/thrust/uninitialized_fill.h index d11d9f3e3..b46758a3c 100644 --- a/thrust/uninitialized_fill.h +++ b/thrust/uninitialized_fill.h @@ -24,9 +24,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup filling * \ingroup transformations @@ -269,7 +267,6 @@ template * \} // transformations */ -} // end thrust +THRUST_NAMESPACE_END #include - diff --git a/thrust/unique.h b/thrust/unique.h index 1782a5c92..426b37ab7 100644 --- a/thrust/unique.h +++ b/thrust/unique.h @@ -25,9 +25,7 @@ #include #include -namespace thrust -{ - +THRUST_NAMESPACE_BEGIN /*! \addtogroup stream_compaction * \{ @@ -961,8 +959,7 @@ template diff --git a/thrust/universal_allocator.h b/thrust/universal_allocator.h index dcd08d8d4..8d85cd20d 100644 --- a/thrust/universal_allocator.h +++ b/thrust/universal_allocator.h @@ -29,8 +29,7 @@ #include __THRUST_DEVICE_SYSTEM_MEMORY_HEADER #undef __THRUST_DEVICE_SYSTEM_MEMORY_HEADER -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /** \addtogroup memory_resources Memory Resources * \ingroup memory_management_classes @@ -75,5 +74,4 @@ using universal_ptr = /*! \} */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/universal_vector.h b/thrust/universal_vector.h index 485f4815b..444187f8c 100644 --- a/thrust/universal_vector.h +++ b/thrust/universal_vector.h @@ -30,8 +30,7 @@ #include __THRUST_DEVICE_SYSTEM_VECTOR_HEADER #undef __THRUST_DEVICE_SYSTEM_VECTOR_HEADER -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /** \addtogroup memory_resources Memory Resources * \ingroup memory_management_classes @@ -55,5 +54,4 @@ using thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::universal_vector; /*! \} */ -} // end thrust - +THRUST_NAMESPACE_END diff --git a/thrust/version.h b/thrust/version.h index ec7208edd..e2591cda3 100644 --- a/thrust/version.h +++ b/thrust/version.h @@ -73,12 +73,3 @@ * Legacy; will be 0 for all future releases. */ #define THRUST_PATCH_NUMBER 0 - -/*! \namespace thrust - * \brief \p thrust is the top-level namespace which contains all Thrust - * functions and types. - */ -namespace thrust -{ - -} diff --git a/thrust/zip_function.h b/thrust/zip_function.h index faea59d4c..b28e3babd 100644 --- a/thrust/zip_function.h +++ b/thrust/zip_function.h @@ -17,8 +17,7 @@ #include #include -namespace thrust -{ +THRUST_NAMESPACE_BEGIN /*! \addtogroup function_objects Function Objects * \{ @@ -206,6 +205,6 @@ auto make_zip_function(Function&& fun) -> zip_function