Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename sentinel.cuh -> types.cuh #452

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/cuco/dynamic_map.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <cuco/detail/dynamic_map_kernels.cuh>
#include <cuco/hash_functions.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/static_map.cuh>
#include <cuco/types.cuh>

#include <thrust/device_vector.h>
#include <thrust/functional.h>
Expand Down
12 changes: 6 additions & 6 deletions include/cuco/operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,37 @@ inline namespace op {
* @brief `insert` operator tag
*/
struct insert_tag {
} inline constexpr insert;
} inline constexpr insert; ///< `cuco::insert` operator

/**
* @brief `insert_and_find` operator tag
*/
struct insert_and_find_tag {
} inline constexpr insert_and_find;
} inline constexpr insert_and_find; ///< `cuco::insert_and_find` operator

/**
* @brief `insert_or_assign` operator tag
*/
struct insert_or_assign_tag {
} inline constexpr insert_or_assign;
} inline constexpr insert_or_assign; ///< `cuco::insert_or_assign` operator

/**
* @brief `erase` operator tag
*/
struct erase_tag {
} inline constexpr erase;
} inline constexpr erase; ///< `cuco::erase` operator

/**
* @brief `contains` operator tag
*/
struct contains_tag {
} inline constexpr contains;
} inline constexpr contains; ///< `cuco::contains` operator

/**
* @brief `find` operator tag
*/
struct find_tag {
} inline constexpr find;
} inline constexpr find; ///< `cuco::find` operator

} // namespace op
} // namespace cuco
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/static_map.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <cuco/detail/static_map_kernels.cuh>
#include <cuco/hash_functions.cuh>
#include <cuco/pair.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/static_map_ref.cuh>
#include <cuco/types.cuh>
#include <cuco/utility/allocator.hpp>
#include <cuco/utility/cuda_thread_scope.cuh>
#include <cuco/utility/traits.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/static_map_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <cuco/hash_functions.cuh>
#include <cuco/operator.hpp>
#include <cuco/probing_scheme.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/storage.cuh>
#include <cuco/types.cuh>
#include <cuco/utility/cuda_thread_scope.cuh>

#include <cuda/std/atomic>
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/static_multimap.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <cuco/detail/prime.hpp>
#include <cuco/hash_functions.cuh>
#include <cuco/probe_sequences.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/types.cuh>
#include <cuco/utility/allocator.hpp>
#include <cuco/utility/traits.hpp>

Expand Down
2 changes: 1 addition & 1 deletion include/cuco/static_multiset.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#include <cuco/extent.cuh>
#include <cuco/hash_functions.cuh>
#include <cuco/probing_scheme.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/static_multiset_ref.cuh>
#include <cuco/storage.cuh>
#include <cuco/types.cuh>
#include <cuco/utility/allocator.hpp>
#include <cuco/utility/cuda_thread_scope.cuh>
#include <cuco/utility/traits.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/static_multiset_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <cuco/hash_functions.cuh>
#include <cuco/operator.hpp>
#include <cuco/probing_scheme.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/storage.cuh>
#include <cuco/types.cuh>
#include <cuco/utility/cuda_thread_scope.cuh>

#include <cuda/std/atomic>
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/static_set.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#include <cuco/extent.cuh>
#include <cuco/hash_functions.cuh>
#include <cuco/probing_scheme.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/static_set_ref.cuh>
#include <cuco/storage.cuh>
#include <cuco/types.cuh>
#include <cuco/utility/allocator.hpp>
#include <cuco/utility/cuda_thread_scope.cuh>
#include <cuco/utility/traits.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/static_set_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <cuco/hash_functions.cuh>
#include <cuco/operator.hpp>
#include <cuco/probing_scheme.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/storage.cuh>
#include <cuco/types.cuh>
#include <cuco/utility/cuda_thread_scope.cuh>

#include <cuda/std/atomic>
Expand Down
10 changes: 10 additions & 0 deletions include/cuco/sentinel.cuh → include/cuco/types.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

#include <cuco/detail/utility/strong_type.cuh>

/**
* @brief Defines various strong type wrappers used across this library.
*
* @note Each strong type inherits from `cuco::detail::strong_type<T>`. `CUCO_DEFINE_STRONG_TYPE`
* and `CUCO_DEFINE_TEMPLATE_STRONG_TYPE` are convenience macros used to define a named type in a
* single line, e.g., `CUCO_DEFINE_STRONG_TYPE(foo, double)` defines `struct foo : public
* cuco::detail::strong_type<double> {...};`, where `cuco::foo{42.0}` is implicitly convertible to
* `double{42.0}`.
*/

namespace cuco {
/**
* @brief A strong type wrapper `cuco::empty_key<Key>` used to denote the empty key sentinel.
Expand Down
19 changes: 19 additions & 0 deletions include/cuco/utility/allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,31 @@ class cuda_allocator {
void deallocate(value_type* p, std::size_t) { CUCO_CUDA_TRY(cudaFree(p)); }
};

/**
* @brief Equality comparison operator.
*
* @tparam T Value type of LHS object
* @tparam U Value type of RHS object
*
* @return `true` iff given arguments are equal
*/
template <typename T, typename U>
bool operator==(cuda_allocator<T> const&, cuda_allocator<U> const&) noexcept
{
return true;
}

/**
* @brief Inequality comparison operator.
*
* @tparam T Value type of LHS object
* @tparam U Value type of RHS object
*
* @param lhs Left-hand side object to compare
* @param rhs Right-hand side object to compare
*
* @return `true` iff given arguments are not equal
*/
template <typename T, typename U>
bool operator!=(cuda_allocator<T> const& lhs, cuda_allocator<U> const& rhs) noexcept
{
Expand Down
12 changes: 8 additions & 4 deletions include/cuco/utility/cuda_thread_scope.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ struct cuda_thread_scope {
};

// alias definitions
inline constexpr auto thread_scope_system = cuda_thread_scope<cuda::thread_scope_system>{};
inline constexpr auto thread_scope_device = cuda_thread_scope<cuda::thread_scope_device>{};
inline constexpr auto thread_scope_block = cuda_thread_scope<cuda::thread_scope_block>{};
inline constexpr auto thread_scope_thread = cuda_thread_scope<cuda::thread_scope_thread>{};
inline constexpr auto thread_scope_system =
cuda_thread_scope<cuda::thread_scope_system>{}; ///< `cuco::thread_scope_system`
inline constexpr auto thread_scope_device =
cuda_thread_scope<cuda::thread_scope_device>{}; ///< `cuco::thread_scope_device`
inline constexpr auto thread_scope_block =
cuda_thread_scope<cuda::thread_scope_block>{}; ///< `cuco::thread_scope_block`
inline constexpr auto thread_scope_thread =
cuda_thread_scope<cuda::thread_scope_thread>{}; ///< `cuco::thread_scope_thread`

} // namespace cuco
9 changes: 6 additions & 3 deletions include/cuco/utility/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ struct is_bitwise_comparable<T, std::enable_if_t<std::has_unique_object_represen
: std::true_type {};

template <typename T>
inline constexpr bool is_bitwise_comparable_v = is_bitwise_comparable<T>::value;
inline constexpr bool is_bitwise_comparable_v =
is_bitwise_comparable<T>::value; ///< Shortcut definition

/**
* @brief Declares that a type `Type` is bitwise comparable.
Expand All @@ -59,9 +60,11 @@ inline constexpr bool is_bitwise_comparable_v = is_bitwise_comparable<T>::value;
}

template <bool value, typename... Args>
inline constexpr bool dependent_bool_value = value;
inline constexpr bool dependent_bool_value = value; ///< Unpacked dependent bool value

template <typename... Args>
inline constexpr bool dependent_false = dependent_bool_value<false, Args...>;
inline constexpr bool dependent_false =
dependent_bool_value<false, Args...>; ///< Emits a `false` value which is dependent on the given
///< argument types

} // namespace cuco
Loading