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

Fix various build errors #1152

Merged
merged 6 commits into from
Jan 19, 2023
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
3 changes: 2 additions & 1 deletion cpp/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2022, NVIDIA CORPORATION.
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -32,6 +32,7 @@ function(ConfigureBench)
PRIVATE raft::raft
$<$<BOOL:${ConfigureBench_DIST}>:raft::distance>
$<$<BOOL:${ConfigureBench_NN}>:raft::nn>
GTest::gtest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benchmark shouldn't depend on gtest. I think, we should try to break the offending dependency instead (which is not so trivial).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...Or maybe we could live with the gtest dependency in benchmarks while we solve the problem with the header dependencies? Any thoughts, @cjnolet ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% agreed w/ @achirkin here. I was going to type up a similar comment but he beat me to it!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benchmark shouldn't depend on gtest. I think, we should try to break the offending dependency instead (which is not so trivial).

My previous comment was in response to this, btw. I don't think we should be crossing the gtest and benchmark dependencies. We should try and pull out the shared bits into a separate header (and maybe try to find a good place in the include/raft/?) for the shared bits but keep gtest-specific things in test and benchmark-specific things in bench.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also okay opening a github issue about this and keeping the gtest dependency in here for now but adding a comment here that references the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #1153

benchmark::benchmark
Threads::Threads
$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX>
Expand Down
6 changes: 4 additions & 2 deletions cpp/include/raft/core/device_mdspan.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -197,7 +197,9 @@ auto make_device_aligned_matrix_view(ElementType* ptr, IndexType n_rows, IndexTy
detail::alignment::value>::data_handle_type;
static_assert(std::is_same<LayoutPolicy, layout_left_padded<ElementType>>::value ||
std::is_same<LayoutPolicy, layout_right_padded<ElementType>>::value);
assert(ptr == alignTo(ptr, detail::alignment::value));
assert(reinterpret_cast<std::uintptr_t>(ptr) ==
std::experimental::details::alignTo(reinterpret_cast<std::uintptr_t>(ptr),
detail::alignment::value));

data_handle_type aligned_pointer = ptr;

Expand Down
6 changes: 4 additions & 2 deletions cpp/include/raft/core/host_mdspan.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -144,7 +144,9 @@ auto make_host_aligned_matrix_view(ElementType* ptr, IndexType n_rows, IndexType

static_assert(std::is_same<LayoutPolicy, layout_left_padded<ElementType>>::value ||
std::is_same<LayoutPolicy, layout_right_padded<ElementType>>::value);
assert(ptr == alignTo(ptr, detail::alignment::value));
assert(reinterpret_cast<std::uintptr_t>(ptr) ==
std::experimental::details::alignTo(reinterpret_cast<std::uintptr_t>(ptr),
detail::alignment::value));
data_handle_type aligned_pointer = ptr;

matrix_extent<IndexType> extents{n_rows, n_cols};
Expand Down
5 changes: 3 additions & 2 deletions cpp/include/raft/matrix/detail/linewise_op.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -796,7 +796,8 @@ struct MatrixLinewiseOp {
"layout for in and out must be either padded row or col major");

// also statically assert padded matrix alignment == 2^i*VecBytes
assert(raft::Pow2<VecBytes>::areSameAlignOffsets(in, out));
RAFT_EXPECTS(raft::Pow2<VecBytes>::areSameAlignOffsets(in.data_handle(), out.data_handle()),
"The matrix views in and out does not have correct alignment");

if (alongLines)
return matrixLinewiseVecRowsSpan<Type,
Expand Down