diff --git a/c/parallel/test/test_for.cpp b/c/parallel/test/test_for.cpp index 472a35ffbba..089aca96412 100644 --- a/c/parallel/test/test_for.cpp +++ b/c/parallel/test/test_for.cpp @@ -12,7 +12,7 @@ #include -#include "c2h.h" +#include "test_util.h" #include void for_each(cccl_iterator_t input, unsigned long long num_items, cccl_op_t op) diff --git a/c/parallel/test/test_reduce.cpp b/c/parallel/test/test_reduce.cpp index 74f00c09507..927bb5e18a7 100644 --- a/c/parallel/test/test_reduce.cpp +++ b/c/parallel/test/test_reduce.cpp @@ -10,7 +10,7 @@ #include -#include "c2h.h" +#include "test_util.h" void reduce(cccl_iterator_t input, cccl_iterator_t output, unsigned long long num_items, cccl_op_t op, cccl_value_t init) { diff --git a/c/parallel/test/c2h.h b/c/parallel/test/test_util.h similarity index 100% rename from c/parallel/test/c2h.h rename to c/parallel/test/test_util.h diff --git a/c2h/CMakeLists.txt b/c2h/CMakeLists.txt new file mode 100644 index 00000000000..6a0ab9cb207 --- /dev/null +++ b/c2h/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.21) + +project(C2H LANGUAGES CXX CUDA) + +cccl_get_catch2() + +find_package(CCCL CONFIG REQUIRED + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS "${CCCL_SOURCE_DIR}/lib/cmake/cccl/" +) + +find_package(CUDAToolkit) + +set(curand_default OFF) +if (CUDA_curand_LIBRARY) + set(curand_default ON) +endif() + +option(C2H_ENABLE_CURAND "Use CUDA CURAND library in c2h." ${curand_default}) + +add_library(cccl.c2h STATIC + generators.cu +) +target_include_directories(cccl.c2h PUBLIC "${C2H_SOURCE_DIR}/include") +target_link_libraries(cccl.c2h PUBLIC + CCCL::CCCL + Catch2::Catch2 +) + +if (C2H_ENABLE_CURAND) + target_link_libraries(cccl.c2h PRIVATE CUDA::curand) + target_compile_definitions(cccl.c2h PRIVATE C2H_HAS_CURAND=1) +else() + target_compile_definitions(cccl.c2h PRIVATE C2H_HAS_CURAND=0) +endif() + +add_library(cccl.c2h.main OBJECT + catch2_runner.cpp + catch2_runner_helper.cu +) +target_link_libraries(cccl.c2h.main PUBLIC cccl.c2h) diff --git a/cub/test/catch2_runner.cpp b/c2h/catch2_runner.cpp similarity index 98% rename from cub/test/catch2_runner.cpp rename to c2h/catch2_runner.cpp index 73f3f70d8a5..1295960aeaa 100644 --- a/cub/test/catch2_runner.cpp +++ b/c2h/catch2_runner.cpp @@ -31,4 +31,4 @@ #define CUB_CONFIG_MAIN #define CUB_EXCLUDE_CATCH2_HELPER_IMPL -#include "catch2_main.cuh" +#include diff --git a/cub/test/catch2_runner_helper.cu b/c2h/catch2_runner_helper.cu similarity index 100% rename from cub/test/catch2_runner_helper.cu rename to c2h/catch2_runner_helper.cu diff --git a/cub/test/catch2_runner_helper.inl b/c2h/catch2_runner_helper.inl similarity index 100% rename from cub/test/catch2_runner_helper.inl rename to c2h/catch2_runner_helper.inl diff --git a/cub/test/c2h/generators.cu b/c2h/generators.cu similarity index 99% rename from cub/test/c2h/generators.cu rename to c2h/generators.cu index a11b5eceee0..e6bdb7f87a9 100644 --- a/cub/test/c2h/generators.cu +++ b/c2h/generators.cu @@ -47,9 +47,9 @@ #include #include #include +#include #include #include -#include #if C2H_HAS_CURAND # include diff --git a/cub/test/bfloat16.h b/c2h/include/c2h/bfloat16.cuh similarity index 100% rename from cub/test/bfloat16.h rename to c2h/include/c2h/bfloat16.cuh diff --git a/cub/test/catch2_main.cuh b/c2h/include/c2h/catch2_main.cuh similarity index 98% rename from cub/test/catch2_main.cuh rename to c2h/include/c2h/catch2_main.cuh index 1d42355ce7a..d3958ff946c 100644 --- a/cub/test/catch2_main.cuh +++ b/c2h/include/c2h/catch2_main.cuh @@ -41,7 +41,7 @@ #include #if defined(CUB_CONFIG_MAIN) -# include "catch2_runner_helper.h" +# include # if !defined(CUB_EXCLUDE_CATCH2_HELPER_IMPL) # include "catch2_runner_helper.inl" diff --git a/cub/test/catch2_runner_helper.h b/c2h/include/c2h/catch2_runner_helper.cuh similarity index 100% rename from cub/test/catch2_runner_helper.h rename to c2h/include/c2h/catch2_runner_helper.cuh diff --git a/cub/test/catch2_test_helper.h b/c2h/include/c2h/catch2_test_helper.cuh similarity index 89% rename from cub/test/catch2_test_helper.h rename to c2h/include/c2h/catch2_test_helper.cuh index bcfa861e52d..111d69b85a4 100644 --- a/cub/test/catch2_test_helper.h +++ b/c2h/include/c2h/catch2_test_helper.cuh @@ -29,14 +29,13 @@ #include +#include + #include #include #include #include -#include "cuda/std/__cccl/diagnostic.h" -#include "test_util_vec.h" - #if __CUDACC_VER_MAJOR__ == 11 _CCCL_NV_DIAG_SUPPRESS(177) // catch2 may contain unused variableds #endif // nvcc-11 @@ -46,9 +45,9 @@ _CCCL_NV_DIAG_SUPPRESS(177) // catch2 may contain unused variableds #include #include -#include "catch2_main.cuh" -#include "test_warning_suppression.cuh" +#include #include +#include #include #include @@ -234,26 +233,26 @@ struct Catch::StringMaker #include #include -#define CUB_TEST_NAME_IMPL(NAME, PARAM) CUB_TEST_STR(NAME) "(" CUB_TEST_STR(PARAM) ")" +#define C2H_TEST_NAME_IMPL(NAME, PARAM) C2H_TEST_STR(NAME) "(" C2H_TEST_STR(PARAM) ")" -#define CUB_TEST_NAME(NAME) CUB_TEST_NAME_IMPL(NAME, VAR_IDX) +#define C2H_TEST_NAME(NAME) C2H_TEST_NAME_IMPL(NAME, VAR_IDX) -#define CUB_TEST_CONCAT(A, B) CUB_TEST_CONCAT_INNER(A, B) -#define CUB_TEST_CONCAT_INNER(A, B) A##B +#define C2H_TEST_CONCAT(A, B) C2H_TEST_CONCAT_INNER(A, B) +#define C2H_TEST_CONCAT_INNER(A, B) A##B -#define CUB_TEST_IMPL(ID, NAME, TAG, ...) \ - using CUB_TEST_CONCAT(types_, ID) = c2h::cartesian_product<__VA_ARGS__>; \ - TEMPLATE_LIST_TEST_CASE(CUB_TEST_NAME(NAME), TAG, CUB_TEST_CONCAT(types_, ID)) +#define C2H_TEST_IMPL(ID, NAME, TAG, ...) \ + using C2H_TEST_CONCAT(types_, ID) = c2h::cartesian_product<__VA_ARGS__>; \ + TEMPLATE_LIST_TEST_CASE(C2H_TEST_NAME(NAME), TAG, C2H_TEST_CONCAT(types_, ID)) -#define CUB_TEST(NAME, TAG, ...) CUB_TEST_IMPL(__LINE__, NAME, TAG, __VA_ARGS__) +#define C2H_TEST(NAME, TAG, ...) C2H_TEST_IMPL(__LINE__, NAME, TAG, __VA_ARGS__) -#define CUB_TEST_LIST_IMPL(ID, NAME, TAG, ...) \ - using CUB_TEST_CONCAT(types_, ID) = c2h::type_list<__VA_ARGS__>; \ - TEMPLATE_LIST_TEST_CASE(CUB_TEST_NAME(NAME), TAG, CUB_TEST_CONCAT(types_, ID)) +#define C2H_TEST_LIST_IMPL(ID, NAME, TAG, ...) \ + using C2H_TEST_CONCAT(types_, ID) = c2h::type_list<__VA_ARGS__>; \ + TEMPLATE_LIST_TEST_CASE(C2H_TEST_NAME(NAME), TAG, C2H_TEST_CONCAT(types_, ID)) -#define CUB_TEST_LIST(NAME, TAG, ...) CUB_TEST_LIST_IMPL(__LINE__, NAME, TAG, __VA_ARGS__) +#define C2H_TEST_LIST(NAME, TAG, ...) C2H_TEST_LIST_IMPL(__LINE__, NAME, TAG, __VA_ARGS__) -#define CUB_TEST_STR(a) #a +#define C2H_TEST_STR(a) #a namespace detail { @@ -267,7 +266,7 @@ inline std::size_t adjust_seed_count(std::size_t requested) } } // namespace detail -#define CUB_SEED(N) \ +#define C2H_SEED(N) \ c2h::seed_t \ { \ GENERATE_COPY(take( \ diff --git a/cub/test/c2h/checked_allocator.cuh b/c2h/include/c2h/checked_allocator.cuh similarity index 100% rename from cub/test/c2h/checked_allocator.cuh rename to c2h/include/c2h/checked_allocator.cuh diff --git a/cub/test/c2h/cpu_timer.cuh b/c2h/include/c2h/cpu_timer.cuh similarity index 100% rename from cub/test/c2h/cpu_timer.cuh rename to c2h/include/c2h/cpu_timer.cuh diff --git a/cub/test/c2h/custom_type.cuh b/c2h/include/c2h/custom_type.cuh similarity index 100% rename from cub/test/c2h/custom_type.cuh rename to c2h/include/c2h/custom_type.cuh diff --git a/cub/test/c2h/device_policy.cuh b/c2h/include/c2h/device_policy.cuh similarity index 100% rename from cub/test/c2h/device_policy.cuh rename to c2h/include/c2h/device_policy.cuh diff --git a/cub/test/c2h/extended_types.cuh b/c2h/include/c2h/extended_types.cuh similarity index 97% rename from cub/test/c2h/extended_types.cuh rename to c2h/include/c2h/extended_types.cuh index f14a0c59d1b..d8e53acd71e 100644 --- a/cub/test/c2h/extended_types.cuh +++ b/c2h/include/c2h/extended_types.cuh @@ -40,11 +40,11 @@ #ifdef TEST_HALF_T # include -# include "../half.h" +# include #endif #ifdef TEST_BF_T # include -# include "../bfloat16.h" +# include #endif diff --git a/cub/test/fill_striped.cuh b/c2h/include/c2h/fill_striped.cuh similarity index 100% rename from cub/test/fill_striped.cuh rename to c2h/include/c2h/fill_striped.cuh diff --git a/cub/test/c2h/generators.cuh b/c2h/include/c2h/generators.cuh similarity index 100% rename from cub/test/c2h/generators.cuh rename to c2h/include/c2h/generators.cuh diff --git a/cub/test/half.h b/c2h/include/c2h/half.cuh similarity index 100% rename from cub/test/half.h rename to c2h/include/c2h/half.cuh diff --git a/cub/test/test_util_vec.h b/c2h/include/c2h/test_util_vec.cuh similarity index 93% rename from cub/test/test_util_vec.h rename to c2h/include/c2h/test_util_vec.cuh index 37083775e79..d2e245727d0 100644 --- a/cub/test/test_util_vec.h +++ b/c2h/include/c2h/test_util_vec.cuh @@ -68,7 +68,7 @@ inline int CoutCast(signed char val) /** * Vector1 overloads */ -#define CUB_VEC_OVERLOAD_1(T, BaseT) \ +#define C2H_VEC_OVERLOAD_1(T, BaseT) \ /* Ostream output */ \ inline std::ostream& operator<<(std::ostream& os, const T& val) \ { \ @@ -105,7 +105,7 @@ inline int CoutCast(signed char val) /** * Vector2 overloads */ -#define CUB_VEC_OVERLOAD_2(T, BaseT) \ +#define C2H_VEC_OVERLOAD_2(T, BaseT) \ /* Ostream output */ \ inline std::ostream& operator<<(std::ostream& os, const T& val) \ { \ @@ -150,7 +150,7 @@ inline int CoutCast(signed char val) /** * Vector3 overloads */ -#define CUB_VEC_OVERLOAD_3(T, BaseT) \ +#define C2H_VEC_OVERLOAD_3(T, BaseT) \ /* Ostream output */ \ inline std::ostream& operator<<(std::ostream& os, const T& val) \ { \ @@ -203,7 +203,7 @@ inline int CoutCast(signed char val) /** * Vector4 overloads */ -#define CUB_VEC_OVERLOAD_4(T, BaseT) \ +#define C2H_VEC_OVERLOAD_4(T, BaseT) \ /* Ostream output */ \ inline std::ostream& operator<<(std::ostream& os, const T& val) \ { \ @@ -264,27 +264,27 @@ inline int CoutCast(signed char val) /** * All vector overloads */ -#define CUB_VEC_OVERLOAD(COMPONENT_T, BaseT) \ - CUB_VEC_OVERLOAD_1(COMPONENT_T##1, BaseT) \ - CUB_VEC_OVERLOAD_2(COMPONENT_T##2, BaseT) \ - CUB_VEC_OVERLOAD_3(COMPONENT_T##3, BaseT) \ - CUB_VEC_OVERLOAD_4(COMPONENT_T##4, BaseT) +#define C2H_VEC_OVERLOAD(COMPONENT_T, BaseT) \ + C2H_VEC_OVERLOAD_1(COMPONENT_T##1, BaseT) \ + C2H_VEC_OVERLOAD_2(COMPONENT_T##2, BaseT) \ + C2H_VEC_OVERLOAD_3(COMPONENT_T##3, BaseT) \ + C2H_VEC_OVERLOAD_4(COMPONENT_T##4, BaseT) /** * Define for types */ -CUB_VEC_OVERLOAD(char, char) -CUB_VEC_OVERLOAD(short, short) -CUB_VEC_OVERLOAD(int, int) -CUB_VEC_OVERLOAD(long, long) -CUB_VEC_OVERLOAD(longlong, long long) -CUB_VEC_OVERLOAD(uchar, unsigned char) -CUB_VEC_OVERLOAD(ushort, unsigned short) -CUB_VEC_OVERLOAD(uint, unsigned int) -CUB_VEC_OVERLOAD(ulong, unsigned long) -CUB_VEC_OVERLOAD(ulonglong, unsigned long long) -CUB_VEC_OVERLOAD(float, float) -CUB_VEC_OVERLOAD(double, double) +C2H_VEC_OVERLOAD(char, char) +C2H_VEC_OVERLOAD(short, short) +C2H_VEC_OVERLOAD(int, int) +C2H_VEC_OVERLOAD(long, long) +C2H_VEC_OVERLOAD(longlong, long long) +C2H_VEC_OVERLOAD(uchar, unsigned char) +C2H_VEC_OVERLOAD(ushort, unsigned short) +C2H_VEC_OVERLOAD(uint, unsigned int) +C2H_VEC_OVERLOAD(ulong, unsigned long) +C2H_VEC_OVERLOAD(ulonglong, unsigned long long) +C2H_VEC_OVERLOAD(float, float) +C2H_VEC_OVERLOAD(double, double) /* * The following section defines macros to overload cub::NumericTraits::{Max,Lowest}() for vector @@ -294,7 +294,7 @@ CUB_VEC_OVERLOAD(double, double) /** * Vector1 overloads */ -#define CUB_VEC_1_TRAITS_OVERLOAD(T, BaseT) \ +#define C2H_VEC_1_TRAITS_OVERLOAD(T, BaseT) \ CUB_NAMESPACE_BEGIN \ template <> \ struct NumericTraits \ @@ -321,7 +321,7 @@ CUB_VEC_OVERLOAD(double, double) /** * Vector2 overloads */ -#define CUB_VEC_2_TRAITS_OVERLOAD(T, BaseT) \ +#define C2H_VEC_2_TRAITS_OVERLOAD(T, BaseT) \ CUB_NAMESPACE_BEGIN \ template <> \ struct NumericTraits \ @@ -348,7 +348,7 @@ CUB_VEC_OVERLOAD(double, double) /** * Vector3 overloads */ -#define CUB_VEC_3_TRAITS_OVERLOAD(T, BaseT) \ +#define C2H_VEC_3_TRAITS_OVERLOAD(T, BaseT) \ CUB_NAMESPACE_BEGIN \ template <> \ struct NumericTraits \ @@ -375,7 +375,7 @@ CUB_VEC_OVERLOAD(double, double) /** * Vector4 overloads */ -#define CUB_VEC_4_TRAITS_OVERLOAD(T, BaseT) \ +#define C2H_VEC_4_TRAITS_OVERLOAD(T, BaseT) \ CUB_NAMESPACE_BEGIN \ template <> \ struct NumericTraits \ @@ -408,24 +408,24 @@ CUB_VEC_OVERLOAD(double, double) /** * All vector overloads */ -#define CUB_VEC_TRAITS_OVERLOAD(COMPONENT_T, BaseT) \ - CUB_VEC_1_TRAITS_OVERLOAD(COMPONENT_T##1, BaseT) \ - CUB_VEC_2_TRAITS_OVERLOAD(COMPONENT_T##2, BaseT) \ - CUB_VEC_3_TRAITS_OVERLOAD(COMPONENT_T##3, BaseT) \ - CUB_VEC_4_TRAITS_OVERLOAD(COMPONENT_T##4, BaseT) +#define C2H_VEC_TRAITS_OVERLOAD(COMPONENT_T, BaseT) \ + C2H_VEC_1_TRAITS_OVERLOAD(COMPONENT_T##1, BaseT) \ + C2H_VEC_2_TRAITS_OVERLOAD(COMPONENT_T##2, BaseT) \ + C2H_VEC_3_TRAITS_OVERLOAD(COMPONENT_T##3, BaseT) \ + C2H_VEC_4_TRAITS_OVERLOAD(COMPONENT_T##4, BaseT) /** * Define for types */ -CUB_VEC_TRAITS_OVERLOAD(char, signed char) -CUB_VEC_TRAITS_OVERLOAD(short, short) -CUB_VEC_TRAITS_OVERLOAD(int, int) -CUB_VEC_TRAITS_OVERLOAD(long, long) -CUB_VEC_TRAITS_OVERLOAD(longlong, long long) -CUB_VEC_TRAITS_OVERLOAD(uchar, unsigned char) -CUB_VEC_TRAITS_OVERLOAD(ushort, unsigned short) -CUB_VEC_TRAITS_OVERLOAD(uint, unsigned int) -CUB_VEC_TRAITS_OVERLOAD(ulong, unsigned long) -CUB_VEC_TRAITS_OVERLOAD(ulonglong, unsigned long long) -CUB_VEC_TRAITS_OVERLOAD(float, float) -CUB_VEC_TRAITS_OVERLOAD(double, double) +C2H_VEC_TRAITS_OVERLOAD(char, signed char) +C2H_VEC_TRAITS_OVERLOAD(short, short) +C2H_VEC_TRAITS_OVERLOAD(int, int) +C2H_VEC_TRAITS_OVERLOAD(long, long) +C2H_VEC_TRAITS_OVERLOAD(longlong, long long) +C2H_VEC_TRAITS_OVERLOAD(uchar, unsigned char) +C2H_VEC_TRAITS_OVERLOAD(ushort, unsigned short) +C2H_VEC_TRAITS_OVERLOAD(uint, unsigned int) +C2H_VEC_TRAITS_OVERLOAD(ulong, unsigned long) +C2H_VEC_TRAITS_OVERLOAD(ulonglong, unsigned long long) +C2H_VEC_TRAITS_OVERLOAD(float, float) +C2H_VEC_TRAITS_OVERLOAD(double, double) diff --git a/cub/test/c2h/utility.cuh b/c2h/include/c2h/utility.cuh similarity index 100% rename from cub/test/c2h/utility.cuh rename to c2h/include/c2h/utility.cuh diff --git a/cub/test/c2h/vector.cuh b/c2h/include/c2h/vector.cuh similarity index 100% rename from cub/test/c2h/vector.cuh rename to c2h/include/c2h/vector.cuh diff --git a/ci/inspect_changes.sh b/ci/inspect_changes.sh index 94ea4d85292..498e2f9d154 100755 --- a/ci/inspect_changes.sh +++ b/ci/inspect_changes.sh @@ -28,17 +28,19 @@ subprojects=( cudax python cccl_c_parallel + c2h ) # ...and their dependencies: declare -A dependencies=( [cccl]="" [libcudacxx]="cccl" - [cub]="cccl libcudacxx thrust" + [cub]="cccl libcudacxx thrust c2h" [thrust]="cccl libcudacxx cub" [cudax]="cccl libcudacxx" [python]="cccl libcudacxx cub thrust cccl_c_parallel" [cccl_c_parallel]="cccl libcudacxx cub thrust" + [c2h]="cccl libcudacxx cub thrust" ) declare -A project_names=( @@ -49,6 +51,7 @@ declare -A project_names=( [cudax]="CUDA Experimental" [python]="python" [cccl_c_parallel]="CCCL C Parallel Library" + [c2h]="Catch2Helper" ) # By default, the project directory is assumed to be the same as the subproject name, diff --git a/cmake/CCCLGetDependencies.cmake b/cmake/CCCLGetDependencies.cmake index 5693d916086..cd7f3c9fc41 100644 --- a/cmake/CCCLGetDependencies.cmake +++ b/cmake/CCCLGetDependencies.cmake @@ -5,6 +5,13 @@ macro(cccl_get_boost) CPMAddPackage("gh:boostorg/boost#boost-1.83.0") endmacro() +# The CCCL Catch2Helper library: +macro(cccl_get_c2h) + if (NOT TARGET cccl.c2h) + add_subdirectory("${CCCL_SOURCE_DIR}/c2h" "${CCCL_BINARY_DIR}/c2h") + endif() +endmacro() + macro(cccl_get_catch2) include("${_cccl_cpm_file}") CPMAddPackage("gh:catchorg/Catch2@2.13.9") diff --git a/cub/examples/CMakeLists.txt b/cub/examples/CMakeLists.txt index 3f1f35381c3..a12c4789758 100644 --- a/cub/examples/CMakeLists.txt +++ b/cub/examples/CMakeLists.txt @@ -1,3 +1,7 @@ +# Some of the examples include the `cub/test/test_util.h` header, which +# depends on c2h: +cccl_get_c2h() + # Create meta targets that build all examples for a single configuration: foreach(cub_target IN LISTS CUB_TARGETS) cub_get_target_property(config_prefix ${cub_target} PREFIX) @@ -30,7 +34,10 @@ function(cub_add_example target_name_var example_name example_src cub_target) set(example_meta_target cub.all.example.${example_name}) add_executable(${example_target} "${example_src}") - target_link_libraries(${example_target} ${cub_target}) + target_link_libraries(${example_target} PRIVATE + ${cub_target} + cccl.c2h + ) cub_clone_target_properties(${example_target} ${cub_target}) cub_configure_cuda_target(${example_target} RDC ${CUB_FORCE_RDC}) target_include_directories(${example_target} PRIVATE "${CUB_SOURCE_DIR}/examples") diff --git a/cub/test/CMakeLists.txt b/cub/test/CMakeLists.txt index 714ba2dd97d..5db6eea6cfa 100644 --- a/cub/test/CMakeLists.txt +++ b/cub/test/CMakeLists.txt @@ -18,18 +18,11 @@ else() ) endif() -cccl_get_catch2() +cccl_get_c2h() cccl_get_nvtx() find_package(CUDAToolkit) -set(curand_default OFF) -if (CUDA_curand_LIBRARY) - set(curand_default ON) -endif() - -option(CUB_C2H_ENABLE_CURAND "Use CUDA CURAND library" ${curand_default}) - set(build_nvrtc_tests ON) if ("NVHPC" STREQUAL "${CMAKE_CXX_COMPILER_ID}") set(build_nvrtc_tests OFF) @@ -181,31 +174,21 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id) # Per config helper library: set(config_c2h_target ${config_prefix}.test.catch2_helper.lid_${launcher_id}) if (NOT TARGET ${config_c2h_target}) - add_library(${config_c2h_target} STATIC c2h/generators.cu) - target_include_directories(${config_c2h_target} PUBLIC "${CUB_SOURCE_DIR}/test") + add_library(${config_c2h_target} INTERFACE) + target_include_directories(${config_c2h_target} INTERFACE "${CUB_SOURCE_DIR}/test") cub_clone_target_properties(${config_c2h_target} ${cub_target}) cub_configure_cuda_target(${config_c2h_target} RDC ${cdp_val}) - target_link_libraries(${config_c2h_target} PRIVATE ${cub_target}) - if (build_nvrtc_tests) - target_link_libraries(${config_c2h_target} PUBLIC CUDA::nvrtc CUDA::cuda_driver) - endif() - if (CUB_C2H_ENABLE_CURAND) - target_link_libraries(${config_c2h_target} PRIVATE CUDA::curand) - target_compile_definitions(${config_c2h_target} PRIVATE C2H_HAS_CURAND=1) - else() - target_compile_definitions(${config_c2h_target} PRIVATE C2H_HAS_CURAND=0) - endif() + target_link_libraries(${config_c2h_target} INTERFACE + ${cub_target} + cccl.c2h + CUDA::nvrtc + CUDA::cuda_driver + ) endif() # config_c2h_target if (CUB_SEPARATE_CATCH2) - set(catch2_main_objects ${config_prefix}.catch2_main_objects) - if (NOT TARGET ${catch2_main_objects}) - add_library(${catch2_main_objects} OBJECT catch2_runner.cpp catch2_runner_helper.cu) - target_link_libraries(${catch2_main_objects} PUBLIC Catch2::Catch2) - endif() - add_executable(${test_target} "${test_src}") - target_link_libraries(${test_target} PRIVATE ${catch2_main_objects}) + target_link_libraries(${test_target} PRIVATE cccl.c2h.main) add_dependencies(${config_meta_target} ${test_target}) add_test(NAME ${test_target} COMMAND "$") @@ -213,8 +196,9 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id) # Per config catch2 runner set(config_c2run_target ${config_prefix}.catch2_test.lid_${launcher_id}) if (NOT TARGET ${config_c2run_target}) - add_executable(${config_c2run_target} catch2_runner.cpp catch2_runner_helper.cu) + add_executable(${config_c2run_target}) target_link_libraries(${config_c2run_target} PRIVATE + cccl.c2h.main ${cub_target} ${config_c2h_target} Catch2::Catch2) @@ -272,16 +256,18 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id) set(test_meta_target cub.all.test.${test_name}) add_executable(${test_target} "${test_src}") - target_link_libraries(${test_target} ${cub_target}) + target_link_libraries(${test_target} PRIVATE + ${cub_target} + cccl.c2h + ) cub_clone_target_properties(${test_target} ${cub_target}) target_include_directories(${test_target} PRIVATE "${CUB_SOURCE_DIR}/test") target_compile_definitions(${test_target} PRIVATE CUB_DETAIL_DEBUG_ENABLE_SYNC) if ("${test_target}" MATCHES "nvtx_in_usercode") - target_link_libraries(${test_target} nvtx3-cpp) + target_link_libraries(${test_target} PRIVATE nvtx3-cpp) endif() - _cub_is_fail_test(is_fail_test "${test_src}") if (is_fail_test) set_target_properties(${test_target} PROPERTIES EXCLUDE_FROM_ALL true diff --git a/cub/test/catch2_large_array_sort_helper.cuh b/cub/test/catch2_large_array_sort_helper.cuh index 547a5f0c3b9..f4c6afbd4b9 100644 --- a/cub/test/catch2_large_array_sort_helper.cuh +++ b/cub/test/catch2_large_array_sort_helper.cuh @@ -46,11 +46,11 @@ #include #include +#include #include #include #include // seed_t #include -#include // #define DEBUG_TIMING diff --git a/cub/test/catch2_radix_sort_helper.cuh b/cub/test/catch2_radix_sort_helper.cuh index 0ea95f270a4..a09094f0bdd 100644 --- a/cub/test/catch2_radix_sort_helper.cuh +++ b/cub/test/catch2_radix_sort_helper.cuh @@ -46,10 +46,10 @@ #include #include -#include "c2h/generators.cuh" -#include "c2h/utility.cuh" -#include "c2h/vector.cuh" -#include "catch2_test_helper.h" +#include +#include +#include +#include // Index types used for OffsetsT testing using offset_types = c2h::type_list; diff --git a/cub/test/catch2_segmented_sort_helper.cuh b/cub/test/catch2_segmented_sort_helper.cuh index 401f02d71ea..f28140d6c76 100644 --- a/cub/test/catch2_segmented_sort_helper.cuh +++ b/cub/test/catch2_segmented_sort_helper.cuh @@ -45,28 +45,13 @@ #include +#include #include +#include #include -#include #include #include -#define TEST_HALF_T _CCCL_HAS_NVFP16 - -#define TEST_BF_T _CCCL_HAS_NVBF16 - -#if TEST_HALF_T -# include - -# include -#endif - -#if TEST_BF_T -# include - -# include -#endif - #define MAKE_SEED_MOD_FUNCTION(name, xor_mask) \ inline c2h::seed_t make_##name##_seed(const c2h::seed_t seed) \ { \ diff --git a/cub/test/catch2_test_block_adjacent_difference.cu b/cub/test/catch2_test_block_adjacent_difference.cu index c62237fd129..df25604d290 100644 --- a/cub/test/catch2_test_block_adjacent_difference.cu +++ b/cub/test/catch2_test_block_adjacent_difference.cu @@ -27,7 +27,7 @@ #include -#include "catch2_test_helper.h" +#include template __global__ void block_adj_diff_kernel(T* data, ActionT action, bool in_place) @@ -241,7 +241,7 @@ struct params_t static constexpr bool read_left = c2h::get<3, TestType>::value; }; -CUB_TEST("Block adjacent difference works with full tiles", +C2H_TEST("Block adjacent difference works with full tiles", "[adjacent difference][block]", key_types, items_per_thread, @@ -252,7 +252,7 @@ CUB_TEST("Block adjacent difference works with full tiles", using key_t = typename params::key_t; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); const bool in_place = GENERATE(false, true); @@ -264,7 +264,7 @@ CUB_TEST("Block adjacent difference works with full tiles", REQUIRE(h_data == d_data); } -CUB_TEST("Block adjacent difference works with last tiles", +C2H_TEST("Block adjacent difference works with last tiles", "[adjacent difference][block]", key_types, items_per_thread, @@ -275,7 +275,7 @@ CUB_TEST("Block adjacent difference works with last tiles", using key_t = typename params::key_t; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); const bool in_place = GENERATE(false, true); const int valid_items = GENERATE_COPY(take(10, random(0, params::tile_size))); @@ -289,7 +289,7 @@ CUB_TEST("Block adjacent difference works with last tiles", REQUIRE(h_data == d_data); } -CUB_TEST("Block adjacent difference works with single tiles", +C2H_TEST("Block adjacent difference works with single tiles", "[adjacent difference][block]", key_types, items_per_thread, @@ -300,7 +300,7 @@ CUB_TEST("Block adjacent difference works with single tiles", using key_t = typename params::key_t; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); const bool in_place = GENERATE(false, true); const int valid_items = GENERATE_COPY(take(10, random(0, params::tile_size))); @@ -317,7 +317,7 @@ CUB_TEST("Block adjacent difference works with single tiles", REQUIRE(h_data == d_data); } -CUB_TEST("Block adjacent difference works with middle tiles", +C2H_TEST("Block adjacent difference works with middle tiles", "[adjacent difference][block]", key_types, items_per_thread, @@ -328,7 +328,7 @@ CUB_TEST("Block adjacent difference works with middle tiles", using key_t = typename params::key_t; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); const bool in_place = GENERATE(false, true); @@ -343,7 +343,7 @@ CUB_TEST("Block adjacent difference works with middle tiles", REQUIRE(h_data == d_data); } -CUB_TEST("Block adjacent difference supports custom types", "[adjacent difference][block]", threads_in_block) +C2H_TEST("Block adjacent difference supports custom types", "[adjacent difference][block]", threads_in_block) { using key_t = c2h::custom_type_t; @@ -354,7 +354,7 @@ CUB_TEST("Block adjacent difference supports custom types", "[adjacent differenc constexpr bool in_place = true; c2h::device_vector d_data(tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); c2h::host_vector h_data = d_data; host_adj_diff(h_data, tile_size); diff --git a/cub/test/catch2_test_block_histogram.cu b/cub/test/catch2_test_block_histogram.cu index 3e3a6ce32e1..6bf005a3641 100644 --- a/cub/test/catch2_test_block_histogram.cu +++ b/cub/test/catch2_test_block_histogram.cu @@ -37,7 +37,7 @@ #include #include -#include "catch2_test_helper.h" +#include template ::value; }; -CUB_TEST("Block histogram can be computed with uniform input", +C2H_TEST("Block histogram can be computed with uniform input", "[histogram][block]", types, items_per_thread, @@ -131,7 +131,7 @@ c2h::host_vector compute_host_reference(int bins, const c2h::host_vector(std::min( static_cast(std::numeric_limits::max()), static_cast(params::bins - 1))); - c2h::gen(CUB_SEED(10), d_samples, min_bin, max_bin); + c2h::gen(C2H_SEED(10), d_samples, min_bin, max_bin); c2h::host_vector h_samples = d_samples; auto h_reference = compute_host_reference(params::bins, h_samples); diff --git a/cub/test/catch2_test_block_load.cu b/cub/test/catch2_test_block_load.cu index 43fd75698f9..32d87b3e4c9 100644 --- a/cub/test/catch2_test_block_load.cu +++ b/cub/test/catch2_test_block_load.cu @@ -30,7 +30,7 @@ #include #include -#include "catch2_test_helper.h" +#include template struct output_idx @@ -160,7 +160,7 @@ struct params_t static constexpr cub::BlockLoadAlgorithm load_algorithm = c2h::get<3, TestType>::value; }; -CUB_TEST("Block load works with even block sizes", +C2H_TEST("Block load works with even block sizes", "[load][block]", types, items_per_thread, @@ -171,7 +171,7 @@ CUB_TEST("Block load works with even block sizes", using type = typename params::type; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -183,7 +183,7 @@ CUB_TEST("Block load works with even block sizes", REQUIRE(d_input == d_output); } -CUB_TEST("Block load works with even odd sizes", +C2H_TEST("Block load works with even odd sizes", "[load][block]", types, items_per_thread, @@ -194,7 +194,7 @@ CUB_TEST("Block load works with even odd sizes", using type = typename params::type; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -206,14 +206,14 @@ CUB_TEST("Block load works with even odd sizes", REQUIRE(d_input == d_output); } -CUB_TEST( +C2H_TEST( "Block load works with even vector types", "[load][block]", vec_types, items_per_thread, a_block_size, load_algorithm) { using params = params_t; using type = typename params::type; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -225,7 +225,7 @@ CUB_TEST( REQUIRE(d_input == d_output); } -CUB_TEST("Block load works with custom types", "[load][block]", items_per_thread, load_algorithm) +C2H_TEST("Block load works with custom types", "[load][block]", items_per_thread, load_algorithm) { using type = c2h::custom_type_t; constexpr int items_per_thread = c2h::get<0, TestType>::value; @@ -234,7 +234,7 @@ CUB_TEST("Block load works with custom types", "[load][block]", items_per_thread static constexpr cub::BlockLoadAlgorithm load_algorithm = c2h::get<1, TestType>::value; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -246,7 +246,7 @@ CUB_TEST("Block load works with custom types", "[load][block]", items_per_thread REQUIRE(d_input == d_output); } -CUB_TEST("Block load works with caching iterators", "[load][block]", items_per_thread, load_algorithm) +C2H_TEST("Block load works with caching iterators", "[load][block]", items_per_thread, load_algorithm) { using type = int; constexpr int items_per_thread = c2h::get<0, TestType>::value; @@ -255,7 +255,7 @@ CUB_TEST("Block load works with caching iterators", "[load][block]", items_per_t static constexpr cub::BlockLoadAlgorithm load_algorithm = c2h::get<1, TestType>::value; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); cub::CacheModifiedInputIterator in( thrust::raw_pointer_cast(d_input.data())); diff --git a/cub/test/catch2_test_block_merge_sort.cu b/cub/test/catch2_test_block_merge_sort.cu index 3d1aa6b442d..a26caad9cb1 100644 --- a/cub/test/catch2_test_block_merge_sort.cu +++ b/cub/test/catch2_test_block_merge_sort.cu @@ -38,7 +38,7 @@ #include -#include "catch2_test_helper.h" +#include struct CustomLess { @@ -202,7 +202,7 @@ struct params_t static constexpr int tile_size = items_per_thread * threads_in_block; }; -CUB_TEST("Block merge sort can sort keys in partial tiles", +C2H_TEST("Block merge sort can sort keys in partial tiles", "[merge sort][block]", key_types, items_per_thread, @@ -213,7 +213,7 @@ CUB_TEST("Block merge sort can sort keys in partial tiles", c2h::device_vector d_keys(GENERATE_COPY(take(10, random(0, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_keys); + c2h::gen(C2H_SEED(10), d_keys); c2h::host_vector h_reference = d_keys; std::stable_sort(thrust::raw_pointer_cast(h_reference.data()), @@ -225,7 +225,7 @@ CUB_TEST("Block merge sort can sort keys in partial tiles", REQUIRE(h_reference == d_keys); } -CUB_TEST( +C2H_TEST( "Block merge sort can sort keys in full tiles", "[merge sort][block]", key_types, items_per_thread, threads_in_block) { using params = params_t; @@ -233,7 +233,7 @@ CUB_TEST( c2h::device_vector d_keys(params::tile_size); - c2h::gen(CUB_SEED(10), d_keys); + c2h::gen(C2H_SEED(10), d_keys); c2h::host_vector h_reference = d_keys; std::stable_sort(thrust::raw_pointer_cast(h_reference.data()), @@ -245,7 +245,7 @@ CUB_TEST( REQUIRE(h_reference == d_keys); } -CUB_TEST("Block merge sort can sort pairs in partial tiles", +C2H_TEST("Block merge sort can sort pairs in partial tiles", "[merge sort][block]", key_types, items_per_thread, @@ -259,8 +259,8 @@ CUB_TEST("Block merge sort can sort pairs in partial tiles", c2h::device_vector d_keys(GENERATE_COPY(take(10, random(0, params::tile_size)))); c2h::device_vector d_vals(d_keys.size()); - c2h::gen(CUB_SEED(5), d_keys); - c2h::gen(CUB_SEED(5), d_vals); + c2h::gen(C2H_SEED(5), d_keys); + c2h::gen(C2H_SEED(5), d_vals); c2h::host_vector h_keys = d_keys; c2h::host_vector h_vals = d_vals; @@ -291,7 +291,7 @@ CUB_TEST("Block merge sort can sort pairs in partial tiles", REQUIRE(h_vals == d_vals); } -CUB_TEST( +C2H_TEST( "Block merge sort can sort pairs in full tiles", "[merge sort][block]", key_types, items_per_thread, threads_in_block) { using params = params_t; @@ -302,8 +302,8 @@ CUB_TEST( c2h::device_vector d_keys(params::tile_size); c2h::device_vector d_vals(d_keys.size()); - c2h::gen(CUB_SEED(5), d_keys); - c2h::gen(CUB_SEED(5), d_vals); + c2h::gen(C2H_SEED(5), d_keys); + c2h::gen(C2H_SEED(5), d_vals); c2h::host_vector h_keys = d_keys; c2h::host_vector h_vals = d_vals; @@ -333,7 +333,7 @@ CUB_TEST( REQUIRE(h_vals == d_vals); } -CUB_TEST("Block merge sort can sort pairs with mixed types", "[merge sort][block]", threads_in_block) +C2H_TEST("Block merge sort can sort pairs with mixed types", "[merge sort][block]", threads_in_block) { using key_t = std::int32_t; using value_t = std::int64_t; @@ -346,8 +346,8 @@ CUB_TEST("Block merge sort can sort pairs with mixed types", "[merge sort][block c2h::device_vector d_keys(tile_size); c2h::device_vector d_vals(d_keys.size()); - c2h::gen(CUB_SEED(5), d_keys); - c2h::gen(CUB_SEED(5), d_vals); + c2h::gen(C2H_SEED(5), d_keys); + c2h::gen(C2H_SEED(5), d_vals); c2h::host_vector h_keys = d_keys; c2h::host_vector h_vals = d_vals; @@ -377,7 +377,7 @@ CUB_TEST("Block merge sort can sort pairs with mixed types", "[merge sort][block REQUIRE(h_vals == d_vals); } -CUB_TEST("Block merge sort can sort large tiles", "[merge sort][block]", threads_in_block) +C2H_TEST("Block merge sort can sort large tiles", "[merge sort][block]", threads_in_block) { using key_t = std::uint16_t; @@ -390,7 +390,7 @@ CUB_TEST("Block merge sort can sort large tiles", "[merge sort][block]", threads constexpr int tile_size = threads_in_block * items_per_thread; c2h::device_vector d_keys(tile_size); - c2h::gen(CUB_SEED(10), d_keys); + c2h::gen(C2H_SEED(10), d_keys); c2h::host_vector h_reference = d_keys; std::stable_sort(thrust::raw_pointer_cast(h_reference.data()), @@ -402,7 +402,7 @@ CUB_TEST("Block merge sort can sort large tiles", "[merge sort][block]", threads REQUIRE(h_reference == d_keys); } -CUB_TEST("Block merge sort is stable", "[merge sort][block]", threads_in_block) +C2H_TEST("Block merge sort is stable", "[merge sort][block]", threads_in_block) { using key_t = c2h::custom_type_t; @@ -411,7 +411,7 @@ CUB_TEST("Block merge sort is stable", "[merge sort][block]", threads_in_block) constexpr int tile_size = threads_in_block * items_per_thread; c2h::device_vector d_keys(tile_size); - c2h::gen(CUB_SEED(10), d_keys); + c2h::gen(C2H_SEED(10), d_keys); c2h::host_vector h_reference = d_keys; std::stable_sort(thrust::raw_pointer_cast(h_reference.data()), diff --git a/cub/test/catch2_test_block_radix_sort.cu b/cub/test/catch2_test_block_radix_sort.cu index ed692ca34af..e5636edde5a 100644 --- a/cub/test/catch2_test_block_radix_sort.cu +++ b/cub/test/catch2_test_block_radix_sort.cu @@ -32,7 +32,7 @@ #include #include "catch2_test_block_radix_sort.cuh" -#include "catch2_test_helper.h" // __CUDA_FP8_TYPES_EXIST__ +#include // __CUDA_FP8_TYPES_EXIST__ // %PARAM% TEST_MEMOIZE mem 0:1 // %PARAM% TEST_ALGORITHM alg 0:1 @@ -113,7 +113,7 @@ bool binary_equal( return thrust::equal(c2h::device_policy, d_output_ptr, d_output_ptr + d_output.size(), d_reference_ptr); } -CUB_TEST("Block radix sort can sort keys", +C2H_TEST("Block radix sort can sort keys", "[radix][sort][block]", types, no_value_types, @@ -129,7 +129,7 @@ CUB_TEST("Block radix sort can sort keys", c2h::device_vector d_output(params::tile_size); c2h::device_vector d_input(params::tile_size); - c2h::gen(CUB_SEED(2), d_input); + c2h::gen(C2H_SEED(2), d_input); constexpr int key_size = sizeof(type) * 8; const int begin_bit = GENERATE_COPY(take(2, random(0, key_size))); @@ -157,7 +157,7 @@ CUB_TEST("Block radix sort can sort keys", REQUIRE(binary_equal(d_output, h_reference, d_input)); } -CUB_TEST("Block radix sort can sort keys in descending order", +C2H_TEST("Block radix sort can sort keys in descending order", "[radix][sort][block]", types, no_value_types, @@ -173,7 +173,7 @@ CUB_TEST("Block radix sort can sort keys in descending order", c2h::device_vector d_output(params::tile_size); c2h::device_vector d_input(params::tile_size); - c2h::gen(CUB_SEED(2), d_input); + c2h::gen(C2H_SEED(2), d_input); constexpr int key_size = sizeof(type) * 8; const int begin_bit = GENERATE_COPY(take(2, random(0, key_size))); @@ -201,7 +201,7 @@ CUB_TEST("Block radix sort can sort keys in descending order", REQUIRE(binary_equal(d_output, h_reference, d_input)); } -CUB_TEST("Block radix sort can sort pairs", +C2H_TEST("Block radix sort can sort pairs", "[radix][sort][block]", key_types, no_value_types, @@ -220,8 +220,8 @@ CUB_TEST("Block radix sort can sort pairs", c2h::device_vector d_output_values(params::tile_size); c2h::device_vector d_input_keys(params::tile_size); c2h::device_vector d_input_values(params::tile_size); - c2h::gen(CUB_SEED(2), d_input_keys); - c2h::gen(CUB_SEED(2), d_input_values); + c2h::gen(C2H_SEED(2), d_input_keys); + c2h::gen(C2H_SEED(2), d_input_values); constexpr int key_size = sizeof(key_type) * 8; const int begin_bit = GENERATE_COPY(take(2, random(0, key_size))); @@ -253,7 +253,7 @@ CUB_TEST("Block radix sort can sort pairs", REQUIRE(binary_equal(d_output_values, h_reference.second, d_input_values)); } -CUB_TEST("Block radix sort can sort pairs in descending order", +C2H_TEST("Block radix sort can sort pairs in descending order", "[radix][sort][block]", key_types, no_value_types, @@ -272,8 +272,8 @@ CUB_TEST("Block radix sort can sort pairs in descending order", c2h::device_vector d_output_values(params::tile_size); c2h::device_vector d_input_keys(params::tile_size); c2h::device_vector d_input_values(params::tile_size); - c2h::gen(CUB_SEED(2), d_input_keys); - c2h::gen(CUB_SEED(2), d_input_values); + c2h::gen(C2H_SEED(2), d_input_keys); + c2h::gen(C2H_SEED(2), d_input_values); constexpr int key_size = sizeof(key_type) * 8; const int begin_bit = GENERATE_COPY(take(2, random(0, key_size))); @@ -305,7 +305,7 @@ CUB_TEST("Block radix sort can sort pairs in descending order", REQUIRE(binary_equal(d_output_values, h_reference.second, d_input_values)); } -CUB_TEST("Block radix sort can sort mixed pairs", +C2H_TEST("Block radix sort can sort mixed pairs", "[radix][sort][block]", key_types, value_types, @@ -324,8 +324,8 @@ CUB_TEST("Block radix sort can sort mixed pairs", c2h::device_vector d_output_values(params::tile_size); c2h::device_vector d_input_keys(params::tile_size); c2h::device_vector d_input_values(params::tile_size); - c2h::gen(CUB_SEED(2), d_input_keys); - c2h::gen(CUB_SEED(2), d_input_values); + c2h::gen(C2H_SEED(2), d_input_keys); + c2h::gen(C2H_SEED(2), d_input_values); constexpr int key_size = sizeof(key_type) * 8; const int begin_bit = GENERATE_COPY(take(2, random(0, key_size))); @@ -357,7 +357,7 @@ CUB_TEST("Block radix sort can sort mixed pairs", REQUIRE(d_output_values == h_reference.second); } -CUB_TEST("Block radix sort can sort mixed pairs in descending order", +C2H_TEST("Block radix sort can sort mixed pairs in descending order", "[radix][sort][block]", key_types, value_types, @@ -376,8 +376,8 @@ CUB_TEST("Block radix sort can sort mixed pairs in descending order", c2h::device_vector d_output_values(params::tile_size); c2h::device_vector d_input_keys(params::tile_size); c2h::device_vector d_input_values(params::tile_size); - c2h::gen(CUB_SEED(2), d_input_keys); - c2h::gen(CUB_SEED(2), d_input_values); + c2h::gen(C2H_SEED(2), d_input_keys); + c2h::gen(C2H_SEED(2), d_input_values); constexpr int key_size = sizeof(key_type) * 8; const int begin_bit = GENERATE_COPY(take(2, random(0, key_size))); diff --git a/cub/test/catch2_test_block_radix_sort.cuh b/cub/test/catch2_test_block_radix_sort.cuh index 9f3bd3b9cf9..2142eb5bf61 100644 --- a/cub/test/catch2_test_block_radix_sort.cuh +++ b/cub/test/catch2_test_block_radix_sort.cuh @@ -30,7 +30,7 @@ #include #include "catch2_radix_sort_helper.cuh" -#include "catch2_test_helper.h" +#include template #include -#include "catch2_test_helper.h" +#include template ::value; }; -CUB_TEST( +C2H_TEST( "Block reduce works with sum", "[reduce][block]", types, items_per_thread, block_dim_xs, block_dim_yzs, algorithm) { using params = params_t; @@ -160,7 +160,7 @@ CUB_TEST( c2h::device_vector d_out(1); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in, std::numeric_limits::min()); + c2h::gen(C2H_SEED(10), d_in, std::numeric_limits::min()); c2h::host_vector h_in = d_in; c2h::host_vector h_reference( @@ -178,7 +178,7 @@ CUB_TEST( REQUIRE_APPROX_EQ(h_reference, d_out); } -CUB_TEST("Block reduce works with sum in partial tiles", +C2H_TEST("Block reduce works with sum in partial tiles", "[reduce][block]", types, single_item_per_thread, @@ -191,7 +191,7 @@ CUB_TEST("Block reduce works with sum in partial tiles", c2h::device_vector d_out(1); c2h::device_vector d_in(GENERATE_COPY(take(2, random(1, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_in, std::numeric_limits::min()); + c2h::gen(C2H_SEED(10), d_in, std::numeric_limits::min()); c2h::host_vector h_in = d_in; std::vector h_reference( @@ -209,7 +209,7 @@ CUB_TEST("Block reduce works with sum in partial tiles", REQUIRE_APPROX_EQ(h_reference, d_out); } -CUB_TEST("Block reduce works with custom op", +C2H_TEST("Block reduce works with custom op", "[reduce][block]", types, items_per_thread, @@ -222,7 +222,7 @@ CUB_TEST("Block reduce works with custom op", c2h::device_vector d_out(1); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in, std::numeric_limits::min()); + c2h::gen(C2H_SEED(10), d_in, std::numeric_limits::min()); c2h::host_vector h_in = d_in; c2h::host_vector h_reference( @@ -240,7 +240,7 @@ CUB_TEST("Block reduce works with custom op", REQUIRE_APPROX_EQ(h_reference, d_out); } -CUB_TEST("Block reduce works with custom op in partial tiles", +C2H_TEST("Block reduce works with custom op in partial tiles", "[reduce][block]", types, single_item_per_thread, @@ -253,7 +253,7 @@ CUB_TEST("Block reduce works with custom op in partial tiles", c2h::device_vector d_out(1); c2h::device_vector d_in(GENERATE_COPY(take(2, random(1, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_in, std::numeric_limits::min()); + c2h::gen(C2H_SEED(10), d_in, std::numeric_limits::min()); c2h::host_vector h_in = d_in; c2h::host_vector h_reference( @@ -271,7 +271,7 @@ CUB_TEST("Block reduce works with custom op in partial tiles", REQUIRE_APPROX_EQ(h_reference, d_out); } -CUB_TEST("Block reduce works with custom types", "[reduce][block]", block_dim_xs, block_dim_yzs, algorithm) +C2H_TEST("Block reduce works with custom types", "[reduce][block]", block_dim_xs, block_dim_yzs, algorithm) { using type = c2h::custom_type_t; @@ -285,7 +285,7 @@ CUB_TEST("Block reduce works with custom types", "[reduce][block]", block_dim_xs c2h::device_vector d_out(1); c2h::device_vector d_in(GENERATE_COPY(take(2, random(1, tile_size)))); - c2h::gen(CUB_SEED(10), d_in, std::numeric_limits::min()); + c2h::gen(C2H_SEED(10), d_in, std::numeric_limits::min()); c2h::host_vector h_in = d_in; c2h::host_vector h_reference( @@ -299,7 +299,7 @@ CUB_TEST("Block reduce works with custom types", "[reduce][block]", block_dim_xs REQUIRE(h_reference == d_out); } -CUB_TEST("Block reduce works with vec types", "[reduce][block]", vec_types, block_dim_xs, block_dim_yzs, algorithm) +C2H_TEST("Block reduce works with vec types", "[reduce][block]", vec_types, block_dim_xs, block_dim_yzs, algorithm) { using type = c2h::get<0, TestType>; @@ -313,7 +313,7 @@ CUB_TEST("Block reduce works with vec types", "[reduce][block]", vec_types, bloc c2h::device_vector d_out(1); c2h::device_vector d_in(GENERATE_COPY(take(2, random(1, tile_size)))); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); c2h::host_vector h_in = d_in; c2h::host_vector h_reference( diff --git a/cub/test/catch2_test_block_run_length_decode.cu b/cub/test/catch2_test_block_run_length_decode.cu index db2166659f9..03d62defefa 100644 --- a/cub/test/catch2_test_block_run_length_decode.cu +++ b/cub/test/catch2_test_block_run_length_decode.cu @@ -35,7 +35,7 @@ #include -#include "catch2_test_helper.h" +#include /****************************************************************************** * HELPER CLASS FOR RUN-LENGTH DECODING TESTS @@ -496,7 +496,7 @@ struct params_t static constexpr int block_dim_z = BlockDimZ; }; -CUB_TEST_LIST( +C2H_TEST_LIST( "Block Run Length Decode works with run lengths and offsets relative to each run", "[rld][block]", params_t<1, 1, 64>, @@ -520,7 +520,7 @@ CUB_TEST_LIST( DO_TEST_RELATIVE_OFFSETS>(); } -CUB_TEST_LIST( +C2H_TEST_LIST( "Block Run Length Decode works with run lengths and performs normal run-length " "decoding", "[rld][block]", @@ -545,7 +545,7 @@ CUB_TEST_LIST( DO_NOT_TEST_RELATIVE_OFFSETS>(); } -CUB_TEST_LIST( +C2H_TEST_LIST( "Block Run Length Decode works with run offsets and generates offsets relative to " "each run", "[rld][block]", @@ -570,7 +570,7 @@ CUB_TEST_LIST( DO_TEST_RELATIVE_OFFSETS>(); } -CUB_TEST_LIST( +C2H_TEST_LIST( "Block Run Length Decode works with run offsets and performs normal run-length " "decoding", "[rld][block]", diff --git a/cub/test/catch2_test_block_scan.cu b/cub/test/catch2_test_block_scan.cu index cc569d74c67..c399048e75c 100644 --- a/cub/test/catch2_test_block_scan.cu +++ b/cub/test/catch2_test_block_scan.cu @@ -29,7 +29,7 @@ #include -#include "catch2_test_helper.h" +#include template ::value; }; -CUB_TEST( +C2H_TEST( "Block scan works with sum", "[scan][block]", types, block_dim_x, block_dim_yz, items_per_thread, algorithm, modes) { using params = params_t; @@ -366,7 +366,7 @@ CUB_TEST( c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); block_scan( d_in, d_out, sum_op_t{}); @@ -377,7 +377,7 @@ CUB_TEST( REQUIRE_APPROX_EQ(h_out, d_out); } -CUB_TEST("Block scan works with vec types", "[scan][block]", vec_types, algorithm, modes) +C2H_TEST("Block scan works with vec types", "[scan][block]", vec_types, algorithm, modes) { constexpr int items_per_thread = 3; constexpr int block_dim_x = 256; @@ -391,7 +391,7 @@ CUB_TEST("Block scan works with vec types", "[scan][block]", vec_types, algorith c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); block_scan(d_in, d_out, sum_op_t{}); @@ -401,7 +401,7 @@ CUB_TEST("Block scan works with vec types", "[scan][block]", vec_types, algorith REQUIRE(h_out == d_out); } -CUB_TEST("Block scan works with custom types", "[scan][block]", algorithm, modes) +C2H_TEST("Block scan works with custom types", "[scan][block]", algorithm, modes) { constexpr int items_per_thread = 3; constexpr int block_dim_x = 256; @@ -415,7 +415,7 @@ CUB_TEST("Block scan works with custom types", "[scan][block]", algorithm, modes c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); block_scan(d_in, d_out, sum_op_t{}); @@ -425,7 +425,7 @@ CUB_TEST("Block scan works with custom types", "[scan][block]", algorithm, modes REQUIRE(h_out == d_out); } -CUB_TEST("Block scan returns valid block aggregate", "[scan][block]", algorithm, modes, block_dim_yz) +C2H_TEST("Block scan returns valid block aggregate", "[scan][block]", algorithm, modes, block_dim_yz) { constexpr int items_per_thread = 3; constexpr int block_dim_x = 64; @@ -443,7 +443,7 @@ CUB_TEST("Block scan returns valid block aggregate", "[scan][block]", algorithm, c2h::device_vector d_block_aggregate(1); c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); block_scan( d_in, d_out, sum_aggregate_op_t{target_thread_id, thrust::raw_pointer_cast(d_block_aggregate.data())}); @@ -455,7 +455,7 @@ CUB_TEST("Block scan returns valid block aggregate", "[scan][block]", algorithm, REQUIRE(block_aggregate == d_block_aggregate[0]); } -CUB_TEST("Block scan supports prefix op", "[scan][block]", algorithm, modes, block_dim_yz) +C2H_TEST("Block scan supports prefix op", "[scan][block]", algorithm, modes, block_dim_yz) { constexpr int items_per_thread = 3; constexpr int block_dim_x = 64; @@ -472,7 +472,7 @@ CUB_TEST("Block scan supports prefix op", "[scan][block]", algorithm, modes, blo c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); block_scan( d_in, d_out, sum_prefix_op_t{prefix}); @@ -483,7 +483,7 @@ CUB_TEST("Block scan supports prefix op", "[scan][block]", algorithm, modes, blo REQUIRE(h_out == d_out); } -CUB_TEST("Block scan supports custom scan op", "[scan][block]", algorithm, modes, block_dim_yz) +C2H_TEST("Block scan supports custom scan op", "[scan][block]", algorithm, modes, block_dim_yz) { constexpr int items_per_thread = 3; constexpr int block_dim_x = 64; @@ -498,7 +498,7 @@ CUB_TEST("Block scan supports custom scan op", "[scan][block]", algorithm, modes c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); block_scan(d_in, d_out, min_op_t{}); @@ -521,7 +521,7 @@ CUB_TEST("Block scan supports custom scan op", "[scan][block]", algorithm, modes REQUIRE(h_out == d_out); } -CUB_TEST("Block custom op scan works with initial value", "[scan][block]", algorithm, modes, block_dim_yz) +C2H_TEST("Block custom op scan works with initial value", "[scan][block]", algorithm, modes, block_dim_yz) { constexpr int items_per_thread = 3; constexpr int block_dim_x = 64; @@ -536,7 +536,7 @@ CUB_TEST("Block custom op scan works with initial value", "[scan][block]", algor c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); const type initial_value = static_cast(GENERATE_COPY(take(2, random(0, tile_size)))); @@ -555,7 +555,7 @@ CUB_TEST("Block custom op scan works with initial value", "[scan][block]", algor REQUIRE(h_out == d_out); } -CUB_TEST("Block custom op scan with initial value returns valid block aggregate", +C2H_TEST("Block custom op scan with initial value returns valid block aggregate", "[scan][block]", algorithm, modes, @@ -574,7 +574,7 @@ CUB_TEST("Block custom op scan with initial value returns valid block aggregate" c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); const type initial_value = static_cast(GENERATE_COPY(take(2, random(0, tile_size)))); @@ -601,7 +601,7 @@ CUB_TEST("Block custom op scan with initial value returns valid block aggregate" REQUIRE(h_block_aggregate == d_block_aggregate[0]); } -CUB_TEST("Block scan supports prefix op and custom scan op", "[scan][block]", algorithm, modes, block_dim_yz) +C2H_TEST("Block scan supports prefix op and custom scan op", "[scan][block]", algorithm, modes, block_dim_yz) { constexpr int items_per_thread = 3; constexpr int block_dim_x = 64; @@ -618,7 +618,7 @@ CUB_TEST("Block scan supports prefix op and custom scan op", "[scan][block]", al c2h::device_vector d_out(tile_size); c2h::device_vector d_in(tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); block_scan( d_in, d_out, min_prefix_op_t{prefix}); diff --git a/cub/test/catch2_test_block_scan_api.cu b/cub/test/catch2_test_block_scan_api.cu index 9b1dd4fb4e6..16daea416cd 100644 --- a/cub/test/catch2_test_block_scan_api.cu +++ b/cub/test/catch2_test_block_scan_api.cu @@ -33,7 +33,7 @@ #include -#include "catch2_test_helper.h" +#include constexpr int num_items_per_thread = 2; constexpr int block_num_threads = 64; @@ -65,7 +65,7 @@ __global__ void InclusiveBlockScanKernel(int* output) output[threadIdx.x * 2 + 1] = thread_data[1]; } -CUB_TEST("Block array-based inclusive scan works with initial value", "[scan][block]") +C2H_TEST("Block array-based inclusive scan works with initial value", "[scan][block]") { thrust::device_vector d_out(block_num_threads * num_items_per_thread); @@ -119,7 +119,7 @@ __global__ void InclusiveBlockScanKernelAggregate(int* output, int* d_block_aggr output[threadIdx.x * 2 + 1] = thread_data[1]; } -CUB_TEST("Block array-based inclusive scan with block aggregate works with initial value", "[scan][block]") +C2H_TEST("Block array-based inclusive scan with block aggregate works with initial value", "[scan][block]") { thrust::device_vector d_out(block_num_threads * num_items_per_thread); diff --git a/cub/test/catch2_test_block_shuffle.cu b/cub/test/catch2_test_block_shuffle.cu index 21003f96c31..81212570268 100644 --- a/cub/test/catch2_test_block_shuffle.cu +++ b/cub/test/catch2_test_block_shuffle.cu @@ -38,7 +38,7 @@ #include -#include "catch2_test_helper.h" +#include template __global__ void block_shuffle_kernel(T* data, ActionT action) @@ -205,13 +205,13 @@ struct params_t static constexpr int tile_size = items_per_thread * threads_in_block; }; -CUB_TEST("Block shuffle offset works", "[shuffle][block]", types, single_item_per_thread, block_dim_x, block_dim_yz) +C2H_TEST("Block shuffle offset works", "[shuffle][block]", types, single_item_per_thread, block_dim_x, block_dim_yz) { using params = params_t; using type = typename params::type; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); const int distance = GENERATE_COPY(take(4, random(1 - params::tile_size, params::tile_size - 1))); @@ -230,13 +230,13 @@ CUB_TEST("Block shuffle offset works", "[shuffle][block]", types, single_item_pe REQUIRE(h_ref == d_data); } -CUB_TEST("Block shuffle rotate works", "[shuffle][block]", types, single_item_per_thread, block_dim_x, block_dim_yz) +C2H_TEST("Block shuffle rotate works", "[shuffle][block]", types, single_item_per_thread, block_dim_x, block_dim_yz) { using params = params_t; using type = typename params::type; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); c2h::device_vector d_ref = d_data; @@ -251,13 +251,13 @@ CUB_TEST("Block shuffle rotate works", "[shuffle][block]", types, single_item_pe REQUIRE(h_ref == d_data); } -CUB_TEST("Block shuffle up works", "[shuffle][block]", types, items_per_thread, block_dim_x, block_dim_yz) +C2H_TEST("Block shuffle up works", "[shuffle][block]", types, items_per_thread, block_dim_x, block_dim_yz) { using params = params_t; using type = typename params::type; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); c2h::device_vector d_ref(params::tile_size); thrust::copy(d_data.begin(), d_data.end() - 1, d_ref.begin() + 1); @@ -269,7 +269,7 @@ CUB_TEST("Block shuffle up works", "[shuffle][block]", types, items_per_thread, REQUIRE(d_ref == d_data); } -CUB_TEST("Block shuffle up works when suffix is required", +C2H_TEST("Block shuffle up works when suffix is required", "[shuffle][block]", types, items_per_thread, @@ -280,7 +280,7 @@ CUB_TEST("Block shuffle up works when suffix is required", using type = typename params::type; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); const int target_thread_id = GENERATE_COPY(take(2, random(0, params::threads_in_block - 1))); @@ -299,13 +299,13 @@ CUB_TEST("Block shuffle up works when suffix is required", REQUIRE(d_suffix_ref == d_suffix); } -CUB_TEST("Block shuffle down works", "[shuffle][block]", types, items_per_thread, block_dim_x, block_dim_yz) +C2H_TEST("Block shuffle down works", "[shuffle][block]", types, items_per_thread, block_dim_x, block_dim_yz) { using params = params_t; using type = typename params::type; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); c2h::device_vector d_ref(params::tile_size); thrust::copy(d_data.begin() + 1, d_data.end(), d_ref.begin()); @@ -317,7 +317,7 @@ CUB_TEST("Block shuffle down works", "[shuffle][block]", types, items_per_thread REQUIRE(d_ref == d_data); } -CUB_TEST("Block shuffle down works when prefix is required", +C2H_TEST("Block shuffle down works when prefix is required", "[shuffle][block]", types, items_per_thread, @@ -328,7 +328,7 @@ CUB_TEST("Block shuffle down works when prefix is required", using type = typename params::type; c2h::device_vector d_data(params::tile_size); - c2h::gen(CUB_SEED(10), d_data); + c2h::gen(C2H_SEED(10), d_data); const int target_thread_id = GENERATE_COPY(take(2, random(0, params::threads_in_block - 1))); diff --git a/cub/test/catch2_test_block_store.cu b/cub/test/catch2_test_block_store.cu index 566dd2e828e..517dbf49438 100644 --- a/cub/test/catch2_test_block_store.cu +++ b/cub/test/catch2_test_block_store.cu @@ -31,7 +31,7 @@ #include #include -#include "catch2_test_helper.h" +#include template struct output_idx @@ -161,7 +161,7 @@ struct params_t static constexpr cub::BlockStoreAlgorithm store_algorithm = c2h::get<3, TestType>::value; }; -CUB_TEST("Block store works with even block sizes", +C2H_TEST("Block store works with even block sizes", "[store][block]", types, items_per_thread, @@ -172,7 +172,7 @@ CUB_TEST("Block store works with even block sizes", using type = typename params::type; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -184,7 +184,7 @@ CUB_TEST("Block store works with even block sizes", REQUIRE(d_input == d_output); } -CUB_TEST("Block store works with even odd sizes", +C2H_TEST("Block store works with even odd sizes", "[store][block]", types, items_per_thread, @@ -195,7 +195,7 @@ CUB_TEST("Block store works with even odd sizes", using type = typename params::type; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -207,7 +207,7 @@ CUB_TEST("Block store works with even odd sizes", REQUIRE(d_input == d_output); } -CUB_TEST("Block store works with even vector types", +C2H_TEST("Block store works with even vector types", "[store][block]", vec_types, items_per_thread, @@ -218,7 +218,7 @@ CUB_TEST("Block store works with even vector types", using type = typename params::type; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, params::tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -230,7 +230,7 @@ CUB_TEST("Block store works with even vector types", REQUIRE(d_input == d_output); } -CUB_TEST("Block store works with custom types", "[store][block]", items_per_thread, store_algorithm) +C2H_TEST("Block store works with custom types", "[store][block]", items_per_thread, store_algorithm) { using type = c2h::custom_type_t; constexpr int items_per_thread = c2h::get<0, TestType>::value; @@ -239,7 +239,7 @@ CUB_TEST("Block store works with custom types", "[store][block]", items_per_thre static constexpr cub::BlockStoreAlgorithm store_algorithm = c2h::get<1, TestType>::value; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); @@ -251,7 +251,7 @@ CUB_TEST("Block store works with custom types", "[store][block]", items_per_thre REQUIRE(d_input == d_output); } -CUB_TEST("Block store works with caching iterators", "[store][block]", items_per_thread, store_algorithm) +C2H_TEST("Block store works with caching iterators", "[store][block]", items_per_thread, store_algorithm) { using type = int; constexpr int items_per_thread = c2h::get<0, TestType>::value; @@ -260,7 +260,7 @@ CUB_TEST("Block store works with caching iterators", "[store][block]", items_per static constexpr cub::BlockStoreAlgorithm store_algorithm = c2h::get<1, TestType>::value; c2h::device_vector d_input(GENERATE_COPY(take(10, random(0, tile_size)))); - c2h::gen(CUB_SEED(10), d_input); + c2h::gen(C2H_SEED(10), d_input); c2h::device_vector d_output(d_input.size()); cub::CacheModifiedOutputIterator out( diff --git a/cub/test/catch2_test_c2h_checked_cuda_allocator.cu b/cub/test/catch2_test_c2h_checked_cuda_allocator.cu index 1e07f8d0c7b..6b901a3ee42 100644 --- a/cub/test/catch2_test_c2h_checked_cuda_allocator.cu +++ b/cub/test/catch2_test_c2h_checked_cuda_allocator.cu @@ -31,7 +31,7 @@ #include // std::bad_alloc #include "thrust/detail/execution_policy.h" -#include +#include std::size_t get_alloc_bytes() { @@ -48,7 +48,7 @@ std::size_t get_alloc_bytes() return alloc_bytes; } -CUB_TEST("c2h::device_vector throws when requested allocations exceed free device memory", +C2H_TEST("c2h::device_vector throws when requested allocations exceed free device memory", "[c2h][checked_cuda_allocator][device_vector]") { c2h::device_vector vec; @@ -57,7 +57,7 @@ CUB_TEST("c2h::device_vector throws when requested allocations exceed free devic REQUIRE_THROWS_AS(vec.resize(alloc_bytes), std::bad_alloc); } -CUB_TEST("c2h::device_policy throws when requested allocations exceed free device memory", +C2H_TEST("c2h::device_policy throws when requested allocations exceed free device memory", "[c2h][checked_cuda_allocator][device_policy]") { thrust::pair buffer{nullptr, 0}; diff --git a/cub/test/catch2_test_debug.cu b/cub/test/catch2_test_debug.cu index 40ad99189cd..e565c218c5e 100644 --- a/cub/test/catch2_test_debug.cu +++ b/cub/test/catch2_test_debug.cu @@ -1,7 +1,7 @@ #include #include -#include "catch2_test_helper.h" +#include TEST_CASE("CubDebug returns input error", "[debug][utils]") { diff --git a/cub/test/catch2_test_device_adjacent_difference_substract_left.cu b/cub/test/catch2_test_device_adjacent_difference_substract_left.cu index 2dcf3276018..69c7ec35503 100644 --- a/cub/test/catch2_test_device_adjacent_difference_substract_left.cu +++ b/cub/test/catch2_test_device_adjacent_difference_substract_left.cu @@ -35,9 +35,9 @@ #include #include -#include "c2h/custom_type.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceAdjacentDifference::SubtractLeft, adjacent_difference_subtract_left); DECLARE_LAUNCH_WRAPPER(cub::DeviceAdjacentDifference::SubtractLeftCopy, adjacent_difference_subtract_left_copy); @@ -54,7 +54,7 @@ using all_types = using types = c2h::type_list; -CUB_TEST("DeviceAdjacentDifference::SubtractLeft can run with empty input", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractLeft can run with empty input", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; @@ -64,7 +64,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeft can run with empty input", "[de adjacent_difference_subtract_left(in.begin(), num_items, cub::Difference{}); } -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy can run with empty input", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy can run with empty input", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; @@ -75,13 +75,13 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy can run with empty input", adjacent_difference_subtract_left_copy(in.begin(), out.begin(), num_items, cub::Difference{}); } -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy does not change the input", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy does not change the input", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector reference = in; adjacent_difference_subtract_left_copy(in.begin(), thrust::discard_iterator<>(), num_items, cub::Difference{}); @@ -89,13 +89,13 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy does not change the input", REQUIRE(reference == in); } -CUB_TEST("DeviceAdjacentDifference::SubtractLeft works with iterators", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractLeft works with iterators", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -106,14 +106,14 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeft works with iterators", "[device REQUIRE(reference == in); } -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with iterators", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with iterators", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -124,13 +124,13 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with iterators", "[de REQUIRE(reference == out); } -CUB_TEST("DeviceAdjacentDifference::SubtractLeft works with pointers", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractLeft works with pointers", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -141,14 +141,14 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeft works with pointers", "[device] REQUIRE(reference == in); } -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with pointers", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with pointers", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -175,7 +175,7 @@ struct cust_diff } }; -CUB_TEST("DeviceAdjacentDifference::SubtractLeft works with custom difference", +C2H_TEST("DeviceAdjacentDifference::SubtractLeft works with custom difference", "[device][adjacent_difference]", all_types) { @@ -183,7 +183,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeft works with custom difference", const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -194,7 +194,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeft works with custom difference", REQUIRE(reference == in); } -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with custom difference", +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with custom difference", "[device][adjacent_difference]", all_types) { @@ -203,7 +203,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with custom differenc const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -234,7 +234,7 @@ struct convertible_from_T } }; -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with a different output type", +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with a different output type", "[device][adjacent_difference]", types) { @@ -243,7 +243,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with a different outp const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector> out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -270,7 +270,7 @@ struct check_difference } }; -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with large indexes", "[device][adjacent_difference]") +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy works with large indexes", "[device][adjacent_difference]") { constexpr cuda::std::size_t num_items = 1ll << 33; c2h::device_vector error(1); @@ -299,7 +299,7 @@ private: unsigned long long* counts_; }; -CUB_TEST("DeviceAdjacentDifference::SubtractLeftCopy uses right number of invocations", "[device][adjacent_difference]") +C2H_TEST("DeviceAdjacentDifference::SubtractLeftCopy uses right number of invocations", "[device][adjacent_difference]") { const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector counts(1, 0); diff --git a/cub/test/catch2_test_device_adjacent_difference_substract_right.cu b/cub/test/catch2_test_device_adjacent_difference_substract_right.cu index 5f464c33ec8..93590232ee7 100644 --- a/cub/test/catch2_test_device_adjacent_difference_substract_right.cu +++ b/cub/test/catch2_test_device_adjacent_difference_substract_right.cu @@ -35,9 +35,9 @@ #include #include -#include "c2h/custom_type.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceAdjacentDifference::SubtractRight, adjacent_difference_subtract_right); DECLARE_LAUNCH_WRAPPER(cub::DeviceAdjacentDifference::SubtractRightCopy, adjacent_difference_subtract_right_copy); @@ -54,7 +54,7 @@ using all_types = using types = c2h::type_list; -CUB_TEST("DeviceAdjacentDifference::SubtractRight can run with empty input", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractRight can run with empty input", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; @@ -64,7 +64,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRight can run with empty input", "[d adjacent_difference_subtract_right(in.begin(), num_items, cub::Difference{}); } -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy can run with empty input", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy can run with empty input", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; @@ -75,13 +75,13 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy can run with empty input", adjacent_difference_subtract_right_copy(in.begin(), out.begin(), num_items, cub::Difference{}); } -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy does not change the input", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy does not change the input", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector reference = in; adjacent_difference_subtract_right_copy(in.begin(), thrust::discard_iterator<>(), num_items, cub::Difference{}); @@ -114,14 +114,14 @@ struct ref_diff } }; -CUB_TEST("DeviceAdjacentDifference::SubtractRight works with iterators", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractRight works with iterators", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -134,14 +134,14 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRight works with iterators", "[devic REQUIRE(reference == in); } -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with iterators", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy works with iterators", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -154,13 +154,13 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with iterators", "[d REQUIRE(reference == out); } -CUB_TEST("DeviceAdjacentDifference::SubtractRight works with pointers", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractRight works with pointers", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -173,14 +173,14 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRight works with pointers", "[device REQUIRE(reference == in); } -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with pointers", "[device][adjacent_difference]", types) +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy works with pointers", "[device][adjacent_difference]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -218,7 +218,7 @@ struct cust_diff } }; -CUB_TEST("DeviceAdjacentDifference::SubtractRight works with custom difference", +C2H_TEST("DeviceAdjacentDifference::SubtractRight works with custom difference", "[device][adjacent_difference]", all_types) { @@ -226,7 +226,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRight works with custom difference", constexpr int num_items = 5; // GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -239,7 +239,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRight works with custom difference", REQUIRE(reference == in); } -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with custom difference", +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy works with custom difference", "[device][adjacent_difference]", types) { @@ -248,7 +248,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with custom differen const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -281,7 +281,7 @@ struct convertible_from_T } }; -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with a different output type", +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy works with a different output type", "[device][adjacent_difference]", types) { @@ -290,7 +290,7 @@ CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with a different out const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector> out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::host_vector h_in = in; c2h::host_vector reference(num_items); @@ -319,7 +319,7 @@ struct check_difference } }; -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy works with large indexes", "[device][adjacent_difference]") +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy works with large indexes", "[device][adjacent_difference]") { constexpr cuda::std::size_t num_items = 1ll << 33; c2h::device_vector error(1); @@ -348,7 +348,7 @@ private: unsigned long long* counts_; }; -CUB_TEST("DeviceAdjacentDifference::SubtractRightCopy uses right number of invocations", +C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy uses right number of invocations", "[device][adjacent_difference]") { const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); diff --git a/cub/test/catch2_test_device_bulk.cu b/cub/test/catch2_test_device_bulk.cu index 0f0a5172117..b92d182b58d 100644 --- a/cub/test/catch2_test_device_bulk.cu +++ b/cub/test/catch2_test_device_bulk.cu @@ -35,8 +35,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -57,7 +57,7 @@ struct incrementer_t } }; -CUB_TEST("Device bulk works", "[bulk][device]", offset_type) +C2H_TEST("Device bulk works", "[bulk][device]", offset_type) { using offset_t = c2h::get<0, TestType>; diff --git a/cub/test/catch2_test_device_decoupled_look_back.cu b/cub/test/catch2_test_device_decoupled_look_back.cu index ff778a30239..1f5602db18f 100644 --- a/cub/test/catch2_test_device_decoupled_look_back.cu +++ b/cub/test/catch2_test_device_decoupled_look_back.cu @@ -33,7 +33,7 @@ #include -#include "catch2_test_helper.h" +#include template __global__ void init_kernel(ScanTileStateT tile_state, int blocks_in_grid) @@ -119,7 +119,7 @@ c2h::host_vector compute_reference(const c2h::device_vector& return reference; } -CUB_TEST("Decoupled look-back works with various message types", "[decoupled look-back][device]", message_types) +C2H_TEST("Decoupled look-back works with various message types", "[decoupled look-back][device]", message_types) { using message_t = typename c2h::get<0, TestType>; using scan_tile_state_t = cub::ScanTileState; @@ -130,7 +130,7 @@ CUB_TEST("Decoupled look-back works with various message types", "[decoupled loo c2h::device_vector tile_data(num_tiles); message_t* d_tile_data = thrust::raw_pointer_cast(tile_data.data()); - c2h::gen(CUB_SEED(2), tile_data); + c2h::gen(C2H_SEED(2), tile_data); c2h::host_vector reference = compute_reference(tile_data); // Query temporary storage requirements diff --git a/cub/test/catch2_test_device_for.cu b/cub/test/catch2_test_device_for.cu index e54eb3ebc83..8fec01be114 100644 --- a/cub/test/catch2_test_device_for.cu +++ b/cub/test/catch2_test_device_for.cu @@ -36,8 +36,8 @@ #include #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -87,7 +87,7 @@ struct referencing_operator_t } }; -CUB_TEST("Device for each works", "[for][device]") +C2H_TEST("Device for each works", "[for][device]") { constexpr int max_items = 5000000; constexpr int min_items = 1; @@ -114,7 +114,7 @@ CUB_TEST("Device for each works", "[for][device]") REQUIRE(num_of_once_marked_items == num_items); } -CUB_TEST("Device for each works with bad operators", "[for][device]") +C2H_TEST("Device for each works with bad operators", "[for][device]") { constexpr int max_items = 5000000; constexpr int min_items = 1; @@ -135,7 +135,7 @@ CUB_TEST("Device for each works with bad operators", "[for][device]") REQUIRE(thrust::equal(c2h::device_policy, input.begin(), input.end(), thrust::make_counting_iterator(std::size_t{}))); } -CUB_TEST("Device for each works with unaligned vectors", "[for][device]") +C2H_TEST("Device for each works with unaligned vectors", "[for][device]") { constexpr int max_items = 5000000; constexpr int min_items = 1; @@ -166,7 +166,7 @@ CUB_TEST("Device for each works with unaligned vectors", "[for][device]") using offset_type = c2h::type_list; -CUB_TEST("Device for each n works", "[for][device]", offset_type) +C2H_TEST("Device for each n works", "[for][device]", offset_type) { using offset_t = c2h::get<0, TestType>; @@ -194,7 +194,7 @@ CUB_TEST("Device for each n works", "[for][device]", offset_type) REQUIRE(num_of_once_marked_items == num_items); } -CUB_TEST("Device for each n works with bad operators", "[for][device]", offset_type) +C2H_TEST("Device for each n works with bad operators", "[for][device]", offset_type) { using offset_t = c2h::get<0, TestType>; @@ -217,7 +217,7 @@ CUB_TEST("Device for each n works with bad operators", "[for][device]", offset_t REQUIRE(thrust::equal(c2h::device_policy, input.begin(), input.end(), thrust::make_counting_iterator(std::size_t{}))); } -CUB_TEST("Device for each n works with unaligned vectors", "[for][device]", offset_type) +C2H_TEST("Device for each n works with unaligned vectors", "[for][device]", offset_type) { using offset_t = c2h::get<0, TestType>; @@ -248,7 +248,7 @@ CUB_TEST("Device for each n works with unaligned vectors", "[for][device]", offs REQUIRE(num_of_once_marked_items == num_items); } -CUB_TEST("Device for each works with couting iterator", "[for][device]") +C2H_TEST("Device for each works with couting iterator", "[for][device]") { using offset_t = int; constexpr offset_t max_items = 5000000; diff --git a/cub/test/catch2_test_device_for_api.cu b/cub/test/catch2_test_device_for_api.cu index 49ae911fc65..c4fa2c06b5c 100644 --- a/cub/test/catch2_test_device_for_api.cu +++ b/cub/test/catch2_test_device_for_api.cu @@ -34,7 +34,7 @@ #include #include -#include "catch2_test_helper.h" +#include // example-begin bulk-square-t struct square_t @@ -73,7 +73,7 @@ struct odd_count_t }; // example-end bulk-odd-count-t -CUB_TEST("Device bulk works with temporary storage", "[bulk][device]") +C2H_TEST("Device bulk works with temporary storage", "[bulk][device]") { // example-begin bulk-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -97,7 +97,7 @@ CUB_TEST("Device bulk works with temporary storage", "[bulk][device]") REQUIRE(vec == expected); } -CUB_TEST("Device bulk works without temporary storage", "[bulk][device]") +C2H_TEST("Device bulk works without temporary storage", "[bulk][device]") { // example-begin bulk-wo-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -111,7 +111,7 @@ CUB_TEST("Device bulk works without temporary storage", "[bulk][device]") REQUIRE(vec == expected); } -CUB_TEST("Device for each n works with temporary storage", "[for_each][device]") +C2H_TEST("Device for each n works with temporary storage", "[for_each][device]") { // example-begin for-each-n-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -135,7 +135,7 @@ CUB_TEST("Device for each n works with temporary storage", "[for_each][device]") REQUIRE(vec == expected); } -CUB_TEST("Device for each n works without temporary storage", "[for_each][device]") +C2H_TEST("Device for each n works without temporary storage", "[for_each][device]") { // example-begin for-each-n-wo-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -149,7 +149,7 @@ CUB_TEST("Device for each n works without temporary storage", "[for_each][device REQUIRE(vec == expected); } -CUB_TEST("Device for each works with temporary storage", "[for_each][device]") +C2H_TEST("Device for each works with temporary storage", "[for_each][device]") { // example-begin for-each-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -173,7 +173,7 @@ CUB_TEST("Device for each works with temporary storage", "[for_each][device]") REQUIRE(vec == expected); } -CUB_TEST("Device for each works without temporary storage", "[for_each][device]") +C2H_TEST("Device for each works without temporary storage", "[for_each][device]") { // example-begin for-each-wo-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -187,7 +187,7 @@ CUB_TEST("Device for each works without temporary storage", "[for_each][device]" REQUIRE(vec == expected); } -CUB_TEST("Device for each n copy works with temporary storage", "[for_each][device]") +C2H_TEST("Device for each n copy works with temporary storage", "[for_each][device]") { // example-begin for-each-copy-n-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -212,7 +212,7 @@ CUB_TEST("Device for each n copy works with temporary storage", "[for_each][devi REQUIRE(count == expected); } -CUB_TEST("Device for each n copy works without temporary storage", "[for_each][device]") +C2H_TEST("Device for each n copy works without temporary storage", "[for_each][device]") { // example-begin for-each-copy-n-wo-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -227,7 +227,7 @@ CUB_TEST("Device for each n copy works without temporary storage", "[for_each][d REQUIRE(count == expected); } -CUB_TEST("Device for each copy works with temporary storage", "[for_each][device]") +C2H_TEST("Device for each copy works with temporary storage", "[for_each][device]") { // example-begin for-each-copy-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; @@ -252,7 +252,7 @@ CUB_TEST("Device for each copy works with temporary storage", "[for_each][device REQUIRE(count == expected); } -CUB_TEST("Device for each copy works without temporary storage", "[for_each][device]") +C2H_TEST("Device for each copy works without temporary storage", "[for_each][device]") { // example-begin for-each-copy-wo-temp-storage thrust::device_vector vec = {1, 2, 3, 4}; diff --git a/cub/test/catch2_test_device_for_copy.cu b/cub/test/catch2_test_device_for_copy.cu index fdb117eff68..822065d4161 100644 --- a/cub/test/catch2_test_device_for_copy.cu +++ b/cub/test/catch2_test_device_for_copy.cu @@ -35,8 +35,8 @@ #include #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -72,7 +72,7 @@ public: } }; -CUB_TEST("Device for each works", "[for_copy][device]") +C2H_TEST("Device for each works", "[for_copy][device]") { constexpr int max_items = 5000000; constexpr int min_items = 1; @@ -100,7 +100,7 @@ CUB_TEST("Device for each works", "[for_copy][device]") REQUIRE(num_of_once_marked_items == num_items); } -CUB_TEST("Device for each works with unaligned vectors", "[for_copy][device]") +C2H_TEST("Device for each works with unaligned vectors", "[for_copy][device]") { constexpr int max_items = 5000000; constexpr int min_items = 1; @@ -129,7 +129,7 @@ CUB_TEST("Device for each works with unaligned vectors", "[for_copy][device]") REQUIRE(num_of_once_marked_items == num_items); } -CUB_TEST("Device for each n works", "[for_copy][device]", offset_type) +C2H_TEST("Device for each n works", "[for_copy][device]", offset_type) { using offset_t = c2h::get<0, TestType>; @@ -157,7 +157,7 @@ CUB_TEST("Device for each n works", "[for_copy][device]", offset_type) REQUIRE(num_of_once_marked_items == num_items); } -CUB_TEST("Device for each n works with unaligned vectors", "[for_copy][device]", offset_type) +C2H_TEST("Device for each n works with unaligned vectors", "[for_copy][device]", offset_type) { using offset_t = c2h::get<0, TestType>; @@ -188,7 +188,7 @@ CUB_TEST("Device for each n works with unaligned vectors", "[for_copy][device]", REQUIRE(num_of_once_marked_items == num_items); } -CUB_TEST("Device for each works with couting iterator", "[for][device]") +C2H_TEST("Device for each works with couting iterator", "[for][device]") { using offset_t = int; constexpr offset_t max_items = 5000000; diff --git a/cub/test/catch2_test_device_for_utils.cu b/cub/test/catch2_test_device_for_utils.cu index 5ecbf0773e4..4ddcff24790 100644 --- a/cub/test/catch2_test_device_for_utils.cu +++ b/cub/test/catch2_test_device_for_utils.cu @@ -30,7 +30,7 @@ #include -#include "catch2_test_helper.h" +#include template struct value_t @@ -98,7 +98,7 @@ void test() STATIC_REQUIRE(!cub::detail::for_each::has_unique_value_overload::value); } -CUB_TEST("Device for utils correctly detect value overloads", "[for][device]") +C2H_TEST("Device for utils correctly detect value overloads", "[for][device]") { test(); test(); diff --git a/cub/test/catch2_test_device_histogram.cu b/cub/test/catch2_test_device_histogram.cu index d7405436e4b..f65c9bad2d4 100644 --- a/cub/test/catch2_test_device_histogram.cu +++ b/cub/test/catch2_test_device_histogram.cu @@ -38,10 +38,10 @@ #include #include -#include "c2h/extended_types.cuh" -#include "c2h/vector.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -244,13 +244,13 @@ void test_even_and_range(LevelT max_level, int max_level_count, OffsetT width, O if (entropy_reduction >= 0) { - c2h::gen(CUB_SEED(1), d_samples, SampleT{0}, static_cast(max_level)); + c2h::gen(C2H_SEED(1), d_samples, SampleT{0}, static_cast(max_level)); if (entropy_reduction > 0) { c2h::device_vector tmp(d_samples.size()); for (int i = 0; i < entropy_reduction; ++i) { - c2h::gen(CUB_SEED(1), tmp); + c2h::gen(C2H_SEED(1), tmp); thrust::transform( c2h::device_policy, d_samples.cbegin(), d_samples.cend(), tmp.cbegin(), d_samples.begin(), bit_and_anything{}); } @@ -417,7 +417,7 @@ using types = float, double>; -CUB_TEST("DeviceHistogram::Histogram* basic use", "[histogram][device]", types) +C2H_TEST("DeviceHistogram::Histogram* basic use", "[histogram][device]", types) { using sample_t = c2h::get<0, TestType>; using level_t = @@ -430,7 +430,7 @@ CUB_TEST("DeviceHistogram::Histogram* basic use", "[histogram][device]", types) // TODO(bgruber): float produces INFs in the HistogramRange test setup AND the HistogramEven implementation // This test covers int32 and int64 arithmetic for bin computation -CUB_TEST("DeviceHistogram::Histogram* large levels", "[histogram][device]", c2h::remove) +C2H_TEST("DeviceHistogram::Histogram* large levels", "[histogram][device]", c2h::remove) { using sample_t = c2h::get<0, TestType>; using level_t = sample_t; @@ -443,7 +443,7 @@ CUB_TEST("DeviceHistogram::Histogram* large levels", "[histogram][device]", c2h: test_even_and_range(max_level, max_level_count, 1920, 1080); } -CUB_TEST("DeviceHistogram::Histogram* odd image sizes", "[histogram][device]") +C2H_TEST("DeviceHistogram::Histogram* odd image sizes", "[histogram][device]") { using sample_t = int; using level_t = int; @@ -455,7 +455,7 @@ CUB_TEST("DeviceHistogram::Histogram* odd image sizes", "[histogram][device]") test_even_and_range(max_level, max_level_count, p.first, p.second); } -CUB_TEST("DeviceHistogram::Histogram* entropy", "[histogram][device]") +C2H_TEST("DeviceHistogram::Histogram* entropy", "[histogram][device]") { const int entropy_reduction = GENERATE(-1, 3, 5); // entropy_reduction = -1 -> all samples == 0 test_even_and_range(256, 256 + 1, 1920, 1080, entropy_reduction); @@ -468,7 +468,7 @@ struct ChannelConfig static constexpr auto active_channels = ActiveChannels; }; -CUB_TEST_LIST("DeviceHistogram::Histogram* channel configs", +C2H_TEST_LIST("DeviceHistogram::Histogram* channel configs", "[histogram][device]", ChannelConfig<1, 1>, ChannelConfig<3, 3>, @@ -480,7 +480,7 @@ CUB_TEST_LIST("DeviceHistogram::Histogram* channel configs", // Testing only HistogramEven is fine, because HistogramRange shares the loading logic and the different binning // implementations are not affected by the iterator. -CUB_TEST("DeviceHistogram::HistogramEven sample iterator", "[histogram_even][device]") +C2H_TEST("DeviceHistogram::HistogramEven sample iterator", "[histogram_even][device]") { using sample_t = int; const auto width = 100; @@ -524,12 +524,12 @@ CUB_TEST("DeviceHistogram::HistogramEven sample iterator", "[histogram_even][dev } // Regression: https://github.com/NVIDIA/cub/issues/479 -CUB_TEST("DeviceHistogram::Histogram* regression NVIDIA/cub#479", "[histogram][device]") +C2H_TEST("DeviceHistogram::Histogram* regression NVIDIA/cub#479", "[histogram][device]") { test_even_and_range(12, 7, 1920, 1080); } -CUB_TEST("DeviceHistogram::Histogram* down-conversion size_t to int", "[histogram][device]") +C2H_TEST("DeviceHistogram::Histogram* down-conversion size_t to int", "[histogram][device]") { _CCCL_IF_CONSTEXPR (sizeof(size_t) != sizeof(int)) { @@ -538,7 +538,7 @@ CUB_TEST("DeviceHistogram::Histogram* down-conversion size_t to int", "[histogra } } -CUB_TEST("DeviceHistogram::HistogramRange levels/samples aliasing", "[histogram_range][device]") +C2H_TEST("DeviceHistogram::HistogramRange levels/samples aliasing", "[histogram_range][device]") { constexpr int num_levels = 7; constexpr int h_samples[]{ @@ -572,7 +572,7 @@ CUB_TEST("DeviceHistogram::HistogramRange levels/samples aliasing", "[histogram_ #if TEST_LAUNCH == 0 // Our bin computation for HistogramEven is guaranteed only for when (max_level - min_level) * num_bins does not // overflow using uint64_t arithmetic. In case of overflow, we expect cudaErrorInvalidValue to be returned. -CUB_TEST_LIST("DeviceHistogram::HistogramEven bin computation does not overflow", +C2H_TEST_LIST("DeviceHistogram::HistogramEven bin computation does not overflow", "[histogram_even][device]", uint8_t, uint16_t, @@ -625,7 +625,7 @@ CUB_TEST_LIST("DeviceHistogram::HistogramEven bin computation does not overflow" #endif // TEST_LAUNCH == 0 // Regression test for https://github.com/NVIDIA/cub/issues/489: integer rounding errors lead to incorrect bin detection -CUB_TEST("DeviceHistogram::HistogramEven bin calculation regression", "[histogram_even][device]") +C2H_TEST("DeviceHistogram::HistogramEven bin calculation regression", "[histogram_even][device]") { constexpr int num_levels = 8; const auto h_histogram_ref = c2h::host_vector{1, 5, 0, 2, 1, 0, 0}; diff --git a/cub/test/catch2_test_device_merge.cu b/cub/test/catch2_test_device_merge.cu index abc8b1a5ce8..d456cfe0826 100644 --- a/cub/test/catch2_test_device_merge.cu +++ b/cub/test/catch2_test_device_merge.cu @@ -11,8 +11,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include #include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -128,8 +128,8 @@ void test_keys(Offset size1 = 3623, Offset size2 = 6346, CompareOp compare_op = c2h::device_vector keys1_d(size1); c2h::device_vector keys2_d(size2); - c2h::gen(CUB_SEED(1), keys1_d); - c2h::gen(CUB_SEED(1), keys2_d); + c2h::gen(C2H_SEED(1), keys1_d); + c2h::gen(C2H_SEED(1), keys2_d); thrust::sort(c2h::device_policy, keys1_d.begin(), keys1_d.end(), compare_op); thrust::sort(c2h::device_policy, keys2_d.begin(), keys2_d.end(), compare_op); @@ -152,7 +152,7 @@ void test_keys(Offset size1 = 3623, Offset size2 = 6346, CompareOp compare_op = CHECK((detail::to_vec(reference_h) == detail::to_vec(c2h::host_vector(result_d)))); } -CUB_TEST("DeviceMerge::MergeKeys key types", "[merge][device]", types) +C2H_TEST("DeviceMerge::MergeKeys key types", "[merge][device]", types) { using key_t = c2h::get<0, TestType>; using offset_t = int; @@ -172,7 +172,7 @@ struct fallback_test_policy_hub }; // TODO(bgruber): This test alone increases compile time from 1m16s to 8m43s. What's going on? -CUB_TEST("DeviceMerge::MergeKeys large key types", "[merge][device]", c2h::type_list) +C2H_TEST("DeviceMerge::MergeKeys large key types", "[merge][device]", c2h::type_list) { using key_t = c2h::get<0, TestType>; using offset_t = int; @@ -223,14 +223,14 @@ CUB_TEST("DeviceMerge::MergeKeys large key types", "[merge][device]", c2h::type_ }); } -CUB_TEST("DeviceMerge::MergeKeys offset types", "[merge][device]", offset_types) +C2H_TEST("DeviceMerge::MergeKeys offset types", "[merge][device]", offset_types) { using key_t = int; using offset_t = c2h::get<0, TestType>; test_keys(3623, 6346, ::cuda::std::less<>{}, merge_keys_custom_offset_type); } -CUB_TEST("DeviceMerge::MergeKeys input sizes", "[merge][device]") +C2H_TEST("DeviceMerge::MergeKeys input sizes", "[merge][device]") { using key_t = int; using offset_t = int; @@ -250,7 +250,7 @@ struct order } }; -CUB_TEST("DeviceMerge::MergeKeys no operator<", "[merge][device]") +C2H_TEST("DeviceMerge::MergeKeys no operator<", "[merge][device]") { using key_t = unordered_t; using offset_t = int; @@ -310,8 +310,8 @@ void test_pairs( // we start with random but sorted keys c2h::device_vector keys1_d(size1); c2h::device_vector keys2_d(size2); - c2h::gen(CUB_SEED(1), keys1_d); - c2h::gen(CUB_SEED(1), keys2_d); + c2h::gen(C2H_SEED(1), keys1_d); + c2h::gen(C2H_SEED(1), keys2_d); thrust::sort(c2h::device_policy, keys1_d.begin(), keys1_d.end(), compare_op); thrust::sort(c2h::device_policy, keys2_d.begin(), keys2_d.end(), compare_op); @@ -360,7 +360,7 @@ void test_pairs( CHECK((detail::to_vec(reference_values_h) == detail::to_vec(c2h::host_vector(result_values_d)))); } -CUB_TEST("DeviceMerge::MergePairs key types", "[merge][device]", types) +C2H_TEST("DeviceMerge::MergePairs key types", "[merge][device]", types) { using key_t = c2h::get<0, TestType>; using value_t = int; @@ -369,7 +369,7 @@ CUB_TEST("DeviceMerge::MergePairs key types", "[merge][device]", types) } // TODO(bgruber): fine tune the type sizes again to hit the fallback and the vsmem policies -// CUB_TEST("DeviceMerge::MergePairs large key types", "[merge][device]", large_types) +// C2H_TEST("DeviceMerge::MergePairs large key types", "[merge][device]", large_types) // { // using key_t = c2h::get<0, TestType>; // using value_t = int; @@ -377,7 +377,7 @@ CUB_TEST("DeviceMerge::MergePairs key types", "[merge][device]", types) // test_pairs(); // } -CUB_TEST("DeviceMerge::MergePairs value types", "[merge][device]", types) +C2H_TEST("DeviceMerge::MergePairs value types", "[merge][device]", types) { using key_t = int; using value_t = c2h::get<0, TestType>; @@ -385,7 +385,7 @@ CUB_TEST("DeviceMerge::MergePairs value types", "[merge][device]", types) test_pairs(); } -CUB_TEST("DeviceMerge::MergePairs offset types", "[merge][device]", offset_types) +C2H_TEST("DeviceMerge::MergePairs offset types", "[merge][device]", offset_types) { using key_t = int; using value_t = int; @@ -393,7 +393,7 @@ CUB_TEST("DeviceMerge::MergePairs offset types", "[merge][device]", offset_types test_pairs(3623, 6346, ::cuda::std::less<>{}, merge_pairs_custom_offset_type); } -CUB_TEST("DeviceMerge::MergePairs input sizes", "[merge][device]") +C2H_TEST("DeviceMerge::MergePairs input sizes", "[merge][device]") { using key_t = int; using value_t = int; @@ -404,7 +404,7 @@ CUB_TEST("DeviceMerge::MergePairs input sizes", "[merge][device]") } // this test exceeds 4GiB of memory and the range of 32-bit integers -CUB_TEST("DeviceMerge::MergePairs really large input", "[merge][device]") +C2H_TEST("DeviceMerge::MergePairs really large input", "[merge][device]") try { using key_t = char; @@ -417,7 +417,7 @@ catch (const std::bad_alloc&) // allocation failure is not a test failure, so we can run tests on smaller GPUs } -CUB_TEST("DeviceMerge::MergePairs iterators", "[merge][device]") +C2H_TEST("DeviceMerge::MergePairs iterators", "[merge][device]") { using key_t = int; using value_t = int; diff --git a/cub/test/catch2_test_device_merge_api.cu b/cub/test/catch2_test_device_merge_api.cu index 8aaf1708459..ff19e87546f 100644 --- a/cub/test/catch2_test_device_merge_api.cu +++ b/cub/test/catch2_test_device_merge_api.cu @@ -9,9 +9,9 @@ #include #include -#include "catch2_test_helper.h" +#include -CUB_TEST("DeviceMerge::MergeKeys API example", "[merge][device]") +C2H_TEST("DeviceMerge::MergeKeys API example", "[merge][device]") { // example-begin merge-keys thrust::device_vector keys1{0, 2, 5}; @@ -47,7 +47,7 @@ CUB_TEST("DeviceMerge::MergeKeys API example", "[merge][device]") CHECK(result == expected); } -CUB_TEST("DeviceMerge::MergePairs API example", "[merge][device]") +C2H_TEST("DeviceMerge::MergePairs API example", "[merge][device]") { // example-begin merge-pairs thrust::device_vector keys1{0, 2, 5}; diff --git a/cub/test/catch2_test_device_merge_sort.cu b/cub/test/catch2_test_device_merge_sort.cu index d7f1c10026b..51d94e75110 100644 --- a/cub/test/catch2_test_device_merge_sort.cu +++ b/cub/test/catch2_test_device_merge_sort.cu @@ -45,8 +45,8 @@ #include "catch2_large_array_sort_helper.cuh" #include "catch2_test_device_merge_sort_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -220,14 +220,14 @@ c2h::device_vector make_shuffled_key_ranks_vector(OffsetT num_items, c2 return key_ranks; } -CUB_TEST("DeviceMergeSort::SortKeysCopy works", "[merge][sort][device]", wide_key_types) +C2H_TEST("DeviceMergeSort::SortKeysCopy works", "[merge][sort][device]", wide_key_types) { using key_t = typename c2h::get<0, TestType>; using offset_t = std::int32_t; // Prepare input const offset_t num_items = GENERATE_COPY(take(2, random(1, 1000000)), values({500, 1000000, 2000000})); - auto key_ranks = make_shuffled_key_ranks_vector(num_items, CUB_SEED(2)); + auto key_ranks = make_shuffled_key_ranks_vector(num_items, C2H_SEED(2)); c2h::device_vector keys_in(num_items); thrust::transform( c2h::device_policy, key_ranks.begin(), key_ranks.end(), keys_in.begin(), rank_to_key_op_t{}); @@ -244,14 +244,14 @@ CUB_TEST("DeviceMergeSort::SortKeysCopy works", "[merge][sort][device]", wide_ke REQUIRE(results_equal == true); } -CUB_TEST("DeviceMergeSort::SortKeys works", "[merge][sort][device]", wide_key_types) +C2H_TEST("DeviceMergeSort::SortKeys works", "[merge][sort][device]", wide_key_types) { using key_t = typename c2h::get<0, TestType>; using offset_t = std::int32_t; // Prepare input const offset_t num_items = GENERATE_COPY(take(2, random(1, 1000000)), values({500, 1000000, 2000000})); - auto key_ranks = make_shuffled_key_ranks_vector(num_items, CUB_SEED(2)); + auto key_ranks = make_shuffled_key_ranks_vector(num_items, C2H_SEED(2)); c2h::device_vector keys_in_out(num_items); thrust::transform( c2h::device_policy, key_ranks.begin(), key_ranks.end(), keys_in_out.begin(), rank_to_key_op_t{}); @@ -266,7 +266,7 @@ CUB_TEST("DeviceMergeSort::SortKeys works", "[merge][sort][device]", wide_key_ty REQUIRE(results_equal == true); } -CUB_TEST("DeviceMergeSort::StableSortKeysCopy works and performs a stable sort when there are a lot sort-keys that " +C2H_TEST("DeviceMergeSort::StableSortKeysCopy works and performs a stable sort when there are a lot sort-keys that " "compare equal", "[merge][sort][device]") { @@ -276,7 +276,7 @@ CUB_TEST("DeviceMergeSort::StableSortKeysCopy works and performs a stable sort w // Prepare input (generate a items that compare equally to check for stability of sort) const offset_t num_items = GENERATE_COPY(take(2, random(1, 1000000)), values({500, 1000000, 2000000})); c2h::device_vector key_ranks(num_items); - c2h::gen(CUB_SEED(2), key_ranks, offset_t{}, static_cast(128)); + c2h::gen(C2H_SEED(2), key_ranks, offset_t{}, static_cast(128)); c2h::device_vector keys_in(num_items); auto key_value_it = thrust::make_counting_iterator(offset_t{}); auto key_init_it = thrust::make_zip_iterator(key_ranks.begin(), key_value_it); @@ -295,7 +295,7 @@ CUB_TEST("DeviceMergeSort::StableSortKeysCopy works and performs a stable sort w REQUIRE(keys_expected == keys_out); } -CUB_TEST("DeviceMergeSort::StableSortKeys works", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::StableSortKeys works", "[merge][sort][device]") { using key_t = c2h::custom_type_t; using offset_t = std::int32_t; @@ -303,7 +303,7 @@ CUB_TEST("DeviceMergeSort::StableSortKeys works", "[merge][sort][device]") // Prepare input const offset_t num_items = GENERATE_COPY(take(2, random(1, 1000000)), values({500, 1000000, 2000000})); c2h::device_vector keys_in_out(num_items); - c2h::gen(CUB_SEED(2), keys_in_out); + c2h::gen(C2H_SEED(2), keys_in_out); // Perform sort stable_sort_keys(thrust::raw_pointer_cast(keys_in_out.data()), num_items, custom_less_op_t{}); @@ -315,14 +315,14 @@ CUB_TEST("DeviceMergeSort::StableSortKeys works", "[merge][sort][device]") REQUIRE(keys_expected == keys_in_out); } -CUB_TEST("DeviceMergeSort::SortPairsCopy works", "[merge][sort][device]", wide_key_types) +C2H_TEST("DeviceMergeSort::SortPairsCopy works", "[merge][sort][device]", wide_key_types) { using key_t = typename c2h::get<0, TestType>; using offset_t = std::int32_t; // Prepare input const offset_t num_items = GENERATE_COPY(take(2, random(1, 1000000)), values({500, 1000000, 2000000})); - auto key_ranks = make_shuffled_key_ranks_vector(num_items, CUB_SEED(2)); + auto key_ranks = make_shuffled_key_ranks_vector(num_items, C2H_SEED(2)); c2h::device_vector keys_in(num_items); thrust::transform( c2h::device_policy, key_ranks.begin(), key_ranks.end(), keys_in.begin(), rank_to_key_op_t{}); @@ -348,14 +348,14 @@ CUB_TEST("DeviceMergeSort::SortPairsCopy works", "[merge][sort][device]", wide_k REQUIRE(values_equal == true); } -CUB_TEST("DeviceMergeSort::SortPairs works", "[merge][sort][device]", wide_key_types) +C2H_TEST("DeviceMergeSort::SortPairs works", "[merge][sort][device]", wide_key_types) { using key_t = typename c2h::get<0, TestType>; using offset_t = std::int32_t; // Prepare input const offset_t num_items = GENERATE_COPY(take(2, random(1, 1000000)), values({500, 1000000, 2000000})); - auto key_ranks = make_shuffled_key_ranks_vector(num_items, CUB_SEED(2)); + auto key_ranks = make_shuffled_key_ranks_vector(num_items, C2H_SEED(2)); c2h::device_vector keys_in_out(num_items); thrust::transform( c2h::device_policy, key_ranks.begin(), key_ranks.end(), keys_in_out.begin(), rank_to_key_op_t{}); @@ -376,7 +376,7 @@ CUB_TEST("DeviceMergeSort::SortPairs works", "[merge][sort][device]", wide_key_t REQUIRE(values_equal == true); } -CUB_TEST( +C2H_TEST( "DeviceMergeSort::StableSortPairs works and performs a stable sort", "[merge][sort][device]", key_types, value_types) { using key_t = typename c2h::get<0, TestType>; @@ -387,8 +387,8 @@ CUB_TEST( const offset_t num_items = GENERATE_COPY(take(2, random(1, 1000000)), values({500, 1000000, 2000000})); c2h::device_vector keys_in_out(num_items); c2h::device_vector values_in_out(num_items); - c2h::gen(CUB_SEED(2), keys_in_out); - c2h::gen(CUB_SEED(1), values_in_out); + c2h::gen(C2H_SEED(2), keys_in_out); + c2h::gen(C2H_SEED(1), values_in_out); // Prepare host data for verification c2h::host_vector keys_expected(keys_in_out); @@ -406,7 +406,7 @@ CUB_TEST( REQUIRE(values_expected == values_in_out); } -CUB_TEST("DeviceMergeSort::StableSortPairs works for large inputs", "[merge][sort][device]", offset_types) +C2H_TEST("DeviceMergeSort::StableSortPairs works for large inputs", "[merge][sort][device]", offset_types) { using testing_types_tuple = c2h::get<0, TestType>; using key_t = typename testing_types_tuple::key_t; @@ -425,7 +425,7 @@ CUB_TEST("DeviceMergeSort::StableSortPairs works for large inputs", "[merge][sor // Initialize random input data large_array_sort_helper arrays; constexpr bool is_descending = false; - arrays.initialize_for_unstable_key_sort(CUB_SEED(1), num_items, is_descending); + arrays.initialize_for_unstable_key_sort(C2H_SEED(1), num_items, is_descending); // Free extra data buffer used during initialization, but not needed for the "in-place" merge sort arrays.deallocate_outputs(); diff --git a/cub/test/catch2_test_device_merge_sort_iterators.cu b/cub/test/catch2_test_device_merge_sort_iterators.cu index cb555f70224..47e7790cfb9 100644 --- a/cub/test/catch2_test_device_merge_sort_iterators.cu +++ b/cub/test/catch2_test_device_merge_sort_iterators.cu @@ -42,8 +42,8 @@ #include #include "catch2_test_device_merge_sort_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -56,7 +56,7 @@ DECLARE_LAUNCH_WRAPPER(cub::DeviceMergeSort::SortKeysCopy, sort_keys_copy); DECLARE_LAUNCH_WRAPPER(cub::DeviceMergeSort::StableSortKeys, stable_sort_keys); DECLARE_LAUNCH_WRAPPER(cub::DeviceMergeSort::StableSortKeysCopy, stable_sort_keys_copy); -CUB_TEST("DeviceMergeSort::SortKeysCopy works with iterators", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::SortKeysCopy works with iterators", "[merge][sort][device]") { using key_t = std::uint32_t; using offset_t = std::int32_t; @@ -76,7 +76,7 @@ CUB_TEST("DeviceMergeSort::SortKeysCopy works with iterators", "[merge][sort][de REQUIRE(keys_equal == true); } -CUB_TEST("DeviceMergeSort::StableSortKeysCopy works with iterators and is stable", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::StableSortKeysCopy works with iterators and is stable", "[merge][sort][device]") { using key_t = std::uint32_t; using offset_t = std::int32_t; @@ -100,7 +100,7 @@ CUB_TEST("DeviceMergeSort::StableSortKeysCopy works with iterators and is stable REQUIRE(keys_expected == keys_out); } -CUB_TEST("DeviceMergeSort::SortKeys works with iterators", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::SortKeys works with iterators", "[merge][sort][device]") { using key_t = std::uint32_t; using offset_t = std::int32_t; @@ -121,7 +121,7 @@ CUB_TEST("DeviceMergeSort::SortKeys works with iterators", "[merge][sort][device REQUIRE(keys_equal == true); } -CUB_TEST("DeviceMergeSort::StableSortKeys works with iterators", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::StableSortKeys works with iterators", "[merge][sort][device]") { using key_t = std::uint32_t; using offset_t = std::int32_t; @@ -142,7 +142,7 @@ CUB_TEST("DeviceMergeSort::StableSortKeys works with iterators", "[merge][sort][ REQUIRE(keys_equal == true); } -CUB_TEST("DeviceMergeSort::SortPairsCopy works with iterators", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::SortPairsCopy works with iterators", "[merge][sort][device]") { using key_t = std::uint32_t; using data_t = std::uint64_t; @@ -168,7 +168,7 @@ CUB_TEST("DeviceMergeSort::SortPairsCopy works with iterators", "[merge][sort][d REQUIRE(values_equal == true); } -CUB_TEST("DeviceMergeSort::SortPairs works with iterators", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::SortPairs works with iterators", "[merge][sort][device]") { using key_t = std::uint32_t; using data_t = std::uint64_t; @@ -197,7 +197,7 @@ CUB_TEST("DeviceMergeSort::SortPairs works with iterators", "[merge][sort][devic REQUIRE(values_equal == true); } -CUB_TEST("DeviceMergeSort::StableSortPairs works with iterators", "[merge][sort][device]") +C2H_TEST("DeviceMergeSort::StableSortPairs works with iterators", "[merge][sort][device]") { using key_t = std::uint32_t; using data_t = std::uint64_t; diff --git a/cub/test/catch2_test_device_merge_sort_vsmem.cu b/cub/test/catch2_test_device_merge_sort_vsmem.cu index 3fe114d4690..728a575e562 100644 --- a/cub/test/catch2_test_device_merge_sort_vsmem.cu +++ b/cub/test/catch2_test_device_merge_sort_vsmem.cu @@ -36,8 +36,8 @@ #include #include "catch2_test_device_merge_sort_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -48,7 +48,7 @@ using key_types = c2h::type_list::type>, c2h::custom_type_t::type>>; -CUB_TEST("DeviceMergeSort::StableSortKeys works for large types", "[merge][sort][device]", key_types) +C2H_TEST("DeviceMergeSort::StableSortKeys works for large types", "[merge][sort][device]", key_types) { using key_t = typename c2h::get<0, TestType>; using offset_t = std::int32_t; @@ -56,7 +56,7 @@ CUB_TEST("DeviceMergeSort::StableSortKeys works for large types", "[merge][sort] // Prepare input const offset_t num_items = GENERATE_COPY(take(2, random(1, 10000))); c2h::device_vector keys_in_out(num_items); - c2h::gen(CUB_SEED(2), keys_in_out); + c2h::gen(C2H_SEED(2), keys_in_out); // Prepare host data for verification c2h::host_vector keys_expected(keys_in_out); @@ -69,7 +69,7 @@ CUB_TEST("DeviceMergeSort::StableSortKeys works for large types", "[merge][sort] REQUIRE(keys_expected == keys_in_out); } -CUB_TEST("DeviceMergeSort::StableSortPairs works for large types", "[merge][sort][device]", key_types) +C2H_TEST("DeviceMergeSort::StableSortPairs works for large types", "[merge][sort][device]", key_types) { using key_t = typename c2h::get<0, TestType>; using data_t = std::uint32_t; @@ -79,8 +79,8 @@ CUB_TEST("DeviceMergeSort::StableSortPairs works for large types", "[merge][sort const offset_t num_items = GENERATE_COPY(take(2, random(1, 10000))); c2h::device_vector keys_in_out(num_items); c2h::device_vector values_in_out(num_items); - c2h::gen(CUB_SEED(2), keys_in_out); - c2h::gen(CUB_SEED(1), values_in_out); + c2h::gen(C2H_SEED(2), keys_in_out); + c2h::gen(C2H_SEED(1), values_in_out); // Prepare host data for verification c2h::host_vector keys_expected(keys_in_out); diff --git a/cub/test/catch2_test_device_partition_flagged.cu b/cub/test/catch2_test_device_partition_flagged.cu index a5dfe079fa5..95f8d386827 100644 --- a/cub/test/catch2_test_device_partition_flagged.cu +++ b/cub/test/catch2_test_device_partition_flagged.cu @@ -44,8 +44,8 @@ #include #include "catch2_test_device_select_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include template static c2h::host_vector get_reference(const c2h::device_vector& in, const c2h::device_vector& flags) @@ -96,7 +96,7 @@ using types = c2h::type_list; -CUB_TEST("DevicePartition::Flagged can run with empty input", "[device][partition_flagged]", types) +C2H_TEST("DevicePartition::Flagged can run with empty input", "[device][partition_flagged]", types) { using type = typename c2h::get<0, TestType>; @@ -114,14 +114,14 @@ CUB_TEST("DevicePartition::Flagged can run with empty input", "[device][partitio REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DevicePartition::Flagged handles all matched", "[device][partition_flagged]", types) +C2H_TEST("DevicePartition::Flagged handles all matched", "[device][partition_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items, static_cast(1)); @@ -135,14 +135,14 @@ CUB_TEST("DevicePartition::Flagged handles all matched", "[device][partition_fla REQUIRE(out == in); } -CUB_TEST("DevicePartition::Flagged handles no matched", "[device][partition_flagged]", types) +C2H_TEST("DevicePartition::Flagged handles no matched", "[device][partition_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items, static_cast(0)); @@ -159,17 +159,17 @@ CUB_TEST("DevicePartition::Flagged handles no matched", "[device][partition_flag REQUIRE(out == in); } -CUB_TEST("DevicePartition::Flagged does not change input", "[device][partition_flagged]", types) +C2H_TEST("DevicePartition::Flagged does not change input", "[device][partition_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); @@ -186,17 +186,17 @@ CUB_TEST("DevicePartition::Flagged does not change input", "[device][partition_f REQUIRE(reference == in); } -CUB_TEST("DevicePartition::Flagged is stable", "[device][partition_flagged]") +C2H_TEST("DevicePartition::Flagged is stable", "[device][partition_flagged]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -211,17 +211,17 @@ CUB_TEST("DevicePartition::Flagged is stable", "[device][partition_flagged]") REQUIRE(reference == out); } -CUB_TEST("DevicePartition::Flagged works with iterators", "[device][partition_flagged]", all_types) +C2H_TEST("DevicePartition::Flagged works with iterators", "[device][partition_flagged]", all_types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -236,17 +236,17 @@ CUB_TEST("DevicePartition::Flagged works with iterators", "[device][partition_fl REQUIRE(reference == out); } -CUB_TEST("DevicePartition::Flagged works with pointers", "[device][partition_flagged]", types) +C2H_TEST("DevicePartition::Flagged works with pointers", "[device][partition_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -289,17 +289,17 @@ struct convertible_to_bool } }; -CUB_TEST("DevicePartition::Flagged works with flags that are convertible to bool", "[device][partition_flagged]") +C2H_TEST("DevicePartition::Flagged works with flags that are convertible to bool", "[device][partition_flagged]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector iflags(num_items); - c2h::gen(CUB_SEED(1), iflags, 0, 1); + c2h::gen(C2H_SEED(1), iflags, 0, 1); c2h::device_vector flags = iflags; const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); @@ -315,7 +315,7 @@ CUB_TEST("DevicePartition::Flagged works with flags that are convertible to bool REQUIRE(reference == out); } -CUB_TEST("DevicePartition::Flagged works with flags that alias input", "[device][partition_flagged]") +C2H_TEST("DevicePartition::Flagged works with flags that alias input", "[device][partition_flagged]") { using type = int; @@ -323,7 +323,7 @@ CUB_TEST("DevicePartition::Flagged works with flags that alias input", "[device] c2h::device_vector out(num_items); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(flags, flags); @@ -358,17 +358,17 @@ struct convertible_from_T } }; -CUB_TEST("DevicePartition::Flagged works with different output type", "[device][partition_flagged]") +C2H_TEST("DevicePartition::Flagged works with different output type", "[device][partition_flagged]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector> out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -383,7 +383,7 @@ CUB_TEST("DevicePartition::Flagged works with different output type", "[device][ REQUIRE(reference == out); } -CUB_TEST("DevicePartition::Flagged works for very large number of items", "[device][partition_flagged]", offset_types) +C2H_TEST("DevicePartition::Flagged works for very large number of items", "[device][partition_flagged]", offset_types) try { using type = std::int64_t; diff --git a/cub/test/catch2_test_device_partition_if.cu b/cub/test/catch2_test_device_partition_if.cu index b6721b3c9e9..76653e9e5fc 100644 --- a/cub/test/catch2_test_device_partition_if.cu +++ b/cub/test/catch2_test_device_partition_if.cu @@ -44,8 +44,8 @@ #include #include "catch2_test_device_select_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DevicePartition::If, partition_if); @@ -86,7 +86,7 @@ using types = c2h:: // List of offset types to be used for testing large number of items using offset_types = c2h::type_list; -CUB_TEST("DevicePartition::If can run with empty input", "[device][partition_if]", types) +C2H_TEST("DevicePartition::If can run with empty input", "[device][partition_if]", types) { using type = typename c2h::get<0, TestType>; @@ -103,14 +103,14 @@ CUB_TEST("DevicePartition::If can run with empty input", "[device][partition_if] REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DevicePartition::If handles all matched", "[device][partition_if]", types) +C2H_TEST("DevicePartition::If handles all matched", "[device][partition_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -122,14 +122,14 @@ CUB_TEST("DevicePartition::If handles all matched", "[device][partition_if]", ty REQUIRE(out == in); } -CUB_TEST("DevicePartition::If handles no matched", "[device][partition_if]", types) +C2H_TEST("DevicePartition::If handles no matched", "[device][partition_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -144,14 +144,14 @@ CUB_TEST("DevicePartition::If handles no matched", "[device][partition_if]", typ REQUIRE(out == in); } -CUB_TEST("DevicePartition::If does not change input", "[device][partition_if]", types) +C2H_TEST("DevicePartition::If does not change input", "[device][partition_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -168,14 +168,14 @@ CUB_TEST("DevicePartition::If does not change input", "[device][partition_if]", REQUIRE(reference == in); } -CUB_TEST("DevicePartition::If is stable", "[device][partition_if]") +C2H_TEST("DevicePartition::If is stable", "[device][partition_if]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -197,14 +197,14 @@ CUB_TEST("DevicePartition::If is stable", "[device][partition_if]") REQUIRE(reference == out); } -CUB_TEST("DevicePartition::If works with iterators", "[device][partition_if]", all_types) +C2H_TEST("DevicePartition::If works with iterators", "[device][partition_if]", all_types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -226,14 +226,14 @@ CUB_TEST("DevicePartition::If works with iterators", "[device][partition_if]", a REQUIRE(reference == out); } -CUB_TEST("DevicePartition::If works with pointers", "[device][partition_if]", types) +C2H_TEST("DevicePartition::If works with pointers", "[device][partition_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -276,14 +276,14 @@ struct convertible_from_T } }; -CUB_TEST("DevicePartition::If works with a different output type", "[device][partition_if]") +C2H_TEST("DevicePartition::If works with a different output type", "[device][partition_if]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector> out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -305,7 +305,7 @@ CUB_TEST("DevicePartition::If works with a different output type", "[device][par REQUIRE(reference == out); } -CUB_TEST("DevicePartition::If works for very large number of items", "[device][partition_if]", offset_types) +C2H_TEST("DevicePartition::If works for very large number of items", "[device][partition_if]", offset_types) try { using type = std::int64_t; diff --git a/cub/test/catch2_test_device_radix_sort_custom.cu b/cub/test/catch2_test_device_radix_sort_custom.cu index b73e3137c5f..df762f5fa37 100644 --- a/cub/test/catch2_test_device_radix_sort_custom.cu +++ b/cub/test/catch2_test_device_radix_sort_custom.cu @@ -42,9 +42,9 @@ #include #include "catch2_radix_sort_helper.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" #include "cub/util_type.cuh" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceRadixSort::SortKeys, sort_keys); DECLARE_LAUNCH_WRAPPER(cub::DeviceRadixSort::SortPairs, sort_pairs); @@ -172,14 +172,14 @@ static std::pair, c2h::device_vector> reference_s return std::make_pair(result_keys, result_values); } -CUB_TEST("Device radix sort works with parts of custom i128_t", "[radix][sort][device]") +C2H_TEST("Device radix sort works with parts of custom i128_t", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(4, random(max_items / 2, max_items))); c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(10), in_keys); + c2h::gen(C2H_SEED(10), in_keys); auto reference_keys = reference_sort_keys(in_keys, false, 64, 128); sort_keys( @@ -188,14 +188,14 @@ CUB_TEST("Device radix sort works with parts of custom i128_t", "[radix][sort][d REQUIRE(reference_keys == out_keys); } -CUB_TEST("Device radix descending sort works with custom i128_t", "[radix][sort][device]") +C2H_TEST("Device radix descending sort works with custom i128_t", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(4, random(max_items / 2, max_items))); c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(10), in_keys); + c2h::gen(C2H_SEED(10), in_keys); const bool is_descending = GENERATE(false, true); auto reference_keys = reference_sort_keys(in_keys, is_descending, 0, 128); @@ -219,7 +219,7 @@ CUB_TEST("Device radix descending sort works with custom i128_t", "[radix][sort] REQUIRE(reference_keys == out_keys); } -CUB_TEST("Device radix sort can sort pairs with custom i128_t keys", "[radix][sort][device]") +C2H_TEST("Device radix sort can sort pairs with custom i128_t keys", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(4, random(max_items / 2, max_items))); @@ -229,8 +229,8 @@ CUB_TEST("Device radix sort can sort pairs with custom i128_t keys", "[radix][so c2h::device_vector in_values(num_items); c2h::device_vector out_values(num_items); - c2h::gen(CUB_SEED(10), in_keys); - c2h::gen(CUB_SEED(1), in_values); + c2h::gen(C2H_SEED(10), in_keys); + c2h::gen(C2H_SEED(1), in_values); const bool is_descending = GENERATE(false, true); auto reference = reference_sort_pairs(in_keys, in_values, is_descending, 0, 128); @@ -259,14 +259,14 @@ CUB_TEST("Device radix sort can sort pairs with custom i128_t keys", "[radix][so REQUIRE(reference.second == out_values); } -CUB_TEST("Device radix sort works with custom i128_t (db)", "[radix][sort][device]") +C2H_TEST("Device radix sort works with custom i128_t (db)", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(4, random(max_items / 2, max_items))); c2h::device_vector keys_1(num_items); c2h::device_vector keys_2(num_items); - c2h::gen(CUB_SEED(2), keys_1); + c2h::gen(C2H_SEED(2), keys_1); key* d_keys_1 = thrust::raw_pointer_cast(keys_1.data()); key* d_keys_2 = thrust::raw_pointer_cast(keys_2.data()); @@ -288,18 +288,18 @@ CUB_TEST("Device radix sort works with custom i128_t (db)", "[radix][sort][devic REQUIRE(reference_keys == out_keys); } -CUB_TEST("Device radix sort works with custom i128_t keys (db)", "[radix][sort][device]") +C2H_TEST("Device radix sort works with custom i128_t keys (db)", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(4, random(max_items / 2, max_items))); c2h::device_vector keys_1(num_items); c2h::device_vector keys_2(num_items); - c2h::gen(CUB_SEED(2), keys_1); + c2h::gen(C2H_SEED(2), keys_1); c2h::device_vector values_1(num_items); c2h::device_vector values_2(num_items); - c2h::gen(CUB_SEED(1), values_1); + c2h::gen(C2H_SEED(1), values_1); key* d_keys_1 = thrust::raw_pointer_cast(keys_1.data()); key* d_keys_2 = thrust::raw_pointer_cast(keys_2.data()); @@ -329,14 +329,14 @@ CUB_TEST("Device radix sort works with custom i128_t keys (db)", "[radix][sort][ REQUIRE(reference_keys.second == out_values); } -CUB_TEST("Device radix descending sort works with bits of custom i128_t", "[radix][sort][device]") +C2H_TEST("Device radix descending sort works with bits of custom i128_t", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(1, random(max_items / 2, max_items))); c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(2), in_keys); + c2h::gen(C2H_SEED(2), in_keys); const int begin_bit = GENERATE_COPY(take(4, random(0, 120))); const int end_bit = GENERATE_COPY(take(4, random(begin_bit, 128))); @@ -367,7 +367,7 @@ CUB_TEST("Device radix descending sort works with bits of custom i128_t", "[radi REQUIRE(reference_keys == out_keys); } -CUB_TEST("Device radix sort can sort pairs with bits of custom i128_t keys", "[radix][sort][device]") +C2H_TEST("Device radix sort can sort pairs with bits of custom i128_t keys", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(1, random(max_items / 2, max_items))); @@ -377,8 +377,8 @@ CUB_TEST("Device radix sort can sort pairs with bits of custom i128_t keys", "[r c2h::device_vector in_values(num_items); c2h::device_vector out_values(num_items); - c2h::gen(CUB_SEED(2), in_keys); - c2h::gen(CUB_SEED(1), in_values); + c2h::gen(C2H_SEED(2), in_keys); + c2h::gen(C2H_SEED(1), in_values); const int begin_bit = GENERATE_COPY(take(4, random(0, 120))); const int end_bit = GENERATE_COPY(take(4, random(begin_bit, 128))); @@ -415,14 +415,14 @@ CUB_TEST("Device radix sort can sort pairs with bits of custom i128_t keys", "[r REQUIRE(reference.second == out_values); } -CUB_TEST("Device radix sort works with bits of custom i128_t (db)", "[radix][sort][device]") +C2H_TEST("Device radix sort works with bits of custom i128_t (db)", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(4, random(max_items / 2, max_items))); c2h::device_vector keys_1(num_items); c2h::device_vector keys_2(num_items); - c2h::gen(CUB_SEED(2), keys_1); + c2h::gen(C2H_SEED(2), keys_1); key* d_keys_1 = thrust::raw_pointer_cast(keys_1.data()); key* d_keys_2 = thrust::raw_pointer_cast(keys_2.data()); @@ -447,18 +447,18 @@ CUB_TEST("Device radix sort works with bits of custom i128_t (db)", "[radix][sor REQUIRE(reference_keys == out_keys); } -CUB_TEST("Device radix sort works with bits of custom i128_t keys (db)", "[radix][sort][device]") +C2H_TEST("Device radix sort works with bits of custom i128_t keys (db)", "[radix][sort][device]") { constexpr int max_items = 1 << 18; const int num_items = GENERATE_COPY(take(4, random(max_items / 2, max_items))); c2h::device_vector keys_1(num_items); c2h::device_vector keys_2(num_items); - c2h::gen(CUB_SEED(2), keys_1); + c2h::gen(C2H_SEED(2), keys_1); c2h::device_vector values_1(num_items); c2h::device_vector values_2(num_items); - c2h::gen(CUB_SEED(1), values_1); + c2h::gen(C2H_SEED(1), values_1); key* d_keys_1 = thrust::raw_pointer_cast(keys_1.data()); key* d_keys_2 = thrust::raw_pointer_cast(keys_2.data()); @@ -526,7 +526,7 @@ static __host__ __device__ bool operator==(const custom_t& lhs, const custom_t& return lhs.f == rhs.f && lhs.lli == rhs.lli; } -CUB_TEST("Device radix sort works against some corner cases", "[radix][sort][device]") +C2H_TEST("Device radix sort works against some corner cases", "[radix][sort][device]") { SECTION("Keys") { @@ -722,7 +722,7 @@ CUB_TEST("Device radix sort works against some corner cases", "[radix][sort][dev } } -CUB_TEST("Device radix sort works against some corner cases (db)", "[radix][sort][device]") +C2H_TEST("Device radix sort works against some corner cases (db)", "[radix][sort][device]") { SECTION("Keys") { @@ -941,7 +941,7 @@ CUB_TEST("Device radix sort works against some corner cases (db)", "[radix][sort } } -CUB_TEST("Device radix sort works against some corner cases (bits)", "[radix][sort][device]") +C2H_TEST("Device radix sort works against some corner cases (bits)", "[radix][sort][device]") { SECTION("Keys") { @@ -1213,7 +1213,7 @@ CUB_TEST("Device radix sort works against some corner cases (bits)", "[radix][so } } -CUB_TEST("Device radix sort works against some corner cases (bits) (db)", "[radix][sort][device]") +C2H_TEST("Device radix sort works against some corner cases (bits) (db)", "[radix][sort][device]") { SECTION("Keys") { diff --git a/cub/test/catch2_test_device_radix_sort_keys.cu b/cub/test/catch2_test_device_radix_sort_keys.cu index 24d60033e34..118df09b3d4 100644 --- a/cub/test/catch2_test_device_radix_sort_keys.cu +++ b/cub/test/catch2_test_device_radix_sort_keys.cu @@ -46,8 +46,8 @@ #include "catch2_large_array_sort_helper.cuh" #include "catch2_radix_sort_helper.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -96,7 +96,7 @@ using single_key_type = c2h::type_list>; // Index types used for NumItemsT testing. cub::detail::ChooseOffsetT only selects 32/64 bit unsigned types: using num_items_types = c2h::type_list; -CUB_TEST("DeviceRadixSort::SortKeys: basic testing", "[keys][radix][sort][device]", key_types) +C2H_TEST("DeviceRadixSort::SortKeys: basic testing", "[keys][radix][sort][device]", key_types) { using key_t = c2h::get<0, TestType>; @@ -109,7 +109,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: basic testing", "[keys][radix][sort][device c2h::device_vector out_keys(num_items); const int num_key_seeds = 3; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); const bool is_descending = GENERATE(false, true); @@ -136,7 +136,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: basic testing", "[keys][radix][sort][device REQUIRE(ref_keys == out_keys); } -CUB_TEST("DeviceRadixSort::SortKeys: bit windows", "[keys][radix][sort][device]", bit_window_key_types) +C2H_TEST("DeviceRadixSort::SortKeys: bit windows", "[keys][radix][sort][device]", bit_window_key_types) { using key_t = c2h::get<0, TestType>; @@ -157,7 +157,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: bit windows", "[keys][radix][sort][device]" c2h::device_vector out_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); const bool is_descending = GENERATE(false, true); @@ -186,7 +186,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: bit windows", "[keys][radix][sort][device]" #ifndef NO_FP_KEY_TYPES -CUB_TEST("DeviceRadixSort::SortKeys: negative zero handling", "[keys][radix][sort][device]", fp_key_types) +C2H_TEST("DeviceRadixSort::SortKeys: negative zero handling", "[keys][radix][sort][device]", fp_key_types) { using key_t = c2h::get<0, TestType>; using bits_t = typename cub::Traits::UnsignedBits; @@ -201,7 +201,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: negative zero handling", "[keys][radix][sor c2h::device_vector out_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Sprinkle some positive and negative zeros randomly throughout the keys: { @@ -209,7 +209,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: negative zero handling", "[keys][radix][sor c2h::device_vector indices(num_indices); for (int i = 0; i < 2; ++i) { - c2h::gen(CUB_SEED(1), indices, std::size_t(0), num_items); + c2h::gen(C2H_SEED(1), indices, std::size_t(0), num_items); auto begin = thrust::make_constant_iterator(i == 0 ? positive_zero : negative_zero); auto end = begin + num_indices; thrust::scatter(c2h::device_policy, begin, end, indices.cbegin(), in_keys.begin()); @@ -242,7 +242,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: negative zero handling", "[keys][radix][sor REQUIRE_BITWISE_EQ(ref_keys, out_keys); } -CUB_TEST("DeviceRadixSort::SortKeys: NaN handling", "[keys][radix][sort][device]", fp_key_types) +C2H_TEST("DeviceRadixSort::SortKeys: NaN handling", "[keys][radix][sort][device]", fp_key_types) { using key_t = c2h::get<0, TestType>; using limits_t = cuda::std::numeric_limits; @@ -253,7 +253,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: NaN handling", "[keys][radix][sort][device] c2h::device_vector out_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Sprinkle some NaNs randomly throughout the keys: { @@ -268,7 +268,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: NaN handling", "[keys][radix][sort][device] if (supported) { has_nans = true; - c2h::gen(CUB_SEED(1), indices, std::size_t(0), num_items); + c2h::gen(C2H_SEED(1), indices, std::size_t(0), num_items); auto begin = thrust::make_constant_iterator(nan_val); auto end = begin + num_indices; thrust::scatter(c2h::device_policy, begin, end, indices.cbegin(), in_keys.begin()); @@ -308,7 +308,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: NaN handling", "[keys][radix][sort][device] #endif // !NO_FP_KEY_TYPES -CUB_TEST("DeviceRadixSort::SortKeys: entropy reduction", "[keys][radix][sort][device]", single_key_type) +C2H_TEST("DeviceRadixSort::SortKeys: entropy reduction", "[keys][radix][sort][device]", single_key_type) { using key_t = c2h::get<0, TestType>; @@ -317,7 +317,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: entropy reduction", "[keys][radix][sort][de c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Repeatedly bitwise-and random keys together. This increases the likelyhood // of duplicate keys. @@ -326,7 +326,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: entropy reduction", "[keys][radix][sort][de c2h::device_vector tmp(num_items); for (int i = 0; i < entropy_reduction; ++i) { - c2h::gen(CUB_SEED(1), tmp); + c2h::gen(C2H_SEED(1), tmp); thrust::transform( c2h::device_policy, in_keys.cbegin(), in_keys.cend(), tmp.cbegin(), in_keys.begin(), thrust::bit_and{}); } @@ -358,7 +358,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: entropy reduction", "[keys][radix][sort][de REQUIRE(ref_keys == out_keys); } -CUB_TEST("DeviceRadixSort::SortKeys: uniform values", "[keys][radix][sort][device]", key_types) +C2H_TEST("DeviceRadixSort::SortKeys: uniform values", "[keys][radix][sort][device]", key_types) { using key_t = c2h::get<0, TestType>; @@ -392,7 +392,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: uniform values", "[keys][radix][sort][devic REQUIRE(ref_keys == out_keys); } -CUB_TEST("DeviceRadixSort::SortKeys: NumItemsT", "[keys][radix][sort][device]", single_key_type, num_items_types) +C2H_TEST("DeviceRadixSort::SortKeys: NumItemsT", "[keys][radix][sort][device]", single_key_type, num_items_types) { using key_t = c2h::get<0, TestType>; using num_items_t = c2h::get<1, TestType>; @@ -405,7 +405,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: NumItemsT", "[keys][radix][sort][device]", c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); const bool is_descending = GENERATE(false, true); @@ -433,7 +433,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: NumItemsT", "[keys][radix][sort][device]", REQUIRE(ref_keys == out_keys); } -CUB_TEST("DeviceRadixSort::SortKeys: DoubleBuffer API", "[keys][radix][sort][device]", single_key_type) +C2H_TEST("DeviceRadixSort::SortKeys: DoubleBuffer API", "[keys][radix][sort][device]", single_key_type) { using key_t = c2h::get<0, TestType>; @@ -442,7 +442,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: DoubleBuffer API", "[keys][radix][sort][dev c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); const bool is_descending = GENERATE(false, true); @@ -474,7 +474,7 @@ void do_large_offset_test(std::size_t num_items) try { large_array_sort_helper arrays; - arrays.initialize_for_unstable_key_sort(CUB_SEED(1), num_items, is_descending); + arrays.initialize_for_unstable_key_sort(C2H_SEED(1), num_items, is_descending); TIME(c2h::cpu_timer timer); @@ -503,7 +503,7 @@ void do_large_offset_test(std::size_t num_items) } } -CUB_TEST("DeviceRadixSort::SortKeys: 32-bit overflow check", "[large][keys][radix][sort][device]", single_key_type) +C2H_TEST("DeviceRadixSort::SortKeys: 32-bit overflow check", "[large][keys][radix][sort][device]", single_key_type) { using key_t = c2h::get<0, TestType>; using num_items_t = std::uint32_t; @@ -518,7 +518,7 @@ CUB_TEST("DeviceRadixSort::SortKeys: 32-bit overflow check", "[large][keys][radi do_large_offset_test(num_items); } -CUB_TEST("DeviceRadixSort::SortKeys: Large Offsets", "[large][keys][radix][sort][device]", single_key_type) +C2H_TEST("DeviceRadixSort::SortKeys: Large Offsets", "[large][keys][radix][sort][device]", single_key_type) { using key_t = c2h::get<0, TestType>; using num_items_t = std::uint64_t; diff --git a/cub/test/catch2_test_device_radix_sort_pairs.cu b/cub/test/catch2_test_device_radix_sort_pairs.cu index bcd853a96e1..505e466994f 100644 --- a/cub/test/catch2_test_device_radix_sort_pairs.cu +++ b/cub/test/catch2_test_device_radix_sort_pairs.cu @@ -42,8 +42,8 @@ #include "catch2_large_array_sort_helper.cuh" #include "catch2_radix_sort_helper.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -56,7 +56,7 @@ using value_types = c2h::type_list; -CUB_TEST("DeviceRadixSort::SortPairs: Basic testing", "[pairs][radix][sort][device]", value_types, num_items_types) +C2H_TEST("DeviceRadixSort::SortPairs: Basic testing", "[pairs][radix][sort][device]", value_types, num_items_types) { using key_t = cuda::std::uint32_t; using value_t = c2h::get<0, TestType>; @@ -75,8 +75,8 @@ CUB_TEST("DeviceRadixSort::SortPairs: Basic testing", "[pairs][radix][sort][devi const int num_key_seeds = 1; const int num_value_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_value_seeds), in_values); const bool is_descending = GENERATE(false, true); @@ -110,7 +110,7 @@ CUB_TEST("DeviceRadixSort::SortPairs: Basic testing", "[pairs][radix][sort][devi REQUIRE(ref_values == out_values); } -CUB_TEST("DeviceRadixSort::SortPairs: DoubleBuffer API", "[pairs][radix][sort][device]", value_types) +C2H_TEST("DeviceRadixSort::SortPairs: DoubleBuffer API", "[pairs][radix][sort][device]", value_types) { using key_t = cuda::std::uint32_t; using value_t = c2h::get<0, TestType>; @@ -126,8 +126,8 @@ CUB_TEST("DeviceRadixSort::SortPairs: DoubleBuffer API", "[pairs][radix][sort][d const int num_key_seeds = 1; const int num_value_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_value_seeds), in_values); const bool is_descending = GENERATE(false, true); @@ -165,7 +165,7 @@ void do_large_offset_test(std::size_t num_items) try { large_array_sort_helper arrays; - arrays.initialize_for_stable_pair_sort(CUB_SEED(1), num_items, is_descending); + arrays.initialize_for_stable_pair_sort(C2H_SEED(1), num_items, is_descending); TIME(c2h::cpu_timer timer); @@ -196,7 +196,7 @@ void do_large_offset_test(std::size_t num_items) } } -CUB_TEST("DeviceRadixSort::SortPairs: 32-bit overflow check", "[large][pairs][radix][sort][device]") +C2H_TEST("DeviceRadixSort::SortPairs: 32-bit overflow check", "[large][pairs][radix][sort][device]") { using key_t = std::uint8_t; using value_t = std::uint8_t; @@ -208,7 +208,7 @@ CUB_TEST("DeviceRadixSort::SortPairs: 32-bit overflow check", "[large][pairs][ra do_large_offset_test(num_items); } -CUB_TEST("DeviceRadixSort::SortPairs: Large Offsets", "[large][pairs][radix][sort][device]") +C2H_TEST("DeviceRadixSort::SortPairs: Large Offsets", "[large][pairs][radix][sort][device]") { using key_t = std::uint8_t; using value_t = std::uint8_t; diff --git a/cub/test/catch2_test_device_reduce.cu b/cub/test/catch2_test_device_reduce.cu index bfd7c3e8a22..7f1103d2e6b 100644 --- a/cub/test/catch2_test_device_reduce.cu +++ b/cub/test/catch2_test_device_reduce.cu @@ -33,11 +33,11 @@ #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" #include "catch2_test_device_reduce.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::Reduce, device_reduce); DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::Sum, device_sum); @@ -91,7 +91,7 @@ enum class gen_data_t : int GEN_TYPE_CONST }; -CUB_TEST("Device reduce works with all device interfaces", "[reduce][device]", full_type_list) +C2H_TEST("Device reduce works with all device interfaces", "[reduce][device]", full_type_list) { using params = params_t; using item_t = typename params::item_t; @@ -117,7 +117,7 @@ CUB_TEST("Device reduce works with all device interfaces", "[reduce][device]", f c2h::device_vector in_items(num_items); if (data_gen_mode == gen_data_t::GEN_TYPE_RANDOM) { - c2h::gen(CUB_SEED(2), in_items); + c2h::gen(C2H_SEED(2), in_items); } else { diff --git a/cub/test/catch2_test_device_reduce.cuh b/cub/test/catch2_test_device_reduce.cuh index 051a49c4d49..c6268adfc9c 100644 --- a/cub/test/catch2_test_device_reduce.cuh +++ b/cub/test/catch2_test_device_reduce.cuh @@ -37,10 +37,10 @@ #include #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" -#include "catch2_test_helper.h" -#include "test_util_vec.h" +#include +#include +#include +#include #include CUB_NAMESPACE_BEGIN diff --git a/cub/test/catch2_test_device_reduce_by_key.cu b/cub/test/catch2_test_device_reduce_by_key.cu index 88c305fd360..a1107aaf762 100644 --- a/cub/test/catch2_test_device_reduce_by_key.cu +++ b/cub/test/catch2_test_device_reduce_by_key.cu @@ -30,11 +30,11 @@ #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" #include "catch2_test_device_reduce.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ReduceByKey, device_reduce_by_key); @@ -68,7 +68,7 @@ type_triple // clang-format on #endif -CUB_TEST("Device reduce-by-key works", "[by_key][reduce][device]", full_type_list) +C2H_TEST("Device reduce-by-key works", "[by_key][reduce][device]", full_type_list) { using params = params_t; using value_t = typename params::item_t; @@ -95,7 +95,7 @@ CUB_TEST("Device reduce-by-key works", "[by_key][reduce][device]", full_type_lis // Generate input segments c2h::device_vector segment_offsets = c2h::gen_uniform_offsets( - CUB_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); + C2H_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); // Get array of keys from segment offsets const offset_t num_segments = static_cast(segment_offsets.size() - 1); @@ -105,7 +105,7 @@ CUB_TEST("Device reduce-by-key works", "[by_key][reduce][device]", full_type_lis // Generate input data c2h::device_vector in_values(num_items); - c2h::gen(CUB_SEED(2), in_values); + c2h::gen(C2H_SEED(2), in_values); auto d_values_it = thrust::raw_pointer_cast(in_values.data()); SECTION("sum") diff --git a/cub/test/catch2_test_device_reduce_by_key_iterators.cu b/cub/test/catch2_test_device_reduce_by_key_iterators.cu index 14b7fcde9fd..adfc05aa9f5 100644 --- a/cub/test/catch2_test_device_reduce_by_key_iterators.cu +++ b/cub/test/catch2_test_device_reduce_by_key_iterators.cu @@ -34,10 +34,10 @@ #include -#include "c2h/custom_type.cuh" #include "catch2_test_device_reduce.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ReduceByKey, device_reduce_by_key); @@ -47,7 +47,7 @@ DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ReduceByKey, device_reduce_by_key); using custom_t = c2h::custom_type_t; using iterator_type_list = c2h::type_list, type_triple>; -CUB_TEST("Device reduce-by-key works with iterators", "[by_key][reduce][device]", iterator_type_list) +C2H_TEST("Device reduce-by-key works with iterators", "[by_key][reduce][device]", iterator_type_list) { using params = params_t; using value_t = typename params::item_t; @@ -74,7 +74,7 @@ CUB_TEST("Device reduce-by-key works with iterators", "[by_key][reduce][device]" // Generate input segments c2h::device_vector segment_offsets = c2h::gen_uniform_offsets( - CUB_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); + C2H_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); // Get array of keys from segment offsets const offset_t num_segments = static_cast(segment_offsets.size() - 1); diff --git a/cub/test/catch2_test_device_reduce_fp_inf.cu b/cub/test/catch2_test_device_reduce_fp_inf.cu index 61fa9b67889..fa7e86cc2ff 100644 --- a/cub/test/catch2_test_device_reduce_fp_inf.cu +++ b/cub/test/catch2_test_device_reduce_fp_inf.cu @@ -32,15 +32,15 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMin, device_arg_min); DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMax, device_arg_max); // %PARAM% TEST_LAUNCH lid 0:1 -CUB_TEST("Device reduce arg{min,max} works with inf items", "[reduce][device]") +C2H_TEST("Device reduce arg{min,max} works with inf items", "[reduce][device]") { using in_t = float; using offset_t = int; diff --git a/cub/test/catch2_test_device_reduce_iterators.cu b/cub/test/catch2_test_device_reduce_iterators.cu index ab1dabbbb16..74a534b0012 100644 --- a/cub/test/catch2_test_device_reduce_iterators.cu +++ b/cub/test/catch2_test_device_reduce_iterators.cu @@ -35,10 +35,10 @@ #include -#include "c2h/custom_type.cuh" #include "catch2_test_device_reduce.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::Reduce, device_reduce); DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::Sum, device_sum); @@ -65,7 +65,7 @@ void test_big_indices_helper(offset_t num_items) REQUIRE(result == num_items); } -CUB_TEST("Device sum works for big indices", "[reduce][device]") +C2H_TEST("Device sum works for big indices", "[reduce][device]") { test_big_indices_helper(1ull << 30); test_big_indices_helper(1ull << 31); @@ -73,7 +73,7 @@ CUB_TEST("Device sum works for big indices", "[reduce][device]") test_big_indices_helper(1ull << 33); } -CUB_TEST("Device reduce works with fancy input iterators", "[reduce][device]", iterator_type_list) +C2H_TEST("Device reduce works with fancy input iterators", "[reduce][device]", iterator_type_list) { using params = params_t; using item_t = typename params::item_t; @@ -116,7 +116,7 @@ CUB_TEST("Device reduce works with fancy input iterators", "[reduce][device]", i REQUIRE(expected_result == out_result[0]); } -CUB_TEST("Device reduce compiles with discard output iterator", "[reduce][device]", iterator_type_list) +C2H_TEST("Device reduce compiles with discard output iterator", "[reduce][device]", iterator_type_list) { using params = params_t; using item_t = typename params::item_t; diff --git a/cub/test/catch2_test_device_run_length_encode.cu b/cub/test/catch2_test_device_run_length_encode.cu index 79a062f778c..e01880d469e 100644 --- a/cub/test/catch2_test_device_run_length_encode.cu +++ b/cub/test/catch2_test_device_run_length_encode.cu @@ -38,8 +38,8 @@ #include #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceRunLengthEncode::Encode, run_length_encode); @@ -57,7 +57,7 @@ using types = c2h::type_list; #if 0 // DeviceRunLengthEncode::Encode cannot handle empty inputs // https://github.com/NVIDIA/cccl/issues/426 -CUB_TEST("DeviceRunLengthEncode::Encode can handle empty input", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::Encode can handle empty input", "[device][run_length_encode]") { constexpr int num_items = 0; c2h::device_vector in(num_items); @@ -74,7 +74,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle empty input", "[device][run_l } #endif -CUB_TEST("DeviceRunLengthEncode::Encode can handle a single element", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::Encode can handle a single element", "[device][run_length_encode]") { constexpr int num_items = 1; c2h::device_vector in(num_items, 42); @@ -89,7 +89,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle a single element", "[device][ REQUIRE(out_num_runs.front() == num_items); } -CUB_TEST("DeviceRunLengthEncode::Encode can handle different counting types", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::Encode can handle different counting types", "[device][run_length_encode]") { constexpr int num_items = 1; c2h::device_vector in(num_items, 42); @@ -104,7 +104,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle different counting types", "[ REQUIRE(out_num_runs.front() == static_cast(num_items)); } -CUB_TEST("DeviceRunLengthEncode::Encode can handle all unique", "[device][run_length_encode]", types) +C2H_TEST("DeviceRunLengthEncode::Encode can handle all unique", "[device][run_length_encode]", types) { using type = typename c2h::get<0, TestType>; @@ -127,7 +127,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle all unique", "[device][run_le REQUIRE(out_num_runs == reference_num_runs); } -CUB_TEST("DeviceRunLengthEncode::Encode can handle all equal", "[device][run_length_encode]", types) +C2H_TEST("DeviceRunLengthEncode::Encode can handle all equal", "[device][run_length_encode]", types) { using type = typename c2h::get<0, TestType>; @@ -148,7 +148,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle all equal", "[device][run_len REQUIRE(out_num_runs == reference_num_runs); } -CUB_TEST("DeviceRunLengthEncode::Encode can handle iterators", "[device][run_length_encode]", all_types) +C2H_TEST("DeviceRunLengthEncode::Encode can handle iterators", "[device][run_length_encode]", all_types) { using type = typename c2h::get<0, TestType>; @@ -157,7 +157,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle iterators", "[device][run_len c2h::device_vector out_unique(num_items); c2h::device_vector out_counts(num_items); c2h::device_vector out_num_runs(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); run_length_encode(in.begin(), out_unique.begin(), out_counts.begin(), out_num_runs.begin(), num_items); @@ -170,7 +170,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle iterators", "[device][run_len REQUIRE(out_unique == reference_out); } -CUB_TEST("DeviceRunLengthEncode::Encode can handle pointers", "[device][run_length_encode]", types) +C2H_TEST("DeviceRunLengthEncode::Encode can handle pointers", "[device][run_length_encode]", types) { using type = typename c2h::get<0, TestType>; @@ -179,7 +179,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode can handle pointers", "[device][run_leng c2h::device_vector out_unique(num_items); c2h::device_vector out_counts(num_items); c2h::device_vector out_num_runs(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); run_length_encode( thrust::raw_pointer_cast(in.data()), @@ -211,7 +211,7 @@ struct convertible_from_T { __host__ __device__ operator T() const noexcept { return val_; } }; -CUB_TEST("DeviceRunLengthEncode::Encode works with a different output type", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::Encode works with a different output type", "[device][run_length_encode]") { using type = c2h::custom_type_t; @@ -220,7 +220,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode works with a different output type", "[d c2h::device_vector> out_unique(num_items); c2h::device_vector out_counts(num_items); c2h::device_vector out_num_runs(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); run_length_encode(in.begin(), out_unique.begin(), @@ -237,7 +237,7 @@ CUB_TEST("DeviceRunLengthEncode::Encode works with a different output type", "[d } #endif // https://github.com/NVIDIA/cccl/issues/400 -CUB_TEST("DeviceRunLengthEncode::Encode can handle leading NaN", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::Encode can handle leading NaN", "[device][run_length_encode]") { using type = double; diff --git a/cub/test/catch2_test_device_run_length_encode_non_trivial_runs.cu b/cub/test/catch2_test_device_run_length_encode_non_trivial_runs.cu index 185c0598ce6..31e5491fe4e 100644 --- a/cub/test/catch2_test_device_run_length_encode_non_trivial_runs.cu +++ b/cub/test/catch2_test_device_run_length_encode_non_trivial_runs.cu @@ -39,8 +39,8 @@ #include #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceRunLengthEncode::NonTrivialRuns, run_length_encode); @@ -58,7 +58,7 @@ using types = c2h::type_list; #if 0 // DeviceRunLengthEncode::NonTrivialRuns cannot handle inputs with one or less elements // https://github.com/NVIDIA/cccl/issues/426 -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle empty input", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle empty input", "[device][run_length_encode]") { constexpr int num_items = 0; c2h::device_vector out_num_runs(1, 42); @@ -73,7 +73,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle empty input", "[devic REQUIRE(out_num_runs.front() == 0); } -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle a single element", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle a single element", "[device][run_length_encode]") { constexpr int num_items = 1; c2h::device_vector out_num_runs(1, 42); @@ -90,7 +90,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle a single element", "[ #endif #if 0 // DeviceRunLengthEncode::NonTrivialRuns cannot handle inputs larger than INT32_MAX -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle large indexes", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle large indexes", "[device][run_length_encode]") { constexpr cuda::std::size_t num_items = 1ull << 33; c2h::device_vector out_num_runs(1, -1); @@ -106,7 +106,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle large indexes", "[dev } #endif -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle different counting types", "[device][run_length_encode]") +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle different counting types", "[device][run_length_encode]") { constexpr int num_items = 1; c2h::device_vector in(num_items, 42); @@ -124,7 +124,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle different counting ty REQUIRE(out_num_runs.front() == 0); } -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle all unique", "[device][run_length_encode]", types) +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle all unique", "[device][run_length_encode]", types) { using type = typename c2h::get<0, TestType>; @@ -141,7 +141,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle all unique", "[device REQUIRE(out_num_runs.front() == 0); } -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle all equal", "[device][run_length_encode]", types) +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle all equal", "[device][run_length_encode]", types) { using type = typename c2h::get<0, TestType>; @@ -150,7 +150,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle all equal", "[device] c2h::device_vector out_offsets(1, -1); c2h::device_vector out_lengths(1, -1); c2h::device_vector out_num_runs(1, -1); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); thrust::fill(c2h::device_policy, in.begin(), in.end(), in.front()); run_length_encode(in.begin(), out_offsets.begin(), out_lengths.begin(), out_num_runs.begin(), num_items); @@ -210,7 +210,7 @@ bool validate_results( return true; } -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle iterators", "[device][run_length_encode]", all_types) +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle iterators", "[device][run_length_encode]", all_types) { using type = typename c2h::get<0, TestType>; @@ -219,7 +219,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle iterators", "[device] c2h::device_vector out_offsets(num_items, -1); c2h::device_vector out_lengths(num_items, -1); c2h::device_vector out_num_runs(1, -1); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); run_length_encode(in.begin(), out_offsets.begin(), out_lengths.begin(), out_num_runs.begin(), num_items); @@ -228,7 +228,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle iterators", "[device] REQUIRE(validate_results(in, out_offsets, out_lengths, out_num_runs, num_items)); } -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle pointers", "[device][run_length_encode]", types) +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle pointers", "[device][run_length_encode]", types) { using type = typename c2h::get<0, TestType>; @@ -237,7 +237,7 @@ CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns can handle pointers", "[device][ c2h::device_vector out_offsets(num_items, -1); c2h::device_vector out_lengths(num_items, -1); c2h::device_vector out_num_runs(1, -1); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); run_length_encode( thrust::raw_pointer_cast(in.data()), @@ -311,7 +311,7 @@ DECLARE_LAUNCH_WRAPPER(CustomDeviceRunLengthEncode::NonTrivialRuns, run_l using time_slicing = c2h::type_list; -CUB_TEST("DeviceRunLengthEncode::NonTrivialRuns does not run out of memory", "[device][run_length_encode]", time_slicing) +C2H_TEST("DeviceRunLengthEncode::NonTrivialRuns does not run out of memory", "[device][run_length_encode]", time_slicing) { using type = typename c2h::get<0, TestType>; using policy_hub_t = device_rle_policy_hub; diff --git a/cub/test/catch2_test_device_scan.cu b/cub/test/catch2_test_device_scan.cu index 736e217b0ea..4ceb6d738c6 100644 --- a/cub/test/catch2_test_device_scan.cu +++ b/cub/test/catch2_test_device_scan.cu @@ -32,11 +32,11 @@ #include -#include "c2h/custom_type.cuh" #include "catch2_test_device_reduce.cuh" #include "catch2_test_device_scan.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::InclusiveScanInit, device_inclusive_scan_with_init); DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveSum, device_exclusive_sum); @@ -85,7 +85,7 @@ enum class gen_data_t : int GEN_TYPE_CONST }; -CUB_TEST("Device scan works with all device interfaces", "[scan][device]", full_type_list) +C2H_TEST("Device scan works with all device interfaces", "[scan][device]", full_type_list) { using params = params_t; using input_t = typename params::item_t; @@ -110,7 +110,7 @@ CUB_TEST("Device scan works with all device interfaces", "[scan][device]", full_ c2h::device_vector in_items(num_items); if (data_gen_mode == gen_data_t::GEN_TYPE_RANDOM) { - c2h::gen(CUB_SEED(2), in_items); + c2h::gen(C2H_SEED(2), in_items); } else { diff --git a/cub/test/catch2_test_device_scan.cuh b/cub/test/catch2_test_device_scan.cuh index dc5b7804e8d..527a0b63f6e 100644 --- a/cub/test/catch2_test_device_scan.cuh +++ b/cub/test/catch2_test_device_scan.cuh @@ -30,7 +30,7 @@ #include #include -#include "catch2_test_helper.h" +#include /** * @brief Helper class template to facilitate specifying input/output type pairs along with the key diff --git a/cub/test/catch2_test_device_scan_api.cu b/cub/test/catch2_test_device_scan_api.cu index eb56fd6845d..a840b08f1f1 100644 --- a/cub/test/catch2_test_device_scan_api.cu +++ b/cub/test/catch2_test_device_scan_api.cu @@ -30,9 +30,9 @@ #include #include -#include "catch2_test_helper.h" +#include -CUB_TEST("Device inclusive scan works", "[scan][device]") +C2H_TEST("Device inclusive scan works", "[scan][device]") { // example-begin device-inclusive-scan thrust::device_vector input{0, -1, 2, -3, 4, -5, 6}; diff --git a/cub/test/catch2_test_device_scan_by_key.cu b/cub/test/catch2_test_device_scan_by_key.cu index f5e40b1e2e9..d1136156173 100644 --- a/cub/test/catch2_test_device_scan_by_key.cu +++ b/cub/test/catch2_test_device_scan_by_key.cu @@ -33,12 +33,12 @@ #include #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" #include "catch2_test_device_reduce.cuh" #include "catch2_test_device_scan.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveSumByKey, device_exclusive_sum_by_key); DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveScanByKey, device_exclusive_scan_by_key); @@ -79,7 +79,7 @@ type_quad // clang-format on #endif -CUB_TEST("Device scan works with all device interfaces", "[by_key][scan][device]", full_type_list) +C2H_TEST("Device scan works with all device interfaces", "[by_key][scan][device]", full_type_list) { using params = params_t; using key_t = typename params::type_pair_t::key_t; @@ -107,7 +107,7 @@ CUB_TEST("Device scan works with all device interfaces", "[by_key][scan][device] // Generate input segments c2h::device_vector segment_offsets = c2h::gen_uniform_offsets( - CUB_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); + C2H_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); // Get array of keys from segment offsets c2h::device_vector segment_keys(num_items); @@ -116,7 +116,7 @@ CUB_TEST("Device scan works with all device interfaces", "[by_key][scan][device] // Generate input data c2h::device_vector in_values(num_items); - c2h::gen(CUB_SEED(2), in_values, std::numeric_limits::min()); + c2h::gen(C2H_SEED(2), in_values, std::numeric_limits::min()); auto d_values_it = thrust::raw_pointer_cast(in_values.data()); // Skip DeviceScan::InclusiveSum and DeviceScan::ExclusiveSum tests for extended floating-point @@ -265,7 +265,7 @@ using key_alias_type_list = c2h::type_list; using key_alias_type_list = c2h::type_list; #endif -CUB_TEST("Device scan works when memory for keys and results alias one another", +C2H_TEST("Device scan works when memory for keys and results alias one another", "[by_key][scan][device]", key_alias_type_list) { @@ -293,7 +293,7 @@ CUB_TEST("Device scan works when memory for keys and results alias one another", // Generate input segments c2h::device_vector segment_offsets = c2h::gen_uniform_offsets( - CUB_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); + C2H_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); // Get array of keys from segment offsets c2h::device_vector segment_keys(num_items); @@ -302,7 +302,7 @@ CUB_TEST("Device scan works when memory for keys and results alias one another", // Generate input data c2h::device_vector in_values(num_items); - c2h::gen(CUB_SEED(2), in_values, std::numeric_limits::min()); + c2h::gen(C2H_SEED(2), in_values, std::numeric_limits::min()); auto d_values_it = thrust::raw_pointer_cast(in_values.data()); SECTION("inclusive sum") diff --git a/cub/test/catch2_test_device_scan_by_key_iterators.cu b/cub/test/catch2_test_device_scan_by_key_iterators.cu index ca242cf6105..9f8dbdbcfd1 100644 --- a/cub/test/catch2_test_device_scan_by_key_iterators.cu +++ b/cub/test/catch2_test_device_scan_by_key_iterators.cu @@ -32,12 +32,12 @@ #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" #include "catch2_test_device_reduce.cuh" #include "catch2_test_device_scan.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveSumByKey, device_exclusive_sum_by_key); DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveScanByKey, device_exclusive_scan_by_key); @@ -79,7 +79,7 @@ enum class gen_data_t : int GEN_TYPE_CONST }; -CUB_TEST("Device scan works with fancy iterators", "[by_key][scan][device]", full_type_list) +C2H_TEST("Device scan works with fancy iterators", "[by_key][scan][device]", full_type_list) { using params = params_t; using key_t = typename params::type_pair_t::key_t; @@ -107,7 +107,7 @@ CUB_TEST("Device scan works with fancy iterators", "[by_key][scan][device]", ful // Generate input segments c2h::device_vector segment_offsets = c2h::gen_uniform_offsets( - CUB_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); + C2H_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); // Get array of keys from segment offsets c2h::device_vector segment_keys(num_items); diff --git a/cub/test/catch2_test_device_scan_by_key_large_offsets.cu b/cub/test/catch2_test_device_scan_by_key_large_offsets.cu index 3e97ff23219..c6ce2900274 100644 --- a/cub/test/catch2_test_device_scan_by_key_large_offsets.cu +++ b/cub/test/catch2_test_device_scan_by_key_large_offsets.cu @@ -32,8 +32,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveScanByKey, device_exclusive_scan_by_key); DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::InclusiveScanByKey, device_inclusive_scan_by_key); @@ -94,7 +94,7 @@ struct div_op } }; -CUB_TEST("DeviceScan::ScanByKey works for very large number of items", "[by_key][scan][device]", offset_types) +C2H_TEST("DeviceScan::ScanByKey works for very large number of items", "[by_key][scan][device]", offset_types) try { using op_t = cub::Sum; diff --git a/cub/test/catch2_test_device_scan_iterators.cu b/cub/test/catch2_test_device_scan_iterators.cu index a07397cc367..0fcceceab5c 100644 --- a/cub/test/catch2_test_device_scan_iterators.cu +++ b/cub/test/catch2_test_device_scan_iterators.cu @@ -35,12 +35,12 @@ #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" #include "catch2_test_device_reduce.cuh" #include "catch2_test_device_scan.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveSum, device_exclusive_sum); DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveScan, device_exclusive_scan); @@ -58,7 +58,7 @@ using custom_t = using iterator_type_list = c2h::type_list, type_pair, type_pair>; -CUB_TEST("Device scan works with iterators", "[scan][device]", iterator_type_list) +C2H_TEST("Device scan works with iterators", "[scan][device]", iterator_type_list) { using params = params_t; using input_t = typename params::item_t; @@ -283,7 +283,7 @@ struct index_to_custom_output_op } }; -CUB_TEST("Device scan works complex accumulator types", "[scan][device]") +C2H_TEST("Device scan works complex accumulator types", "[scan][device]") { constexpr int num_items = 2 * 1024 * 1024; diff --git a/cub/test/catch2_test_device_scan_large_offsets.cu b/cub/test/catch2_test_device_scan_large_offsets.cu index 0c0854e21e1..18c3f652776 100644 --- a/cub/test/catch2_test_device_scan_large_offsets.cu +++ b/cub/test/catch2_test_device_scan_large_offsets.cu @@ -32,8 +32,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceScan::ExclusiveScan, device_exclusive_scan); @@ -70,7 +70,7 @@ struct mod_op } }; -CUB_TEST("DeviceScan works for very large number of items", "[scan][device]", offset_types) +C2H_TEST("DeviceScan works for very large number of items", "[scan][device]", offset_types) try { using op_t = cub::Sum; diff --git a/cub/test/catch2_test_device_segmented_radix_sort_keys.cu b/cub/test/catch2_test_device_segmented_radix_sort_keys.cu index 01c92c8456f..f9d5c4974e2 100644 --- a/cub/test/catch2_test_device_segmented_radix_sort_keys.cu +++ b/cub/test/catch2_test_device_segmented_radix_sort_keys.cu @@ -43,8 +43,8 @@ #include #include "catch2_radix_sort_helper.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // TODO replace with DeviceSegmentedRadixSort::SortKeys interface once https://github.com/NVIDIA/cccl/issues/50 is // addressed Temporary wrapper that allows specializing the DeviceSegmentedRadixSort algorithm for different offset @@ -143,7 +143,7 @@ using fp_key_types = c2h::type_list; // Used for tests that just need a single type for testing: using single_key_type = c2h::type_list>; -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: basic testing", +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: basic testing", "[keys][segmented][radix][sort][device]", key_types, offset_types) @@ -158,14 +158,14 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: basic testing", c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Initialize the output keys using the input keys since not all items // may belong to a segment. c2h::device_vector out_keys(in_keys); c2h::device_vector offsets(num_segments + 1); const int num_segment_seeds = 1; - generate_segment_offsets(CUB_SEED(num_segment_seeds), offsets, static_cast(num_items)); + generate_segment_offsets(C2H_SEED(num_segment_seeds), offsets, static_cast(num_items)); const bool is_descending = GENERATE(false, true); @@ -205,7 +205,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: basic testing", #if defined(SINGLE_TEST_CASE_INSTANTIATION) -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: empty data", "[keys][segmented][radix][sort][device]", single_key_type) +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: empty data", "[keys][segmented][radix][sort][device]", single_key_type) { using key_t = c2h::get<0, TestType>; using offset_t = cuda::std::int32_t; @@ -215,7 +215,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: empty data", "[keys][segmented][ra c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Initialize the output keys using the input keys since not all items // may belong to a segment. c2h::device_vector out_keys(in_keys); @@ -261,7 +261,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: empty data", "[keys][segmented][ra #endif // defined(SINGLE_TEST_CASE_INSTANTIATION) -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: bit windows", +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: bit windows", "[keys][segmented][radix][sort][device]", bit_window_key_types) { @@ -275,14 +275,14 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: bit windows", c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Initialize the output keys using the input keys since not all items // may belong to a segment. c2h::device_vector out_keys(in_keys); c2h::device_vector offsets(num_segments + 1); const int num_segment_seeds = 1; - generate_segment_offsets(CUB_SEED(num_segment_seeds), offsets, static_cast(num_items)); + generate_segment_offsets(C2H_SEED(num_segment_seeds), offsets, static_cast(num_items)); constexpr int num_bits = sizeof(key_t) * CHAR_BIT; // Explicitly use values<>({}) to workaround bug catchorg/Catch2#2040: @@ -332,7 +332,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: bit windows", #if defined(SINGLE_TEST_CASE_INSTANTIATION) -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: large segments", "[keys][segmented][radix][sort][device]", single_key_type) +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: large segments", "[keys][segmented][radix][sort][device]", single_key_type) { using key_t = c2h::get<0, TestType>; using offset_t = cuda::std::int32_t; @@ -345,7 +345,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: large segments", "[keys][segmented c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); c2h::device_vector offsets(3); offsets[0] = 0; @@ -388,7 +388,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: large segments", "[keys][segmented REQUIRE((ref_keys == out_keys) == true); } -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: DoubleBuffer API", +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: DoubleBuffer API", "[keys][segmented][radix][sort][device]", single_key_type) { @@ -402,14 +402,14 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: DoubleBuffer API", c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Initialize the output keys using the input keys since not all items // may belong to a segment. c2h::device_vector out_keys(in_keys); c2h::device_vector offsets(num_segments + 1); const int num_segment_seeds = 1; - generate_segment_offsets(CUB_SEED(num_segment_seeds), offsets, static_cast(num_items)); + generate_segment_offsets(C2H_SEED(num_segment_seeds), offsets, static_cast(num_items)); const bool is_descending = GENERATE(false, true); @@ -440,7 +440,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: DoubleBuffer API", REQUIRE((ref_keys == keys) == true); } -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: unspecified ranges", +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: unspecified ranges", "[keys][segmented][radix][sort][device]", single_key_type) { @@ -454,14 +454,14 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: unspecified ranges", c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); // Initialize the output keys using the input keys since not all items // will belong to a segment. c2h::device_vector out_keys(in_keys); c2h::device_vector begin_offsets(num_segments + 1); const int num_segment_seeds = 1; - generate_segment_offsets(CUB_SEED(num_segment_seeds), begin_offsets, static_cast(num_items)); + generate_segment_offsets(C2H_SEED(num_segment_seeds), begin_offsets, static_cast(num_items)); // Create separate begin/end offsets arrays and remove some of the segments by // setting both offsets to 0. @@ -471,7 +471,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: unspecified ranges", { std::size_t num_empty_segments = num_segments / 16; c2h::device_vector indices(num_empty_segments); - c2h::gen(CUB_SEED(1), indices, std::size_t{0}, num_segments - 1); + c2h::gen(C2H_SEED(1), indices, std::size_t{0}, num_segments - 1); auto begin = thrust::make_constant_iterator(key_t{0}); auto end = begin + num_empty_segments; thrust::scatter(c2h::device_policy, begin, end, indices.cbegin(), begin_offsets.begin()); @@ -516,7 +516,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortKeys: unspecified ranges", # if defined(CCCL_TEST_ENABLE_LARGE_SEGMENTED_SORT) -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: very large num. items and num. segments", +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: very large num. items and num. segments", "[keys][segmented][radix][sort][device]", all_offset_types) try @@ -536,7 +536,7 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); auto offsets = thrust::make_transform_iterator(thrust::make_counting_iterator(std::size_t{0}), segment_iterator_t{num_items}); auto offsets_plus_1 = offsets + 1; @@ -592,7 +592,7 @@ catch (std::bad_alloc& e) std::cerr << "Skipping segmented radix sort test, unsufficient GPU memory. " << e.what() << "\n"; } -CUB_TEST("DeviceSegmentedRadixSort::SortKeys: very large segments", +C2H_TEST("DeviceSegmentedRadixSort::SortKeys: very large segments", "[keys][segmented][radix][sort][device]", all_offset_types) try @@ -610,7 +610,7 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); c2h::device_vector offsets(num_segments + 1); offsets[0] = 0; offsets[1] = static_cast(num_items); diff --git a/cub/test/catch2_test_device_segmented_radix_sort_pairs.cu b/cub/test/catch2_test_device_segmented_radix_sort_pairs.cu index b4198ade6e2..ccc0f529959 100644 --- a/cub/test/catch2_test_device_segmented_radix_sort_pairs.cu +++ b/cub/test/catch2_test_device_segmented_radix_sort_pairs.cu @@ -39,9 +39,9 @@ #include #include "catch2_radix_sort_helper.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" #include "thrust/detail/raw_pointer_cast.h" +#include // TODO replace with DeviceSegmentedRadixSort::SortPairs interface once https://github.com/NVIDIA/cccl/issues/50 is // addressed Temporary wrapper that allows specializing the DeviceSegmentedRadixSort algorithm for different offset @@ -113,7 +113,7 @@ using custom_value_t = c2h::custom_type_t; using value_types = c2h::type_list; // Index types used for OffsetsT testing -CUB_TEST("DeviceSegmentedRadixSort::SortPairs: Basic testing", +C2H_TEST("DeviceSegmentedRadixSort::SortPairs: Basic testing", "[pairs][segmented][radix][sort][device]", value_types, offset_types) @@ -129,15 +129,15 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: Basic testing", c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); c2h::device_vector in_values(num_items); const int num_value_seeds = 1; - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_value_seeds), in_values); c2h::device_vector offsets(num_segments + 1); const int num_segment_seeds = 1; - generate_segment_offsets(CUB_SEED(num_segment_seeds), offsets, static_cast(num_items)); + generate_segment_offsets(C2H_SEED(num_segment_seeds), offsets, static_cast(num_items)); // Initialize the output vectors by copying the inputs since not all items // may belong to a segment. @@ -187,7 +187,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: Basic testing", REQUIRE(ref_values == out_values); } -CUB_TEST("DeviceSegmentedRadixSort::SortPairs: DoubleBuffer API", "[pairs][segmented][radix][sort][device]", value_types) +C2H_TEST("DeviceSegmentedRadixSort::SortPairs: DoubleBuffer API", "[pairs][segmented][radix][sort][device]", value_types) { using key_t = cuda::std::uint32_t; using value_t = c2h::get<0, TestType>; @@ -199,15 +199,15 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: DoubleBuffer API", "[pairs][segme c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); c2h::device_vector in_values(num_items); const int num_value_seeds = 1; - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_value_seeds), in_values); c2h::device_vector offsets(num_segments + 1); const int num_segment_seeds = 1; - generate_segment_offsets(CUB_SEED(num_segment_seeds), offsets, static_cast(num_items)); + generate_segment_offsets(C2H_SEED(num_segment_seeds), offsets, static_cast(num_items)); // Initialize the output vectors by copying the inputs since not all items // may belong to a segment. @@ -251,7 +251,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: DoubleBuffer API", "[pairs][segme REQUIRE(ref_values == values); } -CUB_TEST("DeviceSegmentedRadixSort::SortPairs: unspecified ranges", +C2H_TEST("DeviceSegmentedRadixSort::SortPairs: unspecified ranges", "[pairs][segmented][radix][sort][device]", value_types) { @@ -265,11 +265,11 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: unspecified ranges", c2h::device_vector in_keys(num_items); const int num_key_seeds = 1; - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); c2h::device_vector in_values(num_items); const int num_value_seeds = 1; - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_value_seeds), in_values); // Initialize the output vectors by copying the inputs since not all items // may belong to a segment. @@ -278,7 +278,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: unspecified ranges", c2h::device_vector begin_offsets(num_segments + 1); const int num_segment_seeds = 1; - generate_segment_offsets(CUB_SEED(num_segment_seeds), begin_offsets, static_cast(num_items)); + generate_segment_offsets(C2H_SEED(num_segment_seeds), begin_offsets, static_cast(num_items)); // Create separate begin/end offsets arrays and remove some of the segments by // setting both offsets to 0. @@ -288,7 +288,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: unspecified ranges", { std::size_t num_empty_segments = num_segments / 16; c2h::device_vector indices(num_empty_segments); - c2h::gen(CUB_SEED(1), indices, std::size_t{0}, num_segments - 1); + c2h::gen(C2H_SEED(1), indices, std::size_t{0}, num_segments - 1); auto begin = thrust::make_constant_iterator(key_t{0}); auto end = begin + num_empty_segments; thrust::scatter(c2h::device_policy, begin, end, indices.cbegin(), begin_offsets.begin()); @@ -340,7 +340,7 @@ CUB_TEST("DeviceSegmentedRadixSort::SortPairs: unspecified ranges", #if defined(CCCL_TEST_ENABLE_LARGE_SEGMENTED_SORT) -CUB_TEST("DeviceSegmentedRadixSort::SortPairs: very large num. items and num. segments", +C2H_TEST("DeviceSegmentedRadixSort::SortPairs: very large num. items and num. segments", "[pairs][segmented][radix][sort][device]", all_offset_types) try @@ -362,8 +362,8 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector in_values(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_value_seeds), in_values); c2h::device_vector out_keys(num_items); c2h::device_vector out_values(num_items); auto offsets = @@ -431,7 +431,7 @@ catch (std::bad_alloc& e) std::cerr << "Skipping segmented radix sort test, unsufficient GPU memory. " << e.what() << "\n"; } -CUB_TEST("DeviceSegmentedRadixSort::SortPairs: very large segments", +C2H_TEST("DeviceSegmentedRadixSort::SortPairs: very large segments", "[pairs][segmented][radix][sort][device]", all_offset_types) try @@ -451,8 +451,8 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector in_values(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_value_seeds), in_values); c2h::device_vector out_values(num_items); c2h::device_vector offsets(num_segments + 1); offsets[0] = 0; diff --git a/cub/test/catch2_test_device_segmented_reduce.cu b/cub/test/catch2_test_device_segmented_reduce.cu index 5559e7e2e81..b1f41b50290 100644 --- a/cub/test/catch2_test_device_segmented_reduce.cu +++ b/cub/test/catch2_test_device_segmented_reduce.cu @@ -32,11 +32,11 @@ #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" #include "catch2_test_device_reduce.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceSegmentedReduce::Reduce, device_segmented_reduce); DECLARE_LAUNCH_WRAPPER(cub::DeviceSegmentedReduce::Sum, device_segmented_sum); @@ -77,7 +77,7 @@ type_pair using offsets = c2h::type_list; -CUB_TEST("Device reduce works with all device interfaces", "[segmented][reduce][device]", full_type_list, offsets) +C2H_TEST("Device reduce works with all device interfaces", "[segmented][reduce][device]", full_type_list, offsets) { using type_pair_t = typename c2h::get<0, TestType>; using input_t = typename type_pair_t::input_t; @@ -104,13 +104,13 @@ CUB_TEST("Device reduce works with all device interfaces", "[segmented][reduce][ // Generate input segments c2h::device_vector segment_offsets = c2h::gen_uniform_offsets( - CUB_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); + C2H_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); const offset_t num_segments = static_cast(segment_offsets.size() - 1); auto d_offsets_it = thrust::raw_pointer_cast(segment_offsets.data()); // Generate input data c2h::device_vector in_items(num_items); - c2h::gen(CUB_SEED(2), in_items); + c2h::gen(C2H_SEED(2), in_items); auto d_in_it = thrust::raw_pointer_cast(in_items.data()); SECTION("reduce") diff --git a/cub/test/catch2_test_device_segmented_reduce_api.cu b/cub/test/catch2_test_device_segmented_reduce_api.cu index 935f4afa87c..116b68c37ca 100644 --- a/cub/test/catch2_test_device_segmented_reduce_api.cu +++ b/cub/test/catch2_test_device_segmented_reduce_api.cu @@ -36,8 +36,8 @@ #include #include -#include "catch2_test_helper.h" #include "thrust/detail/raw_pointer_cast.h" +#include // example-begin segmented-reduce-custommin struct CustomMin @@ -59,7 +59,7 @@ struct is_equal } }; -CUB_TEST("cub::DeviceSegmentedReduce::Reduce works with int data elements", "[segmented_reduce][device]") +C2H_TEST("cub::DeviceSegmentedReduce::Reduce works with int data elements", "[segmented_reduce][device]") { // example-begin segmented-reduce-reduce int num_segments = 3; @@ -105,7 +105,7 @@ CUB_TEST("cub::DeviceSegmentedReduce::Reduce works with int data elements", "[se REQUIRE(d_out == expected); } -CUB_TEST("cub::DeviceSegmentedReduce::Sum works with int data elements", "[segmented_reduce][device]") +C2H_TEST("cub::DeviceSegmentedReduce::Sum works with int data elements", "[segmented_reduce][device]") { // example-begin segmented-reduce-sum int num_segments = 3; @@ -133,7 +133,7 @@ CUB_TEST("cub::DeviceSegmentedReduce::Sum works with int data elements", "[segme REQUIRE(d_out == expected); } -CUB_TEST("cub::DeviceSegmentedReduce::Min works with int data elements", "[segmented_reduce][device]") +C2H_TEST("cub::DeviceSegmentedReduce::Min works with int data elements", "[segmented_reduce][device]") { // example-begin segmented-reduce-min int num_segments = 3; @@ -161,7 +161,7 @@ CUB_TEST("cub::DeviceSegmentedReduce::Min works with int data elements", "[segme REQUIRE(d_out == expected); } -CUB_TEST("cub::DeviceSegmentedReduce::ArgMin works with int data elements", "[segmented_reduce][device]") +C2H_TEST("cub::DeviceSegmentedReduce::ArgMin works with int data elements", "[segmented_reduce][device]") { // example-begin segmented-reduce-argmin int num_segments = 3; @@ -189,7 +189,7 @@ CUB_TEST("cub::DeviceSegmentedReduce::ArgMin works with int data elements", "[se REQUIRE(thrust::equal(d_out.begin(), d_out.end(), expected.begin(), is_equal())); } -CUB_TEST("cub::DeviceSegmentedReduce::Max works with int data elements", "[segmented_reduce][device]") +C2H_TEST("cub::DeviceSegmentedReduce::Max works with int data elements", "[segmented_reduce][device]") { // example-begin segmented-reduce-max int num_segments = 3; @@ -217,7 +217,7 @@ CUB_TEST("cub::DeviceSegmentedReduce::Max works with int data elements", "[segme REQUIRE(d_out == expected); } -CUB_TEST("cub::DeviceSegmentedReduce::ArgMax works with int data elements", "[segmented_reduce][device]") +C2H_TEST("cub::DeviceSegmentedReduce::ArgMax works with int data elements", "[segmented_reduce][device]") { // example-begin segmented-reduce-argmax int num_segments = 3; diff --git a/cub/test/catch2_test_device_segmented_reduce_iterators.cu b/cub/test/catch2_test_device_segmented_reduce_iterators.cu index a81559b91ed..4647b2e8c03 100644 --- a/cub/test/catch2_test_device_segmented_reduce_iterators.cu +++ b/cub/test/catch2_test_device_segmented_reduce_iterators.cu @@ -36,10 +36,10 @@ #include -#include "c2h/custom_type.cuh" #include "catch2_test_device_reduce.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceSegmentedReduce::Reduce, device_segmented_reduce); DECLARE_LAUNCH_WRAPPER(cub::DeviceSegmentedReduce::Sum, device_segmented_sum); @@ -51,7 +51,7 @@ using custom_t = c2h::custom_type_t, type_pair>; using offsets = c2h::type_list; -CUB_TEST("Device segmented reduce works with fancy input iterators", "[reduce][device]", iterator_type_list, offsets) +C2H_TEST("Device segmented reduce works with fancy input iterators", "[reduce][device]", iterator_type_list, offsets) { using type_pair_t = typename c2h::get<0, TestType>; using item_t = typename type_pair_t::input_t; @@ -77,7 +77,7 @@ CUB_TEST("Device segmented reduce works with fancy input iterators", "[reduce][d // Generate input segments c2h::device_vector segment_offsets = c2h::gen_uniform_offsets( - CUB_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); + C2H_SEED(1), num_items, std::get<0>(seg_size_range), std::get<1>(seg_size_range)); const offset_t num_segments = static_cast(segment_offsets.size() - 1); auto d_offsets_it = thrust::raw_pointer_cast(segment_offsets.data()); diff --git a/cub/test/catch2_test_device_segmented_reduce_iterators_64bit.cu b/cub/test/catch2_test_device_segmented_reduce_iterators_64bit.cu index 7036d50ae45..fe6c76639a9 100644 --- a/cub/test/catch2_test_device_segmented_reduce_iterators_64bit.cu +++ b/cub/test/catch2_test_device_segmented_reduce_iterators_64bit.cu @@ -35,8 +35,8 @@ #include #include "catch2/catch.hpp" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceSegmentedReduce::Reduce, device_segmented_reduce); DECLARE_LAUNCH_WRAPPER(cub::DeviceSegmentedReduce::Sum, device_segmented_sum); @@ -46,7 +46,7 @@ DECLARE_LAUNCH_WRAPPER(cub::DeviceSegmentedReduce::Sum, device_segmented_sum); // List of types to test using offsets = c2h::type_list; -CUB_TEST("Device segmented reduce works with fancy input iterators and 64-bit offsets", "[reduce][device]", offsets) +C2H_TEST("Device segmented reduce works with fancy input iterators and 64-bit offsets", "[reduce][device]", offsets) { using offset_t = typename c2h::get<0, TestType>; using op_t = cub::Sum; diff --git a/cub/test/catch2_test_device_segmented_sort_keys.cu b/cub/test/catch2_test_device_segmented_sort_keys.cu index 28404aade8f..0b4ac659718 100644 --- a/cub/test/catch2_test_device_segmented_sort_keys.cu +++ b/cub/test/catch2_test_device_segmented_sort_keys.cu @@ -27,8 +27,8 @@ #include "insert_nested_NVTX_range_guard.h" // above header needs to be included first #include "catch2_radix_sort_helper.cuh" +#include #include -#include // FIXME: Graph launch disabled, algorithm syncs internally. WAR exists for device-launch, figure out how to enable for // graph launch. @@ -95,7 +95,7 @@ using key_types = #endif >; -CUB_TEST("DeviceSegmentedSortKeys: No segments", "[keys][segmented][sort][device]") +C2H_TEST("DeviceSegmentedSortKeys: No segments", "[keys][segmented][sort][device]") { // Type doesn't affect the escape logic, so it should be fine // to test only one set of types here. @@ -128,7 +128,7 @@ CUB_TEST("DeviceSegmentedSortKeys: No segments", "[keys][segmented][sort][device REQUIRE(values_buffer.selector == 1); } -CUB_TEST("DeviceSegmentedSortKeys: Empty segments", "[keys][segmented][sort][device]") +C2H_TEST("DeviceSegmentedSortKeys: Empty segments", "[keys][segmented][sort][device]") { // Type doesn't affect the escape logic, so it should be fine // to test only one set of types here. @@ -165,7 +165,7 @@ CUB_TEST("DeviceSegmentedSortKeys: Empty segments", "[keys][segmented][sort][dev REQUIRE(values_buffer.selector == 1); } -CUB_TEST("DeviceSegmentedSortKeys: Same size segments, derived keys", "[keys][segmented][sort][device]", key_types) +C2H_TEST("DeviceSegmentedSortKeys: Same size segments, derived keys", "[keys][segmented][sort][device]", key_types) { using KeyT = c2h::get<0, TestType>; @@ -180,7 +180,7 @@ CUB_TEST("DeviceSegmentedSortKeys: Same size segments, derived keys", "[keys][se test_same_size_segments_derived(segment_size, segments); } -CUB_TEST("DeviceSegmentedSortKeys: Randomly sized segments, derived keys", "[keys][segmented][sort][device]", key_types) +C2H_TEST("DeviceSegmentedSortKeys: Randomly sized segments, derived keys", "[keys][segmented][sort][device]", key_types) { using KeyT = c2h::get<0, TestType>; @@ -193,10 +193,10 @@ CUB_TEST("DeviceSegmentedSortKeys: Randomly sized segments, derived keys", "[key take(2, random(1 << 10, 1 << 15)), take(2, random(1 << 15, 1 << 20))); - test_random_size_segments_derived(CUB_SEED(1), max_items, max_segment, segments); + test_random_size_segments_derived(C2H_SEED(1), max_items, max_segment, segments); } -CUB_TEST("DeviceSegmentedSortKeys: Randomly sized segments, random keys", "[keys][segmented][sort][device]", key_types) +C2H_TEST("DeviceSegmentedSortKeys: Randomly sized segments, random keys", "[keys][segmented][sort][device]", key_types) { using KeyT = c2h::get<0, TestType>; @@ -205,25 +205,25 @@ CUB_TEST("DeviceSegmentedSortKeys: Randomly sized segments, random keys", "[keys const int segments = GENERATE_COPY(take(2, random(1 << 15, 1 << 20))); - test_random_size_segments_random(CUB_SEED(1), max_items, max_segment, segments); + test_random_size_segments_random(C2H_SEED(1), max_items, max_segment, segments); } -CUB_TEST("DeviceSegmentedSortKeys: Edge case segments, random keys", "[keys][segmented][sort][device]", key_types) +C2H_TEST("DeviceSegmentedSortKeys: Edge case segments, random keys", "[keys][segmented][sort][device]", key_types) { using KeyT = c2h::get<0, TestType>; - test_edge_case_segments_random(CUB_SEED(4)); + test_edge_case_segments_random(C2H_SEED(4)); } -CUB_TEST("DeviceSegmentedSortKeys: Unspecified segments, random keys", "[keys][segmented][sort][device]", key_types) +C2H_TEST("DeviceSegmentedSortKeys: Unspecified segments, random keys", "[keys][segmented][sort][device]", key_types) { using KeyT = c2h::get<0, TestType>; - test_unspecified_segments_random(CUB_SEED(4)); + test_unspecified_segments_random(C2H_SEED(4)); } #if defined(CCCL_TEST_ENABLE_LARGE_SEGMENTED_SORT) // we can reuse the same structure of DeviceSegmentedRadixSortKeys for simplicity -CUB_TEST("DeviceSegmentedSortKeys: very large num. items and num. segments", +C2H_TEST("DeviceSegmentedSortKeys: very large num. items and num. segments", "[keys][segmented][sort][device]", all_offset_types) try @@ -243,7 +243,7 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); auto offsets = thrust::make_transform_iterator(thrust::make_counting_iterator(std::size_t{0}), segment_iterator_t{num_items}); auto offsets_plus_1 = offsets + 1; @@ -295,7 +295,7 @@ catch (std::bad_alloc& e) std::cerr << "Skipping segmented sort test, unsufficient GPU memory. " << e.what() << "\n"; } -CUB_TEST("DeviceSegmentedSort::SortKeys: very large segments", "[keys][segmented][sort][device]", all_offset_types) +C2H_TEST("DeviceSegmentedSort::SortKeys: very large segments", "[keys][segmented][sort][device]", all_offset_types) try { using key_t = cuda::std::uint8_t; // minimize memory footprint to support a wider range of GPUs @@ -311,7 +311,7 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); c2h::device_vector offsets(num_segments + 1); offsets[0] = 0; offsets[1] = static_cast(num_items); diff --git a/cub/test/catch2_test_device_segmented_sort_pairs.cu b/cub/test/catch2_test_device_segmented_sort_pairs.cu index 182a4cfd960..fe49553b105 100644 --- a/cub/test/catch2_test_device_segmented_sort_pairs.cu +++ b/cub/test/catch2_test_device_segmented_sort_pairs.cu @@ -27,8 +27,8 @@ #include "catch2_radix_sort_helper.cuh" // above header needs to be included first +#include #include -#include // FIXME: Graph launch disabled, algorithm syncs internally. WAR exists for device-launch, figure out how to enable for // graph launch. @@ -102,7 +102,7 @@ using pair_types = #endif >; -CUB_TEST("DeviceSegmentedSortPairs: No segments", "[pairs][segmented][sort][device]") +C2H_TEST("DeviceSegmentedSortPairs: No segments", "[pairs][segmented][sort][device]") { // Type doesn't affect the escape logic, so it should be fine // to test only one set of types here. @@ -136,7 +136,7 @@ CUB_TEST("DeviceSegmentedSortPairs: No segments", "[pairs][segmented][sort][devi REQUIRE(values_buffer.selector == 1); } -CUB_TEST("DeviceSegmentedSortPairs: Empty segments", "[pairs][segmented][sort][device]") +C2H_TEST("DeviceSegmentedSortPairs: Empty segments", "[pairs][segmented][sort][device]") { // Type doesn't affect the escape logic, so it should be fine // to test only one set of types here. @@ -174,7 +174,7 @@ CUB_TEST("DeviceSegmentedSortPairs: Empty segments", "[pairs][segmented][sort][d REQUIRE(values_buffer.selector == 1); } -CUB_TEST("DeviceSegmentedSortPairs: Same size segments, derived keys/values", +C2H_TEST("DeviceSegmentedSortPairs: Same size segments, derived keys/values", "[pairs][segmented][sort][device]", pair_types) { @@ -193,7 +193,7 @@ CUB_TEST("DeviceSegmentedSortPairs: Same size segments, derived keys/values", test_same_size_segments_derived(segment_size, segments); } -CUB_TEST("DeviceSegmentedSortPairs: Randomly sized segments, derived keys/values", +C2H_TEST("DeviceSegmentedSortPairs: Randomly sized segments, derived keys/values", "[pairs][segmented][sort][device]", pair_types) { @@ -210,10 +210,10 @@ CUB_TEST("DeviceSegmentedSortPairs: Randomly sized segments, derived keys/values take(2, random(1 << 10, 1 << 15)), take(2, random(1 << 15, 1 << 20))); - test_random_size_segments_derived(CUB_SEED(1), max_items, max_segment, segments); + test_random_size_segments_derived(C2H_SEED(1), max_items, max_segment, segments); } -CUB_TEST("DeviceSegmentedSortPairs: Randomly sized segments, random keys/values", +C2H_TEST("DeviceSegmentedSortPairs: Randomly sized segments, random keys/values", "[pairs][segmented][sort][device]", pair_types) { @@ -226,10 +226,10 @@ CUB_TEST("DeviceSegmentedSortPairs: Randomly sized segments, random keys/values" const int segments = GENERATE_COPY(take(2, random(1 << 15, 1 << 20))); - test_random_size_segments_random(CUB_SEED(1), max_items, max_segment, segments); + test_random_size_segments_random(C2H_SEED(1), max_items, max_segment, segments); } -CUB_TEST("DeviceSegmentedSortPairs: Edge case segments, random keys/values", +C2H_TEST("DeviceSegmentedSortPairs: Edge case segments, random keys/values", "[pairs][segmented][sort][device]", pair_types) { @@ -237,10 +237,10 @@ CUB_TEST("DeviceSegmentedSortPairs: Edge case segments, random keys/values", using KeyT = c2h::get<0, PairT>; using ValueT = c2h::get<1, PairT>; - test_edge_case_segments_random(CUB_SEED(4)); + test_edge_case_segments_random(C2H_SEED(4)); } -CUB_TEST("DeviceSegmentedSortPairs: Unspecified segments, random key/values", +C2H_TEST("DeviceSegmentedSortPairs: Unspecified segments, random key/values", "[pairs][segmented][sort][device]", pair_types) { @@ -248,13 +248,13 @@ CUB_TEST("DeviceSegmentedSortPairs: Unspecified segments, random key/values", using KeyT = c2h::get<0, PairT>; using ValueT = c2h::get<1, PairT>; - test_unspecified_segments_random(CUB_SEED(4)); + test_unspecified_segments_random(C2H_SEED(4)); } #if defined(CCCL_TEST_ENABLE_LARGE_SEGMENTED_SORT) // we can reuse the same structure of DeviceSegmentedRadixSortPairs for simplicity -CUB_TEST("DeviceSegmentedSortPairs: very large num. items and num. segments", +C2H_TEST("DeviceSegmentedSortPairs: very large num. items and num. segments", "[pairs][segmented][sort][device]", all_offset_types) try @@ -276,8 +276,8 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector in_values(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_value_seeds), in_values); // Initialize the output vectors by copying the inputs since not all items may belong to a segment. c2h::device_vector out_keys(num_items); @@ -341,7 +341,7 @@ catch (std::bad_alloc& e) std::cerr << "Skipping segmented sort test, unsufficient GPU memory. " << e.what() << "\n"; } -CUB_TEST("DeviceSegmentedSort::SortPairs: very large segments", "[pairs][segmented][sort][device]", all_offset_types) +C2H_TEST("DeviceSegmentedSort::SortPairs: very large segments", "[pairs][segmented][sort][device]", all_offset_types) try { using key_t = cuda::std::uint8_t; // minimize memory footprint to support a wider range of GPUs @@ -360,8 +360,8 @@ try c2h::device_vector in_keys(num_items); c2h::device_vector in_values(num_items); c2h::device_vector out_keys(num_items); - c2h::gen(CUB_SEED(num_key_seeds), in_keys); - c2h::gen(CUB_SEED(num_value_seeds), in_values); + c2h::gen(C2H_SEED(num_key_seeds), in_keys); + c2h::gen(C2H_SEED(num_value_seeds), in_values); c2h::device_vector out_values(num_items); c2h::device_vector offsets(num_segments + 1); offsets[0] = 0; diff --git a/cub/test/catch2_test_device_select_api.cu b/cub/test/catch2_test_device_select_api.cu index 18b5ce887ca..e961600decb 100644 --- a/cub/test/catch2_test_device_select_api.cu +++ b/cub/test/catch2_test_device_select_api.cu @@ -36,7 +36,7 @@ #include -#include "catch2_test_helper.h" +#include // example-begin segmented-select-iseven struct is_even_t @@ -48,7 +48,7 @@ struct is_even_t }; // example-end segmented-select-iseven -CUB_TEST("cub::DeviceSelect::FlaggedIf works with int data elements", "[select][device]") +C2H_TEST("cub::DeviceSelect::FlaggedIf works with int data elements", "[select][device]") { // example-begin segmented-select-flaggedif constexpr int num_items = 8; @@ -92,7 +92,7 @@ CUB_TEST("cub::DeviceSelect::FlaggedIf works with int data elements", "[select][ REQUIRE(d_out == expected); } -CUB_TEST("cub::DeviceSelect::FlaggedIf in-place works with int data elements", "[select][device]") +C2H_TEST("cub::DeviceSelect::FlaggedIf in-place works with int data elements", "[select][device]") { // example-begin segmented-select-flaggedif-inplace constexpr int num_items = 8; diff --git a/cub/test/catch2_test_device_select_common.cuh b/cub/test/catch2_test_device_select_common.cuh index 39f82d04612..015fcb81a47 100644 --- a/cub/test/catch2_test_device_select_common.cuh +++ b/cub/test/catch2_test_device_select_common.cuh @@ -7,7 +7,7 @@ #include -#include "catch2_test_helper.h" +#include template struct less_than_t diff --git a/cub/test/catch2_test_device_select_flagged.cu b/cub/test/catch2_test_device_select_flagged.cu index 84dd38f0c3e..6176be099d9 100644 --- a/cub/test/catch2_test_device_select_flagged.cu +++ b/cub/test/catch2_test_device_select_flagged.cu @@ -37,8 +37,8 @@ #include #include "catch2_test_device_select_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include template static c2h::host_vector get_reference(const c2h::device_vector& in, const c2h::device_vector& flags) @@ -86,7 +86,7 @@ using all_types = using types = c2h::type_list>; -CUB_TEST("DeviceSelect::Flagged can run with empty input", "[device][select_flagged]", types) +C2H_TEST("DeviceSelect::Flagged can run with empty input", "[device][select_flagged]", types) { using type = typename c2h::get<0, TestType>; @@ -104,14 +104,14 @@ CUB_TEST("DeviceSelect::Flagged can run with empty input", "[device][select_flag REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::Flagged handles all matched", "[device][select_flagged]", types) +C2H_TEST("DeviceSelect::Flagged handles all matched", "[device][select_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items, 1); @@ -125,14 +125,14 @@ CUB_TEST("DeviceSelect::Flagged handles all matched", "[device][select_flagged]" REQUIRE(out == in); } -CUB_TEST("DeviceSelect::Flagged handles no matched", "[device][select_flagged]", types) +C2H_TEST("DeviceSelect::Flagged handles no matched", "[device][select_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(0); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items, 0); @@ -145,17 +145,17 @@ CUB_TEST("DeviceSelect::Flagged handles no matched", "[device][select_flagged]", REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::Flagged does not change input", "[device][select_flagged]", types) +C2H_TEST("DeviceSelect::Flagged does not change input", "[device][select_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); // Needs to be device accessible @@ -171,7 +171,7 @@ CUB_TEST("DeviceSelect::Flagged does not change input", "[device][select_flagged REQUIRE(reference == in); } -CUB_TEST("DeviceSelect::Flagged is stable", +C2H_TEST("DeviceSelect::Flagged is stable", "[device][select_flagged]", c2h::type_list>) { @@ -180,10 +180,10 @@ CUB_TEST("DeviceSelect::Flagged is stable", const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -198,17 +198,17 @@ CUB_TEST("DeviceSelect::Flagged is stable", REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::Flagged works with iterators", "[device][select_flagged]", all_types) +C2H_TEST("DeviceSelect::Flagged works with iterators", "[device][select_flagged]", all_types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -223,17 +223,17 @@ CUB_TEST("DeviceSelect::Flagged works with iterators", "[device][select_flagged] REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::Flagged works with pointers", "[device][select_flagged]", types) +C2H_TEST("DeviceSelect::Flagged works with pointers", "[device][select_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -276,17 +276,17 @@ struct convertible_to_bool } }; -CUB_TEST("DeviceSelect::Flagged works with flags that are convertible to bool", "[device][select_flagged]") +C2H_TEST("DeviceSelect::Flagged works with flags that are convertible to bool", "[device][select_flagged]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector iflags(num_items); - c2h::gen(CUB_SEED(1), iflags, 0, 1); + c2h::gen(C2H_SEED(1), iflags, 0, 1); c2h::device_vector flags = iflags; const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); @@ -303,7 +303,7 @@ CUB_TEST("DeviceSelect::Flagged works with flags that are convertible to bool", REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::Flagged works with flags that alias input", "[device][select_flagged]") +C2H_TEST("DeviceSelect::Flagged works with flags that alias input", "[device][select_flagged]") { using type = int; @@ -311,7 +311,7 @@ CUB_TEST("DeviceSelect::Flagged works with flags that alias input", "[device][se c2h::device_vector out(num_items); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(flags, flags); @@ -326,16 +326,16 @@ CUB_TEST("DeviceSelect::Flagged works with flags that alias input", "[device][se REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::Flagged works in place", "[device][select_flagged]", types) +C2H_TEST("DeviceSelect::Flagged works in place", "[device][select_flagged]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const c2h::host_vector reference = get_reference(in, flags); @@ -349,14 +349,14 @@ CUB_TEST("DeviceSelect::Flagged works in place", "[device][select_flagged]", typ REQUIRE(reference == in); } -CUB_TEST("DeviceSelect::Flagged works in place with flags that alias input", "[device][select_flagged]") +C2H_TEST("DeviceSelect::Flagged works in place with flags that alias input", "[device][select_flagged]") { using type = int; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(flags, flags); @@ -392,17 +392,17 @@ struct convertible_from_T } }; -CUB_TEST("DeviceSelect::Flagged works with a different output type", "[device][select_flagged]") +C2H_TEST("DeviceSelect::Flagged works with a different output type", "[device][select_flagged]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector> out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags, 0, 1); + c2h::gen(C2H_SEED(1), flags, 0, 1); const int num_selected = static_cast(thrust::count(c2h::device_policy, flags.begin(), flags.end(), 1)); const c2h::host_vector reference = get_reference(in, flags); @@ -418,7 +418,7 @@ CUB_TEST("DeviceSelect::Flagged works with a different output type", "[device][s REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::Flagged works for very large number of items", "[device][select_flagged]") +C2H_TEST("DeviceSelect::Flagged works for very large number of items", "[device][select_flagged]") try { using type = std::int64_t; diff --git a/cub/test/catch2_test_device_select_flagged_if.cu b/cub/test/catch2_test_device_select_flagged_if.cu index 652e6986723..62c3994416b 100644 --- a/cub/test/catch2_test_device_select_flagged_if.cu +++ b/cub/test/catch2_test_device_select_flagged_if.cu @@ -36,8 +36,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include template struct predicate_op_wrapper_t @@ -127,7 +127,7 @@ using types = c2h::type_list; using flag_types = c2h::type_list; -CUB_TEST("DeviceSelect::FlaggedIf can run with empty input", "[device][select_flagged_if]", types) +C2H_TEST("DeviceSelect::FlaggedIf can run with empty input", "[device][select_flagged_if]", types) { using type = typename c2h::get<0, TestType>; @@ -145,7 +145,7 @@ CUB_TEST("DeviceSelect::FlaggedIf can run with empty input", "[device][select_fl REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::FlaggedIf handles all matched", "[device][select_flagged_if]", types) +C2H_TEST("DeviceSelect::FlaggedIf handles all matched", "[device][select_flagged_if]", types) { using type = typename c2h::get<0, TestType>; @@ -153,7 +153,7 @@ CUB_TEST("DeviceSelect::FlaggedIf handles all matched", "[device][select_flagged c2h::device_vector in(num_items); c2h::device_vector out(num_items); c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -165,14 +165,14 @@ CUB_TEST("DeviceSelect::FlaggedIf handles all matched", "[device][select_flagged REQUIRE(out == in); } -CUB_TEST("DeviceSelect::FlaggedIf handles no matched", "[device][select_flagged_if]", types) +C2H_TEST("DeviceSelect::FlaggedIf handles no matched", "[device][select_flagged_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(0); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); c2h::device_vector flags(num_items, 0); @@ -185,7 +185,7 @@ CUB_TEST("DeviceSelect::FlaggedIf handles no matched", "[device][select_flagged_ REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::FlaggedIf does not change input and is stable", +C2H_TEST("DeviceSelect::FlaggedIf does not change input and is stable", "[device][select_flagged_if]", c2h::type_list, flag_types) @@ -196,12 +196,12 @@ CUB_TEST("DeviceSelect::FlaggedIf does not change input and is stable", const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); is_even_t is_even{}; c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags); + c2h::gen(C2H_SEED(1), flags); const c2h::host_vector reference_out = get_reference(in, flags, is_even); const int num_selected = static_cast(reference_out.size()); @@ -225,7 +225,7 @@ CUB_TEST("DeviceSelect::FlaggedIf does not change input and is stable", REQUIRE(reference_out == out); } -CUB_TEST("DeviceSelect::FlaggedIf works with iterators", "[device][select_if]", all_types, flag_types) +C2H_TEST("DeviceSelect::FlaggedIf works with iterators", "[device][select_if]", all_types, flag_types) { using input_type = typename c2h::get<0, TestType>; using flag_type = typename c2h::get<1, TestType>; @@ -233,12 +233,12 @@ CUB_TEST("DeviceSelect::FlaggedIf works with iterators", "[device][select_if]", const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); is_even_t is_even{}; c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags); + c2h::gen(C2H_SEED(1), flags); const c2h::host_vector reference = get_reference(in, flags, is_even); const int num_selected = static_cast(reference.size()); @@ -253,7 +253,7 @@ CUB_TEST("DeviceSelect::FlaggedIf works with iterators", "[device][select_if]", REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::FlaggedIf works with pointers", "[device][select_flagged]", types, flag_types) +C2H_TEST("DeviceSelect::FlaggedIf works with pointers", "[device][select_flagged]", types, flag_types) { using input_type = typename c2h::get<0, TestType>; using flag_type = typename c2h::get<1, TestType>; @@ -261,12 +261,12 @@ CUB_TEST("DeviceSelect::FlaggedIf works with pointers", "[device][select_flagged const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); is_even_t is_even{}; c2h::device_vector flags(num_items); - c2h::gen(CUB_SEED(1), flags); + c2h::gen(C2H_SEED(1), flags); const c2h::host_vector reference = get_reference(in, flags, is_even); const int num_selected = static_cast(reference.size()); diff --git a/cub/test/catch2_test_device_select_if.cu b/cub/test/catch2_test_device_select_if.cu index 4cd6a043700..ab8d5da24a9 100644 --- a/cub/test/catch2_test_device_select_if.cu +++ b/cub/test/catch2_test_device_select_if.cu @@ -43,8 +43,8 @@ #include #include "catch2_test_device_select_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceSelect::If, select_if); @@ -91,7 +91,7 @@ using all_types = using types = c2h:: type_list>; -CUB_TEST("DeviceSelect::If can run with empty input", "[device][select_if]", types) +C2H_TEST("DeviceSelect::If can run with empty input", "[device][select_if]", types) { using type = typename c2h::get<0, TestType>; @@ -108,14 +108,14 @@ CUB_TEST("DeviceSelect::If can run with empty input", "[device][select_if]", typ REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::If handles all matched", "[device][select_if]", types) +C2H_TEST("DeviceSelect::If handles all matched", "[device][select_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -127,14 +127,14 @@ CUB_TEST("DeviceSelect::If handles all matched", "[device][select_if]", types) REQUIRE(out == in); } -CUB_TEST("DeviceSelect::If handles no matched", "[device][select_if]", types) +C2H_TEST("DeviceSelect::If handles no matched", "[device][select_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(0); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -145,14 +145,14 @@ CUB_TEST("DeviceSelect::If handles no matched", "[device][select_if]", types) REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::If does not change input", "[device][select_if]", types) +C2H_TEST("DeviceSelect::If does not change input", "[device][select_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -169,14 +169,14 @@ CUB_TEST("DeviceSelect::If does not change input", "[device][select_if]", types) REQUIRE(reference == in); } -CUB_TEST("DeviceSelect::If is stable", "[device][select_if]") +C2H_TEST("DeviceSelect::If is stable", "[device][select_if]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -200,14 +200,14 @@ CUB_TEST("DeviceSelect::If is stable", "[device][select_if]") REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::If works with iterators", "[device][select_if]", all_types) +C2H_TEST("DeviceSelect::If works with iterators", "[device][select_if]", all_types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -223,14 +223,14 @@ CUB_TEST("DeviceSelect::If works with iterators", "[device][select_if]", all_typ REQUIRE(thrust::all_of(c2h::device_policy, boundary, out.end(), equal_to_default_t{})); } -CUB_TEST("DeviceSelect::If works with pointers", "[device][select_if]", types) +C2H_TEST("DeviceSelect::If works with pointers", "[device][select_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -247,13 +247,13 @@ CUB_TEST("DeviceSelect::If works with pointers", "[device][select_if]", types) REQUIRE(thrust::all_of(c2h::device_policy, boundary, out.end(), equal_to_default_t{})); } -CUB_TEST("DeviceSelect::If works in place", "[device][select_if]", types) +C2H_TEST("DeviceSelect::If works in place", "[device][select_if]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -293,14 +293,14 @@ struct convertible_from_T } }; -CUB_TEST("DeviceSelect::If works with a different output type", "[device][select_if]") +C2H_TEST("DeviceSelect::If works with a different output type", "[device][select_if]") { using type = c2h::custom_type_t; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector> out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; @@ -316,7 +316,7 @@ CUB_TEST("DeviceSelect::If works with a different output type", "[device][select REQUIRE(thrust::all_of(c2h::device_policy, boundary, out.end(), equal_to_default_t{})); } -CUB_TEST("DeviceSelect::If works for very large number of items", "[device][select_if]") +C2H_TEST("DeviceSelect::If works for very large number of items", "[device][select_if]") try { using type = std::int64_t; @@ -361,7 +361,7 @@ catch (std::bad_alloc&) // Exceeding memory is not a failure. } -CUB_TEST("DeviceSelect::If works for very large number of output items", "[device][select_if]") +C2H_TEST("DeviceSelect::If works for very large number of output items", "[device][select_if]") try { using type = std::uint8_t; diff --git a/cub/test/catch2_test_device_select_if_vsmem.cu b/cub/test/catch2_test_device_select_if_vsmem.cu index ae49ffc168f..802942a8d9c 100644 --- a/cub/test/catch2_test_device_select_if_vsmem.cu +++ b/cub/test/catch2_test_device_select_if_vsmem.cu @@ -32,8 +32,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include #include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -61,14 +61,14 @@ struct less_than_t } }; -CUB_TEST("DeviceSelect::If works for large types", "[select_if][vsmem][device]", types) +C2H_TEST("DeviceSelect::If works for large types", "[select_if][vsmem][device]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 10000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); // Just pick one of the input elements as boundary less_than_t le{in[num_items / 2]}; diff --git a/cub/test/catch2_test_device_select_unique.cu b/cub/test/catch2_test_device_select_unique.cu index ddecf4664e6..aab7d230474 100644 --- a/cub/test/catch2_test_device_select_unique.cu +++ b/cub/test/catch2_test_device_select_unique.cu @@ -40,8 +40,8 @@ #include #include "catch2_test_device_select_common.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include template inline T to_bound(const unsigned long long bound) @@ -102,7 +102,7 @@ using all_types = using types = c2h::type_list; -CUB_TEST("DeviceSelect::Unique can run with empty input", "[device][select_unique]", types) +C2H_TEST("DeviceSelect::Unique can run with empty input", "[device][select_unique]", types) { using type = typename c2h::get<0, TestType>; @@ -119,7 +119,7 @@ CUB_TEST("DeviceSelect::Unique can run with empty input", "[device][select_uniqu REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::Unique handles none equal", "[device][select_unique]", types) +C2H_TEST("DeviceSelect::Unique handles none equal", "[device][select_unique]", types) { using type = typename c2h::get<0, TestType>; @@ -134,7 +134,7 @@ CUB_TEST("DeviceSelect::Unique handles none equal", "[device][select_unique]", t REQUIRE(num_selected_out[0] == num_items); } -CUB_TEST("DeviceSelect::Unique handles all equal", "[device][select_unique]", types) +C2H_TEST("DeviceSelect::Unique handles all equal", "[device][select_unique]", types) { using type = typename c2h::get<0, TestType>; @@ -153,14 +153,14 @@ CUB_TEST("DeviceSelect::Unique handles all equal", "[device][select_unique]", ty REQUIRE(out[0] == in[0]); } -CUB_TEST("DeviceSelect::Unique does not change input", "[device][select_unique]", types) +C2H_TEST("DeviceSelect::Unique does not change input", "[device][select_unique]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(2), in, to_bound(0), to_bound(42)); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -174,14 +174,14 @@ CUB_TEST("DeviceSelect::Unique does not change input", "[device][select_unique]" REQUIRE(reference == in); } -CUB_TEST("DeviceSelect::Unique works with iterators", "[device][select_unique]", all_types) +C2H_TEST("DeviceSelect::Unique works with iterators", "[device][select_unique]", all_types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(2), in, to_bound(0), to_bound(42)); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -199,14 +199,14 @@ CUB_TEST("DeviceSelect::Unique works with iterators", "[device][select_unique]", REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::Unique works with pointers", "[device][select_unique]", types) +C2H_TEST("DeviceSelect::Unique works with pointers", "[device][select_unique]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector out(num_items); - c2h::gen(CUB_SEED(2), in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(2), in, to_bound(0), to_bound(42)); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -245,14 +245,14 @@ struct convertible_from_T } }; -CUB_TEST("DeviceSelect::Unique works with a different output type", "[device][select_unique]", types) +C2H_TEST("DeviceSelect::Unique works with a different output type", "[device][select_unique]", types) { using type = typename c2h::get<0, TestType>; const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector in(num_items); c2h::device_vector> out(num_items); - c2h::gen(CUB_SEED(2), in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(2), in, to_bound(0), to_bound(42)); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -270,7 +270,7 @@ CUB_TEST("DeviceSelect::Unique works with a different output type", "[device][se REQUIRE(reference == out); } -CUB_TEST("DeviceSelect::Unique works for very large number of items", "[device][select_unique]") +C2H_TEST("DeviceSelect::Unique works for very large number of items", "[device][select_unique]") try { using type = std::int64_t; diff --git a/cub/test/catch2_test_device_select_unique_by_key.cu b/cub/test/catch2_test_device_select_unique_by_key.cu index 4603f000704..2b3929292a2 100644 --- a/cub/test/catch2_test_device_select_unique_by_key.cu +++ b/cub/test/catch2_test_device_select_unique_by_key.cu @@ -38,8 +38,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include template inline T to_bound(const unsigned long long bound) @@ -133,7 +133,7 @@ using huge_types = c2h::type_list; -CUB_TEST("DeviceSelect::UniqueByKey can run with empty input", "[device][select_unique_by_key]", types) +C2H_TEST("DeviceSelect::UniqueByKey can run with empty input", "[device][select_unique_by_key]", types) { using type = typename c2h::get<0, TestType>; @@ -149,7 +149,7 @@ CUB_TEST("DeviceSelect::UniqueByKey can run with empty input", "[device][select_ REQUIRE(num_selected_out[0] == 0); } -CUB_TEST("DeviceSelect::UniqueByKey handles none equal", "[device][select_unique_by_key]", types) +C2H_TEST("DeviceSelect::UniqueByKey handles none equal", "[device][select_unique_by_key]", types) { using type = typename c2h::get<0, TestType>; @@ -158,7 +158,7 @@ CUB_TEST("DeviceSelect::UniqueByKey handles none equal", "[device][select_unique c2h::device_vector vals_out(num_items); // Ensure we copy the right value - c2h::gen(CUB_SEED(2), vals_in); + c2h::gen(C2H_SEED(2), vals_in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -176,7 +176,7 @@ CUB_TEST("DeviceSelect::UniqueByKey handles none equal", "[device][select_unique REQUIRE(vals_in == vals_out); } -CUB_TEST("DeviceSelect::UniqueByKey handles all equal", "[device][select_unique_by_key]", types) +C2H_TEST("DeviceSelect::UniqueByKey handles all equal", "[device][select_unique_by_key]", types) { using type = typename c2h::get<0, TestType>; using val_type = c2h::custom_type_t; @@ -188,7 +188,7 @@ CUB_TEST("DeviceSelect::UniqueByKey handles all equal", "[device][select_unique_ c2h::device_vector vals_out(1); // Ensure we copy the right value - c2h::gen(CUB_SEED(2), vals_in); + c2h::gen(C2H_SEED(2), vals_in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -203,7 +203,7 @@ CUB_TEST("DeviceSelect::UniqueByKey handles all equal", "[device][select_unique_ REQUIRE(vals_in[0] == vals_out[0]); } -CUB_TEST("DeviceSelect::UniqueByKey does not change input", "[device][select_unique_by_key]", types) +C2H_TEST("DeviceSelect::UniqueByKey does not change input", "[device][select_unique_by_key]", types) { using type = typename c2h::get<0, TestType>; using val_type = c2h::custom_type_t; @@ -211,8 +211,8 @@ CUB_TEST("DeviceSelect::UniqueByKey does not change input", "[device][select_uni const int num_items = GENERATE_COPY(take(2, random(1, 1000000))); c2h::device_vector keys_in(num_items); c2h::device_vector vals_in(num_items); - c2h::gen(CUB_SEED(2), keys_in, to_bound(0), to_bound(42)); - c2h::gen(CUB_SEED(1), vals_in); + c2h::gen(C2H_SEED(2), keys_in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(1), vals_in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -255,7 +255,7 @@ struct custom_equality_op } }; -CUB_TEST("DeviceSelect::UniqueByKey works with iterators", "[device][select_unique_by_key]", all_types) +C2H_TEST("DeviceSelect::UniqueByKey works with iterators", "[device][select_unique_by_key]", all_types) { using type = typename c2h::get<0, TestType>; using val_type = c2h::custom_type_t; @@ -265,8 +265,8 @@ CUB_TEST("DeviceSelect::UniqueByKey works with iterators", "[device][select_uniq c2h::device_vector vals_in(num_items); c2h::device_vector keys_out(num_items); c2h::device_vector vals_out(num_items); - c2h::gen(CUB_SEED(2), keys_in, to_bound(0), to_bound(42)); - c2h::gen(CUB_SEED(1), vals_in); + c2h::gen(C2H_SEED(2), keys_in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(1), vals_in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -291,7 +291,7 @@ CUB_TEST("DeviceSelect::UniqueByKey works with iterators", "[device][select_uniq REQUIRE(reference_vals == vals_out); } -CUB_TEST("DeviceSelect::UniqueByKey works with pointers", "[device][select_unique_by_key]", types) +C2H_TEST("DeviceSelect::UniqueByKey works with pointers", "[device][select_unique_by_key]", types) { using type = typename c2h::get<0, TestType>; using val_type = c2h::custom_type_t; @@ -301,8 +301,8 @@ CUB_TEST("DeviceSelect::UniqueByKey works with pointers", "[device][select_uniqu c2h::device_vector vals_in(num_items); c2h::device_vector keys_out(num_items); c2h::device_vector vals_out(num_items); - c2h::gen(CUB_SEED(2), keys_in, to_bound(0), to_bound(42)); - c2h::gen(CUB_SEED(1), vals_in); + c2h::gen(C2H_SEED(2), keys_in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(1), vals_in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -352,7 +352,7 @@ struct convertible_from_T } }; -CUB_TEST("DeviceSelect::UniqueByKey works with a different output type", "[device][select_unique_by_key]", types) +C2H_TEST("DeviceSelect::UniqueByKey works with a different output type", "[device][select_unique_by_key]", types) { using type = typename c2h::get<0, TestType>; using val_type = c2h::custom_type_t; @@ -362,8 +362,8 @@ CUB_TEST("DeviceSelect::UniqueByKey works with a different output type", "[devic c2h::device_vector vals_in(num_items); c2h::device_vector keys_out(num_items); c2h::device_vector> vals_out(num_items); - c2h::gen(CUB_SEED(2), keys_in, to_bound(0), to_bound(42)); - c2h::gen(CUB_SEED(1), vals_in); + c2h::gen(C2H_SEED(2), keys_in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(1), vals_in); // Needs to be device accessible c2h::device_vector num_selected_out(1, 0); @@ -388,7 +388,7 @@ CUB_TEST("DeviceSelect::UniqueByKey works with a different output type", "[devic REQUIRE(reference_vals == vals_out); } -CUB_TEST("DeviceSelect::UniqueByKey works and uses vsmem for large types", +C2H_TEST("DeviceSelect::UniqueByKey works and uses vsmem for large types", "[device][select_unique_by_key][vsmem]", huge_types) { @@ -399,7 +399,7 @@ CUB_TEST("DeviceSelect::UniqueByKey works and uses vsmem for large types", c2h::device_vector keys_in(num_items); c2h::device_vector keys_out(num_items); c2h::device_vector vals_out(num_items); - c2h::gen(CUB_SEED(2), keys_in, to_bound(0), to_bound(42)); + c2h::gen(C2H_SEED(2), keys_in, to_bound(0), to_bound(42)); auto vals_it = thrust::make_transform_iterator(thrust::make_counting_iterator(0U), index_to_huge_type_op_t{}); @@ -434,7 +434,7 @@ CUB_TEST("DeviceSelect::UniqueByKey works and uses vsmem for large types", REQUIRE(reference_vals == vals_out); } -CUB_TEST("DeviceSelect::UniqueByKey works for very large input that need 64-bit offset types", +C2H_TEST("DeviceSelect::UniqueByKey works for very large input that need 64-bit offset types", "[device][select_unique_by_key]") { using type = std::int32_t; @@ -462,7 +462,7 @@ CUB_TEST("DeviceSelect::UniqueByKey works for very large input that need 64-bit REQUIRE(reference_values == values_out); } -CUB_TEST("DeviceSelect::UniqueByKey works for very large outputs that needs 64-bit offset types", +C2H_TEST("DeviceSelect::UniqueByKey works for very large outputs that needs 64-bit offset types", "[device][select_unique_by_key]") { using type = std::int32_t; @@ -490,7 +490,7 @@ CUB_TEST("DeviceSelect::UniqueByKey works for very large outputs that needs 64-b REQUIRE(num_items == static_cast(num_selected_out[0])); } -CUB_TEST("DeviceSelect::UniqueByKey works with a custom equality operator", "[device][select_unique_by_key]") +C2H_TEST("DeviceSelect::UniqueByKey works with a custom equality operator", "[device][select_unique_by_key]") { using type = std::int32_t; using custom_op_t = custom_equality_op; diff --git a/cub/test/catch2_test_device_three_way_partition.cu b/cub/test/catch2_test_device_three_way_partition.cu index f94f48a5b2a..b42966d492a 100644 --- a/cub/test/catch2_test_device_three_way_partition.cu +++ b/cub/test/catch2_test_device_three_way_partition.cu @@ -38,9 +38,9 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" #include "cub/util_type.cuh" +#include DECLARE_LAUNCH_WRAPPER(cub::DevicePartition::If, partition); @@ -103,7 +103,7 @@ struct count_to_pair_t } }; -CUB_TEST("Device three-way partition can handle empty problems", "[partition][device]", types) +C2H_TEST("Device three-way partition can handle empty problems", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; @@ -222,7 +222,7 @@ thrust_partition(FirstPartSelectionOp first_selector, SecondPartSelectionOp seco return result; } -CUB_TEST("Device three-way partition is stable", "[partition][device]", types) +C2H_TEST("Device three-way partition is stable", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; using pair_type = cuda::std::pair; @@ -245,7 +245,7 @@ CUB_TEST("Device three-way partition is stable", "[partition][device]", types) REQUIRE(cub_result == thrust_result); } -CUB_TEST("Device three-way partition handles empty first part", "[partition][device]", types) +C2H_TEST("Device three-way partition handles empty first part", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; @@ -266,7 +266,7 @@ CUB_TEST("Device three-way partition handles empty first part", "[partition][dev REQUIRE(cub_result.num_items_in_first_part == 0); } -CUB_TEST("Device three-way partition handles empty second part", "[partition][device]", types) +C2H_TEST("Device three-way partition handles empty second part", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; @@ -287,7 +287,7 @@ CUB_TEST("Device three-way partition handles empty second part", "[partition][de REQUIRE(cub_result.num_items_in_second_part == 0); } -CUB_TEST("Device three-way partition handles empty unselected part", "[partition][device]", types) +C2H_TEST("Device three-way partition handles empty unselected part", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; @@ -307,7 +307,7 @@ CUB_TEST("Device three-way partition handles empty unselected part", "[partition REQUIRE(cub_result.num_unselected_items == 0); } -CUB_TEST("Device three-way partition handles only unselected items", "[partition][device]", types) +C2H_TEST("Device three-way partition handles only unselected items", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; @@ -328,7 +328,7 @@ CUB_TEST("Device three-way partition handles only unselected items", "[partition REQUIRE(cub_result.num_items_in_second_part == 0); } -CUB_TEST("Device three-way partition handles reverse iterator", "[partition][device]", types) +C2H_TEST("Device three-way partition handles reverse iterator", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; @@ -384,7 +384,7 @@ CUB_TEST("Device three-way partition handles reverse iterator", "[partition][dev REQUIRE(actual_num_items_in_first_part == num_items_in_first_part); } -CUB_TEST("Device three-way partition handles single output", "[partition][device]", types) +C2H_TEST("Device three-way partition handles single output", "[partition][device]", types) { using type = typename c2h::get<0, TestType>; diff --git a/cub/test/catch2_test_device_transform.cu b/cub/test/catch2_test_device_transform.cu index 50f253ef5c3..ed91365adb5 100644 --- a/cub/test/catch2_test_device_transform.cu +++ b/cub/test/catch2_test_device_transform.cu @@ -15,10 +15,10 @@ #include -#include "c2h/custom_type.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" -#include "test/test_util_vec.h" +#include +#include +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -104,7 +104,7 @@ using offset_types = c2h::type_list; FILTER_UBLKCP \ _CCCL_DIAG_POP -CUB_TEST("DeviceTransform::Transform BabelStream add", +C2H_TEST("DeviceTransform::Transform BabelStream add", "[device][device_transform]", c2h::type_list, offset_types, @@ -119,8 +119,8 @@ CUB_TEST("DeviceTransform::Transform BabelStream add", c2h::device_vector a(num_items); c2h::device_vector b(num_items); - c2h::gen(CUB_SEED(1), a); - c2h::gen(CUB_SEED(1), b); + c2h::gen(C2H_SEED(1), a); + c2h::gen(C2H_SEED(1), b); c2h::device_vector result(num_items); transform_many_with_alg( @@ -185,7 +185,7 @@ using overaligned_types = >; // test with types exceeding the memcpy_async and bulk copy alignments (16 and 128 bytes respectively) -CUB_TEST("DeviceTransform::Transform overaligned type", "[device][device_transform]", overaligned_types) +C2H_TEST("DeviceTransform::Transform overaligned type", "[device][device_transform]", overaligned_types) { using type = c2h::get<0, TestType>; CAPTURE(c2h::demangle(typeid(type).name())); @@ -205,7 +205,7 @@ CUB_TEST("DeviceTransform::Transform overaligned type", "[device][device_transfo REQUIRE(result == c2h::device_vector(num_items, 7)); } -CUB_TEST("DeviceTransform::Transform huge type", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform huge type", "[device][device_transform]") { using huge_t = c2h::custom_type_t::type>; static_assert(alignof(huge_t) == 8, "Need a large type with alignment < 16"); @@ -214,8 +214,8 @@ CUB_TEST("DeviceTransform::Transform huge type", "[device][device_transform]") const int num_items = GENERATE(0, 1, 100, 1000); c2h::device_vector a(num_items); c2h::device_vector b(num_items); - c2h::gen(CUB_SEED(1), a); - c2h::gen(CUB_SEED(1), b); + c2h::gen(C2H_SEED(1), a); + c2h::gen(C2H_SEED(1), b); c2h::device_vector result(num_items); transform_many(::cuda::std::make_tuple(a.begin(), b.begin()), result.begin(), num_items, ::cuda::std::plus{}); @@ -235,7 +235,7 @@ struct times_seven } }; -CUB_TEST("DeviceTransform::Transform with large input", "[device][device_transform]", algorithms) +C2H_TEST("DeviceTransform::Transform with large input", "[device][device_transform]", algorithms) try { using type = unsigned char; @@ -246,7 +246,7 @@ try constexpr offset_t num_items = (offset_t{1} << 32) + 123456; // a few thread blocks beyond 4GiB c2h::device_vector input(num_items); - c2h::gen(CUB_SEED(1), input); + c2h::gen(C2H_SEED(1), input); c2h::device_vector result(num_items); transform_many_with_alg( @@ -275,7 +275,7 @@ struct nstream_kernel }; // overwrites one input stream -CUB_TEST("DeviceTransform::Transform BabelStream nstream", +C2H_TEST("DeviceTransform::Transform BabelStream nstream", "[device][device_transform]", c2h::type_list, offset_types, @@ -291,9 +291,9 @@ CUB_TEST("DeviceTransform::Transform BabelStream nstream", c2h::device_vector a(num_items); c2h::device_vector b(num_items); c2h::device_vector c(num_items); - c2h::gen(CUB_SEED(1), a, type{10}, type{100}); - c2h::gen(CUB_SEED(1), b, type{10}, type{100}); - c2h::gen(CUB_SEED(1), c, type{10}, type{100}); + c2h::gen(C2H_SEED(1), a, type{10}, type{100}); + c2h::gen(C2H_SEED(1), b, type{10}, type{100}); + c2h::gen(C2H_SEED(1), c, type{10}, type{100}); // copy to host before changing c2h::host_vector a_h = a; @@ -317,7 +317,7 @@ struct sum_five } }; -CUB_TEST("DeviceTransform::Transform add five streams", "[device][device_transform]", algorithms) +C2H_TEST("DeviceTransform::Transform add five streams", "[device][device_transform]", algorithms) { using offset_t = int; constexpr auto alg = c2h::get<0, TestType>::value; @@ -350,7 +350,7 @@ struct give_me_five } }; -CUB_TEST("DeviceTransform::Transform no streams", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform no streams", "[device][device_transform]") { constexpr int num_items = 100; c2h::device_vector result(num_items); @@ -361,7 +361,7 @@ CUB_TEST("DeviceTransform::Transform no streams", "[device][device_transform]") REQUIRE(reference == result); } -CUB_TEST("DeviceTransform::Transform fancy input iterator types", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform fancy input iterator types", "[device][device_transform]") { using type = int; @@ -378,7 +378,7 @@ CUB_TEST("DeviceTransform::Transform fancy input iterator types", "[device][devi REQUIRE(reference_h == result); } -CUB_TEST("DeviceTransform::Transform fancy output iterator type", "[device][device_transform]", algorithms) +C2H_TEST("DeviceTransform::Transform fancy output iterator type", "[device][device_transform]", algorithms) { using type = int; using offset_t = int; @@ -397,7 +397,7 @@ CUB_TEST("DeviceTransform::Transform fancy output iterator type", "[device][devi REQUIRE(result == c2h::device_vector(num_items, (13 + 35) + 4)); } -CUB_TEST("DeviceTransform::Transform mixed input iterator types", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform mixed input iterator types", "[device][device_transform]") { using type = int; @@ -427,7 +427,7 @@ struct plus_needs_stable_address } }; -CUB_TEST("DeviceTransform::Transform address stability", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform address stability", "[device][device_transform]") { using type = int; @@ -490,7 +490,7 @@ static_assert(!thrust::is_trivially_relocatable::value, ""); // CUB // (e.g. by tracking/counting invocations of those), since C++ allows (but not guarantees) elision of these operations. // Also thrust algorithms perform a lot of copies in-between, so the test needs to use only raw allocations and // iteration for setup and checking. -CUB_TEST("DeviceTransform::Transform not trivially relocatable", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform not trivially relocatable", "[device][device_transform]") { constexpr int num_items = 100; c2h::device_vector input(num_items, non_trivial{42}); @@ -502,7 +502,7 @@ CUB_TEST("DeviceTransform::Transform not trivially relocatable", "[device][devic REQUIRE((reference == result)); } -CUB_TEST("DeviceTransform::Transform buffer start alignment", +C2H_TEST("DeviceTransform::Transform buffer start alignment", "[device][device_transform]", c2h::type_list) { @@ -540,7 +540,7 @@ struct StringMaker> } // namespace Catch // TODO(bgruber): rewrite this example using int3 -CUB_TEST("DeviceTransform::Transform aligned_base_ptr", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform aligned_base_ptr", "[device][device_transform]") { alignas(128) int arr[256]; using namespace cub::detail::transform; diff --git a/cub/test/catch2_test_device_transform_api.cu b/cub/test/catch2_test_device_transform_api.cu index 46388ed6b23..e6b5193613f 100644 --- a/cub/test/catch2_test_device_transform_api.cu +++ b/cub/test/catch2_test_device_transform_api.cu @@ -6,7 +6,7 @@ #include #include -#include "catch2_test_helper.h" +#include // need a separate function because the ext. lambda needs to be enclosed by a function with external linkage on Windows void test_transform_api() @@ -29,7 +29,7 @@ void test_transform_api() CHECK(result == expected); } -CUB_TEST("DeviceTransform::Transform API example", "[device][device_transform]") +C2H_TEST("DeviceTransform::Transform API example", "[device][device_transform]") { test_transform_api(); } @@ -59,7 +59,7 @@ void test_transform_stable_api() CHECK(result == expected); } -CUB_TEST("DeviceTransform::TransformStableArgumentAddresses API example", "[device][device_transform]") +C2H_TEST("DeviceTransform::TransformStableArgumentAddresses API example", "[device][device_transform]") { test_transform_stable_api(); } diff --git a/cub/test/catch2_test_device_transform_reduce.cu b/cub/test/catch2_test_device_transform_reduce.cu index 7c313562d7c..33878846625 100644 --- a/cub/test/catch2_test_device_transform_reduce.cu +++ b/cub/test/catch2_test_device_transform_reduce.cu @@ -32,11 +32,11 @@ #include -#include "c2h/custom_type.cuh" -#include "c2h/extended_types.cuh" #include "catch2_test_device_reduce.cuh" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include +#include +#include DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::TransformReduce, device_transform_reduce); @@ -53,7 +53,7 @@ struct square_t } }; -CUB_TEST("Device transform reduce works with pointers", "[reduce][device]", types) +C2H_TEST("Device transform reduce works with pointers", "[reduce][device]", types) { using item_t = c2h::get<0, TestType>; using init_t = item_t; @@ -69,7 +69,7 @@ CUB_TEST("Device transform reduce works with pointers", "[reduce][device]", type item_t init{42}; c2h::device_vector out(1); c2h::device_vector in(num_items + 1); - c2h::gen(CUB_SEED(2), in); + c2h::gen(C2H_SEED(2), in); item_t* d_in = thrust::raw_pointer_cast(in.data()); item_t* d_out = thrust::raw_pointer_cast(out.data()); @@ -100,7 +100,7 @@ CUB_TEST("Device transform reduce works with pointers", "[reduce][device]", type } } -CUB_TEST("Device transform reduce works with iterators", "[reduce][device]", types) +C2H_TEST("Device transform reduce works with iterators", "[reduce][device]", types) { using item_t = c2h::get<0, TestType>; using init_t = item_t; @@ -212,7 +212,7 @@ struct reduction_op_t } }; -CUB_TEST("Device transform reduce doesn't let input type into reduction op", "[reduce][device]") +C2H_TEST("Device transform reduce doesn't let input type into reduction op", "[reduce][device]") { constexpr int max_items = 5000000; constexpr int min_items = 1; diff --git a/cub/test/catch2_test_iterator.cu b/cub/test/catch2_test_iterator.cu index fb2639b6fc2..e2a5c915319 100644 --- a/cub/test/catch2_test_iterator.cu +++ b/cub/test/catch2_test_iterator.cu @@ -39,7 +39,7 @@ #include -#include "catch2_test_helper.h" +#include using scalar_types = c2h::type_list; @@ -108,7 +108,7 @@ void test_iterator(InputIteratorT d_in, const c2h::host_vector& h_reference) CHECK(d_in == h_itrs[1]); } -CUB_TEST("Test constant iterator", "[iterator]", scalar_types) +C2H_TEST("Test constant iterator", "[iterator]", scalar_types) { using T = c2h::get<0, TestType>; const T base = static_cast(GENERATE(0, 99)); @@ -116,7 +116,7 @@ CUB_TEST("Test constant iterator", "[iterator]", scalar_types) test_iterator(cub::ConstantInputIterator(base), h_reference); } -CUB_TEST("Test counting iterator", "[iterator]", scalar_types) +C2H_TEST("Test counting iterator", "[iterator]", scalar_types) { using T = c2h::get<0, TestType>; const T base = static_cast(GENERATE(0, 99)); @@ -142,14 +142,14 @@ using cache_modifiers = cub::LOAD_LDG, cub::LOAD_VOLATILE>; -CUB_TEST("Test cache modified iterator", "[iterator]", types, cache_modifiers) +C2H_TEST("Test cache modified iterator", "[iterator]", types, cache_modifiers) { using T = c2h::get<0, TestType>; constexpr auto cache_modifier = c2h::get<1, TestType>::value; constexpr int TEST_VALUES = 11000; c2h::device_vector d_data(TEST_VALUES); - c2h::gen(CUB_SEED(1), d_data); + c2h::gen(C2H_SEED(1), d_data); c2h::host_vector h_data(d_data); const auto h_reference = c2h::host_vector{ @@ -168,13 +168,13 @@ struct transform_op_t } }; -CUB_TEST("Test transform iterator", "[iterator]", types) +C2H_TEST("Test transform iterator", "[iterator]", types) { using T = c2h::get<0, TestType>; constexpr int TEST_VALUES = 11000; c2h::device_vector d_data(TEST_VALUES); - c2h::gen(CUB_SEED(1), d_data); + c2h::gen(C2H_SEED(1), d_data); c2h::host_vector h_data(d_data); transform_op_t op; @@ -192,13 +192,13 @@ CUB_TEST("Test transform iterator", "[iterator]", types) h_reference); } -CUB_TEST("Test tex-obj texture iterator", "[iterator]", types) +C2H_TEST("Test tex-obj texture iterator", "[iterator]", types) { using T = c2h::get<0, TestType>; constexpr unsigned int TEST_VALUES = 11000; c2h::device_vector d_data(TEST_VALUES); - c2h::gen(CUB_SEED(1), d_data); + c2h::gen(C2H_SEED(1), d_data); c2h::host_vector h_data(d_data); const auto h_reference = c2h::host_vector{ @@ -209,13 +209,13 @@ CUB_TEST("Test tex-obj texture iterator", "[iterator]", types) test_iterator(d_obj_itr, h_reference); } -CUB_TEST("Test texture transform iterator", "[iterator]", types) +C2H_TEST("Test texture transform iterator", "[iterator]", types) { using T = c2h::get<0, TestType>; constexpr int TEST_VALUES = 11000; c2h::device_vector d_data(TEST_VALUES); - c2h::gen(CUB_SEED(1), d_data); + c2h::gen(C2H_SEED(1), d_data); c2h::host_vector h_data(d_data.begin(), d_data.end()); transform_op_t op; diff --git a/cub/test/catch2_test_launch_helper.h b/cub/test/catch2_test_launch_helper.h index 4ccb0622abd..fbe71c1abb0 100644 --- a/cub/test/catch2_test_launch_helper.h +++ b/cub/test/catch2_test_launch_helper.h @@ -29,7 +29,7 @@ #include -#include "catch2_test_helper.h" +#include //! @file //! This file contains utilities for device-scope API tests @@ -46,7 +46,7 @@ //! // arguments as the CUB API. The wrapper name is provided as the second argument. //! DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::Sum, cub_reduce_sum); //! -//! CUB_TEST("Reduce test", "[device][reduce]") +//! C2H_TEST("Reduce test", "[device][reduce]") //! { //! // ... //! // Invoke the wrapper from the test. It'll allocate temporary storage and diff --git a/cub/test/catch2_test_launch_wrapper.cu b/cub/test/catch2_test_launch_wrapper.cu index ef03c0bba10..21670628edc 100644 --- a/cub/test/catch2_test_launch_wrapper.cu +++ b/cub/test/catch2_test_launch_wrapper.cu @@ -29,8 +29,8 @@ #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include // %PARAM% TEST_LAUNCH lid 0:1:2 @@ -127,7 +127,7 @@ struct cub_api_example_t DECLARE_LAUNCH_WRAPPER(cub_api_example_t::x2_0, x2_0); DECLARE_LAUNCH_WRAPPER(cub_api_example_t::x0_5, x0_5); -CUB_TEST("Launch wrapper works with predefined invocables", "[test][utils]") +C2H_TEST("Launch wrapper works with predefined invocables", "[test][utils]") { INFO("Launch = " << TEST_LAUNCH); @@ -187,7 +187,7 @@ struct custom_x0_5_invocable } }; -CUB_TEST("Launch wrapper works with custom invocables", "[test][utils]") +C2H_TEST("Launch wrapper works with custom invocables", "[test][utils]") { int n = 42; c2h::device_vector in(n, 21); diff --git a/cub/test/catch2_test_nvrtc.cu b/cub/test/catch2_test_nvrtc.cu index 8dddb38c576..5bd26145250 100644 --- a/cub/test/catch2_test_nvrtc.cu +++ b/cub/test/catch2_test_nvrtc.cu @@ -29,7 +29,7 @@ #include -#include "catch2_test_helper.h" +#include #include TEST_CASE("Test nvrtc", "[test][nvrtc]") diff --git a/cub/test/catch2_test_printing.cu b/cub/test/catch2_test_printing.cu index f5634570ff5..631a6804c07 100644 --- a/cub/test/catch2_test_printing.cu +++ b/cub/test/catch2_test_printing.cu @@ -1,7 +1,7 @@ #include -#include "catch2_test_helper.h" #include "test_util.h" +#include template std::string print(T val) diff --git a/cub/test/catch2_test_radix_operations.cu b/cub/test/catch2_test_radix_operations.cu index 56d1ccebc38..98cbdd388d0 100644 --- a/cub/test/catch2_test_radix_operations.cu +++ b/cub/test/catch2_test_radix_operations.cu @@ -34,7 +34,7 @@ #include #include -#include +#include template struct fundamental_extractor_t @@ -57,7 +57,7 @@ template c2h::host_vector get_random_buffer() { c2h::device_vector buffer(sizeof(T)); - c2h::gen(CUB_SEED(3), buffer); + c2h::gen(C2H_SEED(3), buffer); return buffer; } @@ -95,7 +95,7 @@ using a_few_fundamental_types = c2h::type_list; * dst: 0 0 0 0 0 0 1 0 0 1 * */ -CUB_TEST("Radix operations extract digits from fundamental types", "[radix][operations]", fundamental_types) +C2H_TEST("Radix operations extract digits from fundamental types", "[radix][operations]", fundamental_types) { using key_t = typename c2h::get<0, TestType>; using traits = cub::detail::radix::traits_t; @@ -308,13 +308,13 @@ void test_tuple() } } -CUB_TEST("Radix operations extract digits from pairs", "[radix][operations]", fundamental_types, fundamental_types) +C2H_TEST("Radix operations extract digits from pairs", "[radix][operations]", fundamental_types, fundamental_types) { test_tuple, // typename c2h::get<1, TestType>>(); } -CUB_TEST("Radix operations extract digits from triples", +C2H_TEST("Radix operations extract digits from triples", "[radix][operations]", fundamental_types, fundamental_types, @@ -325,7 +325,7 @@ CUB_TEST("Radix operations extract digits from triples", typename c2h::get<2, TestType>>(); } -CUB_TEST("Radix operations extract digits from tetrads", +C2H_TEST("Radix operations extract digits from tetrads", "[radix][operations]", a_few_fundamental_types, a_few_fundamental_types, @@ -345,7 +345,7 @@ CUB_TEST("Radix operations extract digits from tetrads", * dst: 0 0 1 1 0 0 1 1 0 0 * */ -CUB_TEST("Radix operations inverse fundamental types", "[radix][operations]", fundamental_types) +C2H_TEST("Radix operations inverse fundamental types", "[radix][operations]", fundamental_types) { using key_t = typename c2h::get<0, TestType>; using traits = cub::detail::radix::traits_t; @@ -385,7 +385,7 @@ CUB_TEST("Radix operations inverse fundamental types", "[radix][operations]", fu * < <---- higher bits / lower bits ----> > * */ -CUB_TEST("Radix operations inverse pairs", "[radix][operations]", fundamental_types, fundamental_types) +C2H_TEST("Radix operations inverse pairs", "[radix][operations]", fundamental_types, fundamental_types) { using tpl_t = ::cuda::std::tuple, // typename c2h::get<1, TestType>>; @@ -420,7 +420,7 @@ CUB_TEST("Radix operations inverse pairs", "[radix][operations]", fundamental_ty * This tests checks that radix operations can get a value that when converted * to binary-comparable representation, yields smallest possible value. */ -CUB_TEST("Radix operations infere minimal value for fundamental types", "[radix][operations]", fundamental_types) +C2H_TEST("Radix operations infere minimal value for fundamental types", "[radix][operations]", fundamental_types) { using key_t = typename c2h::get<0, TestType>; using traits = cub::detail::radix::traits_t; @@ -435,7 +435,7 @@ CUB_TEST("Radix operations infere minimal value for fundamental types", "[radix] REQUIRE(ref == val); } -CUB_TEST( +C2H_TEST( "Radix operations infere minimal value for pair types", "[radix][operations]", fundamental_types, fundamental_types) { using tpl_t = ::cuda::std::tuple, // @@ -456,7 +456,7 @@ CUB_TEST( * This tests checks that radix operations can get a value that when converted * to binary-comparable representation, yields largest possible value. */ -CUB_TEST("Radix operations infere maximal value for fundamental types", "[radix][operations]", fundamental_types) +C2H_TEST("Radix operations infere maximal value for fundamental types", "[radix][operations]", fundamental_types) { using key_t = typename c2h::get<0, TestType>; using traits = cub::detail::radix::traits_t; @@ -468,7 +468,7 @@ CUB_TEST("Radix operations infere maximal value for fundamental types", "[radix] REQUIRE(ref == val); } -CUB_TEST( +C2H_TEST( "Radix operations infere maximal value for pair types", "[radix][operations]", fundamental_types, fundamental_types) { using tpl_t = ::cuda::std::tuple, // @@ -497,7 +497,7 @@ using fundamental_signed_types = c2h::type_list -#include "catch2_test_helper.h" #include "cub/detail/temporary_storage.cuh" +#include using num_storage_slots = c2h::enum_type_list; @@ -52,14 +52,14 @@ std::size_t get_actual_zero() return get_temporary_storage_size(sizes); } -CUB_TEST("Test empty storage", "[temporary_storage_layout]", num_storage_slots) +C2H_TEST("Test empty storage", "[temporary_storage_layout]", num_storage_slots) { constexpr auto storage_slots = c2h::get<0, TestType>::value; cub::detail::temporary_storage::layout temporary_storage; CHECK(temporary_storage.get_size() == get_actual_zero()); } -CUB_TEST("Test partially filled storage", "[temporary_storage_layout]", num_storage_slots) +C2H_TEST("Test partially filled storage", "[temporary_storage_layout]", num_storage_slots) { constexpr auto storage_slots = c2h::get<0, TestType>::value; using target_type = std::uint64_t; @@ -104,7 +104,7 @@ CUB_TEST("Test partially filled storage", "[temporary_storage_layout]", num_stor } } -CUB_TEST("Test grow", "[temporary_storage_layout]", num_storage_slots) +C2H_TEST("Test grow", "[temporary_storage_layout]", num_storage_slots) { constexpr auto StorageSlots = c2h::get<0, TestType>::value; using target_type = std::uint64_t; @@ -143,7 +143,7 @@ CUB_TEST("Test grow", "[temporary_storage_layout]", num_storage_slots) } } -CUB_TEST("Test double grow", "[temporary_storage_layout]", num_storage_slots) +C2H_TEST("Test double grow", "[temporary_storage_layout]", num_storage_slots) { constexpr auto storage_slots = c2h::get<0, TestType>::value; using target_type = std::uint64_t; diff --git a/cub/test/catch2_test_thread_operators.cu b/cub/test/catch2_test_thread_operators.cu index 399f842368a..c96bb411cf4 100644 --- a/cub/test/catch2_test_thread_operators.cu +++ b/cub/test/catch2_test_thread_operators.cu @@ -27,8 +27,8 @@ #include -#include "catch2_test_helper.h" #include "test_util.h" +#include template T Make(int val) @@ -90,7 +90,7 @@ CUSTOM_TYPE_FACTORY(Div, int, /, false); CUSTOM_TYPE_FACTORY(Gt, bool, >, true); CUSTOM_TYPE_FACTORY(Lt, bool, <, true); -CUB_TEST("Equality", "[thread_operator]") +C2H_TEST("Equality", "[thread_operator]") { cub::Equality op{}; @@ -105,7 +105,7 @@ CUB_TEST("Equality", "[thread_operator]") CHECK(op(Make(magic_val), magic_val + 1) == false); } -CUB_TEST("Inequality", "[thread_operator]") +C2H_TEST("Inequality", "[thread_operator]") { cub::Inequality op{}; @@ -120,7 +120,7 @@ CUB_TEST("Inequality", "[thread_operator]") CHECK(op(Make(magic_val), magic_val + 1) == true); } -CUB_TEST("InequalityWrapper", "[thread_operator]") +C2H_TEST("InequalityWrapper", "[thread_operator]") { cub::Equality wrapped_op{}; cub::InequalityWrapper op{wrapped_op}; @@ -161,7 +161,7 @@ void StaticSame() STATIC_REQUIRE(std::is_same::value); } -CUB_TEST("Sum", "[thread_operator]") +C2H_TEST("Sum", "[thread_operator]") { cub::Sum op{}; @@ -178,7 +178,7 @@ CUB_TEST("Sum", "[thread_operator]") StaticSame(); } -CUB_TEST("Difference", "[thread_operator]") +C2H_TEST("Difference", "[thread_operator]") { cub::Difference op{}; @@ -196,7 +196,7 @@ CUB_TEST("Difference", "[thread_operator]") StaticSame(); } -CUB_TEST("Division", "[thread_operator]") +C2H_TEST("Division", "[thread_operator]") { cub::Division op{}; @@ -214,7 +214,7 @@ CUB_TEST("Division", "[thread_operator]") StaticSame(); } -CUB_TEST("Max", "[thread_operator]") +C2H_TEST("Max", "[thread_operator]") { cub::Max op{}; @@ -231,7 +231,7 @@ CUB_TEST("Max", "[thread_operator]") StaticSame(magic_val))), int>(); } -CUB_TEST("Min", "[thread_operator]") +C2H_TEST("Min", "[thread_operator]") { cub::Min op{}; diff --git a/cub/test/catch2_test_thread_sort.cu b/cub/test/catch2_test_thread_sort.cu index e1b521dff73..e05cef8df95 100644 --- a/cub/test/catch2_test_thread_sort.cu +++ b/cub/test/catch2_test_thread_sort.cu @@ -32,8 +32,8 @@ #include #include -#include "catch2_test_helper.h" #include "cub/thread/thread_sort.cuh" +#include struct CustomLess { @@ -74,7 +74,7 @@ __global__ void kernel(const KeyT* keys_in, KeyT* keys_out, const ValueT* values using value_types = c2h::type_list; using items_per_thread_list = c2h::enum_type_list; -CUB_TEST("Test", "[thread_sort]", value_types, items_per_thread_list) +C2H_TEST("Test", "[thread_sort]", value_types, items_per_thread_list) { using key_t = std::uint32_t; using value_t = c2h::get<0, TestType>; @@ -87,7 +87,7 @@ CUB_TEST("Test", "[thread_sort]", value_types, items_per_thread_list) for (int iteration = 0; iteration < 10; iteration++) { - c2h::gen(CUB_SEED(2), data_source); + c2h::gen(C2H_SEED(2), data_source); c2h::device_vector in_keys(data_source); c2h::device_vector out_keys(elements); diff --git a/cub/test/catch2_test_util_choose_offset.cu b/cub/test/catch2_test_util_choose_offset.cu index 9da5b59239f..08fa0eb98aa 100644 --- a/cub/test/catch2_test_util_choose_offset.cu +++ b/cub/test/catch2_test_util_choose_offset.cu @@ -31,9 +31,9 @@ #include #include -#include "catch2_test_helper.h" +#include -CUB_TEST("Tests choose_offset", "[util][type]") +C2H_TEST("Tests choose_offset", "[util][type]") { // Uses unsigned 32-bit type for signed 32-bit type STATIC_REQUIRE(::cuda::std::is_same, std::uint32_t>::value); @@ -45,7 +45,7 @@ CUB_TEST("Tests choose_offset", "[util][type]") STATIC_REQUIRE(::cuda::std::is_same, unsigned long long>::value); } -CUB_TEST("Tests choose_signed_offset", "[util][type]") +C2H_TEST("Tests choose_signed_offset", "[util][type]") { // Uses signed 64-bit type for unsigned signed 32-bit type STATIC_REQUIRE(::cuda::std::is_same, std::int64_t>::value); @@ -75,7 +75,7 @@ CUB_TEST("Tests choose_signed_offset", "[util][type]") ::cuda::std::numeric_limits::max())); } -CUB_TEST("Tests promote_small_offset", "[util][type]") +C2H_TEST("Tests promote_small_offset", "[util][type]") { // Uses input type for types of at least 32 bits STATIC_REQUIRE(::cuda::std::is_same, std::int32_t>::value); diff --git a/cub/test/catch2_test_util_device.cu b/cub/test/catch2_test_util_device.cu index c2038ff0188..897f5c6ecd5 100644 --- a/cub/test/catch2_test_util_device.cu +++ b/cub/test/catch2_test_util_device.cu @@ -35,8 +35,8 @@ #include #include -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include CUB_NAMESPACE_BEGIN @@ -62,7 +62,7 @@ CUB_NAMESPACE_END // %PARAM% TEST_LAUNCH lid 0:1:2 DECLARE_LAUNCH_WRAPPER(cub::get_cuda_arch_from_kernel, get_cuda_arch_from_kernel); -CUB_TEST("CUB correctly identifies the ptx version the kernel was compiled for", "[util][dispatch]") +C2H_TEST("CUB correctly identifies the ptx version the kernel was compiled for", "[util][dispatch]") { constexpr std::size_t single_item = 1; c2h::device_vector cuda_arch(single_item); @@ -92,7 +92,7 @@ CUB_TEST("CUB correctly identifies the ptx version the kernel was compiled for", } #ifdef __CUDA_ARCH_LIST__ -CUB_TEST("PtxVersion returns a value from __CUDA_ARCH_LIST__", "[util][dispatch]") +C2H_TEST("PtxVersion returns a value from __CUDA_ARCH_LIST__", "[util][dispatch]") { int ptx_version = 0; REQUIRE(cub::PtxVersion(ptx_version) == cudaSuccess); @@ -177,7 +177,7 @@ check_chained_policy_prunes_to_arch_list(void* d_temp_storage, size_t& temp_stor DECLARE_LAUNCH_WRAPPER(check_chained_policy_prunes_to_arch_list, check_wrapper_all); -CUB_TEST("ChainedPolicy prunes based on __CUDA_ARCH_LIST__", "[util][dispatch]") +C2H_TEST("ChainedPolicy prunes based on __CUDA_ARCH_LIST__", "[util][dispatch]") { check_wrapper_all(); } @@ -267,7 +267,7 @@ struct policy_hub_minimal using max_policy = policy350; }; -CUB_TEST("ChainedPolicy invokes correct policy", "[util][dispatch]") +C2H_TEST("ChainedPolicy invokes correct policy", "[util][dispatch]") { SECTION("policy_hub_some") { diff --git a/cub/test/catch2_test_util_math.cu b/cub/test/catch2_test_util_math.cu index 6f88c2515bf..8da2fd8a63f 100644 --- a/cub/test/catch2_test_util_math.cu +++ b/cub/test/catch2_test_util_math.cu @@ -29,9 +29,9 @@ #include -#include "catch2_test_helper.h" +#include -CUB_TEST("Tests safe_add_bound_to_max", "[util][math]") +C2H_TEST("Tests safe_add_bound_to_max", "[util][math]") { REQUIRE(cub::detail::safe_add_bound_to_max(0U, ::cuda::std::numeric_limits::max()) == ::cuda::std::numeric_limits::max()); diff --git a/cub/test/catch2_test_util_type.cu b/cub/test/catch2_test_util_type.cu index ed201a6ea48..05469035a69 100644 --- a/cub/test/catch2_test_util_type.cu +++ b/cub/test/catch2_test_util_type.cu @@ -31,9 +31,9 @@ #include -#include "catch2_test_helper.h" +#include -CUB_TEST("Tests non_void_value_t", "[util][type]") +C2H_TEST("Tests non_void_value_t", "[util][type]") { using fallback_t = float; using void_fancy_it = cub::DiscardOutputIterator; @@ -73,7 +73,7 @@ struct HasDog using dog = int; }; -CUB_TEST("Test CUB_DEFINE_DETECT_NESTED_TYPE", "[util][type]") +C2H_TEST("Test CUB_DEFINE_DETECT_NESTED_TYPE", "[util][type]") { STATIC_REQUIRE(cat_detect::value); STATIC_REQUIRE(!cat_detect::value); diff --git a/cub/test/catch2_test_vsmem.cu b/cub/test/catch2_test_vsmem.cu index da83e444d42..f8715ad6f5a 100644 --- a/cub/test/catch2_test_vsmem.cu +++ b/cub/test/catch2_test_vsmem.cu @@ -34,8 +34,8 @@ #include #include "catch2/catch.hpp" -#include "catch2_test_helper.h" #include "catch2_test_launch_helper.h" +#include //---------------------------------------------------------------------------- // Helper section @@ -409,7 +409,7 @@ DECLARE_LAUNCH_WRAPPER(device_dummy_algorithm, dummy_algorithm); using type_list = c2h::type_list, large_custom_t<80>, large_custom_t<128>, large_custom_t<512>>; -CUB_TEST("Virtual shared memory works within algorithms", "[util][vsmem]", type_list) +C2H_TEST("Virtual shared memory works within algorithms", "[util][vsmem]", type_list) { using item_t = typename c2h::get<0, TestType>; using offset_t = int32_t; @@ -424,7 +424,7 @@ CUB_TEST("Virtual shared memory works within algorithms", "[util][vsmem]", type_ auto const out_ptr = reinterpret_cast(thrust::raw_pointer_cast(out.data())); // Generate some random noise input data - c2h::gen(CUB_SEED(1), in); + c2h::gen(C2H_SEED(1), in); // Query default and fallback policies and agents so we can confirm vsmem using default_policy_t = typename device_dummy_algorithm_policy_t::policy_350::DummyAlgorithmPolicy; diff --git a/cub/test/catch2_test_warp_exchange.cuh b/cub/test/catch2_test_warp_exchange.cuh index ae78b7623bb..46d46d0ee16 100644 --- a/cub/test/catch2_test_warp_exchange.cuh +++ b/cub/test/catch2_test_warp_exchange.cuh @@ -35,8 +35,8 @@ #include -#include "catch2_test_helper.h" -#include "fill_striped.cuh" +#include +#include template struct exchange_data_t; diff --git a/cub/test/catch2_test_warp_exchange_shfl.cu b/cub/test/catch2_test_warp_exchange_shfl.cu index 8974253b819..6a0f7c92727 100644 --- a/cub/test/catch2_test_warp_exchange_shfl.cu +++ b/cub/test/catch2_test_warp_exchange_shfl.cu @@ -49,7 +49,7 @@ struct params_t } // namespace -CUB_TEST("Blocked to striped works", "[exchange][warp][shfl]", inout_types, items_per_thread) +C2H_TEST("Blocked to striped works", "[exchange][warp][shfl]", inout_types, items_per_thread) { using params = params_t; using in_type = typename params::in_type; @@ -69,7 +69,7 @@ CUB_TEST("Blocked to striped works", "[exchange][warp][shfl]", inout_types, item REQUIRE(h_expected_output == d_out); } -CUB_TEST("Striped to blocked works", "[exchange][warp][shfl]", inout_types, items_per_thread) +C2H_TEST("Striped to blocked works", "[exchange][warp][shfl]", inout_types, items_per_thread) { using params = params_t; using in_type = typename params::in_type; diff --git a/cub/test/catch2_test_warp_exchange_smem.cu b/cub/test/catch2_test_warp_exchange_smem.cu index 95815867c40..adb6081c8c9 100644 --- a/cub/test/catch2_test_warp_exchange_smem.cu +++ b/cub/test/catch2_test_warp_exchange_smem.cu @@ -56,7 +56,7 @@ struct params_t } // namespace -CUB_TEST("Scatter to striped works", "[exchange][warp][smem]", inout_types, logical_warp_threads, items_per_thread) +C2H_TEST("Scatter to striped works", "[exchange][warp][smem]", inout_types, logical_warp_threads, items_per_thread) { using params = params_t; using in_type = typename params::in_type; @@ -75,7 +75,7 @@ CUB_TEST("Scatter to striped works", "[exchange][warp][smem]", inout_types, logi REQUIRE(h_expected_output == d_out); } -CUB_TEST("Blocked to striped works", "[exchange][warp][smem]", inout_types, logical_warp_threads, items_per_thread) +C2H_TEST("Blocked to striped works", "[exchange][warp][smem]", inout_types, logical_warp_threads, items_per_thread) { using params = params_t; using in_type = typename params::in_type; @@ -95,7 +95,7 @@ CUB_TEST("Blocked to striped works", "[exchange][warp][smem]", inout_types, logi REQUIRE(h_expected_output == d_out); } -CUB_TEST("Striped to blocked works", "[exchange][warp][smem]", inout_types, logical_warp_threads, items_per_thread) +C2H_TEST("Striped to blocked works", "[exchange][warp][smem]", inout_types, logical_warp_threads, items_per_thread) { using params = params_t; using in_type = typename params::in_type; diff --git a/cub/test/catch2_test_warp_load.cu b/cub/test/catch2_test_warp_load.cu index ebe905c0375..4d96b2a915d 100644 --- a/cub/test/catch2_test_warp_load.cu +++ b/cub/test/catch2_test_warp_load.cu @@ -30,8 +30,8 @@ #include -#include "catch2_test_helper.h" -#include "fill_striped.cuh" +#include +#include template ; @@ -261,7 +261,7 @@ CUB_TEST( REQUIRE(num_errors == expected_error_count); } -CUB_TEST("Warp load guarded range works with cache modified iterator", +C2H_TEST("Warp load guarded range works with cache modified iterator", "[load][warp]", types, logical_warp_threads, @@ -290,7 +290,7 @@ CUB_TEST("Warp load guarded range works with cache modified iterator", REQUIRE(num_errors == expected_error_count); } -CUB_TEST("Warp load unguarded range works with pointer", +C2H_TEST("Warp load unguarded range works with pointer", "[load][warp]", types, logical_warp_threads, @@ -313,7 +313,7 @@ CUB_TEST("Warp load unguarded range works with pointer", REQUIRE(num_errors == expected_error_count); } -CUB_TEST("Warp load unguarded range works with cache modified iterator", +C2H_TEST("Warp load unguarded range works with cache modified iterator", "[load][warp]", types, logical_warp_threads, diff --git a/cub/test/catch2_test_warp_mask.cu b/cub/test/catch2_test_warp_mask.cu index 7646b0981f0..1766bfb4027 100644 --- a/cub/test/catch2_test_warp_mask.cu +++ b/cub/test/catch2_test_warp_mask.cu @@ -27,7 +27,7 @@ #include -#include "catch2_test_helper.h" +#include template struct total_warps_t @@ -51,7 +51,7 @@ bool is_lane_involved(unsigned int member_mask, unsigned int lane) using logical_warp_threads = c2h::iota<1, 32>; using power_of_two_warp_threads = c2h::enum_type_list; -CUB_TEST("Warp mask ignores lanes before current logical warp", "[mask][warp]", power_of_two_warp_threads) +C2H_TEST("Warp mask ignores lanes before current logical warp", "[mask][warp]", power_of_two_warp_threads) { constexpr int logical_warp_thread = c2h::get<0, TestType>::value; constexpr unsigned int total_warps = total_warps_t::value(); @@ -68,7 +68,7 @@ CUB_TEST("Warp mask ignores lanes before current logical warp", "[mask][warp]", } } -CUB_TEST("Warp mask involves lanes of current logical warp", "[mask][warp]", logical_warp_threads) +C2H_TEST("Warp mask involves lanes of current logical warp", "[mask][warp]", logical_warp_threads) { constexpr int logical_warp_thread = c2h::get<0, TestType>::value; constexpr unsigned int total_warps = total_warps_t::value(); @@ -86,7 +86,7 @@ CUB_TEST("Warp mask involves lanes of current logical warp", "[mask][warp]", log } } -CUB_TEST("Warp mask ignores lanes after current logical warp", "[mask][warp]", logical_warp_threads) +C2H_TEST("Warp mask ignores lanes after current logical warp", "[mask][warp]", logical_warp_threads) { constexpr int logical_warp_thread = c2h::get<0, TestType>::value; constexpr unsigned int total_warps = total_warps_t::value(); diff --git a/cub/test/catch2_test_warp_merge_sort.cu b/cub/test/catch2_test_warp_merge_sort.cu index faab58054d1..f450d159e6e 100644 --- a/cub/test/catch2_test_warp_merge_sort.cu +++ b/cub/test/catch2_test_warp_merge_sort.cu @@ -35,8 +35,8 @@ #include -#include "c2h/custom_type.cuh" -#include "catch2_test_helper.h" +#include +#include struct CustomLess { @@ -400,7 +400,7 @@ struct params_t static constexpr bool is_stable = c2h::get<3, TestType>::value == stability::stable; }; -CUB_TEST( +C2H_TEST( "Warp sort on keys-only works", "[sort][warp]", key_types, logical_warp_threads, items_per_thread_list, stability_list) { using params = params_t; @@ -412,7 +412,7 @@ CUB_TEST( c2h::device_vector d_out(params::tile_size); auto segment_sizes = thrust::make_constant_iterator(params::logical_warp_items); const auto oob_default = std::numeric_limits::max(); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); // Run test warp_merge_sort( @@ -426,7 +426,7 @@ CUB_TEST( REQUIRE(h_in_out == d_out); } -CUB_TEST("Warp sort keys-only on partial warp-tile works", +C2H_TEST("Warp sort keys-only on partial warp-tile works", "[sort][warp]", key_types, logical_warp_threads, @@ -443,8 +443,8 @@ CUB_TEST("Warp sort keys-only on partial warp-tile works", c2h::device_vector d_out(params::tile_size); c2h::device_vector d_segment_sizes(params::total_warps); const auto oob_default = std::numeric_limits::max(); - c2h::gen(CUB_SEED(5), d_in); - c2h::gen(CUB_SEED(5), d_segment_sizes, 0, params::logical_warp_items); + c2h::gen(C2H_SEED(5), d_in); + c2h::gen(C2H_SEED(5), d_segment_sizes, 0, params::logical_warp_items); // Run test warp_merge_sort( @@ -459,7 +459,7 @@ CUB_TEST("Warp sort keys-only on partial warp-tile works", REQUIRE(h_in_out == d_out); } -CUB_TEST("Warp sort on keys-value pairs works", +C2H_TEST("Warp sort on keys-value pairs works", "[sort][warp]", key_types, logical_warp_threads, @@ -479,7 +479,7 @@ CUB_TEST("Warp sort on keys-value pairs works", c2h::device_vector d_values_out(params::tile_size); auto segment_sizes = thrust::make_constant_iterator(params::logical_warp_items); const auto oob_default = std::numeric_limits::max(); - c2h::gen(CUB_SEED(10), d_keys_in); + c2h::gen(C2H_SEED(10), d_keys_in); // Run test warp_merge_sort( @@ -501,7 +501,7 @@ CUB_TEST("Warp sort on keys-value pairs works", REQUIRE(h_values_in_out == d_values_out); } -CUB_TEST("Warp sort on key-value pairs of a partial warp-tile works", +C2H_TEST("Warp sort on key-value pairs of a partial warp-tile works", "[sort][warp]", key_types, logical_warp_threads, @@ -522,8 +522,8 @@ CUB_TEST("Warp sort on key-value pairs of a partial warp-tile works", c2h::device_vector d_values_out(params::tile_size); c2h::device_vector d_segment_sizes(params::total_warps); const auto oob_default = std::numeric_limits::max(); - c2h::gen(CUB_SEED(5), d_keys_in); - c2h::gen(CUB_SEED(5), d_segment_sizes, 0, params::logical_warp_items); + c2h::gen(C2H_SEED(5), d_keys_in); + c2h::gen(C2H_SEED(5), d_segment_sizes, 0, params::logical_warp_items); // Run test warp_merge_sort( diff --git a/cub/test/catch2_test_warp_reduce.cu b/cub/test/catch2_test_warp_reduce.cu index 55c3ed3e532..c962a66de13 100644 --- a/cub/test/catch2_test_warp_reduce.cu +++ b/cub/test/catch2_test_warp_reduce.cu @@ -34,8 +34,8 @@ #include #include -#include "c2h/custom_type.cuh" -#include "catch2_test_helper.h" +#include +#include template __global__ void warp_reduce_kernel(T* in, T* out, ActionT action) @@ -337,7 +337,7 @@ struct params_t static constexpr int tile_size = total_warps * logical_warp_threads; }; -CUB_TEST("Warp sum works", "[reduce][warp]", full_type_list, logical_warp_threads) +C2H_TEST("Warp sum works", "[reduce][warp]", full_type_list, logical_warp_threads) { using params = params_t; using type = typename params::type; @@ -346,7 +346,7 @@ CUB_TEST("Warp sum works", "[reduce][warp]", full_type_list, logical_warp_thread c2h::device_vector d_in(params::tile_size); c2h::device_vector d_out(params::tile_size); constexpr auto valid_items = params::logical_warp_threads; - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); // Run test warp_reduce(d_in, d_out, warp_sum_t{}); @@ -369,7 +369,7 @@ CUB_TEST("Warp sum works", "[reduce][warp]", full_type_list, logical_warp_thread verify_results(h_out, d_out); } -CUB_TEST("Warp reduce works", "[reduce][warp]", builtin_type_list, logical_warp_threads) +C2H_TEST("Warp reduce works", "[reduce][warp]", builtin_type_list, logical_warp_threads) { using params = params_t; using type = typename params::type; @@ -379,7 +379,7 @@ CUB_TEST("Warp reduce works", "[reduce][warp]", builtin_type_list, logical_warp_ c2h::device_vector d_in(params::tile_size); c2h::device_vector d_out(params::tile_size); constexpr auto valid_items = params::logical_warp_threads; - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); // Run test warp_reduce(d_in, d_out, warp_reduce_t{red_op_t{}}); @@ -402,7 +402,7 @@ CUB_TEST("Warp reduce works", "[reduce][warp]", builtin_type_list, logical_warp_ verify_results(h_out, d_out); } -CUB_TEST("Warp sum on partial warp works", "[reduce][warp]", full_type_list, logical_warp_threads) +C2H_TEST("Warp sum on partial warp works", "[reduce][warp]", full_type_list, logical_warp_threads) { using params = params_t; using type = typename params::type; @@ -411,7 +411,7 @@ CUB_TEST("Warp sum on partial warp works", "[reduce][warp]", full_type_list, log c2h::device_vector d_in(params::tile_size); c2h::device_vector d_out(params::tile_size); const int valid_items = GENERATE_COPY(take(2, random(1, params::logical_warp_threads))); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); // Run test warp_reduce(d_in, d_out, warp_sum_partial_t{valid_items}); @@ -434,7 +434,7 @@ CUB_TEST("Warp sum on partial warp works", "[reduce][warp]", full_type_list, log verify_results(h_out, d_out); } -CUB_TEST("Warp reduce on partial warp works", "[reduce][warp]", builtin_type_list, logical_warp_threads) +C2H_TEST("Warp reduce on partial warp works", "[reduce][warp]", builtin_type_list, logical_warp_threads) { using params = params_t; using type = typename params::type; @@ -444,7 +444,7 @@ CUB_TEST("Warp reduce on partial warp works", "[reduce][warp]", builtin_type_lis c2h::device_vector d_in(params::tile_size); c2h::device_vector d_out(params::tile_size); const int valid_items = GENERATE_COPY(take(2, random(1, params::logical_warp_threads))); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); // Run test warp_reduce( @@ -468,7 +468,7 @@ CUB_TEST("Warp reduce on partial warp works", "[reduce][warp]", builtin_type_lis verify_results(h_out, d_out); } -CUB_TEST("Warp segmented sum works", "[reduce][warp]", full_type_list, logical_warp_threads, segmented_modes) +C2H_TEST("Warp segmented sum works", "[reduce][warp]", full_type_list, logical_warp_threads, segmented_modes) { using params = params_t; using type = typename params::type; @@ -486,8 +486,8 @@ CUB_TEST("Warp segmented sum works", "[reduce][warp]", full_type_list, logical_w constexpr auto valid_items = params::logical_warp_threads; constexpr uint8_t min = 0; constexpr uint8_t max = 2; - c2h::gen(CUB_SEED(5), d_in); - c2h::gen(CUB_SEED(5), d_flags, min, max); + c2h::gen(C2H_SEED(5), d_in); + c2h::gen(C2H_SEED(5), d_flags, min, max); // Run test warp_reduce( @@ -511,7 +511,7 @@ CUB_TEST("Warp segmented sum works", "[reduce][warp]", full_type_list, logical_w verify_results(h_out, d_out); } -CUB_TEST("Warp segmented reduction works", "[reduce][warp]", builtin_type_list, logical_warp_threads, segmented_modes) +C2H_TEST("Warp segmented reduction works", "[reduce][warp]", builtin_type_list, logical_warp_threads, segmented_modes) { using params = params_t; using type = typename params::type; @@ -532,8 +532,8 @@ CUB_TEST("Warp segmented reduction works", "[reduce][warp]", builtin_type_list, constexpr auto valid_items = params::logical_warp_threads; constexpr uint8_t min = 0; constexpr uint8_t max = 2; - c2h::gen(CUB_SEED(5), d_in); - c2h::gen(CUB_SEED(5), d_flags, min, max); + c2h::gen(C2H_SEED(5), d_in); + c2h::gen(C2H_SEED(5), d_flags, min, max); // Run test warp_reduce( diff --git a/cub/test/catch2_test_warp_scan.cu b/cub/test/catch2_test_warp_scan.cu index 28be8c75602..261bcb2811d 100644 --- a/cub/test/catch2_test_warp_scan.cu +++ b/cub/test/catch2_test_warp_scan.cu @@ -28,7 +28,7 @@ #include #include -#include "catch2_test_helper.h" +#include template __global__ void warp_combine_scan_kernel(T* in, T* inclusive_out, T* exclusive_out, ActionT action) @@ -355,14 +355,14 @@ struct params_t static constexpr int tile_size = total_warps * logical_warp_threads; }; -CUB_TEST("Warp scan works with sum", "[scan][warp]", types, logical_warp_threads, modes) +C2H_TEST("Warp scan works with sum", "[scan][warp]", types, logical_warp_threads, modes) { using params = params_t; using type = typename params::type; c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); warp_scan(d_in, d_out, sum_op_t{}); @@ -372,14 +372,14 @@ CUB_TEST("Warp scan works with sum", "[scan][warp]", types, logical_warp_threads REQUIRE_APPROX_EQ(h_out, d_out); } -CUB_TEST("Warp scan works with vec_types", "[scan][warp]", vec_types, logical_warp_threads, modes) +C2H_TEST("Warp scan works with vec_types", "[scan][warp]", vec_types, logical_warp_threads, modes) { using params = params_t; using type = typename params::type; c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); warp_scan(d_in, d_out, sum_op_t{}); @@ -389,7 +389,7 @@ CUB_TEST("Warp scan works with vec_types", "[scan][warp]", vec_types, logical_wa REQUIRE(h_out == d_out); } -CUB_TEST("Warp scan works with custom types", +C2H_TEST("Warp scan works with custom types", "[scan][warp]", c2h::type_list>, logical_warp_threads, @@ -400,7 +400,7 @@ CUB_TEST("Warp scan works with custom types", c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); warp_scan(d_in, d_out, sum_op_t{}); @@ -410,7 +410,7 @@ CUB_TEST("Warp scan works with custom types", REQUIRE(h_out == d_out); } -CUB_TEST("Warp scan returns valid warp aggregate", +C2H_TEST("Warp scan returns valid warp aggregate", "[scan][warp]", c2h::type_list>, logical_warp_threads, @@ -422,7 +422,7 @@ CUB_TEST("Warp scan returns valid warp aggregate", c2h::device_vector d_warp_aggregates(params::total_warps); c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); const int target_thread_id = GENERATE_COPY(take(2, random(0, params::logical_warp_threads - 1))); @@ -439,14 +439,14 @@ CUB_TEST("Warp scan returns valid warp aggregate", } // TODO : Do we need all the types? -CUB_TEST("Warp scan works with custom scan op", "[scan][warp]", types, logical_warp_threads, modes) +C2H_TEST("Warp scan works with custom scan op", "[scan][warp]", types, logical_warp_threads, modes) { using params = params_t; using type = typename params::type; c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); warp_scan(d_in, d_out, min_op_t{}); @@ -479,7 +479,7 @@ CUB_TEST("Warp scan works with custom scan op", "[scan][warp]", types, logical_w REQUIRE_APPROX_EQ(h_out, d_out); } -CUB_TEST("Warp custom op scan returns valid warp aggregate", "[scan][warp]", types, logical_warp_threads, modes) +C2H_TEST("Warp custom op scan returns valid warp aggregate", "[scan][warp]", types, logical_warp_threads, modes) { using params = params_t; using type = typename params::type; @@ -487,7 +487,7 @@ CUB_TEST("Warp custom op scan returns valid warp aggregate", "[scan][warp]", typ c2h::device_vector d_warp_aggregates(params::total_warps); c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); const int target_thread_id = GENERATE_COPY(take(2, random(0, params::logical_warp_threads - 1))); @@ -526,14 +526,14 @@ CUB_TEST("Warp custom op scan returns valid warp aggregate", "[scan][warp]", typ REQUIRE(h_warp_aggregates == d_warp_aggregates); } -CUB_TEST("Warp custom op scan works with initial value", "[scan][warp]", types, logical_warp_threads, modes) +C2H_TEST("Warp custom op scan works with initial value", "[scan][warp]", types, logical_warp_threads, modes) { using params = params_t; using type = typename params::type; c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); const type initial_value = static_cast(GENERATE_COPY(take(2, random(0, params::tile_size)))); @@ -554,7 +554,7 @@ CUB_TEST("Warp custom op scan works with initial value", "[scan][warp]", types, REQUIRE_APPROX_EQ(h_out, d_out); } -CUB_TEST("Warp custom op scan with initial value returns valid warp aggregate", +C2H_TEST("Warp custom op scan with initial value returns valid warp aggregate", "[scan][warp]", types, logical_warp_threads, @@ -566,7 +566,7 @@ CUB_TEST("Warp custom op scan with initial value returns valid warp aggregate", c2h::device_vector d_warp_aggregates(params::total_warps); c2h::device_vector d_out(params::tile_size); c2h::device_vector d_in(params::tile_size); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); const int target_thread_id = GENERATE_COPY(take(2, random(0, params::logical_warp_threads - 1))); const type initial_value = static_cast(GENERATE_COPY(take(2, random(0, params::tile_size)))); @@ -592,7 +592,7 @@ CUB_TEST("Warp custom op scan with initial value returns valid warp aggregate", REQUIRE(h_warp_aggregates == d_warp_aggregates); } -CUB_TEST("Warp combination scan works with custom scan op", "[scan][warp]", logical_warp_threads) +C2H_TEST("Warp combination scan works with custom scan op", "[scan][warp]", logical_warp_threads) { constexpr int logical_warp_threads = c2h::get<0, TestType>(); constexpr int total_warps = total_warps_t::value(); @@ -601,7 +601,7 @@ CUB_TEST("Warp combination scan works with custom scan op", "[scan][warp]", logi c2h::device_vector d_inclusive_out(total_warps * logical_warp_threads); c2h::device_vector d_exclusive_out(total_warps * logical_warp_threads); c2h::device_vector d_in(total_warps * logical_warp_threads); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); warp_combine_scan(d_in, d_inclusive_out, d_exclusive_out, min_scan_op_t{}); @@ -642,7 +642,7 @@ CUB_TEST("Warp combination scan works with custom scan op", "[scan][warp]", logi REQUIRE(h_exclusive_out == d_exclusive_out); } -CUB_TEST("Warp combination custom scan works with initial value", "[scan][warp]", logical_warp_threads) +C2H_TEST("Warp combination custom scan works with initial value", "[scan][warp]", logical_warp_threads) { constexpr int logical_warp_threads = c2h::get<0, TestType>(); constexpr int total_warps = total_warps_t::value(); @@ -651,7 +651,7 @@ CUB_TEST("Warp combination custom scan works with initial value", "[scan][warp]" c2h::device_vector d_inclusive_out(total_warps * logical_warp_threads); c2h::device_vector d_exclusive_out(total_warps * logical_warp_threads); c2h::device_vector d_in(total_warps * logical_warp_threads); - c2h::gen(CUB_SEED(10), d_in); + c2h::gen(C2H_SEED(10), d_in); const type initial_value = GENERATE_COPY(take(2, random(0, total_warps * logical_warp_threads))); diff --git a/cub/test/catch2_test_warp_scan_api.cu b/cub/test/catch2_test_warp_scan_api.cu index b0c68916af2..6314f2d9e51 100644 --- a/cub/test/catch2_test_warp_scan_api.cu +++ b/cub/test/catch2_test_warp_scan_api.cu @@ -31,11 +31,11 @@ #include #include -#include "catch2_test_helper.h" #include "cuda/std/__algorithm/fill.h" #include "cuda/std/__algorithm/max.h" #include "cuda/std/__numeric/inclusive_scan.h" #include "cuda/std/__numeric/iota.h" +#include constexpr int num_warps = 4; @@ -85,7 +85,7 @@ __global__ void InclusiveWarpScanKernel(int* output) // example-end inclusive-warp-scan-init-value } -CUB_TEST("Warp array-based inclusive scan works with initial value", "[scan][warp]") +C2H_TEST("Warp array-based inclusive scan works with initial value", "[scan][warp]") { thrust::device_vector d_out(num_warps * 32); @@ -139,7 +139,7 @@ __global__ void InclusiveWarpScanKernelAggr(int* output, int* d_warp_aggregate) d_warp_aggregate[warp_id] = warp_aggregate; } -CUB_TEST("Warp array-based inclusive scan aggregate works with initial value", "[scan][warp]") +C2H_TEST("Warp array-based inclusive scan aggregate works with initial value", "[scan][warp]") { thrust::device_vector d_out(num_warps * 32); c2h::device_vector d_warp_aggregate(num_warps); diff --git a/cub/test/catch2_test_warp_store.cu b/cub/test/catch2_test_warp_store.cu index 59a3720462e..9c9015c9a99 100644 --- a/cub/test/catch2_test_warp_store.cu +++ b/cub/test/catch2_test_warp_store.cu @@ -28,8 +28,8 @@ #include #include -#include "catch2_test_helper.h" -#include "fill_striped.cuh" +#include +#include template #include -#include "c2h/vector.cuh" #include "test_util.h" +#include /** * @brief Host-side random data generation diff --git a/cub/test/test_util.h b/cub/test/test_util.h index 3bea08ebaee..fd09321342b 100644 --- a/cub/test/test_util.h +++ b/cub/test/test_util.h @@ -54,10 +54,10 @@ #include #include -#include "c2h/extended_types.cuh" #include "mersenne.h" -#include "test_util_vec.h" #include "test_warning_suppression.cuh" +#include +#include #include /****************************************************************************** diff --git a/docs/cub/test_overview.rst b/docs/cub/test_overview.rst index ee40c5707ec..66567847ee9 100644 --- a/docs/cub/test_overview.rst +++ b/docs/cub/test_overview.rst @@ -19,8 +19,8 @@ This guide is focused on new tests. .. code-block:: c++ #include - #include "c2h/vector.cuh" - #include "catch2_test_helper.h" + #include + #include Directory and File Naming ************************************* @@ -51,7 +51,7 @@ Say there's no need to cover many types with your test. .. code-block:: c++ // 0) Define test name and tags - CUB_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]") + C2H_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]") { using type = std::int32_t; constexpr int threads_per_block = 256; @@ -61,7 +61,7 @@ Say there's no need to cover many types with your test. c2h::device_vector d_input(num_items); // 2) Generate 3 random input arrays using Catch2 helper - c2h::gen(CUB_SEED(3), d_input); + c2h::gen(C2H_SEED(3), d_input); // 3) Allocate output array c2h::device_vector d_output(d_input.size()); @@ -83,7 +83,7 @@ Say there's no need to cover many types with your test. REQUIRE( d_input == d_output ); } -We introduce test cases with the ``CUB_TEST`` macro in (0). +We introduce test cases with the ``C2H_TEST`` macro in (0). This macro always takes two string arguments - a free-form test name and one or more tags. Then, in (1), we allocate device memory using ``c2h::device_vector``. ``c2h::device_vector`` and ``c2h::host_vector`` behave similarly to their Thrust counterparts, @@ -100,7 +100,7 @@ The memory is filled with random data in (2). Generator ``c2h::gen`` takes at least two parameters. The first one is a random generator seed. -Instead of providing a single value, we use the ``CUB_SEED`` macro. +Instead of providing a single value, we use the ``C2H_SEED`` macro. The macro expects a number of seeds that has to be generated. In the example above, we require three random seeds to be generated. This leads to the whole test being executed three times @@ -149,7 +149,7 @@ If these are **runtime values**, we can use the Catch2 ``GENERATE`` macro: .. code-block:: c++ - CUB_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]") + C2H_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]") { int num_items = GENERATE(1, 100, 1'000'000); // 0) Init. a variable with a generator // ... @@ -160,7 +160,7 @@ Multiple generators in a test inside the same scope will form the cartesian prod Please consult the `Catch2 documentation `_ for more details. -``CUB_SEED(3)`` uses a generator expression internally. +``C2H_SEED(3)`` uses a generator expression internally. Type Lists @@ -169,7 +169,7 @@ Type Lists Since CUB is a generic library, it's often required to test CUB algorithms against many types. To do so, -it's sufficient to define a type list and provide it to the ``CUB_TEST`` macro. +it's sufficient to define a type list and provide it to the ``C2H_TEST`` macro. This is useful for **compile-time** parameterization of tests. .. code-block:: c++ @@ -177,7 +177,7 @@ This is useful for **compile-time** parameterization of tests. // 0) Define type list using types = c2h::type_list; - CUB_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", + C2H_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", types) // 1) Provide it to the test case { // 2) Access current type with `c2h::get` @@ -206,7 +206,7 @@ To do so, you can add another type list as follows: using block_sizes = c2h::enum_type_list; using types = c2h::type_list; - CUB_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", + C2H_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", types, block_sizes) { using type = typename c2h::get<0, TestType>; @@ -229,14 +229,14 @@ and multiple random sequence generations. using block_sizes = c2h::enum_type_list; using types = c2h::type_list; - CUB_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", + C2H_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", types, block_sizes) { using type = typename c2h::get<0, TestType>; constexpr int threads_per_block = c2h::get<1, TestType>::value; // ... c2h::device_vector d_input(5); - c2h::gen(CUB_SEED(2), d_input); + c2h::gen(C2H_SEED(2), d_input); } The code above leads to the following combinations being compiled: @@ -251,13 +251,13 @@ The code above leads to the following combinations being compiled: - ``type = std::int32_t``, ``threads_per_block = 256``, 2nd random generated input sequence Each new generator multiplies the number of execution times by its number of seeds. That means -that if there were further more sequence generators (``c2h::gen(CUB_SEED(X), ...)``) on the +that if there were further more sequence generators (``c2h::gen(C2H_SEED(X), ...)``) on the example above the test would execute X more times and so on. Speedup Compilation Time ===================================== -Since type lists in the ``CUB_TEST`` form a Cartesian product, +Since type lists in the ``C2H_TEST`` form a Cartesian product, compilation time grows quickly with every new dimension. To keep the compilation process parallelized, it's possible to rely on our ``%PARAM%`` machinery: @@ -268,7 +268,7 @@ it's possible to rely on our ``%PARAM%`` machinery: using block_sizes = c2h::enum_type_list; using types = c2h::type_list; - CUB_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", + C2H_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", types, block_sizes) { using type = typename c2h::get<0, TestType>; @@ -297,7 +297,7 @@ Let's consider the final test that illustrates all of the tools we discussed abo using block_sizes = c2h::enum_type_list; using types = c2h::type_list; - CUB_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", + C2H_TEST("SCOPE FACILITY works with CONDITION", "[FACILITY][SCOPE]", types, block_sizes) { using type = typename c2h::get<0, TestType>; @@ -306,7 +306,7 @@ Let's consider the final test that illustrates all of the tools we discussed abo c2h::device_vector d_input( GENERATE_COPY(take(2, random(0, max_num_items)))); - c2h::gen(CUB_SEED(3), d_input); + c2h::gen(C2H_SEED(3), d_input); c2h::device_vector d_output(d_input.size());