Skip to content

Commit

Permalink
Merge branch 'branch-22.06' of github.com:rapidsai/cugraph into enh_u…
Browse files Browse the repository at this point in the history
…pdate_frontier_split
  • Loading branch information
seunghwak committed May 24, 2022
2 parents fcfea4d + 305392d commit 9c255da
Show file tree
Hide file tree
Showing 45 changed files with 1,336 additions and 593 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ python/cugraph/cugraph/tests/dask-worker-space

# Sphinx docs & build artifacts
docs/cugraph/source/api_docs/api/*

2 changes: 1 addition & 1 deletion ci/benchmark/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ CUGRAPH_DEPS=(cudf rmm)
LIBCUGRAPH_DEPS=(cudf rmm)

gpuci_logger "Install required packages"
gpuci_conda_retry install -c nvidia -c rapidsai -c rapidsai-nightly -c conda-forge \
gpuci_mamba_retry install -c nvidia -c rapidsai -c rapidsai-nightly -c conda-forge \
"cudf=${MINOR_VERSION}" \
"rmm=${MINOR_VERSION}" \
"cudatoolkit=$CUDA_REL" \
Expand Down
14 changes: 8 additions & 6 deletions ci/cpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ else
CONDA_LOCAL_CHANNEL="ci/artifacts/cugraph/cpu/.conda-bld/"
fi

# FIXME: Move boa install to gpuci/rapidsai
gpuci_mamba_retry install -c conda-forge boa

###############################################################################
# BUILD - Conda package builds
Expand All @@ -86,9 +88,9 @@ fi
if [ "$BUILD_LIBCUGRAPH" == '1' ]; then
gpuci_logger "Building conda package for libcugraph and libcugraph_etl"
if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/libcugraph
gpuci_conda_retry mambabuild --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/libcugraph
else
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} --dirty --no-remove-work-dir conda/recipes/libcugraph
gpuci_conda_retry mambabuild --no-build-id --croot ${CONDA_BLD_DIR} --dirty --no-remove-work-dir conda/recipes/libcugraph
mkdir -p ${CONDA_BLD_DIR}/libcugraph
mv ${CONDA_BLD_DIR}/work ${CONDA_BLD_DIR}/libcugraph/work
fi
Expand All @@ -101,11 +103,11 @@ fi
if [ "$BUILD_CUGRAPH" == "1" ]; then
gpuci_logger "Building conda packages for pylibcugraph and cugraph"
if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/pylibcugraph --python=$PYTHON
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/cugraph --python=$PYTHON
gpuci_conda_retry mambabuild --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/pylibcugraph --python=$PYTHON
gpuci_conda_retry mambabuild --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/cugraph --python=$PYTHON
else
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/pylibcugraph -c ${CONDA_LOCAL_CHANNEL} --dirty --no-remove-work-dir --python=$PYTHON
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/cugraph -c ${CONDA_LOCAL_CHANNEL} --dirty --no-remove-work-dir --python=$PYTHON
gpuci_conda_retry mambabuild --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/pylibcugraph -c ${CONDA_LOCAL_CHANNEL} --dirty --no-remove-work-dir --python=$PYTHON
gpuci_conda_retry mambabuild --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/cugraph -c ${CONDA_LOCAL_CHANNEL} --dirty --no-remove-work-dir --python=$PYTHON
mkdir -p ${CONDA_BLD_DIR}/cugraph
mv ${CONDA_BLD_DIR}/work ${CONDA_BLD_DIR}/cugraph/work
fi
Expand Down
7 changes: 5 additions & 2 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ else
gpuci_logger "Installing libcugraph-tests"
gpuci_mamba_retry install -c ${CONDA_ARTIFACT_PATH} libcugraph libcugraph_etl libcugraph-tests

# TODO: Move boa install to gpuci/rapidsai
gpuci_mamba_retry install boa

gpuci_logger "Building and installing pylibcugraph and cugraph..."
export CONDA_BLD_DIR="${WORKSPACE}/.conda-bld"
export VERSION_SUFFIX=""
gpuci_conda_retry build conda/recipes/pylibcugraph --no-build-id --croot ${CONDA_BLD_DIR} -c ${CONDA_ARTIFACT_PATH} --python=${PYTHON}
gpuci_conda_retry build conda/recipes/cugraph --no-build-id --croot ${CONDA_BLD_DIR} -c ${CONDA_ARTIFACT_PATH} --python=${PYTHON}
gpuci_conda_retry mambabuild conda/recipes/pylibcugraph --no-build-id --croot ${CONDA_BLD_DIR} -c ${CONDA_ARTIFACT_PATH} --python=${PYTHON}
gpuci_conda_retry mambabuild conda/recipes/cugraph --no-build-id --croot ${CONDA_BLD_DIR} -c ${CONDA_ARTIFACT_PATH} --python=${PYTHON}
gpuci_mamba_retry install cugraph pylibcugraph -c ${CONDA_BLD_DIR} -c ${CONDA_ARTIFACT_PATH}
fi

Expand Down
11 changes: 11 additions & 0 deletions conda/recipes/cugraph/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

sysroot_version:
- "2.17"
10 changes: 7 additions & 3 deletions conda/recipes/cugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- CUDAHOSTCXX
- PARALLEL_LEVEL
ignore_run_exports_from:
- {{ compiler('cuda') }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
- python x.x
- cython>=0.29,<0.30
- libcugraph={{ version }}
Expand Down
12 changes: 12 additions & 0 deletions conda/recipes/libcugraph/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

cmake_version:
- ">=3.20.1,!=3.23.0"

Expand All @@ -15,3 +24,6 @@ gtest_version:

libcusolver_version:
- ">=11.2.1"

sysroot_version:
- "2.17"
13 changes: 10 additions & 3 deletions conda/recipes/libcugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ source:

build:
script_env:
- CC
- CXX
- CUDAHOSTCXX
- PARALLEL_LEVEL
- VERSION_SUFFIX
- CMAKE_GENERATOR
Expand All @@ -34,6 +31,10 @@ build:
requirements:
build:
- cmake {{ cmake_version }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
- doxygen {{ doxygen_version }}
- cudatoolkit {{ cuda_version }}.*
Expand All @@ -54,6 +55,8 @@ outputs:
build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
- {{ compiler('cuda') }}
requirements:
build:
- cmake {{ cmake_version }}
Expand All @@ -76,6 +79,8 @@ outputs:
build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
- {{ compiler('cuda') }}
requirements:
build:
- cmake {{ cmake_version }}
Expand All @@ -96,6 +101,8 @@ outputs:
build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
ignore_run_exports_from:
- {{ compiler('cuda') }}
requirements:
build:
- cmake {{ cmake_version }}
Expand Down
11 changes: 11 additions & 0 deletions conda/recipes/pylibcugraph/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

sysroot_version:
- "2.17"
10 changes: 7 additions & 3 deletions conda/recipes/pylibcugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- CUDAHOSTCXX
- PARALLEL_LEVEL
ignore_run_exports_from:
- {{ compiler('cuda') }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
- python x.x
- cython>=0.29,<0.30
- libcugraph={{ version }}
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ add_library(cugraph_c
src/c_api/sssp.cpp
src/c_api/extract_paths.cpp
src/c_api/random_walks.cpp
src/c_api/louvain.cpp
src/c_api/triangle_count.cpp
src/c_api/uniform_neighbor_sampling.cpp
src/c_api/labeling_result.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,10 @@ void transform_reduce_dst_nbr_intersection_of_e_endpoints_by_v(
d_vertex_partition_range_lasts_in_edge_partition_minor_range =
rmm::device_uvector<vertex_t>(row_comm_size, handle.get_stream());
auto h_vertex_partition_range_lasts = graph_view.vertex_partition_range_lasts();
raft::update_device(
(*d_vertex_partition_range_lasts_in_edge_partition_minor_range).data(),
h_vertex_partition_range_lasts.data() + row_comm_size * col_comm_rank,
h_vertex_partition_range_lasts.size() + row_comm_size * (col_comm_rank + int{1}),
handle.get_stream());
raft::update_device((*d_vertex_partition_range_lasts_in_edge_partition_minor_range).data(),
h_vertex_partition_range_lasts.data() + row_comm_size * col_comm_rank,
row_comm_size,
handle.get_stream());
}

for (size_t i = 0; i < graph_view.number_of_local_edge_partitions(); ++i) {
Expand Down
24 changes: 24 additions & 0 deletions cpp/include/cugraph_c/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,30 @@ void* cugraph_type_erased_device_array_release(cugraph_type_erased_device_array_
cugraph_type_erased_device_array_view_t* cugraph_type_erased_device_array_view(
cugraph_type_erased_device_array_t* array);

/**
* @brief Create a type erased device array view with a different type
*
* Create a type erased device array view from
* a type erased device array treating the underlying
* pointer as a different type.
*
* Note: This is only viable when the underlying types are the same size. That
* is, you can switch between INT32 and FLOAT32, or between INT64 and FLOAT64.
* But if the types are different sizes this will be an error.
*
* @param [in] array Pointer to the type erased device array
* @param [in] dtype The type to cast the pointer to
* @param [out] result_view Address where to put the allocated device view
* @param [out] error Pointer to an error object storing details of any error. Will
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
*/
cugraph_error_code_t cugraph_type_erased_device_array_view_as_type(
cugraph_type_erased_device_array_t* array,
data_type_id_t dtype,
cugraph_type_erased_device_array_view_t** result_view,
cugraph_error_t** error);

/**
* @brief Create a type erased device array view from
* a raw device pointer.
Expand Down
54 changes: 53 additions & 1 deletion cpp/include/cugraph_c/community_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ typedef struct {
* the entire set of vertices in the graph is processed
* @param [in] do_expensive_check
* A flag to run expensive checks for input arguments (if set to true)
* @param [in] result Output from the triangle_count call
* @param [out] result Output from the triangle_count call
* @param [out] error Pointer to an error object storing details of any error. Will
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
Expand Down Expand Up @@ -72,6 +72,58 @@ cugraph_type_erased_device_array_view_t* cugraph_triangle_count_result_get_count
*/
void cugraph_triangle_count_result_free(cugraph_triangle_count_result_t* result);

/**
* @brief Opaque heirarchical clustering output
*/
typedef struct {
int32_t align_;
} cugraph_heirarchical_clustering_result_t;

/**
* @brief Compute Louvain
*
* @param [in] handle Handle for accessing resources
* @param [in] graph Pointer to graph. NOTE: Graph might be modified if the storage
* needs to be transposed
* @param [in] max_level Maximum level in hierarchy
* @param [in] resolution Resolution parameter (gamma) in modularity formula.
* This changes the size of the communities. Higher resolutions
* lead to more smaller communities, lower resolutions lead to
* fewer larger communities.
* @param [in] do_expensive_check
* A flag to run expensive checks for input arguments (if set to true)
* @param [out] result Output from the Louvain call
* @param [out] error Pointer to an error object storing details of any error. Will
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
*/
cugraph_error_code_t cugraph_louvain(const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
size_t max_level,
double resolution,
bool_t do_expensive_check,
cugraph_heirarchical_clustering_result_t** result,
cugraph_error_t** error);

/**
* @brief Get heirarchical clustering vertices
*/
cugraph_type_erased_device_array_view_t* cugraph_heirarchical_clustering_result_get_vertices(
cugraph_heirarchical_clustering_result_t* result);

/**
* @brief Get heirarchical clustering clusters
*/
cugraph_type_erased_device_array_view_t* cugraph_heirarchical_clustering_result_get_clusters(
cugraph_heirarchical_clustering_result_t* result);

/**
* @brief Free a heirarchical clustering result
*
* @param [in] result The result from a sampling algorithm
*/
void cugraph_heirarchical_clustering_result_free(cugraph_heirarchical_clustering_result_t* result);

#ifdef __cplusplus
}
#endif
25 changes: 25 additions & 0 deletions cpp/src/c_api/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,28 @@ extern "C" cugraph_error_code_t cugraph_type_erased_device_array_view_copy(
return CUGRAPH_UNKNOWN_ERROR;
}
}

extern "C" cugraph_error_code_t cugraph_type_erased_device_array_view_as_type(
cugraph_type_erased_device_array_t* array,
data_type_id_t dtype,
cugraph_type_erased_device_array_view_t** result_view,
cugraph_error_t** error)
{
auto internal_pointer =
reinterpret_cast<cugraph::c_api::cugraph_type_erased_device_array_t*>(array);

if (data_type_sz[dtype] == data_type_sz[internal_pointer->type_]) {
*result_view = reinterpret_cast<cugraph_type_erased_device_array_view_t*>(
new cugraph::c_api::cugraph_type_erased_device_array_view_t{internal_pointer->data_.data(),
internal_pointer->size_,
internal_pointer->data_.size(),
dtype});
return CUGRAPH_SUCCESS;
} else {
std::stringstream ss;
ss << "Could not treat type " << internal_pointer->type_ << " as type " << dtype;
auto tmp_error = new cugraph::c_api::cugraph_error_t{ss.str().c_str()};
*error = reinterpret_cast<cugraph_error_t*>(tmp_error);
return CUGRAPH_INVALID_INPUT;
}
}
Loading

0 comments on commit 9c255da

Please sign in to comment.