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

Update MG negative sampling to return random samples distributed as specified #4885

Merged
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
5 changes: 4 additions & 1 deletion cpp/include/cugraph/sampling_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,10 @@ lookup_endpoints_from_edge_ids_and_types(
* @param dst_biases Optional bias for randomly selecting destination vertices. If std::nullopt
* vertices will be selected uniformly. In multi-GPU environment the biases should be partitioned
* based on the vertex partitions.
* @param num_samples Number of negative samples to generate
* @param num_samples Number of negative samples to generate. In SG mode this represents the total
* number of samples to generate. In MG mode, each gpu will provide the number of samples desired
* on that GPU. The total number of samples in MG mode will be the aggregation of these values, the
* resulting samples will be randomly distributed across the ranks.
* @param remove_duplicates If true, remove duplicate samples
* @param remove_existing_edges If true, remove samples that are actually edges in the graph
* @param exact_number_of_samples If true, repeat generation until we get the exact number of
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/detail/permute_range.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
* Copyright (c) 2024-2025, 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 @@ -58,7 +58,7 @@ rmm::device_uvector<vertex_t> permute_range(raft::handle_t const& handle,
sub_range_sizes.begin(), sub_range_sizes.end(), sub_range_sizes.begin(), global_start);
CUGRAPH_EXPECTS(
sub_range_sizes[comm_rank] == local_range_start,
"Invalid input arguments: a rage must have contiguous and non-overlapping values");
"Invalid input arguments: a range must have contiguous and non-overlapping values");
}
rmm::device_uvector<vertex_t> permuted_integers(local_range_size, handle.get_stream());

Expand Down
19 changes: 1 addition & 18 deletions cpp/src/detail/permute_range_v32.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
* Copyright (c) 2024-2025, 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 @@ -16,23 +16,6 @@

#include "detail/permute_range.cuh"

#include <cugraph/detail/collect_comm_wrapper.hpp>
#include <cugraph/detail/shuffle_wrappers.hpp>
#include <cugraph/detail/utility_wrappers.hpp>
#include <cugraph/utilities/host_scalar_comm.hpp>
#include <cugraph/utilities/shuffle_comm.cuh>

#include <raft/core/device_span.hpp>
#include <raft/core/handle.hpp>
#include <raft/random/rng_state.hpp>

#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

#include <thrust/iterator/constant_iterator.h>
#include <thrust/reduce.h>
#include <thrust/sort.h>

namespace cugraph {

namespace detail {
Expand Down
19 changes: 1 addition & 18 deletions cpp/src/detail/permute_range_v64.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
* Copyright (c) 2024-2025, 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 @@ -16,23 +16,6 @@

#include "detail/permute_range.cuh"

#include <cugraph/detail/collect_comm_wrapper.hpp>
#include <cugraph/detail/shuffle_wrappers.hpp>
#include <cugraph/detail/utility_wrappers.hpp>
#include <cugraph/utilities/host_scalar_comm.hpp>
#include <cugraph/utilities/shuffle_comm.cuh>

#include <raft/core/device_span.hpp>
#include <raft/core/handle.hpp>
#include <raft/random/rng_state.hpp>

#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

#include <thrust/iterator/constant_iterator.h>
#include <thrust/reduce.h>
#include <thrust/sort.h>

namespace cugraph {

namespace detail {
Expand Down
Loading
Loading