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 cuGraph compile-time warnings. #2755

Merged
merged 4 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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 cpp/src/community/legacy/extract_subgraph_by_vertex.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cugraph/legacy/graph.hpp>
#include <cugraph/utilities/error.hpp>

#include <raft/device_atomics.cuh>
#include <raft/util/device_atomics.cuh>
#include <rmm/device_vector.hpp>
#include <rmm/exec_policy.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/components/legacy/weak_cc.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <type_traits>

#include <raft/cudart_utils.h>
#include <raft/device_atomics.cuh>
#include <raft/util/device_atomics.cuh>

#include "utils.h"
#include <rmm/device_vector.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/generators/generator_tools.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cugraph/utilities/error.hpp>
#include <generators/scramble.cuh>

#include <raft/cuda_utils.cuh>
#include <raft/util/cuda_utils.cuh>

#include <rmm/device_uvector.hpp>

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/linear_assignment/hungarian.cu
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <cugraph/legacy/graph.hpp>
#include <cugraph/utilities/error.hpp>

#include <raft/lap/lap.cuh>
#include <raft/solver/linear_assignment.cuh>

#include <rmm/cuda_stream_view.hpp>
#include <rmm/device_uvector.hpp>
Expand Down Expand Up @@ -74,7 +74,7 @@ weight_t hungarian(raft::handle_t const& handle,
rmm::device_uvector<index_t> col_assignments_v(num_rows, handle.get_stream());

// Create an instance of LinearAssignmentProblem using problem size, number of subproblems
raft::lap::LinearAssignmentProblem<index_t, weight_t> lpx(handle, num_rows, 1, epsilon);
raft::solver::LinearAssignmentProblem<index_t, weight_t> lpx(handle, num_rows, 1, epsilon);

// Solve LAP(s) for given cost matrix
lpx.solve(d_original_cost, d_assignment, col_assignments_v.data());
Expand Down Expand Up @@ -109,7 +109,7 @@ weight_t hungarian(raft::handle_t const& handle,
: max_cost;
});

raft::lap::LinearAssignmentProblem<index_t, weight_t> lpx(handle, n, 1, epsilon);
raft::solver::LinearAssignmentProblem<index_t, weight_t> lpx(handle, n, 1, epsilon);

// Solve LAP(s) for given cost matrix
lpx.solve(tmp_cost_v.begin(), tmp_row_assignment_v.begin(), tmp_col_assignment_v.begin());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <raft/integer_utils.h>
#include <raft/util/integer_utils.hpp>
#include <rmm/exec_policy.hpp>

#include <cub/cub.cuh>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/prims/property_op_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <raft/comms/comms.hpp>
#include <raft/core/device_span.hpp>
#include <raft/device_atomics.cuh>
#include <raft/util/device_atomics.cuh>

#include <cub/cub.cuh>
#include <thrust/detail/type_traits/iterator/is_discard_iterator.h>
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/sampling/random_walks.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, 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 All @@ -17,7 +17,6 @@
// Andrei Schaffer, [email protected]
//
#include "random_walks.cuh"
#include <cugraph/algorithms.hpp>

namespace cugraph {
// template explicit instantiation directives (EIDir's):
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/sampling/random_walks.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
//
#pragma once

#include <cugraph/algorithms.hpp>
#include <cugraph/detail/utility_wrappers.hpp>
#include <cugraph/graph.hpp>

#include <utilities/graph_utils.cuh>

#include <raft/device_atomics.cuh>
#include <raft/handle.hpp>
#include <raft/util/device_atomics.cuh>

#include <rmm/device_uvector.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/sampling/rw_traversals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

#include <cub/cub.cuh>

#include <raft/device_atomics.cuh>
#include <raft/handle.hpp>
#include <raft/util/device_atomics.cuh>

#include <rmm/device_uvector.hpp>

Expand Down
2 changes: 0 additions & 2 deletions cpp/src/serialization/serializer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

#include <utilities/graph_utils.cuh>

#include <raft/device_atomics.cuh>

#include <thrust/copy.h>

#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/structure/detail/structure_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <cugraph/utilities/error.hpp>
#include <cugraph/utilities/misc_utils.cuh>

#include <raft/device_atomics.cuh>
#include <raft/handle.hpp>
#include <raft/util/device_atomics.cuh>
#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/structure/graph_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <cugraph/utilities/host_scalar_comm.hpp>
#include <cugraph/utilities/misc_utils.cuh>

#include <raft/device_atomics.cuh>
#include <raft/handle.hpp>
#include <raft/util/device_atomics.cuh>
#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/structure/legacy/graph.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cugraph/utilities/error.hpp>
#include <utilities/graph_utils.cuh>

#include <raft/device_atomics.cuh>
#include <raft/util/device_atomics.cuh>
#include <rmm/exec_policy.hpp>

#include <thrust/for_each.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/traversal/legacy/mg/common_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <raft/integer_utils.h>
#include <raft/util/integer_utils.hpp>

namespace cugraph {

Expand Down
18 changes: 9 additions & 9 deletions cpp/src/tree/mst.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <cugraph/legacy/graph.hpp>
#include <cugraph/utilities/error.hpp>

#include <raft/sparse/mst/mst.cuh>
#include <raft/sparse/solver/mst.cuh>

namespace cugraph {

Expand All @@ -40,14 +40,14 @@ std::unique_ptr<legacy::GraphCOO<vertex_t, edge_t, weight_t>> mst_impl(
{
auto stream = handle.get_stream();
rmm::device_uvector<vertex_t> colors(graph.number_of_vertices, stream);
auto mst_edges = raft::mst::mst<vertex_t, edge_t, weight_t>(handle,
graph.offsets,
graph.indices,
graph.edge_data,
graph.number_of_vertices,
graph.number_of_edges,
colors.data(),
stream);
auto mst_edges = raft::sparse::solver::mst<vertex_t, edge_t, weight_t>(handle,
graph.offsets,
graph.indices,
graph.edge_data,
graph.number_of_vertices,
graph.number_of_edges,
colors.data(),
stream);

legacy::GraphCOOContents<vertex_t, edge_t, weight_t> coo_contents{
graph.number_of_vertices,
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/utilities/graph_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <cugraph/utilities/error.hpp>

#include <raft/cudart_utils.h>
#include <raft/device_atomics.cuh>
#include <raft/util/device_atomics.cuh>
#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

Expand Down
36 changes: 24 additions & 12 deletions cpp/tests/structure/streams.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,37 @@
#include <rmm/mr/device/cuda_memory_resource.hpp>
#include <thrust/functional.h>
#include <thrust/transform.h>

struct StreamTest : public ::testing::Test {
};

TEST_F(StreamTest, basic_test)
{
int n_streams = 4;
size_t n_streams = 4;
auto stream_pool = std::make_shared<rmm::cuda_stream_pool>(n_streams);
raft::handle_t handle(rmm::cuda_stream_per_thread, stream_pool);

const size_t intput_size = 4096;
const size_t input_size = 4096;

std::vector<std::thread> threads(n_streams);

for (size_t i = 0; i < n_streams; ++i) {
threads[i] = std::thread(
[&handle, input_size](size_t i) {
rmm::device_uvector<int> u(input_size, handle.get_next_usable_stream(i));
rmm::device_uvector<int> v(input_size, handle.get_next_usable_stream(i));
thrust::transform(rmm::exec_policy(handle.get_next_usable_stream(i)),
u.begin(),
u.end(),
v.begin(),
v.begin(),
2 * thrust::placeholders::_1 + thrust::placeholders::_2);
CUDA_TRY(cudaStreamSynchronize(handle.get_next_usable_stream(i)));
},
i);
}

#pragma omp parallel for
for (int i = 0; i < n_streams; i++) {
rmm::device_uvector<int> u(intput_size, handle.get_next_usable_stream(i)),
v(intput_size, handle.get_next_usable_stream(i));
thrust::transform(rmm::exec_policy(handle.get_next_usable_stream(i)),
u.begin(),
u.end(),
v.begin(),
v.begin(),
2 * thrust::placeholders::_1 + thrust::placeholders::_2);
for (size_t i = 0; i < n_streams; ++i) {
threads[i].join();
}
}