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

Add support to create temporal graphs #4819

Draft
wants to merge 6 commits into
base: branch-25.02
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 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
8 changes: 8 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,14 @@ set(CUGRAPH_SOURCES
src/structure/create_graph_from_edgelist_sg_v32_e32.cu
src/structure/create_graph_from_edgelist_mg_v64_e64.cu
src/structure/create_graph_from_edgelist_mg_v32_e32.cu
src/structure/create_graph_from_edgelist_sg_v64_e64_t32.cu
src/structure/create_graph_from_edgelist_sg_v32_e32_t32.cu
src/structure/create_graph_from_edgelist_mg_v64_e64_t32.cu
src/structure/create_graph_from_edgelist_mg_v32_e32_t32.cu
src/structure/create_graph_from_edgelist_sg_v64_e64_t64.cu
src/structure/create_graph_from_edgelist_sg_v32_e32_t64.cu
src/structure/create_graph_from_edgelist_mg_v64_e64_t64.cu
src/structure/create_graph_from_edgelist_mg_v32_e32_t64.cu
src/structure/symmetrize_edgelist_sg_v64_e64.cu
src/structure/symmetrize_edgelist_sg_v32_e32.cu
src/structure/symmetrize_edgelist_mg_v64_e64.cu
Expand Down
50 changes: 42 additions & 8 deletions cpp/include/cugraph/detail/shuffle_wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
namespace cugraph {
namespace detail {

// FIXME: Consider moving this file (or most of this file) into the src directory...
// at least some of these functions don't really belong in the public API

/**
* @brief Shuffle external (i.e. before renumbering) vertex pairs (which can be edge end points) to
* their local GPUs based on edge partitioning.
Expand All @@ -33,6 +36,7 @@ namespace detail {
* @tparam edge_t Type of edge identifiers. Needs to be an integral type.
* @tparam weight_t Type of edge weights. Needs to be a floating point type.
* @tparam edge_type_t Type of edge type identifiers. Needs to be an integral type.
* @tparam edge_time_t The type of the edge time stamp
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistent with the documentation below.
@tparam edge_time_t Type of edge time. Needs to be an integral type.
Should this be the integral type as well?

*
* @param[in] handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator,
* and handles to various CUDA libraries) to run graph algorithms.
Expand All @@ -44,24 +48,34 @@ namespace detail {
* @param[in] weights Optional vector of vertex pair weight values.
* @param[in] edge_ids Optional vector of vertex pair edge id values.
* @param[in] edge_types Optional vector of vertex pair edge type values.
* @param[in] edge_start_times Optional vector of vertex pair edge start time values.
* @param[in] edge_end_times Optional vector of vertex pair edge end time values.
*
* @return Tuple of vectors storing shuffled major vertices, minor vertices and optional weights,
* edge ids and edge types
*/
template <typename vertex_t, typename edge_t, typename weight_t, typename edge_type_id_t>
template <typename vertex_t,
typename edge_t,
typename weight_t,
typename edge_type_t,
typename edge_time_t>
std::tuple<rmm::device_uvector<vertex_t>,
rmm::device_uvector<vertex_t>,
std::optional<rmm::device_uvector<weight_t>>,
std::optional<rmm::device_uvector<edge_t>>,
std::optional<rmm::device_uvector<edge_type_id_t>>,
std::optional<rmm::device_uvector<edge_type_t>>,
std::optional<rmm::device_uvector<edge_time_t>>,
std::optional<rmm::device_uvector<edge_time_t>>,
std::vector<size_t>>
shuffle_ext_vertex_pairs_with_values_to_local_gpu_by_edge_partitioning(
raft::handle_t const& handle,
rmm::device_uvector<vertex_t>&& majors,
rmm::device_uvector<vertex_t>&& minors,
std::optional<rmm::device_uvector<weight_t>>&& weights,
std::optional<rmm::device_uvector<edge_t>>&& edge_ids,
std::optional<rmm::device_uvector<edge_type_id_t>>&& edge_types);
std::optional<rmm::device_uvector<edge_type_t>>&& edge_types,
std::optional<rmm::device_uvector<edge_time_t>>&& edge_start_times,
std::optional<rmm::device_uvector<edge_time_t>>&& edge_end_times);

/**
* @brief Shuffle internal (i.e. renumbered) vertex pairs (which can be edge end points) to their
Expand All @@ -71,6 +85,7 @@ shuffle_ext_vertex_pairs_with_values_to_local_gpu_by_edge_partitioning(
* @tparam edge_t Type of edge identifiers. Needs to be an integral type.
* @tparam weight_t Type of edge weights. Needs to be a floating point type.
* @tparam edge_type_t Type of edge type identifiers. Needs to be an integral type.
* @tparam edge_time_t Type of edge time. Needs to be an integral type.
*
* @param[in] handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator,
* and handles to various CUDA libraries) to run graph algorithms.
Expand All @@ -82,27 +97,37 @@ shuffle_ext_vertex_pairs_with_values_to_local_gpu_by_edge_partitioning(
* @param[in] weights Optional vector of vertex pair weight values.
* @param[in] edge_ids Optional vector of vertex pair edge id values.
* @param[in] edge_types Optional vector of vertex pair edge type values.
* @param[in] edge_start_times Optional vector of vertex pair start time values.
* @param[in] edge_end_times Optional vector of vertex pair end time values.
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistent with the documentation above.

 * @param[in] edge_start_times Optional vector of vertex pair edge start time values.
 * @param[in] edge_end_times Optional vector of vertex pair edge end time values.

Should this better be "vetex pair edge start/end time values'' for consistency?

*
* @param[in] vertex_partition_range_lasts Vector of each GPU's vertex partition range's last
* (exclusive) vertex ID.
*
* @return Tuple of vectors storing shuffled major vertices, minor vertices and optional weights,
* edge ids and edge types and rx counts
*/
template <typename vertex_t, typename edge_t, typename weight_t, typename edge_type_id_t>
template <typename vertex_t,
typename edge_t,
typename weight_t,
typename edge_type_t,
typename edge_time_t>
std::tuple<rmm::device_uvector<vertex_t>,
rmm::device_uvector<vertex_t>,
std::optional<rmm::device_uvector<weight_t>>,
std::optional<rmm::device_uvector<edge_t>>,
std::optional<rmm::device_uvector<edge_type_id_t>>,
std::optional<rmm::device_uvector<edge_type_t>>,
std::optional<rmm::device_uvector<edge_time_t>>,
std::optional<rmm::device_uvector<edge_time_t>>,
std::vector<size_t>>
shuffle_int_vertex_pairs_with_values_to_local_gpu_by_edge_partitioning(
raft::handle_t const& handle,
rmm::device_uvector<vertex_t>&& majors,
rmm::device_uvector<vertex_t>&& minors,
std::optional<rmm::device_uvector<weight_t>>&& weights,
std::optional<rmm::device_uvector<edge_t>>&& edge_ids,
std::optional<rmm::device_uvector<edge_type_id_t>>&& edge_types,
std::optional<rmm::device_uvector<edge_type_t>>&& edge_types,
std::optional<rmm::device_uvector<edge_time_t>>&& edge_start_times,
std::optional<rmm::device_uvector<edge_time_t>>&& edge_end_times,
std::vector<vertex_t> const& vertex_partition_range_lasts);

/**
Expand Down Expand Up @@ -220,7 +245,10 @@ shuffle_int_vertex_value_pairs_to_local_gpu_by_vertex_partitioning(
* @param[in,out] d_edgelist_minors Vertex IDs for destinations (if we are internally storing edges
* in the sparse 2D matrix using sources as major indices) or sources (otherwise)
* @param[in,out] d_edgelist_weights Optional edge weights
Copy link
Contributor

Choose a reason for hiding this comment

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

Documentation missing for edge_t, edge_type_t & edge_time_t.

* @param[in,out] d_edgelist_id_type_pairs Optional edge (ID, type) pairs
* @param[in,out] d_edgelist_ids Optional edge ids
* @param[in,out] d_edgelist_types Optional edge types
* @param[in,out] d_edgelist_start_times Optional edge start times
* @param[in,out] d_edgelist_end_times Optional edge end times
* @param[in] groupby_and_count_local_partition_by_minor If set to true, groupby and count edges
* based on (local partition ID, GPU ID) pairs (where GPU IDs are computed by applying the
* compute_gpu_id_from_vertex_t function to the minor vertex ID). If set to false, groupby and count
Expand All @@ -230,14 +258,20 @@ shuffle_int_vertex_value_pairs_to_local_gpu_by_vertex_partitioning(
* groupby_and_count_local_partition is false) or in each segment with the same (local partition ID,
* GPU ID) pair.
*/
template <typename vertex_t, typename edge_t, typename weight_t, typename edge_type_t>
template <typename vertex_t,
typename edge_t,
typename weight_t,
typename edge_type_t,
typename edge_time_t>
rmm::device_uvector<size_t> groupby_and_count_edgelist_by_local_partition_id(
raft::handle_t const& handle,
rmm::device_uvector<vertex_t>& d_edgelist_majors,
rmm::device_uvector<vertex_t>& d_edgelist_minors,
std::optional<rmm::device_uvector<weight_t>>& d_edgelist_weights,
std::optional<rmm::device_uvector<edge_t>>& d_edgelist_edge_ids,
std::optional<rmm::device_uvector<edge_type_t>>& d_edgelist_edge_types,
std::optional<rmm::device_uvector<edge_time_t>>& d_edgelist_edge_start_times,
std::optional<rmm::device_uvector<edge_time_t>>& d_edgelist_edge_end_times,
bool groupby_and_count_local_partition_by_minor = false);

/**
Expand Down
Loading
Loading