Repository navigation
Add SciPy compatible connected_components - #4940
Conversation
| cusparselt_path = os.environ.get('CUGRAPH_PATH', '') | ||
| for i in 'include', 'include/cugraph': | ||
| inc_path = os.path.join(cusparselt_path, i) | ||
| if os.path.exists(inc_path): | ||
| settings['include_dirs'].append(inc_path) | ||
| lib_path = os.path.join(cusparselt_path, 'lib') |
There was a problem hiding this comment.
| cusparselt_path = os.environ.get('CUGRAPH_PATH', '') | |
| for i in 'include', 'include/cugraph': | |
| inc_path = os.path.join(cusparselt_path, i) | |
| if os.path.exists(inc_path): | |
| settings['include_dirs'].append(inc_path) | |
| lib_path = os.path.join(cusparselt_path, 'lib') | |
| cugraph_path = os.environ.get('CUGRAPH_PATH', '') | |
| for i in 'include', 'include/cugraph': | |
| inc_path = os.path.join(cugraph_path, i) | |
| if os.path.exists(inc_path): | |
| settings['include_dirs'].append(inc_path) | |
| lib_path = os.path.join(cugraph_path, 'lib') |
|
|
||
| if module['name'] == 'cugraph': | ||
| cusparselt_path = os.environ.get('CUGRAPH_PATH', '') | ||
| for i in 'include', 'include/cugraph': |
There was a problem hiding this comment.
Do we need to include include/cugraph as well?
I think just adding include dir to path list and using #include <cugraph/algorithms.hpp> from code looks better to avoid referencing the wrong header file.
There was a problem hiding this comment.
Thank you for pointing that out. I agree with that it is not clean to include include/cugraph. Actually, I tried the method you pointed out before, but it gave me the following error.
In file included from cupy_backends/cuda/libs/../../cupy_cugraph.h:12:0,
from cupy_backends/cuda/libs/cugraph.cpp:674:
/home/anaruse/.pyenv/versions/miniconda3-4.7.12/envs/libcugraph-nightly/include/cugraph/algorithms.hpp:17:10: fatal error: experimental/graph.hpp: No such file or directory
#include <experimental/graph.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
This might be a problem with libcugraph, but I was able to solve it by adding include/cugraph, so I'm doing so now. Please let me know if you have any other good workarounds!
There was a problem hiding this comment.
Thank you for the explanation, so the current cugraph seems to expect include/cugraph to be on the path. Sounds reasonable to merge as is 👍
|
pfnCI, test this please. |
|
Jenkins CI test (for commit 1b27d46, target branch master) succeeded! |
…nents Add SciPy compatible connected_components
This PR adds SciPy compatible connected_components (cupyx.scipy.sparse.csgraph.connected_components) using libcugraph.
I think there are two main ways to use the functionality of cuGraph: 1) using the python APIs of cugraph, or 2) using the C++ APIs of libcugraph. I understand that you think the former method is better (#4219 (comment)), but cugraph has more dependent modules than libcugraph, so I think the latter is better for many CuPy users (Please see also #4219 (comment)).
As you can see from this PR, if you use libcugraph, you can use the feature of cuGraph via a python bindings to the libcugraph C++ APIs as well as cuTENSOR, NCCL, among others.
Libcugraph can be installed via conda as follows.
Current stable version of libcugraph 0.18, which can be installed from the
rapidsaichannel now, has an issue in the strongly connected components (SCC). It will be fixed in 0.19. So if you want to use the SCC, please install libcugraph 0.19 or above usingrapidsai-nightlychannel.To enable libcugraph, set the environment variable
CUGRAPH_PATHas below when you built CuPy from source.This is related to #4054 and #4219.