Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/branch-24.04' into tests/pytes…
Browse files Browse the repository at this point in the history
…t/warning_failure
  • Loading branch information
mroeschke committed Mar 13, 2024
2 parents a353e81 + 3086f83 commit f971bcb
Show file tree
Hide file tree
Showing 61 changed files with 3,113 additions and 634 deletions.
112 changes: 112 additions & 0 deletions benchmarks/nx-cugraph/pytest-based/bench_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,28 @@ def get_highest_degree_node(graph_obj):
return max(degrees, key=lambda t: t[1])[0]


def build_personalization_dict(pagerank_dict):
"""
Returns a dictionary that can be used as the personalization value for a
call to nx.pagerank(). The pagerank_dict passed in is used as the initial
source of values for each node, and this function simply treats the list of
dict values as two halves (halves A and B) and swaps them so (most if not
all) nodes/keys are assigned a different value from the dictionary.
"""
num_half = len(pagerank_dict) // 2
A_half_items = list(pagerank_dict.items())[:num_half]
B_half_items = list(pagerank_dict.items())[num_half:]

# Support an odd number of items by initializing with B_half_items, which
# will always be one bigger if the number of items is odd. This will leave
# the one remainder (in the case of an odd number) unchanged.
pers_dict = dict(B_half_items)
pers_dict.update({A_half_items[i][0]: B_half_items[i][1] for i in range(num_half)})
pers_dict.update({B_half_items[i][0]: A_half_items[i][1] for i in range(num_half)})

return pers_dict


################################################################################
# Benchmarks
def bench_from_networkx(benchmark, graph_obj):
Expand Down Expand Up @@ -431,6 +453,26 @@ def bench_pagerank(benchmark, graph_obj, backend_wrapper):
assert type(result) is dict


def bench_pagerank_personalized(benchmark, graph_obj, backend_wrapper):
G = get_graph_obj_for_benchmark(graph_obj, backend_wrapper)

# FIXME: This will run for every combination of inputs, even if the
# graph/dataset does not change. Ideally this is run once per
# graph/dataset.
pagerank_dict = nx.pagerank(G)
personalization_dict = build_personalization_dict(pagerank_dict)

result = benchmark.pedantic(
target=backend_wrapper(nx.pagerank),
args=(G,),
kwargs={"personalization": personalization_dict},
rounds=rounds,
iterations=iterations,
warmup_rounds=warmup_rounds,
)
assert type(result) is dict


def bench_single_source_shortest_path_length(benchmark, graph_obj, backend_wrapper):
G = get_graph_obj_for_benchmark(graph_obj, backend_wrapper)
node = get_highest_degree_node(graph_obj)
Expand Down Expand Up @@ -804,3 +846,73 @@ def bench_weakly_connected_components(benchmark, graph_obj, backend_wrapper):
warmup_rounds=warmup_rounds,
)
assert type(result) is list


@pytest.mark.skip(reason="benchmark not implemented")
def bench_complete_bipartite_graph(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_connected_components(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_is_connected(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_node_connected_component(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_number_connected_components(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_is_isolate(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_isolates(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_number_of_isolates(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_complement(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_reverse(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_is_arborescence(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_is_branching(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_is_forest(benchmark, graph_obj, backend_wrapper):
pass


@pytest.mark.skip(reason="benchmark not implemented")
def bench_is_tree(benchmark, graph_obj, backend_wrapper):
pass
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARGS=$*
# script, and that this script resides in the repo dir!
REPODIR=$(cd $(dirname $0); pwd)

RAPIDS_VERSION=24.04
RAPIDS_VERSION="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2/' VERSION)"

# Valid args to this script (all possible targets and options) - only one per line
VALIDARGS="
Expand Down
4 changes: 3 additions & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ rapids-mamba-retry install \
rapids-logger "Install cugraph-dgl"
rapids-mamba-retry install "${PYTHON_CHANNEL}/linux-64/cugraph-dgl-*.tar.bz2"

export RAPIDS_VERSION_NUMBER="24.04"
export RAPIDS_VERSION="$(rapids-version)"
export RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)"
export RAPIDS_VERSION_NUMBER="$RAPIDS_VERSION_MAJOR_MINOR"
export RAPIDS_DOCS_DIR="$(mktemp -d)"

for PROJECT in libcugraphops libwholegraph; do
Expand Down
3 changes: 2 additions & 1 deletion ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ echo "${version}" > VERSION
rapids-logger "Begin py build"

package_dir="python"
for package_name in pylibcugraph cugraph nx-cugraph cugraph-pyg cugraph-dgl; do
for package_name in pylibcugraph cugraph cugraph-pyg cugraph-dgl; do
underscore_package_name=$(echo "${package_name}" | tr "-" "_")
sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/${underscore_package_name}/_version.py"
done
sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/nx-cugraph/_nx_cugraph/_version.py"

# TODO: Remove `--no-test` flags once importing on a CPU
# node works correctly
Expand Down
6 changes: 5 additions & 1 deletion ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}"

# Patch project metadata files to include the CUDA version suffix and version override.
version_package_name="$underscore_package_name"
if [[ "${version_package_name}" = "nx_cugraph" ]]; then
version_package_name="_nx_cugraph"
fi
pyproject_file="${package_dir}/pyproject.toml"
version_file="${package_dir}/${underscore_package_name}/_version.py"
version_file="${package_dir}/${version_package_name}/_version.py"

sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file}
echo "${version}" > VERSION
Expand Down
31 changes: 0 additions & 31 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,11 @@ function sed_runner() {
sed -i.bak ''"$1"'' $2 && rm -f ${2}.bak
}

# rapids-cmake version
sed_runner 's/'"branch-.*\/RAPIDS.cmake"'/'"branch-${NEXT_SHORT_TAG}\/RAPIDS.cmake"'/g' fetch_rapids.cmake

# CMakeLists update
sed_runner 's/'"CUGRAPH VERSION .* LANGUAGES C CXX CUDA)"'/'"CUGRAPH VERSION ${NEXT_FULL_TAG} LANGUAGES C CXX CUDA)"'/g' cpp/CMakeLists.txt
sed_runner 's|'"branch-.*/RAPIDS.cmake"'|'"branch-${NEXT_SHORT_TAG}/RAPIDS.cmake"'|g' cpp/CMakeLists.txt
sed_runner 's/'"CUGRAPH_ETL VERSION .* LANGUAGES C CXX CUDA)"'/'"CUGRAPH_ETL VERSION ${NEXT_FULL_TAG} LANGUAGES C CXX CUDA)"'/g' cpp/libcugraph_etl/CMakeLists.txt
sed_runner 's|'"branch-.*/RAPIDS.cmake"'|'"branch-${NEXT_SHORT_TAG}/RAPIDS.cmake"'|g' cpp/libcugraph_etl/CMakeLists.txt
sed_runner "s/set(pylibcugraph_version .*)/set(pylibcugraph_version ${NEXT_FULL_TAG})/g" python/pylibcugraph/CMakeLists.txt
sed_runner "s/set(cugraph_version .*)/set(cugraph_version ${NEXT_FULL_TAG})/g" python/cugraph/CMakeLists.txt

# RTD update
sed_runner 's/version = .*/version = '"'${NEXT_SHORT_TAG}'"'/g' docs/cugraph/source/conf.py
sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/cugraph/source/conf.py


# build.sh script
sed_runner 's/RAPIDS_VERSION=.*/RAPIDS_VERSION='${NEXT_SHORT_TAG}'/g' build.sh

# Centralized version file update
# NOTE: Any script that runs in CI will need to use gha-tool `rapids-generate-version`
# and echo it to `VERSION` file to get an alpha spec of the current version
echo "${NEXT_FULL_TAG}" > VERSION

# Wheel testing script
sed_runner "s/branch-.*/branch-${NEXT_SHORT_TAG}/g" ci/test_wheel_cugraph.sh

# Need to distutils-normalize the original version
NEXT_SHORT_TAG_PEP440=$(python -c "from setuptools.extern import packaging; print(packaging.version.Version('${NEXT_SHORT_TAG}'))")

Expand Down Expand Up @@ -105,19 +83,11 @@ for DEP in "${DEPENDENCIES[@]}"; do
done
done

# Doxyfile update
sed_runner "s|PROJECT_NUMBER[[:space:]]*=.*|PROJECT_NUMBER=${NEXT_SHORT_TAG}|" cpp/doxygen/Doxyfile

# ucx-py version
sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}.*\"/}" conda/recipes/cugraph/conda_build_config.yaml
sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}.*\"/}" conda/recipes/cugraph-service/conda_build_config.yaml
sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}.*\"/}" conda/recipes/pylibcugraph/conda_build_config.yaml

# nx-cugraph NetworkX entry-point meta-data
sed_runner "s@branch-[0-9][0-9].[0-9][0-9]@branch-${NEXT_SHORT_TAG}@g" python/nx-cugraph/_nx_cugraph/__init__.py
# FIXME: can this use the standard VERSION file and update mechanism?
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/nx-cugraph/_nx_cugraph/__init__.py

# CI files
for FILE in .github/workflows/*.yaml; do
sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}"
Expand All @@ -126,7 +96,6 @@ for FILE in .github/workflows/*.yaml; do
# Wheel builds install dask-cuda from source, update its branch
sed_runner "s/dask-cuda.git@branch-[0-9][0-9].[0-9][0-9]/dask-cuda.git@branch-${NEXT_SHORT_TAG}/g" "${FILE}"
done
sed_runner "s/RAPIDS_VERSION_NUMBER=\".*/RAPIDS_VERSION_NUMBER=\"${NEXT_SHORT_TAG}\"/g" ci/build_docs.sh

sed_runner "s/branch-.*/branch-${NEXT_SHORT_TAG}/g" python/nx-cugraph/README.md

Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies:
- ninja
- notebook>=0.5.0
- numba>=0.57
- numpy>=1.23
- numpy>=1.23,<2.0a0
- numpydoc
- nvcc_linux-64=11.8
- openmpi
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-122_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies:
- ninja
- notebook>=0.5.0
- numba>=0.57
- numpy>=1.23
- numpy>=1.23,<2.0a0
- numpydoc
- openmpi
- packaging>=21
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cugraph-dgl/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ requirements:
- cugraph ={{ version }}
- dgl >=1.1.0.cu*
- numba >=0.57
- numpy >=1.23
- numpy >=1.23,<2.0a0
- pylibcugraphops ={{ minor_version }}
- python
- pytorch
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cugraph-pyg/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ requirements:
run:
- rapids-dask-dependency ={{ minor_version }}
- numba >=0.57
- numpy >=1.23
- numpy >=1.23,<2.0a0
- python
- pytorch >=2.0
- cupy >=12.0.0
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cugraph-service/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ outputs:
- dask-cuda ={{ minor_version }}
- dask-cudf ={{ minor_version }}
- numba >=0.57
- numpy >=1.23
- numpy >=1.23,<2.0a0
- python
- rapids-dask-dependency ={{ minor_version }}
- thriftpy2 >=0.4.15
Expand Down
6 changes: 3 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

include(../fetch_rapids.cmake)
include(../rapids_config.cmake)
include(rapids-cmake)
include(rapids-cpm)
include(rapids-cuda)
Expand All @@ -25,7 +25,7 @@ include(rapids-find)

rapids_cuda_init_architectures(CUGRAPH)

project(CUGRAPH VERSION 24.04.00 LANGUAGES C CXX CUDA)
project(CUGRAPH VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA)

if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND
CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0)
Expand Down Expand Up @@ -590,7 +590,7 @@ find_package(Doxygen 1.8.11)
if(Doxygen_FOUND)
add_custom_command(OUTPUT CUGRAPH_DOXYGEN
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doxygen
COMMAND doxygen Doxyfile
COMMAND ${CMAKE_COMMAND} -E env "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" doxygen Doxyfile
VERBATIM)

add_custom_target(docs_cugraph DEPENDS CUGRAPH_DOXYGEN)
Expand Down
2 changes: 1 addition & 1 deletion cpp/doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = libcugraph
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER=24.04
PROJECT_NUMBER=$(RAPIDS_VERSION_MAJOR_MINOR)

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cugraph/graph_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ class graph_view_t<vertex_t, edge_t, store_transposed, multi_gpu, std::enable_if
major_value_range_start_offset);
}

// FIXME: deprecated, replaced with copmute_number_of_edges (which works with or without edge
// FIXME: deprecated, replaced with compute_number_of_edges (which works with or without edge
// masking)
edge_t number_of_edges() const
{
Expand Down Expand Up @@ -923,7 +923,7 @@ class graph_view_t<vertex_t, edge_t, store_transposed, multi_gpu, std::enable_if
offsets_, indices_, this->number_of_vertices());
}

// FIXME: deprecated, replaced with copmute_number_of_edges (which works with or without edge
// FIXME: deprecated, replaced with compute_number_of_edges (which works with or without edge
// masking)
edge_t number_of_edges() const
{
Expand Down
8 changes: 8 additions & 0 deletions cpp/include/cugraph/utilities/misc_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ thrust::optional<T> to_thrust_optional(std::optional<T> val)
return ret;
}

template <typename T>
std::optional<T> to_std_optional(thrust::optional<T> val)
{
std::optional<T> ret{std::nullopt};
if (val) { ret = *val; }
return ret;
}

template <typename idx_t, typename offset_t>
rmm::device_uvector<idx_t> expand_sparse_offsets(raft::device_span<offset_t const> offsets,
idx_t base_idx,
Expand Down
4 changes: 2 additions & 2 deletions cpp/libcugraph_etl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#=============================================================================

cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)
include(../../fetch_rapids.cmake)
include(../../rapids_config.cmake)

include(rapids-cmake)
include(rapids-cpm)
Expand All @@ -25,7 +25,7 @@ include(rapids-find)

rapids_cuda_init_architectures(CUGRAPH_ETL)

project(CUGRAPH_ETL VERSION 24.04.00 LANGUAGES C CXX CUDA)
project(CUGRAPH_ETL VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA)

if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND
CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0)
Expand Down
Loading

0 comments on commit f971bcb

Please sign in to comment.