I'm encountering an issue while trying to create a graph view using the cuGraph library in CUDA. Specifically, I'm using the graph_view_t constructor to create a graph view from device spans representing offsets and indices of a graph. However, I'm consistently getting an error stating: "cuGraph failure at file=/root/cugraph/cpp/src/structure/graph_view_impl.cuh line=533: Internal Error: offsets.size() returns an invalid value."
raft::handle_t handle;
rmm::device_uvector<long> d_source_offsets(source_offsets->size(), stream);
rmm::device_uvector<long> d_destination_indices(destination_indices->size(), stream);
CUDA_CHECK(cudaMemcpyAsync(
d_source_offsets.data(),
source_offsets->data(),
source_offsets->size() * sizeof(long),
cudaMemcpyHostToDevice,
stream.value()));
CUDA_CHECK(cudaMemcpyAsync(
d_destination_indices.data(),
destination_indices->data(),
destination_indices->size() * sizeof(long),
cudaMemcpyHostToDevice,
stream.value()));
stream.synchronize();
raft::device_span<long> offsets_span(d_source_offsets.data(), d_source_offsets.size());
raft::device_span<long> indices_span(d_destination_indices.data(), d_destination_indices.size());
cugraph::graph_view_t<long, long, false, false> graph_view(offsets_span, indices_span, {});
Any insights into why this error might be occurring and how to resolve it would be greatly appreciated. Thank you!
Our typical use case is for users to create a
graph_tusing the functioncreate_graph_from_edgelistand then create thegraph_view_tfrom it. There are some optimizations that we can make in the CUDA kernels within our graph algorithms if the vertices are ordered by degree (largest first) and there are some extra data structures that help us recognize and facilitate that. Of course,create_graph_from_edgelistrequires a COO input, so if you have CSR input and don't want to convert you can certainly create thegraph_view_tyourself based on your data structures. You just potentially miss out on some optimization opportunities when you use thegraph_view_t.The constructor for
graph_view_trequires the third argument to be populated properly. The failure you are seeing come from a check of the input parameters.https://github.com/rapidsai/cugraph/blob/7904ff07d4a9a9b567193e46f9a6ed50ab6649f2/cpp/include/cugraph/graph_view.hpp#L348 identifies the structure for the single-gpu variation of
graph_view_meta_t. You would need to provide values for the 3 non-optional fields.Here's an example of where we construct a single-gpu
graph_view_t: https://github.com/rapidsai/cugraph/blob/7904ff07d4a9a9b567193e46f9a6ed50ab6649f2/cpp/include/cugraph/graph.hpp#L289.Extending your code as follows should be sufficient:
You can set the graph properties as appropriate for your situation, the first element is whether the graph is symmetric, the second is whether the graph is a multigraph.