diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 4b5d0c26d0b..9777388b435 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -20,17 +20,13 @@ jobs: - conda-python-build - conda-python-tests - docs-build - - wheel-build-pylibcugraph + - wheel-build-cpp + - wheel-build-python - wheel-tests-pylibcugraph - - wheel-build-cugraph - wheel-tests-cugraph - - wheel-build-nx-cugraph - wheel-tests-nx-cugraph - - wheel-build-cugraph-dgl - wheel-tests-cugraph-dgl - - wheel-build-cugraph-pyg - wheel-tests-cugraph-pyg - - wheel-build-cugraph-equivariant - wheel-tests-cugraph-equivariant - devcontainer secrets: inherit @@ -93,93 +89,68 @@ jobs: arch: "amd64" container_image: "rapidsai/ci-conda:cuda11.8.0-ubuntu22.04-py3.10" run_script: "ci/build_docs.sh" - wheel-build-pylibcugraph: + wheel-build-cpp: needs: checks secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08 with: + matrix_filter: group_by([.ARCH, (.CUDA_VER|split(".")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(".")|map(tonumber))) build_type: pull-request - script: ci/build_wheel_pylibcugraph.sh + script: ci/build_wheel_cpp.sh extra-repo: rapidsai/cugraph-ops extra-repo-sha: branch-24.08 extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY node_type: cpu32 - wheel-tests-pylibcugraph: - needs: wheel-build-pylibcugraph + wheel-build-python: + needs: wheel-build-cpp secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08 - with: - build_type: pull-request - script: ci/test_wheel_pylibcugraph.sh - wheel-build-cugraph: - needs: wheel-tests-pylibcugraph - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: pull-request - script: ci/build_wheel_cugraph.sh + script: ci/build_wheel_python.sh extra-repo: rapidsai/cugraph-ops extra-repo-sha: branch-24.08 extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY - wheel-tests-cugraph: - needs: wheel-build-cugraph + node_type: cpu32 + wheel-tests-pylibcugraph: + needs: wheel-build-python secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08 with: build_type: pull-request - script: ci/test_wheel_cugraph.sh - wheel-build-nx-cugraph: - needs: wheel-tests-pylibcugraph + script: ci/test_wheel_pylibcugraph.sh + wheel-tests-cugraph: + needs: wheel-build-python secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08 with: build_type: pull-request - script: ci/build_wheel_nx-cugraph.sh + script: ci/test_wheel_cugraph.sh wheel-tests-nx-cugraph: - needs: wheel-build-nx-cugraph + needs: wheel-build-python secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08 with: build_type: pull-request script: ci/test_wheel_nx-cugraph.sh - wheel-build-cugraph-dgl: - needs: wheel-tests-cugraph - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08 - with: - build_type: pull-request - script: ci/build_wheel_cugraph-dgl.sh wheel-tests-cugraph-dgl: - needs: wheel-build-cugraph-dgl + needs: wheel-build-python secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08 with: build_type: pull-request script: ci/test_wheel_cugraph-dgl.sh matrix_filter: map(select(.ARCH == "amd64")) - wheel-build-cugraph-pyg: - needs: wheel-tests-cugraph - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08 - with: - build_type: pull-request - script: ci/build_wheel_cugraph-pyg.sh wheel-tests-cugraph-pyg: - needs: wheel-build-cugraph-pyg + needs: wheel-build-python secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08 with: build_type: pull-request script: ci/test_wheel_cugraph-pyg.sh matrix_filter: map(select(.ARCH == "amd64")) - wheel-build-cugraph-equivariant: - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08 - with: - build_type: pull-request - script: ci/build_wheel_cugraph-equivariant.sh wheel-tests-cugraph-equivariant: - needs: wheel-build-cugraph-equivariant + needs: wheel-build-python secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08 with: diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh deleted file mode 100755 index da0f3617f3f..00000000000 --- a/ci/build_wheel.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# Copyright (c) 2023-2024, NVIDIA CORPORATION. - -set -euo pipefail - -package_name=$1 -package_dir=$2 -underscore_package_name=$(echo "${package_name}" | tr "-" "_") - -source rapids-configure-sccache -source rapids-date-string - -version=$(rapids-generate-version) -git_commit=$(git rev-parse HEAD) - -RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" - -# This is the version of the suffix with a preceding hyphen. It's used -# everywhere except in the final wheel name. -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}/${version_package_name}/_version.py" - -sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file} -echo "${version}" > VERSION -sed -i "/^__git_commit__ / s/= .*/= \"${git_commit}\"/g" ${version_file} - -# For nightlies we want to ensure that we're pulling in alphas as well. The -# easiest way to do so is to augment the spec with a constraint containing a -# min alpha version that doesn't affect the version bounds but does allow usage -# of alpha versions for that dependency without --pre -alpha_spec='' -if ! rapids-is-release-build; then - alpha_spec=',>=0.0.0a0' -fi - -for dep in rmm cudf cugraph raft-dask pylibcugraph pylibcugraphops pylibwholegraph pylibraft ucx-py; do - sed -r -i "s/${dep}==(.*)\"/${dep}${PACKAGE_CUDA_SUFFIX}==\1${alpha_spec}\"/g" ${pyproject_file} -done - -# dask-cuda & rapids-dask-dependency doesn't get a suffix, but it does get an alpha spec. -for dep in dask-cuda rapids-dask-dependency; do - sed -r -i "s/${dep}==(.*)\"/${dep}==\1${alpha_spec}\"/g" ${pyproject_file} -done - - -if [[ $PACKAGE_CUDA_SUFFIX == "-cu12" ]]; then - sed -i "s/cupy-cuda11x/cupy-cuda12x/g" ${pyproject_file} -fi - -cd "${package_dir}" - -python -m pip wheel \ - -w dist \ - -vvv \ - --no-deps \ - --disable-pip-version-check \ - --extra-index-url https://pypi.nvidia.com \ - . - -# pure-python packages should be marked as pure, and not have auditwheel run on them. -if [[ ${package_name} == "nx-cugraph" ]] || \ - [[ ${package_name} == "cugraph-dgl" ]] || \ - [[ ${package_name} == "cugraph-pyg" ]] || \ - [[ ${package_name} == "cugraph-equivariant" ]]; then - RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-upload-wheels-to-s3 dist -else - mkdir -p final_dist - python -m auditwheel repair -w final_dist dist/* - RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 final_dist -fi diff --git a/ci/build_wheel_cpp.sh b/ci/build_wheel_cpp.sh new file mode 100755 index 00000000000..ec6cb37a795 --- /dev/null +++ b/ci/build_wheel_cpp.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright (c) 2024, NVIDIA CORPORATION. + +set -euo pipefail + +package_name="libcugraph" +package_dir="python/libcugraph" + +source rapids-configure-sccache +source rapids-date-string + +version=$(rapids-generate-version) +git_commit=$(git rev-parse HEAD) + +RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" + +# This is the version of the suffix with a preceding hyphen. It's used +# everywhere except in the final wheel name. +PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}" + +pyproject_file="${package_dir}/pyproject.toml" +version_file="${package_dir}/${package_name}/_version.py" + +sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file} +echo "${version}" > VERSION +sed -i "/^__git_commit__ / s/= .*/= \"${git_commit}\"/g" ${version_file} + +# For nightlies we want to ensure that we're pulling in alphas as well. The +# easiest way to do so is to augment the spec with a constraint containing a +# min alpha version that doesn't affect the version bounds but does allow usage +# of alpha versions for that dependency without --pre +alpha_spec='' +if ! rapids-is-release-build; then + alpha_spec=',>=0.0.0a0' +fi + +for dep in librmm libraft libcugraphops; do + sed -r -i "s/${dep}==(.*)\"/${dep}${PACKAGE_CUDA_SUFFIX}==\1${alpha_spec}\"/g" ${pyproject_file} +done + +cd "${package_dir}" + +libraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 cpp efafdb6) +libcugraphops_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact cugraph-ops 629 cpp e7c6f06) + +python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check --find-links ${libraft_wheelhouse} --find-links ${libcugraphops_wheelhouse} + +mkdir -p final_dist +python -m auditwheel repair --exclude libraft.so --exclude libcugraph-ops++.so -w final_dist dist/* +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 cpp final_dist diff --git a/ci/build_wheel_cugraph-dgl.sh b/ci/build_wheel_cugraph-dgl.sh deleted file mode 100755 index d62f810cba4..00000000000 --- a/ci/build_wheel_cugraph-dgl.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Copyright (c) 2024, NVIDIA CORPORATION. - -set -euo pipefail - -./ci/build_wheel.sh cugraph-dgl python/cugraph-dgl diff --git a/ci/build_wheel_cugraph-equivariant.sh b/ci/build_wheel_cugraph-equivariant.sh deleted file mode 100755 index fcc8e0f774c..00000000000 --- a/ci/build_wheel_cugraph-equivariant.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Copyright (c) 2024, NVIDIA CORPORATION. - -set -euo pipefail - -./ci/build_wheel.sh cugraph-equivariant python/cugraph-equivariant diff --git a/ci/build_wheel_cugraph-pyg.sh b/ci/build_wheel_cugraph-pyg.sh deleted file mode 100755 index 97baa243f73..00000000000 --- a/ci/build_wheel_cugraph-pyg.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Copyright (c) 2024, NVIDIA CORPORATION. - -set -euo pipefail - -./ci/build_wheel.sh cugraph-pyg python/cugraph-pyg diff --git a/ci/build_wheel_cugraph.sh b/ci/build_wheel_cugraph.sh deleted file mode 100755 index 6545ee3eca0..00000000000 --- a/ci/build_wheel_cugraph.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Copyright (c) 2023-2024, NVIDIA CORPORATION. - -set -euo pipefail - -RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" - -# Download the pylibcugraph wheel built in the previous step and make it -# available for pip to find. We must use PIP_FIND_LINKS because the package -# must be made available to the isolated build step, and there is no way to -# manually install it into that environment. -RAPIDS_PY_WHEEL_NAME=pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX} rapids-download-wheels-from-s3 ./local-pylibcugraph -export PIP_FIND_LINKS=$(pwd)/local-pylibcugraph - -PARALLEL_LEVEL=$(python -c \ - "from math import ceil; from multiprocessing import cpu_count; print(ceil(cpu_count()/4))") - -export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_CUGRAPH_CPP=OFF;-DCPM_cugraph-ops_SOURCE=${GITHUB_WORKSPACE}/cugraph-ops/" -export SKBUILD_BUILD_TOOL_ARGS="-j${PARALLEL_LEVEL};-l${PARALLEL_LEVEL}" - -./ci/build_wheel.sh cugraph python/cugraph diff --git a/ci/build_wheel_nx-cugraph.sh b/ci/build_wheel_nx-cugraph.sh deleted file mode 100755 index 4481de1283d..00000000000 --- a/ci/build_wheel_nx-cugraph.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Copyright (c) 2023, NVIDIA CORPORATION. - -set -euo pipefail - -./ci/build_wheel.sh nx-cugraph python/nx-cugraph diff --git a/ci/build_wheel_pylibcugraph.sh b/ci/build_wheel_pylibcugraph.sh deleted file mode 100755 index ee33ab4a82d..00000000000 --- a/ci/build_wheel_pylibcugraph.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# Copyright (c) 2023-2024, NVIDIA CORPORATION. - -set -euo pipefail - -PARALLEL_LEVEL=$(python -c \ - "from math import ceil; from multiprocessing import cpu_count; print(ceil(cpu_count()/4))") - -export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_CUGRAPH_CPP=OFF;-DCPM_cugraph-ops_SOURCE=${GITHUB_WORKSPACE}/cugraph-ops/" -export SKBUILD_BUILD_TOOL_ARGS="-j${PARALLEL_LEVEL};-l${PARALLEL_LEVEL}" - -./ci/build_wheel.sh pylibcugraph python/pylibcugraph diff --git a/ci/build_wheel_python.sh b/ci/build_wheel_python.sh new file mode 100755 index 00000000000..9fefc4d7905 --- /dev/null +++ b/ci/build_wheel_python.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Copyright (c) 2023-2024, NVIDIA CORPORATION. + +set -euo pipefail + +source rapids-configure-sccache +source rapids-date-string + +version=$(rapids-generate-version) +git_commit=$(git rev-parse HEAD) + +RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" +CPP_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp /tmp/libcugraph_dist) + +libraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 cpp efafdb6) +libcugraphops_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact cugraph-ops 629 cpp e7c6f06) +pylibraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 python efafdb6) + +PYTHON_WHEELHOUSE="${PWD}/dist/" +PYTHON_PURE_WHEELHOUSE="${PWD}/pure_dist/" +PYTHON_AUDITED_WHEELHOUSE="${PWD}/final_dist/" + +WHEELHOUSES=("${libraft_wheelhouse}" "${libcugraphops_wheelhouse}" "${pylibraft_wheelhouse}" "${CPP_WHEELHOUSE}" "${PYTHON_WHEELHOUSE}" "${PYTHON_PURE_WHEELHOUSE}") +mkdir -p "${PYTHON_AUDITED_WHEELHOUSE}" + +FIND_LINKS="" +# Iterate over the array +for wheelhouse in "${WHEELHOUSES[@]}"; do + FIND_LINKS+="--find-links ${wheelhouse} " +done + +# This is the version of the suffix with a preceding hyphen. It's used +# everywhere except in the final wheel name. +PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}" + +echo "${version}" > VERSION + +# For nightlies we want to ensure that we're pulling in alphas as well. The +# easiest way to do so is to augment the spec with a constraint containing a +# min alpha version that doesn't affect the version bounds but does allow usage +# of alpha versions for that dependency without --pre +alpha_spec='' +if ! rapids-is-release-build; then + alpha_spec=',>=0.0.0a0' +fi + +build_wheel () { + local package_name="${1}" + local current_wheelhouse="${2}" + + local underscore_package_name=$(echo "${package_name}" | tr "-" "_") + local version_package_name="$underscore_package_name" + if [[ "${version_package_name}" = "nx_cugraph" ]]; then + version_package_name="_nx_cugraph" + fi + + local package_dir="python/${package_name}" + local pyproject_file="${package_dir}/pyproject.toml" + local version_file="${package_dir}/${version_package_name}/_version.py" + + sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file} + sed -i "/^__git_commit__ / s/= .*/= \"${git_commit}\"/g" ${version_file} + + for dep in rmm cudf cugraph libcugraph raft-dask pylibcugraph pylibcugraphops pylibraft ucx-py; do + sed -r -i "s/${dep}==(.*)\"/${dep}${PACKAGE_CUDA_SUFFIX}==\1${alpha_spec}\"/g" ${pyproject_file} + done + + # dask-cuda & rapids-dask-dependency don't get a suffix, but they do get an alpha spec. + for dep in dask-cuda rapids-dask-dependency; do + sed -r -i "s/${dep}==(.*)\"/${dep}==\1${alpha_spec}\"/g" ${pyproject_file} + done + + if [[ $PACKAGE_CUDA_SUFFIX == "-cu12" ]]; then + sed -i "s/cupy-cuda11x/cupy-cuda12x/g" ${pyproject_file} + fi + + python -m pip wheel "${package_dir}" -w ${current_wheelhouse} -vvv --no-deps --disable-pip-version-check ${FIND_LINKS} +} + +build_wheel pylibcugraph "${PYTHON_WHEELHOUSE}" +build_wheel cugraph "${PYTHON_WHEELHOUSE}" +build_wheel nx-cugraph "${PYTHON_PURE_WHEELHOUSE}" +build_wheel cugraph-dgl "${PYTHON_PURE_WHEELHOUSE}" +build_wheel cugraph-pyg "${PYTHON_PURE_WHEELHOUSE}" +build_wheel cugraph-equivariant "${PYTHON_PURE_WHEELHOUSE}" + +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-upload-wheels-to-s3 python ${PYTHON_PURE_WHEELHOUSE} + +python -m auditwheel repair -w "${PYTHON_AUDITED_WHEELHOUSE}" --exclude libcugraph.so --exclude libcugraph_c.so --exclude libraft.so --exclude libcugraph-ops++.so ${PYTHON_WHEELHOUSE}/* +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 python ${PYTHON_AUDITED_WHEELHOUSE} diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index f5c14e8d315..d3d49d6ac0a 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -91,8 +91,6 @@ sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}.*\"/}" cond # CI files for FILE in .github/workflows/*.yaml; do sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}" - # Wheel builds clone cugraph-ops, update its branch - sed_runner "s/extra-repo-sha: branch-.*/extra-repo-sha: branch-${NEXT_SHORT_TAG}/g" "${FILE}" # 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 diff --git a/ci/test_wheel.sh b/ci/test_wheel.sh index 158704e08d1..82c2eab3e34 100755 --- a/ci/test_wheel.sh +++ b/ci/test_wheel.sh @@ -8,18 +8,19 @@ package_dir=$2 python_package_name=$(echo ${package_name}|sed 's/-/_/g') -mkdir -p ./dist RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -# nx-cugraph is a pure wheel, which is part of generating the download path -if [[ "${package_name}" == "nx-cugraph" ]]; then - RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 ./dist -else - RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist -fi -# use 'ls' to expand wildcard before adding `[extra]` requires for pip -# pip creates wheels using python package names -python -m pip install $(ls ./dist/${python_package_name}*.whl)[test] +librmm_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact rmm 1529 cpp) +rmm_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact rmm 1529 python) +libraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 cpp efafdb6) +pylibraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 python efafdb6) +libcugraphops_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact cugraph-ops 629 cpp e7c6f06) + +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp ./dist +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 python ./dist + +python -m pip install "${python_package_name}-${RAPIDS_PY_CUDA_SUFFIX}[test]>=0.0.0a0" --find-links ${librmm_wheelhouse} --find-links ${rmm_wheelhouse} --find-links ${libraft_wheelhouse} --find-links ${pylibraft_wheelhouse} --find-links ${libcugraphops_wheelhouse} --find-links ./dist # Run smoke tests for aarch64 pull requests arch=$(uname -m) diff --git a/ci/test_wheel_cugraph-dgl.sh b/ci/test_wheel_cugraph-dgl.sh index 564b46cb07e..d06e87ad0ae 100755 --- a/ci/test_wheel_cugraph-dgl.sh +++ b/ci/test_wheel_cugraph-dgl.sh @@ -8,19 +8,19 @@ package_dir="python/cugraph-dgl" python_package_name=$(echo ${package_name}|sed 's/-/_/g') -mkdir -p ./dist RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -# Download wheels built during this job. -RAPIDS_PY_WHEEL_NAME="pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./local-deps -RAPIDS_PY_WHEEL_NAME="cugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./local-deps -python -m pip install ./local-deps/*.whl +librmm_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact rmm 1529 cpp) +rmm_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact rmm 1529 python) +libraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 cpp 0435e6b) +pylibraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 python 0435e6b) +libcugraphops_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact cugraph-ops 629 cpp e7c6f06) -# use 'ls' to expand wildcard before adding `[extra]` requires for pip -RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 ./dist -# pip creates wheels using python package names -python -m pip install $(ls ./dist/${python_package_name}*.whl)[test] +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp ./dist +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 python ./dist +python -m pip install "${python_package_name}-${RAPIDS_PY_CUDA_SUFFIX}[test]>=0.0.0a0" --find-links ${librmm_wheelhouse} --find-links ${rmm_wheelhouse} --find-links ${libraft_wheelhouse} --find-links ${pylibraft_wheelhouse} --find-links ${libcugraphops_wheelhouse} --find-links ./dist PKG_CUDA_VER="$(echo ${CUDA_VERSION} | cut -d '.' -f1,2 | tr -d '.')" PKG_CUDA_VER_MAJOR=${PKG_CUDA_VER:0:2} diff --git a/ci/test_wheel_cugraph-equivariant.sh b/ci/test_wheel_cugraph-equivariant.sh index cb952055f06..4f716c22955 100755 --- a/ci/test_wheel_cugraph-equivariant.sh +++ b/ci/test_wheel_cugraph-equivariant.sh @@ -8,14 +8,12 @@ package_dir="python/cugraph-equivariant" python_package_name=$(echo ${package_name}|sed 's/-/_/g') -mkdir -p ./dist RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -# use 'ls' to expand wildcard before adding `[extra]` requires for pip -RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 ./dist -# pip creates wheels using python package names -python -m pip install $(ls ./dist/${python_package_name}*.whl)[test] +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 ./dist +python -m pip install "${python_package_name}-${RAPIDS_PY_CUDA_SUFFIX}[test]>=0.0.0a0" --find-links ./dist PKG_CUDA_VER="$(echo ${CUDA_VERSION} | cut -d '.' -f1,2 | tr -d '.')" PKG_CUDA_VER_MAJOR=${PKG_CUDA_VER:0:2} diff --git a/ci/test_wheel_cugraph-pyg.sh b/ci/test_wheel_cugraph-pyg.sh index c55ae033344..ed5c6b6c4e3 100755 --- a/ci/test_wheel_cugraph-pyg.sh +++ b/ci/test_wheel_cugraph-pyg.sh @@ -8,18 +8,20 @@ package_dir="python/cugraph-pyg" python_package_name=$(echo ${package_name}|sed 's/-/_/g') -mkdir -p ./dist RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -# Download wheels built during this job. -RAPIDS_PY_WHEEL_NAME="pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./local-deps -RAPIDS_PY_WHEEL_NAME="cugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./local-deps -python -m pip install ./local-deps/*.whl +librmm_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact rmm 1529 cpp) +rmm_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact rmm 1529 python) +libraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 cpp 0435e6b) +pylibraft_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact raft 2264 python 0435e6b) +libcugraphops_wheelhouse=$(RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-get-pr-wheel-artifact cugraph-ops 629 cpp e7c6f06) + +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp ./dist +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist +RAPIDS_PY_WHEEL_NAME="${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 python ./dist -# use 'ls' to expand wildcard before adding `[extra]` requires for pip -RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-s3 ./dist # pip creates wheels using python package names -python -m pip install $(ls ./dist/${python_package_name}*.whl)[test] +python -m pip install "${python_package_name}-${RAPIDS_PY_CUDA_SUFFIX}[test]>=0.0.0a0" --find-links ${librmm_wheelhouse} --find-links ${rmm_wheelhouse} --find-links ${libraft_wheelhouse} --find-links ${pylibraft_wheelhouse} --find-links ${libcugraphops_wheelhouse} --find-links ./dist # RAPIDS_DATASET_ROOT_DIR is used by test scripts export RAPIDS_DATASET_ROOT_DIR="$(realpath datasets)" diff --git a/ci/test_wheel_cugraph.sh b/ci/test_wheel_cugraph.sh index d351ea21624..3dd3771a5f4 100755 --- a/ci/test_wheel_cugraph.sh +++ b/ci/test_wheel_cugraph.sh @@ -1,11 +1,6 @@ #!/bin/bash -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. set -eoxu pipefail -# Download the pylibcugraph built in the previous step -RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -RAPIDS_PY_WHEEL_NAME="pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./local-pylibcugraph-dep -python -m pip install --no-deps ./local-pylibcugraph-dep/pylibcugraph*.whl - ./ci/test_wheel.sh cugraph python/cugraph diff --git a/dependencies.yaml b/dependencies.yaml index c37d2080771..a6f6de8f561 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -68,6 +68,22 @@ files: - test_python_common - test_python_cugraph - test_python_pylibcugraph + py_build_libcugraph: + output: pyproject + pyproject_dir: python/libcugraph + extras: + table: build-system + includes: + - common_build + - libcugraph_build + - cpp_wheels + py_run_libcugraph: + output: pyproject + pyproject_dir: python/libcugraph + extras: + table: project + includes: + - cpp_wheels py_build_cugraph: output: pyproject pyproject_dir: python/cugraph @@ -79,6 +95,7 @@ files: - depends_on_pylibraft - depends_on_pylibcugraph - python_build_cythonize + - libcugraph_wheel py_run_cugraph: output: pyproject pyproject_dir: python/cugraph @@ -92,6 +109,7 @@ files: - depends_on_pylibcugraph - depends_on_cupy - python_run_cugraph + - libcugraph_wheel py_test_cugraph: output: pyproject pyproject_dir: python/cugraph @@ -112,14 +130,17 @@ files: - depends_on_rmm - depends_on_pylibraft - python_build_cythonize + - libcugraph_wheel py_run_pylibcugraph: output: pyproject pyproject_dir: python/pylibcugraph extras: table: project includes: + - depends_on_cupy - depends_on_rmm - depends_on_pylibraft + - libcugraph_wheel py_test_pylibcugraph: output: pyproject pyproject_dir: python/pylibcugraph @@ -446,6 +467,23 @@ dependencies: - output_types: [pyproject, requirements] packages: - scikit-build-core[pyproject]>=0.7.0 + libcugraph_wheel: + common: + - output_types: [pyproject, requirements] + packages: + - libcugraph==24.8.* + libcugraph_build: + common: + - output_types: [pyproject, requirements] + packages: + - scikit-build-core[pyproject]>=0.7.0 + cpp_wheels: + common: + - output_types: [requirements, pyproject] + packages: + - librmm==24.8.* + - libraft==24.8.* + - libcugraphops==24.8.* python_run_cugraph: common: - output_types: [conda, pyproject] diff --git a/python/cugraph/CMakeLists.txt b/python/cugraph/CMakeLists.txt index dfccf02d042..63942a845b3 100644 --- a/python/cugraph/CMakeLists.txt +++ b/python/cugraph/CMakeLists.txt @@ -27,11 +27,6 @@ project( LANGUAGES CXX CUDA ) -################################################################################ -# - User Options -------------------------------------------------------------- -option(FIND_CUGRAPH_CPP "Search for existing CUGRAPH C++ installations before defaulting to local files" - OFF -) option(USE_CUGRAPH_OPS "Enable all functions that call cugraph-ops" ON) if(NOT USE_CUGRAPH_OPS) @@ -39,32 +34,10 @@ if(NOT USE_CUGRAPH_OPS) add_compile_definitions(NO_CUGRAPH_OPS) endif() -# If the user requested it, we attempt to find CUGRAPH. -if(FIND_CUGRAPH_CPP) - find_package(cugraph "${RAPIDS_VERSION}" REQUIRED) -else() - set(cugraph_FOUND OFF) -endif() +find_package(cugraph "${RAPIDS_VERSION}" REQUIRED) include(rapids-cython-core) -if(NOT cugraph_FOUND) - set(BUILD_TESTS OFF) - set(BUILD_CUGRAPH_MG_TESTS OFF) - set(BUILD_CUGRAPH_OPS_CPP_TESTS OFF) - set(CUDA_STATIC_RUNTIME ON) - set(USE_RAFT_STATIC ON) - set(CUGRAPH_COMPILE_RAFT_LIB ON) - set(CUGRAPH_USE_CUGRAPH_OPS_STATIC ON) - set(CUGRAPH_EXCLUDE_CUGRAPH_OPS_FROM_ALL ON) - set(ALLOW_CLONE_CUGRAPH_OPS ON) - - add_subdirectory(../../cpp cugraph-cpp EXCLUDE_FROM_ALL) - - set(cython_lib_dir cugraph) - install(TARGETS cugraph DESTINATION ${cython_lib_dir}) -endif() - rapids_cython_init() add_subdirectory(cugraph/components) @@ -76,7 +49,3 @@ add_subdirectory(cugraph/linear_assignment) add_subdirectory(cugraph/structure) add_subdirectory(cugraph/tree) add_subdirectory(cugraph/utilities) - -if(DEFINED cython_lib_dir) - rapids_cython_add_rpath_entries(TARGET cugraph PATHS "${cython_lib_dir}") -endif() diff --git a/python/cugraph/cugraph/__init__.py b/python/cugraph/cugraph/__init__.py index ba7e23df800..55c4d55c081 100644 --- a/python/cugraph/cugraph/__init__.py +++ b/python/cugraph/cugraph/__init__.py @@ -11,6 +11,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +# If libcugraph was installed as a wheel, we must request it to load the library +# symbols. Otherwise, we assume that the library was installed in a system path that ld +# can find. +try: + import libcugraph +except ModuleNotFoundError: + pass +else: + libcugraph.load_library() + del libcugraph + + from cugraph.community import ( ecg, induced_subgraph, diff --git a/python/cugraph/pyproject.toml b/python/cugraph/pyproject.toml index 5e530a61a66..2f0dbd5f115 100644 --- a/python/cugraph/pyproject.toml +++ b/python/cugraph/pyproject.toml @@ -5,6 +5,7 @@ requires = [ "cmake>=3.26.4", "cython>=3.0.0", + "libcugraph==24.8.*", "ninja", "pylibcugraph==24.8.*", "pylibraft==24.8.*", @@ -32,6 +33,7 @@ dependencies = [ "dask-cuda==24.8.*", "dask-cudf==24.8.*", "fsspec[http]>=0.6.0", + "libcugraph==24.8.*", "numba>=0.57", "numpy>=1.23,<2.0a0", "pylibcugraph==24.8.*", diff --git a/python/libcugraph/CMakeLists.txt b/python/libcugraph/CMakeLists.txt new file mode 100644 index 00000000000..429df34ff5c --- /dev/null +++ b/python/libcugraph/CMakeLists.txt @@ -0,0 +1,39 @@ +# ============================================================================= +# Copyright (c) 2024, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= + +cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) + +include(../../rapids_config.cmake) + +include(rapids-cuda) +rapids_cuda_init_architectures(libcugraph-python) + +project( + libcugraph-python + VERSION "${RAPIDS_VERSION}" + LANGUAGES CXX CUDA +) + +option(USE_CUGRAPH_OPS "Enable all functions that call cugraph-ops" ON) + +if(NOT USE_CUGRAPH_OPS) + message(STATUS "Disabling libcugraph functions that reference cugraph-ops") + add_compile_definitions(NO_CUGRAPH_OPS) +endif() + +set(BUILD_TESTS OFF) +set(BUILD_CUGRAPH_MG_TESTS OFF) +set(CUDA_STATIC_RUNTIME ON) + +add_subdirectory(../../cpp cugraph-cpp) diff --git a/python/libcugraph/LICENSE b/python/libcugraph/LICENSE new file mode 120000 index 00000000000..30cff7403da --- /dev/null +++ b/python/libcugraph/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/python/libcugraph/README.md b/python/libcugraph/README.md new file mode 120000 index 00000000000..fe840054137 --- /dev/null +++ b/python/libcugraph/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/python/libcugraph/libcugraph/VERSION b/python/libcugraph/libcugraph/VERSION new file mode 120000 index 00000000000..d62dc733efd --- /dev/null +++ b/python/libcugraph/libcugraph/VERSION @@ -0,0 +1 @@ +../../../VERSION \ No newline at end of file diff --git a/python/libcugraph/libcugraph/__init__.py b/python/libcugraph/libcugraph/__init__.py new file mode 100644 index 00000000000..ad367c7ae01 --- /dev/null +++ b/python/libcugraph/libcugraph/__init__.py @@ -0,0 +1,18 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is simply used to make librmm a real package rather than a namespace +# package to work around https://github.com/scikit-build/scikit-build-core/issues/682. +# Since we have it, we may as well also set up some helpful metadata. +from libcugraph._version import __git_commit__, __version__ +from libcugraph.load import load_library diff --git a/python/libcugraph/libcugraph/_version.py b/python/libcugraph/libcugraph/_version.py new file mode 100644 index 00000000000..cb96e5d7508 --- /dev/null +++ b/python/libcugraph/libcugraph/_version.py @@ -0,0 +1,26 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import importlib.resources + +# Read VERSION file from the module that is symlinked to VERSION file +# in the root of the repo at build time or copied to the moudle at +# installation. VERSION is a separate file that allows CI build-time scripts +# to update version info (including commit hashes) without modifying +# source files. +__version__ = ( + importlib.resources.files("libcugraph").joinpath("VERSION").read_text().strip() +) +__git_commit__ = "" diff --git a/python/libcugraph/libcugraph/load.py b/python/libcugraph/libcugraph/load.py new file mode 100644 index 00000000000..192ca1290d8 --- /dev/null +++ b/python/libcugraph/libcugraph/load.py @@ -0,0 +1,58 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import ctypes +import os + +import libraft +import libcugraphops + + +def load_library(): + # libraft and libcugraphops must be loaded before libcugraph since libcugraph + # references their symbols. + libraft.load_library() + libcugraphops.load_library() + + # Dynamically load libcugraph.so. Prefer a system library if one is present to + # avoid clobbering symbols that other packages might expect, but if no + # other library is present use the one in the wheel. + try: + libcugraph_lib = ctypes.CDLL("libcugraph.so", ctypes.RTLD_GLOBAL) + except OSError: + libcugraph_lib = ctypes.CDLL( + # TODO: Do we always know it will be lib64? Should we consider + # finding a way for CMake to export the path for us to find here? + os.path.join(os.path.dirname(__file__), "lib64", "libcugraph.so"), + ctypes.RTLD_GLOBAL, + ) + + # Dynamically load libcugraph_c.so. Prefer a system library if one is present to + # avoid clobbering symbols that other packages might expect, but if no + # other library is present use the one in the wheel. + try: + libcugraph_c_lib = ctypes.CDLL("libcugraph_c.so", ctypes.RTLD_GLOBAL) + except OSError: + libcugraph_c_lib = ctypes.CDLL( + # TODO: Do we always know it will be lib64? Should we consider + # finding a way for CMake to export the path for us to find here? + os.path.join(os.path.dirname(__file__), "lib64", "libcugraph_c.so"), + ctypes.RTLD_GLOBAL, + ) + + # The caller almost never needs to do anything with these libraries, but no + # harm in offering the option since this object at least provides a handle + # to inspect where libcugraph was loaded from. + return libcugraph_lib, libcugraph_c_lib diff --git a/python/libcugraph/pyproject.toml b/python/libcugraph/pyproject.toml new file mode 100644 index 00000000000..cc266bb6fba --- /dev/null +++ b/python/libcugraph/pyproject.toml @@ -0,0 +1,55 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. + +[build-system] +requires = [ + "cmake>=3.26.4", + "libcugraphops==24.8.*", + "libraft==24.8.*", + "librmm==24.8.*", + "ninja", + "scikit-build-core[pyproject]>=0.7.0", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. +build-backend = "scikit_build_core.build" + +[project] +name = "libcugraph" +dynamic = ["version"] +description = "libcugraph - The libcugraph cuGraph C/C++/CUDA library" +readme = { file = "README.md", content-type = "text/markdown" } +authors = [ + { name = "NVIDIA Corporation" }, +] +license = { text = "Apache 2.0" } +requires-python = ">=3.9" +dependencies = [ + "libcugraphops==24.8.*", + "libraft==24.8.*", + "librmm==24.8.*", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. +classifiers = [ + "Intended Audience :: Developers", + "Programming Language :: C++", + "Environment :: GPU :: NVIDIA CUDA", +] + +[project.urls] +Homepage = "https://github.com/rapidsai/cugraph" +Documentation = "https://docs.rapids.ai/api/cugraph/stable/" + +[project.entry-points."cmake.prefix"] +libcugraph = "libcugraph" + +[tool.scikit-build] +build-dir = "build/{wheel_tag}" +cmake.build-type = "Release" +cmake.minimum-version = "3.26.4" +ninja.make-fallback = true +sdist.reproducible = true +wheel.packages = ["libcugraph"] +wheel.install-dir = "libcugraph" +wheel.py-api = "py3" + +[tool.scikit-build.metadata.version] +provider = "scikit_build_core.metadata.regex" +input = "libcugraph/VERSION" +regex = "(?P.*)" diff --git a/python/pylibcugraph/CMakeLists.txt b/python/pylibcugraph/CMakeLists.txt index f43b7db1279..3e7067d4e0a 100644 --- a/python/pylibcugraph/CMakeLists.txt +++ b/python/pylibcugraph/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) include(../../rapids_config.cmake) -# We always need CUDA for cuML because the raft dependency brings in a +# We always need CUDA for pylibcugraph because the raft dependency brings in a # header-only cuco dependency that enables CUDA unconditionally. include(rapids-cuda) rapids_cuda_init_architectures(pylibcugraph-python) @@ -27,11 +27,6 @@ project( LANGUAGES CXX CUDA ) -################################################################################ -# - User Options -------------------------------------------------------------- -option(FIND_CUGRAPH_CPP "Search for existing CUGRAPH C++ installations before defaulting to local files" - OFF -) option(USE_CUGRAPH_OPS "Enable all functions that call cugraph-ops" ON) if(NOT USE_CUGRAPH_OPS) @@ -39,37 +34,9 @@ if(NOT USE_CUGRAPH_OPS) add_compile_definitions(NO_CUGRAPH_OPS) endif() -# If the user requested it we attempt to find CUGRAPH. -if(FIND_CUGRAPH_CPP) - find_package(cugraph "${RAPIDS_VERSION}" REQUIRED) -else() - set(cugraph_FOUND OFF) -endif() +find_package(cugraph "${RAPIDS_VERSION}" REQUIRED) include(rapids-cython-core) - -if (NOT cugraph_FOUND) - set(BUILD_TESTS OFF) - set(BUILD_CUGRAPH_MG_TESTS OFF) - set(BUILD_CUGRAPH_OPS_CPP_TESTS OFF) - set(CUDA_STATIC_RUNTIME ON) - set(USE_RAFT_STATIC ON) - set(CUGRAPH_COMPILE_RAFT_LIB ON) - set(CUGRAPH_USE_CUGRAPH_OPS_STATIC ON) - set(CUGRAPH_EXCLUDE_CUGRAPH_OPS_FROM_ALL ON) - set(ALLOW_CLONE_CUGRAPH_OPS ON) - - add_subdirectory(../../cpp cugraph-cpp EXCLUDE_FROM_ALL) - - set(cython_lib_dir pylibcugraph) - install(TARGETS cugraph DESTINATION ${cython_lib_dir}) - install(TARGETS cugraph_c DESTINATION ${cython_lib_dir}) -endif() - rapids_cython_init() add_subdirectory(pylibcugraph) - -if(DEFINED cython_lib_dir) - rapids_cython_add_rpath_entries(TARGET cugraph PATHS "${cython_lib_dir}") -endif() diff --git a/python/pylibcugraph/pylibcugraph/__init__.py b/python/pylibcugraph/pylibcugraph/__init__.py index dcdef05e106..dd64a51d582 100644 --- a/python/pylibcugraph/pylibcugraph/__init__.py +++ b/python/pylibcugraph/pylibcugraph/__init__.py @@ -11,6 +11,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +# If libcugraph was installed as a wheel, we must request it to load the library +# symbols. Otherwise, we assume that the library was installed in a system path that ld +# can find. +try: + import libcugraph +except ModuleNotFoundError: + pass +else: + libcugraph.load_library() + del libcugraph + + from pylibcugraph.components._connectivity import ( strongly_connected_components, ) diff --git a/python/pylibcugraph/pyproject.toml b/python/pylibcugraph/pyproject.toml index fdb82244e37..9dd7a975bab 100644 --- a/python/pylibcugraph/pyproject.toml +++ b/python/pylibcugraph/pyproject.toml @@ -5,6 +5,7 @@ requires = [ "cmake>=3.26.4", "cython>=3.0.0", + "libcugraph==24.8.*", "ninja", "pylibraft==24.8.*", "rmm==24.8.*", @@ -26,6 +27,8 @@ authors = [ license = { text = "Apache 2.0" } requires-python = ">=3.9" dependencies = [ + "cupy-cuda11x>=12.0.0", + "libcugraph==24.8.*", "pylibraft==24.8.*", "rmm==24.8.*", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.