-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compute cosine similarity for vertex pairs (#4482)
compute cosine similarity for vertex pairs Authors: - Naim (https://github.com/naimnv) Approvers: - Seunghwa Kang (https://github.com/seunghwak) URL: #4482
- Loading branch information
Showing
15 changed files
with
764 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Copyright (c) 2022-2024, 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "link_prediction/cosine_similarity_impl.cuh" | ||
|
||
namespace cugraph { | ||
|
||
template rmm::device_uvector<float> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, float const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<float> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<float> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int64_t const>, raft::device_span<int64_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<double> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, double const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<double> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<double> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int64_t const>, raft::device_span<int64_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<float>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, float const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<float>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int64_t>, rmm::device_uvector<int64_t>, rmm::device_uvector<float>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::optional<raft::device_span<int64_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<double>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, double const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<double>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int64_t>, rmm::device_uvector<int64_t>, rmm::device_uvector<double>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, true> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::optional<raft::device_span<int64_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
} // namespace cugraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Copyright (c) 2022-2024, 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "link_prediction/cosine_similarity_impl.cuh" | ||
|
||
namespace cugraph { | ||
|
||
template rmm::device_uvector<float> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, float const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<float> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<float> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int64_t const>, raft::device_span<int64_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<double> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, double const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<double> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int32_t const>, raft::device_span<int32_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template rmm::device_uvector<double> cosine_similarity_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::tuple<raft::device_span<int64_t const>, raft::device_span<int64_t const>> vertex_pairs, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<float>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, float const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<float>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int64_t>, rmm::device_uvector<int64_t>, rmm::device_uvector<float>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, float const*>> edge_weight_view, | ||
std::optional<raft::device_span<int64_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<double>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int32_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int32_t, double const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int32_t>, rmm::device_uvector<int32_t>, rmm::device_uvector<double>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int32_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::optional<raft::device_span<int32_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
template std:: | ||
tuple<rmm::device_uvector<int64_t>, rmm::device_uvector<int64_t>, rmm::device_uvector<double>> | ||
cosine_similarity_all_pairs_coefficients( | ||
raft::handle_t const& handle, | ||
graph_view_t<int64_t, int64_t, false, false> const& graph_view, | ||
std::optional<edge_property_view_t<int64_t, double const*>> edge_weight_view, | ||
std::optional<raft::device_span<int64_t const>> vertices, | ||
std::optional<size_t> topk, | ||
bool do_expensive_check); | ||
|
||
} // namespace cugraph |
Oops, something went wrong.