Skip to content

Commit

Permalink
Fix namespace typo
Browse files Browse the repository at this point in the history
  • Loading branch information
lowener committed Sep 12, 2023
1 parent f9c544e commit d075184
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions cpp/bench/prims/util/bitset.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <raft/util/bitset.cuh>
#include <rmm/device_uvector.hpp>

namespace raft::bench::utils {
namespace raft::bench::util {

struct bitset_inputs {
uint32_t bitset_len;
Expand All @@ -42,9 +42,9 @@ struct bitset_bench : public fixture {
void run_benchmark(::benchmark::State& state) override
{
loop_on_state(state, [this]() {
auto my_bitset = raft::utils::bitset<bitset_t, index_t>(
auto my_bitset = raft::util::bitset<bitset_t, index_t>(
this->res, raft::make_const_mdspan(mask.view()), params.bitset_len);
raft::utils::bitset_test(
raft::util::bitset_test(
res, my_bitset.view(), raft::make_const_mdspan(queries.view()), outputs.view());
});
}
Expand Down Expand Up @@ -72,4 +72,4 @@ RAFT_BENCH_REGISTER(Uint16_64, "", bitset_input_vecs);
RAFT_BENCH_REGISTER(Uint32_32, "", bitset_input_vecs);
RAFT_BENCH_REGISTER(Uint32_64, "", bitset_input_vecs);

} // namespace raft::bench::utils
} // namespace raft::bench::util
16 changes: 8 additions & 8 deletions cpp/include/raft/util/bitset.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <raft/util/device_atomics.cuh>
#include <thrust/for_each.h>

namespace raft::utils {
namespace raft::util {
/**
* @defgroup bitset Bitset
* @{
Expand Down Expand Up @@ -157,11 +157,11 @@ struct bitset {
*
* @return bitset_view<bitset_t, index_t>
*/
inline auto view() -> raft::utils::bitset_view<bitset_t, index_t>
inline auto view() -> raft::util::bitset_view<bitset_t, index_t>
{
return bitset_view<bitset_t, index_t>(bitset_.view());
}
[[nodiscard]] inline auto view() const -> raft::utils::bitset_view<const bitset_t, index_t>
[[nodiscard]] inline auto view() const -> raft::util::bitset_view<const bitset_t, index_t>
{
return bitset_view<const bitset_t, index_t>(bitset_.view());
}
Expand Down Expand Up @@ -201,13 +201,13 @@ struct bitset {
*/
template <typename bitset_t, typename index_t>
void bitset_set(const raft::resources& res,
raft::utils::bitset_view<bitset_t, index_t> bitset_view_,
raft::util::bitset_view<bitset_t, index_t> bitset_view_,
raft::device_vector_view<const index_t, index_t> mask_index,
bool set_value = false)
{
auto* bitset_ptr = bitset_view_.data_handle();
constexpr auto bitset_element_size =
raft::utils::bitset_view<bitset_t, index_t>::bitset_element_size;
raft::util::bitset_view<bitset_t, index_t>::bitset_element_size;
thrust::for_each_n(
resource::get_thrust_policy(res),
mask_index.data_handle(),
Expand Down Expand Up @@ -238,7 +238,7 @@ void bitset_set(const raft::resources& res,
*/
template <typename bitset_t, typename index_t, typename output_t = bool>
void bitset_test(const raft::resources& res,
const raft::utils::bitset_view<bitset_t, index_t> bitset_view_,
const raft::util::bitset_view<bitset_t, index_t> bitset_view_,
raft::device_vector_view<const index_t, index_t> queries,
raft::device_vector_view<output_t, index_t> output)
{
Expand All @@ -260,7 +260,7 @@ void bitset_test(const raft::resources& res,
*/
template <typename bitset_t, typename index_t>
void bitset_flip(const raft::resources& res,
raft::utils::bitset_view<bitset_t, index_t> bitset_view_)
raft::util::bitset_view<bitset_t, index_t> bitset_view_)
{
auto bitset_span = bitset_view_.to_mdspan();
raft::linalg::map(
Expand All @@ -270,4 +270,4 @@ void bitset_flip(const raft::resources& res,
raft::make_const_mdspan(bitset_span));
}
/** @} */
} // end namespace raft::utils
} // end namespace raft::util
12 changes: 6 additions & 6 deletions cpp/test/util/bitset.cu
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <algorithm>
#include <numeric>

namespace raft::utils {
namespace raft::util {

struct test_spec {
uint64_t bitset_len;
Expand Down Expand Up @@ -108,7 +108,7 @@ class BitsetTest : public testing::TestWithParam<test_spec> {
resource::sync_stream(res, stream);

// calculate the results
auto test_bitset = raft::utils::bitset<bitset_t, index_t>(
auto test_bitset = raft::util::bitset<bitset_t, index_t>(
res, raft::make_const_mdspan(mask_device.view()), index_t(spec.bitset_len));
update_host(
bitset_result.data(), test_bitset.view().data_handle(), bitset_result.size(), stream);
Expand All @@ -127,7 +127,7 @@ class BitsetTest : public testing::TestWithParam<test_spec> {
// Create queries and verify the test results
raft::random::uniformInt(res, rng, query_device.view(), index_t(0), index_t(spec.bitset_len));
update_host(query_cpu.data(), query_device.data_handle(), query_device.extent(0), stream);
raft::utils::bitset_test(
raft::util::bitset_test(
res, test_bitset.view(), raft::make_const_mdspan(query_device.view()), result_device.view());
update_host(result_cpu.data(), result_device.data_handle(), result_device.extent(0), stream);
test_cpu_bitset(bitset_ref, query_cpu, result_ref);
Expand All @@ -138,15 +138,15 @@ class BitsetTest : public testing::TestWithParam<test_spec> {
raft::random::uniformInt(res, rng, mask_device.view(), index_t(0), index_t(spec.bitset_len));
update_host(mask_cpu.data(), mask_device.data_handle(), mask_device.extent(0), stream);
resource::sync_stream(res, stream);
raft::utils::bitset_set<bitset_t, index_t>(res, test_bitset.view(), mask_device.view());
raft::util::bitset_set<bitset_t, index_t>(res, test_bitset.view(), mask_device.view());
update_host(bitset_result.data(), test_bitset.data_handle(), bitset_result.size(), stream);

add_cpu_bitset(bitset_ref, mask_cpu);
resource::sync_stream(res, stream);
ASSERT_TRUE(hostVecMatch(bitset_ref, bitset_result, raft::Compare<bitset_t>()));

// Flip the bitset and re-test
raft::utils::bitset_flip<bitset_t, index_t>(res, test_bitset.view());
raft::util::bitset_flip<bitset_t, index_t>(res, test_bitset.view());
update_host(bitset_result.data(), test_bitset.data_handle(), bitset_result.size(), stream);
flip_cpu_bitset(bitset_ref);
resource::sync_stream(res, stream);
Expand Down Expand Up @@ -186,4 +186,4 @@ using Uint64_64 = BitsetTest<uint64_t, uint64_t>;
TEST_P(Uint64_64, Run) { run(); }
INSTANTIATE_TEST_CASE_P(BitsetTest, Uint64_64, inputs);

} // namespace raft::utils
} // namespace raft::util

0 comments on commit d075184

Please sign in to comment.