Skip to content

Temporal sampling implementation #4994

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

Open
wants to merge 80 commits into
base: branch-25.08
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
dc3b296
Temporal sampling implementation, still debugging
ChuckHastings Mar 20, 2025
125c993
merge latest, resolve conflicts
ChuckHastings Mar 21, 2025
a8c358d
Merge branch 'branch-25.04' into temporal_sampling_impl
ChuckHastings Mar 21, 2025
2fd8a3a
update validation routine to take span
ChuckHastings Mar 21, 2025
f0bb2d6
after discussion, add back the halving of unnormalized results on und…
ChuckHastings Mar 26, 2025
c324219
Merge branch 'branch-25.04' into temporal_sampling_impl
ChuckHastings Mar 26, 2025
e80991f
fix build_error
seunghwak Mar 31, 2025
7fa3126
finished debugging simple case
ChuckHastings Apr 2, 2025
093c6ae
Merge branch 'branch-25.06' into temporal_sampling_impl
ChuckHastings Apr 2, 2025
23c429a
Merge branch 'pr_5004' into temporal_sampling_impl
ChuckHastings Apr 2, 2025
f95ecd9
incorporate Seunghwa's changes
ChuckHastings Apr 2, 2025
42433bf
Merge branch 'branch-25.06' into temporal_sampling_impl
ChuckHastings Apr 14, 2025
097ba64
finish debugging SG version
ChuckHastings May 2, 2025
c6f0ba5
Merge branch 'branch-25.06' into temporal_sampling_impl
ChuckHastings May 2, 2025
5e619ec
finished debugging MG unit tests
ChuckHastings May 12, 2025
6424665
Merge branch 'branch-25.06' into temporal_sampling_impl
ChuckHastings May 12, 2025
d959352
first round of PR comment changes
ChuckHastings May 12, 2025
164ef28
add xxx.cu - debugging code
ChuckHastings May 13, 2025
386ed07
Merge branch 'branch-25.06' into temporal_sampling_impl
ChuckHastings May 14, 2025
9720d66
address PR comments
ChuckHastings May 15, 2025
da7dc54
Merge branch 'branch-25.06' into temporal_sampling_impl
ChuckHastings May 15, 2025
55c069f
try turning down parallel level
ChuckHastings May 15, 2025
06eaa3b
try turning down parallel level
ChuckHastings May 16, 2025
2788555
set parallel level for CI
ChuckHastings May 16, 2025
a37e7dd
address PR comments
ChuckHastings May 16, 2025
86bf1a6
missed adding new file in last push
ChuckHastings May 16, 2025
d3b8fea
split up temporal implementation (very inelegant) to improve compiler…
ChuckHastings May 23, 2025
313f4f3
update name of gather_one_hop_functions file to cuh, since it include…
ChuckHastings May 23, 2025
86bc51f
Merge branch 'branch-25.06' into temporal_sampling_impl
ChuckHastings May 23, 2025
03c2e36
fix a merge issue... revert hacks in build scripts that I used to try…
ChuckHastings May 23, 2025
a9a87de
update shuffle call missed in merge
ChuckHastings May 24, 2025
72910f2
get rid of warning, try reducing parallelism in wheel build
ChuckHastings May 25, 2025
08fdbba
address comment from part 1 PR
ChuckHastings Jun 10, 2025
af6215d
Next batch of updates, also update MG tests to work in ctest
ChuckHastings Jun 11, 2025
fe1f115
remove some debugging statements, remove FIXME and size check since t…
ChuckHastings Jun 11, 2025
770e85f
Merge branch 'branch-25.08' into variant_work_part2
ChuckHastings Jun 11, 2025
f823b23
Documentation update based on PR comment
ChuckHastings Jun 11, 2025
ffb8ac9
First group of changes for this... clean up some shuffle functions
ChuckHastings Jun 11, 2025
12ef996
Merge branch 'variant_work_part2' into variant_work_part3
ChuckHastings Jun 11, 2025
098a179
move shuffle_wrappers file into source
ChuckHastings Jun 11, 2025
2ff2963
adjust shuffle_vertex_pairs functions
ChuckHastings Jun 12, 2025
ca22513
Merge branch 'branch-25.08' into variant_work_part3
ChuckHastings Jun 12, 2025
f4a4a4b
remove extra copy of shuffle_vertices_with_properties
ChuckHastings Jun 12, 2025
1238da8
change shuffle_and_organize_output to be a non-templated function
ChuckHastings Jun 12, 2025
0456a49
clean up files
ChuckHastings Jun 12, 2025
2ac4adb
rename file
ChuckHastings Jun 12, 2025
a8529a5
move shuffle_wrappers in test files
ChuckHastings Jun 13, 2025
7707e5b
fix bug in MTMG changes
ChuckHastings Jun 13, 2025
25ab94d
Merge branch 'branch-25.08' into temporal_sampling_impl
ChuckHastings Jun 13, 2025
a101220
finish updating shuffle_and_organize for sampling output
ChuckHastings Jun 25, 2025
2f45968
Merge branch 'branch-25.08' into variant_work_part4
ChuckHastings Jun 26, 2025
5e42443
Merge branch 'branch-25.08' into variant_work_part4
ChuckHastings Jun 26, 2025
8c3dc5a
more work on shuffle vertex pairs
ChuckHastings Jun 26, 2025
0c247f0
Merge branch 'branch-25.08' into variant_work_part4
ChuckHastings Jun 26, 2025
eee2d8e
Merge remote-tracking branch 'refs/remotes/upstream/variant_work_part…
ChuckHastings Jun 26, 2025
7537304
Close the loop on the shuffle_ext_edges work... remove all references…
ChuckHastings Jun 26, 2025
bd27d77
Merge branch 'branch-25.08' into variant_work_part3
ChuckHastings Jun 26, 2025
3c69ad9
missed update MTMG code
ChuckHastings Jun 27, 2025
6ff43d2
Merge branch 'branch-25.08' into variant_work_part3
ChuckHastings Jun 27, 2025
a1a0727
bug in last commit
ChuckHastings Jun 27, 2025
15b2983
round 1 of PR comments
ChuckHastings Jun 27, 2025
def4676
Merge branch 'branch-25.08' into temporal_sampling_impl
ChuckHastings Jun 28, 2025
dfb415f
resolve some missed things from merge
ChuckHastings Jun 28, 2025
73082d7
refactor shuffle_and_organize signature based on PR review feedback
ChuckHastings Jun 29, 2025
f0865fa
Merge branch 'branch-25.08' into variant_work_part4
ChuckHastings Jun 29, 2025
6c611d9
fix bugs in last push
ChuckHastings Jun 30, 2025
52978f8
fix bug in shuffle change
ChuckHastings Jun 30, 2025
ed201b7
Merge branch 'branch-25.08' into variant_work_part4
ChuckHastings Jun 30, 2025
632c396
sampled edges will always have a size > 2 since have src/dst
ChuckHastings Jun 30, 2025
347427f
missed deleting a function definition, a few cosmetic changes
ChuckHastings Jul 1, 2025
6649d1b
Merge branch 'variant_work_part4' into variant_work_part3
ChuckHastings Jul 1, 2025
30d8070
Merge branch 'branch-25.08' into variant_work_part3
ChuckHastings Jul 1, 2025
71f15cb
a bit more cleanup of shuffle_int_*
ChuckHastings Jul 1, 2025
af93e39
Merge branch 'branch-25.08' into variant_work_part3
ChuckHastings Jul 1, 2025
711b7cc
clean up includes
ChuckHastings Jul 2, 2025
9d1ffe8
Merge branch 'branch-25.08' into variant_work_part3
ChuckHastings Jul 2, 2025
8137234
Merge branch 'variant_work_part3' into temporal_sampling_impl
ChuckHastings Jul 2, 2025
b4ae8eb
refactor temporal_sample_edges to use transform_gather_e primitive
ChuckHastings Jul 8, 2025
b26b5a5
Merge branch 'branch-25.08' into temporal_sampling_impl
ChuckHastings Jul 8, 2025
b25d360
apply transform_gather_e logic to sample_edges
ChuckHastings Jul 8, 2025
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
79 changes: 79 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,35 @@ endif()
# which should give us a better parallel schedule.

set(CUGRAPH_SOURCES
src/sampling/temporal_sampling_sg_v32_e32.cu
src/sampling/temporal_sampling_sg_v64_e64.cu
src/sampling/temporal_sampling_mg_v32_e32.cu
src/sampling/temporal_sampling_mg_v64_e64.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w32_t32_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w32_t32_mg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w32_t64_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w32_t64_mg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w64_t32_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w64_t32_mg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w64_t64_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v32_w64_t64_mg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w32_t32_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w32_t32_mg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w32_t64_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w32_t64_mg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w64_t32_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w64_t32_mg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w64_t64_sg.cu
src/sampling/detail/temporal_label_gather_one_hop_edgelist_v64_w64_t64_mg.cu
src/sampling/detail/update_temporal_edge_mask_sg_v32_e32.cu
src/sampling/detail/update_temporal_edge_mask_sg_v64_e64.cu
src/sampling/detail/update_temporal_edge_mask_mg_v32_e32.cu
src/sampling/detail/update_temporal_edge_mask_mg_v64_e64.cu
src/utilities/shuffle_vertices_mg_v32_fp.cu
src/utilities/shuffle_vertices_mg_v32_integral.cu
src/utilities/shuffle_vertices_mg_v64_fp.cu
src/utilities/shuffle_vertices_mg_v64_integral.cu
src/utilities/validation_checks.cu
src/detail/permute_range_v32.cu
src/detail/permute_range_v64.cu
src/utilities/shuffle_vertex_pairs_mg_v32_e32.cu
Expand Down Expand Up @@ -263,10 +288,64 @@ set(CUGRAPH_SOURCES
src/sampling/detail/check_edge_bias_values_sg_v32_e32.cu
src/sampling/detail/check_edge_bias_values_mg_v64_e64.cu
src/sampling/detail/check_edge_bias_values_mg_v32_e32.cu
src/sampling/detail/temporal_partition_vertices_v64.cu
src/sampling/detail/temporal_partition_vertices_v32.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w32_t32_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w32_t32_mg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w32_t64_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w32_t64_mg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w64_t32_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w64_t32_mg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w64_t64_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v32_w64_t64_mg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w32_t32_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w32_t32_mg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w32_t64_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w32_t64_mg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w64_t32_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w64_t32_mg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w64_t64_sg.cu
src/sampling/detail/temporal_simple_gather_one_hop_edgelist_v64_w64_t64_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t32_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t32_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t64_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t64_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t32_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t32_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t64_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t64_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t32_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t32_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t64_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t64_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t32_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t32_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t64_tag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t64_tag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t32_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t32_notag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t64_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w32_t64_notag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t32_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t32_notag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t64_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v32_w64_t64_notag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t32_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t32_notag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t64_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w32_t64_notag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t32_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t32_notag_sg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t64_notag_mg.cu
src/sampling/detail/simple_gather_one_hop_edgelist_v64_w64_t64_notag_sg.cu
src/sampling/detail/sample_edges_sg_v64_e64.cu
src/sampling/detail/sample_edges_sg_v32_e32.cu
src/sampling/detail/sample_edges_mg_v64_e64.cu
src/sampling/detail/sample_edges_mg_v32_e32.cu
src/sampling/detail/temporal_sample_edges_sg_v64_e64.cu
src/sampling/detail/temporal_sample_edges_sg_v32_e32.cu
src/sampling/detail/temporal_sample_edges_mg_v64_e64.cu
src/sampling/detail/temporal_sample_edges_mg_v32_e32.cu
src/sampling/detail/shuffle_and_organize_output.cu
src/sampling/neighbor_sampling_mg_v32_e32.cu
src/sampling/neighbor_sampling_mg_v64_e64.cu
Expand Down
39 changes: 14 additions & 25 deletions cpp/include/cugraph/arithmetic_variant_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ using const_arithmetic_device_span_t = std::variant<std::monostate,
raft::device_span<int64_t const>,
raft::device_span<size_t const>>;

template <typename edge_t>
template <typename vertex_t, typename edge_t>
using edge_arithmetic_property_view_t =
std::variant<std::monostate,
cugraph::edge_dummy_property_view_t,
cugraph::edge_multi_index_property_view_t<edge_t, vertex_t>,
cugraph::edge_property_view_t<edge_t, float const*>,
cugraph::edge_property_view_t<edge_t, double const*>,
cugraph::edge_property_view_t<edge_t, int32_t const*>,
Expand Down Expand Up @@ -158,31 +160,18 @@ auto variant_type_dispatch(const_arithmetic_device_span_t& property, func_t func
}
}

template <typename edge_t, typename func_t>
auto variant_type_dispatch(edge_arithmetic_property_view_t<edge_t>& property, func_t func)
template <typename vertex_t, typename edge_t, typename func_t>
auto variant_type_dispatch(edge_arithmetic_property_view_t<edge_t, vertex_t>& property, func_t func)
{
if (std::holds_alternative<cugraph::edge_property_view_t<edge_t, float const*>>(property)) {
auto& prop = std::get<cugraph::edge_property_view_t<edge_t, float const*>>(property);
return func(prop);
} else if (std::holds_alternative<cugraph::edge_property_view_t<edge_t, double const*>>(
property)) {
auto& prop = std::get<cugraph::edge_property_view_t<edge_t, double const*>>(property);
return func(prop);
} else if (std::holds_alternative<cugraph::edge_property_view_t<edge_t, int32_t const*>>(
property)) {
auto& prop = std::get<cugraph::edge_property_view_t<edge_t, int32_t const*>>(property);
return func(prop);
} else if (std::holds_alternative<cugraph::edge_property_view_t<edge_t, int64_t const*>>(
property)) {
auto& prop = std::get<cugraph::edge_property_view_t<edge_t, int64_t const*>>(property);
return func(prop);
} else {
CUGRAPH_EXPECTS(
(std::holds_alternative<cugraph::edge_property_view_t<edge_t, size_t const*>>(property)),
"unsupported variant type -- shouldn't happen");

auto& prop = std::get<cugraph::edge_property_view_t<edge_t, size_t const*>>(property);
return func(prop);
switch (property.index()) {
case 1: return func(std::get<1>(property));
case 2: return func(std::get<2>(property));
case 3: return func(std::get<3>(property));
case 4: return func(std::get<4>(property));
case 5: return func(std::get<5>(property));
case 6: return func(std::get<6>(property));
case 7: return func(std::get<7>(property));
default: CUGRAPH_FAIL("Variant not initialized");
}
}

Expand Down
16 changes: 16 additions & 0 deletions cpp/include/cugraph/edge_property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@
#include <thrust/iterator/iterator_traits.h>

#include <optional>
#include <tuple>
#include <type_traits>

namespace cugraph {
namespace detail {

template <typename... Ts, std::size_t... Is>
auto view_concat_impl(std::tuple<Ts...> const& tuple, std::index_sequence<Is...>)
{
return view_concat(std::get<Is>(tuple)...);
}

} // namespace detail

template <typename edge_t,
typename ValueIterator,
Expand Down Expand Up @@ -273,4 +283,10 @@ auto view_concat(edge_property_view_t<edge_t, Iters, Types> const&... views)
edge_partition_concat_value_firsts, first_view.edge_counts());
}

template <typename... Ts>
auto view_concat(std::tuple<Ts...> const& tuple)
{
return detail::view_concat_impl(tuple, std::index_sequence_for<Ts...>{});
}

} // namespace cugraph
Loading
Loading