Skip to content

Commit

Permalink
Don't compile int32_t/int64_t vertex_t/edge_t combinations (#4720)
Browse files Browse the repository at this point in the history
To reduce compile time and library size... we're dropping pre-compiled support for vertex_t as int32_t and edge_t as int64_t.  This is a small edge case in memory utilization.

The data structures and primitives would still support such a configuration, but we're not compiling it into libcugraph.so with this PR. 

Seems to improve C++ compile time by 25% on my dgx18 and a 30% reduction in the size of libcugraph.so.

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)

Approvers:
  - Seunghwa Kang (https://github.com/seunghwak)

URL: #4720
  • Loading branch information
ChuckHastings authored Oct 18, 2024
1 parent 69d6601 commit 2ac5586
Show file tree
Hide file tree
Showing 209 changed files with 39 additions and 7,672 deletions.
106 changes: 0 additions & 106 deletions cpp/CMakeLists.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cpp/include/cugraph/utilities/graph_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ template <typename vertex_t, typename edge_t>
struct is_vertex_edge_combo {
static constexpr bool value = is_one_of<vertex_t, int32_t, int64_t>::value &&
is_one_of<edge_t, int32_t, int64_t>::value &&
(sizeof(vertex_t) <= sizeof(edge_t));
(sizeof(vertex_t) == sizeof(edge_t));
};

// meta-function that constrains
Expand Down
22 changes: 0 additions & 22 deletions cpp/src/c_api/graph_helper_mg.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ create_constant_edge_property(
cugraph::graph_view_t<int32_t, int32_t, false, true> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, false, true>, float>
create_constant_edge_property(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, false, true> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, false, true>, float>
create_constant_edge_property(
raft::handle_t const& handle,
Expand All @@ -42,11 +36,6 @@ create_constant_edge_property(raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int32_t, true, true> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, true, true>, float>
create_constant_edge_property(raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, true, true> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, true, true>, float>
create_constant_edge_property(raft::handle_t const& handle,
cugraph::graph_view_t<int64_t, int64_t, true, true> const& graph_view,
Expand All @@ -58,12 +47,6 @@ create_constant_edge_property(
cugraph::graph_view_t<int32_t, int32_t, false, true> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, false, true>, double>
create_constant_edge_property(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, false, true> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, false, true>, double>
create_constant_edge_property(
raft::handle_t const& handle,
Expand All @@ -75,11 +58,6 @@ create_constant_edge_property(raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int32_t, true, true> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, true, true>, double>
create_constant_edge_property(raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, true, true> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, true, true>, double>
create_constant_edge_property(raft::handle_t const& handle,
cugraph::graph_view_t<int64_t, int64_t, true, true> const& graph_view,
Expand Down
24 changes: 0 additions & 24 deletions cpp/src/c_api/graph_helper_sg.cu
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ create_constant_edge_property(
cugraph::graph_view_t<int32_t, int32_t, false, false> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, false, false>, float>
create_constant_edge_property(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, false, false> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, false, false>, float>
create_constant_edge_property(
raft::handle_t const& handle,
Expand All @@ -66,12 +60,6 @@ create_constant_edge_property(
cugraph::graph_view_t<int32_t, int32_t, true, false> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, true, false>, float>
create_constant_edge_property(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, true, false> const& graph_view,
float constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, true, false>, float>
create_constant_edge_property(
raft::handle_t const& handle,
Expand All @@ -84,12 +72,6 @@ create_constant_edge_property(
cugraph::graph_view_t<int32_t, int32_t, false, false> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, false, false>, double>
create_constant_edge_property(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, false, false> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, false, false>, double>
create_constant_edge_property(
raft::handle_t const& handle,
Expand All @@ -102,12 +84,6 @@ create_constant_edge_property(
cugraph::graph_view_t<int32_t, int32_t, true, false> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int32_t, int64_t, true, false>, double>
create_constant_edge_property(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, true, false> const& graph_view,
double constant_value);

template edge_property_t<cugraph::graph_view_t<int64_t, int64_t, true, false>, double>
create_constant_edge_property(
raft::handle_t const& handle,
Expand Down
16 changes: 8 additions & 8 deletions cpp/src/c_api/graph_mg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,14 @@ extern "C" cugraph_error_code_t cugraph_graph_create_mg(
raft::comms::op_t::SUM,
p_handle->handle_->get_stream());

cugraph_data_type_id_t edge_type{vertex_type};

if (vertex_type == cugraph_data_type_id_t::INT32)
CAPI_EXPECTS(num_edges < int32_threshold,
CUGRAPH_INVALID_INPUT,
"Number of edges won't fit in 32-bit integer, using 32-bit type",
*error);

auto vertex_types = cugraph::host_scalar_allgather(
p_handle->handle_->get_comms(), static_cast<int>(vertex_type), p_handle->handle_->get_stream());

Expand Down Expand Up @@ -434,14 +442,6 @@ extern "C" cugraph_error_code_t cugraph_graph_create_mg(
"different weight type used on different GPUs",
*error);

cugraph_data_type_id_t edge_type;

if (num_edges < int32_threshold) {
edge_type = static_cast<cugraph_data_type_id_t>(vertex_types[0]);
} else {
edge_type = cugraph_data_type_id_t::INT64;
}

if (weight_type == cugraph_data_type_id_t::NTYPES) {
weight_type = cugraph_data_type_id_t::FLOAT32;
}
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/c_api/graph_sg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,14 +609,14 @@ extern "C" cugraph_error_code_t cugraph_graph_create_sg(
"Invalid input arguments: src size != weights size.",
*error);

cugraph_data_type_id_t edge_type;
cugraph_data_type_id_t weight_type;
if (p_src->type_ == cugraph_data_type_id_t::INT32)
CAPI_EXPECTS(p_src->size_ < int32_threshold,
CUGRAPH_INVALID_INPUT,
"Number of edges won't fit in 32-bit integer, using 32-bit type",
*error);

if (p_src->size_ < int32_threshold) {
edge_type = p_src->type_;
} else {
edge_type = cugraph_data_type_id_t::INT64;
}
cugraph_data_type_id_t edge_type = p_src->type_;
cugraph_data_type_id_t weight_type;

if (weights != nullptr) {
weight_type = p_weights->type_;
Expand Down
58 changes: 0 additions & 58 deletions cpp/src/centrality/betweenness_centrality_mg_v32_e64.cu

This file was deleted.

58 changes: 0 additions & 58 deletions cpp/src/centrality/betweenness_centrality_sg_v32_e64.cu

This file was deleted.

40 changes: 0 additions & 40 deletions cpp/src/centrality/eigenvector_centrality_mg_v32_e64.cu

This file was deleted.

40 changes: 0 additions & 40 deletions cpp/src/centrality/eigenvector_centrality_sg_v32_e64.cu

This file was deleted.

Loading

0 comments on commit 2ac5586

Please sign in to comment.