cugraph icon indicating copy to clipboard operation
cugraph copied to clipboard

[BUG]: RuntimeError: non-success value returned from cugraph_sg_graph_create_from_csr()

Open esnvidia opened this issue 1 year ago • 0 comments

Version

nvcr.io/nvidia/rapidsai/base:24.08-cuda12.5-py3.11

Which installation method(s) does this occur on?

Docker

Describe the bug.

In the past, such as in nvcr.io/nvidia/rapidsai/rapidsai-core:22.12-cuda11.5-runtime-ubuntu20.04-py3.9 I could do the following that integrated cuml and cugraph nicely (see minimum reproducible example)

Now, in 24.08 I get an error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[82], line 3
      1 # Create a cuGraph Graph object using the CSR matrix.
      2 g = cg.Graph()
----> 3 g.from_cudf_adjlist(knn_csr.indptr, knn_csr.indices)

File [/opt/conda/lib/python3.11/site-packages/cugraph/structure/graph_classes.py:271](/opt/conda/lib/python3.11/site-packages/cugraph/structure/graph_classes.py#line=270), in Graph.from_cudf_adjlist(self, offset_col, index_col, value_col, renumber, store_transposed)
    269 elif self._Impl.edgelist is not None or self._Impl.adjlist is not None:
    270     raise RuntimeError("Graph already has values")
--> 271 self._Impl._simpleGraphImpl__from_adjlist(offset_col, index_col, value_col)

File [/opt/conda/lib/python3.11/site-packages/cugraph/structure/graph_implementation/simpleGraph.py:550](/opt/conda/lib/python3.11/site-packages/cugraph/structure/graph_implementation/simpleGraph.py#line=549), in simpleGraphImpl.__from_adjlist(self, offset_col, index_col, value_col, renumber, store_transposed)
    548 if value_col is not None:
    549     self.properties.weighted = True
--> 550 self._make_plc_graph(
    551     value_col=value_col, store_transposed=store_transposed, renumber=renumber
    552 )
    554 if self.batch_enabled:
    555     self._replicate_adjlist()

File [/opt/conda/lib/python3.11/site-packages/cugraph/structure/graph_implementation/simpleGraph.py:1211](/opt/conda/lib/python3.11/site-packages/cugraph/structure/graph_implementation/simpleGraph.py#line=1210), in simpleGraphImpl._make_plc_graph(self, value_col, store_transposed, renumber, drop_multi_edges)
   1203         id_col = id_col.astype("int64")
   1204         warnings.warn(
   1205             f"Vertex type is int64 but edge id type is {id_col.dtype}"
   1206             ", automatically casting edge id type to int64. "
   1207             "This may cause extra memory usage.  Consider passing"
   1208             " a int64 list of edge ids instead."
   1209         )
-> 1211 self._plc_graph = SGGraph(
   1212     resource_handle=ResourceHandle(),
   1213     graph_properties=graph_props,
   1214     src_or_offset_array=src_or_offset_array,
   1215     dst_or_index_array=dst_or_index_array,
   1216     weight_array=weight_col,
   1217     edge_id_array=id_col,
   1218     edge_type_array=type_col,
   1219     store_transposed=store_transposed,
   1220     renumber=renumber,
   1221     do_expensive_check=True,
   1222     input_array_format=input_array_format,
   1223     drop_multi_edges=drop_multi_edges,
   1224 )

File graphs.pyx:243, in pylibcugraph.graphs.SGGraph.__cinit__()

File utils.pyx:53, in pylibcugraph.utils.assert_success()

RuntimeError: non-success value returned from cugraph_sg_graph_create_from_csr(): CUGRAPH_UNKNOWN_ERROR cuGraph failure at file=/opt/conda/conda-bld/work/cpp/src/structure/create_graph_from_edgelist_impl.cuh line=1365: Invalid input arguments: graph_properties.is_symmetric is true but the input edge list is not symmetric.
Obtained 54 stack frames
#1 in [/opt/conda/lib/python3.11/site-packages/cugraph/structure/../../../../libcugraph.so](/opt/conda/lib/libcugraph.so)(+0x18f72f9) [0x7f41961712f9]
#2 in [/opt/conda/lib/python3.11/site-packages/cugraph/structure/../../../../libcugraph.so](/opt/conda/lib/libcugraph.so): std::enable_if<!(false), std::tuple<cugraph::graph_t<int, int, false, false, void>, std::optional<cugraph::edge_property_t<cugraph::graph_view_t<int, int, false, false, void>, float> >, std::optional<cugraph::edge_property_t<cugraph::graph_view_t<int, int, false, false, void>, int> >, std::optional<cugraph::edge_property_t<cugraph::graph_view_t<int, int, false, false, void>, int> >, std::optional<rmm::device_uvector<int> > > >::type cugraph::(anonymous namespace)::create_graph_from_edgelist_impl<int, int, float, int, int, false, false>(raft::handle_t const&, std::optional<rmm::device_uvector<int> >&&, rmm::device_uvector<int>&&, rmm::device_uvector<int>&&, std::optional<rmm::device_uvector<float> >&&, std::optional<rmm::device_uvector<int> >&&, std::optional<rmm::device_uvector<int> >&&, cugraph::graph_properties_t, bool, bool) +0x386f [0x7f419b88c81f]
#3 in [/opt/conda/lib/python3.11/site-packages/cugraph/structure/../../../../libcugraph.so](/opt/conda/lib/libcugraph.so): std::tuple<cugraph::graph_t<int, int, false, false, void>, std::optional<cugraph::edge_property_t<cugraph::graph_view_t<int, int, false, false, void>, float> >, std::optional<cugraph::edge_property_t<cugraph::graph_view_t<int, int, false, false, void>, int> >, std::optional<cugraph::edge_property_t<cugraph::graph_view_t<int, int, false, false, void>, int> >, std::optional<rmm::device_uvector<int> > > cugraph::create_graph_from_edgelist<int, int, float, int, int, false, false>(raft::handle_t const&, std::optional<rmm::device_uvector<int> >&&, rmm::device_uvector<int>&&, rmm::device_uvector<int>&&, std::optional<rmm::device_uvector<float> >&&, std::optional<rmm::device_uvector<int> >&&, std::optional<rmm::device_uvector<int> >&&, cugraph::graph_properties_t, bool, bool) +0x28 [0x7f419b88d4f8]
#4 in [/opt/conda/lib/python3.11/site-packages/pylibcugraph/../../../libcugraph_c.so]

...and more

Converting the knn_csr to a numpy array, or pd.Series, or cudf.Series does not work.

Minimum reproducible example

import cugraph as cg
import cudf
import cuml
from cuml import NearestNeighbors


# Generate a synthetic dataset
data, label = cuml.datasets.make_classification(n_samples=2_000_000,
                                                n_features=10, 
                                                n_informative=8, 
                                                n_redundant=2, 
                                                n_classes=5,
                                                random_state=31415926)

# instantiate NearestNeighbors for 10 nearest neighbors and fit the data
n_neighbors = 10
knn = NearestNeighbors(n_neighbors=n_neighbors)

knn.fit(data)


# Compute the distances and indices of each neighbor
distances, indices = knn.kneighbors(data, n_neighbors=n_neighbors)


# return a CSR matrix, which can be used to generate a Graph object later.
knn_csr = knn.kneighbors_graph(data, n_neighbors=n_neighbors)
# type(knn_csr)  == cupyx.scipy.sparse._csr.csr_matrix

# Create a cuGraph Graph object using the CSR matrix.
g = cg.Graph()
g.from_cudf_adjlist(knn_csr.indptr, knn_csr.indices) # error is here.

Relevant log output

No response

Environment details

4xA100 80GB SXM Driver Version: 535.104.12 CUDA Version: 12.5

Other/Misc.

No response

Code of Conduct

  • [x] I agree to follow cuGraph's Code of Conduct
  • [x] I have searched the open bugs and have found no duplicates for this bug report

esnvidia avatar Oct 04 '24 05:10 esnvidia