From 04b4d11fa6db1eb1029d802fe91adcc4c044b361 Mon Sep 17 00:00:00 2001 From: Ray Douglass Date: Fri, 15 Mar 2024 11:49:52 -0400 Subject: [PATCH 1/9] DOC v24.06 Updates [skip ci] --- .../cuda11.8-conda/devcontainer.json | 4 +- .devcontainer/cuda11.8-pip/devcontainer.json | 8 +-- .../cuda12.2-conda/devcontainer.json | 4 +- .devcontainer/cuda12.2-pip/devcontainer.json | 8 +-- .github/workflows/build.yaml | 36 +++++----- .github/workflows/pr.yaml | 48 ++++++------- .github/workflows/test.yaml | 18 ++--- VERSION | 2 +- .../all_cuda-118_arch-x86_64.yaml | 30 ++++---- .../all_cuda-122_arch-x86_64.yaml | 30 ++++---- .../cugraph-service/conda_build_config.yaml | 2 +- conda/recipes/cugraph/conda_build_config.yaml | 2 +- .../pylibcugraph/conda_build_config.yaml | 2 +- dependencies.yaml | 68 +++++++++---------- docs/cugraph/source/nx_cugraph/nx_cugraph.md | 2 +- notebooks/README.md | 8 +-- .../conda/cugraph_dgl_dev_cuda-118.yaml | 4 +- python/cugraph-dgl/pyproject.toml | 4 +- python/cugraph-equivariant/pyproject.toml | 2 +- .../conda/cugraph_pyg_dev_cuda-118.yaml | 4 +- python/cugraph-pyg/pyproject.toml | 4 +- python/cugraph-service/server/pyproject.toml | 16 ++--- python/cugraph/pyproject.toml | 22 +++--- python/nx-cugraph/pyproject.toml | 2 +- python/pylibcugraph/pyproject.toml | 10 +-- 25 files changed, 170 insertions(+), 170 deletions(-) diff --git a/.devcontainer/cuda11.8-conda/devcontainer.json b/.devcontainer/cuda11.8-conda/devcontainer.json index 4c8eb45734e..bab521f485d 100644 --- a/.devcontainer/cuda11.8-conda/devcontainer.json +++ b/.devcontainer/cuda11.8-conda/devcontainer.json @@ -5,12 +5,12 @@ "args": { "CUDA": "11.8", "PYTHON_PACKAGE_MANAGER": "conda", - "BASE": "rapidsai/devcontainers:24.04-cpp-cuda11.8-mambaforge-ubuntu22.04" + "BASE": "rapidsai/devcontainers:24.06-cpp-cuda11.8-mambaforge-ubuntu22.04" } }, "hostRequirements": {"gpu": "optional"}, "features": { - "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.4": {} + "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.6": {} }, "overrideFeatureInstallOrder": [ "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils" diff --git a/.devcontainer/cuda11.8-pip/devcontainer.json b/.devcontainer/cuda11.8-pip/devcontainer.json index 4e0f6d23570..d225f15f755 100644 --- a/.devcontainer/cuda11.8-pip/devcontainer.json +++ b/.devcontainer/cuda11.8-pip/devcontainer.json @@ -5,22 +5,22 @@ "args": { "CUDA": "11.8", "PYTHON_PACKAGE_MANAGER": "pip", - "BASE": "rapidsai/devcontainers:24.04-cpp-cuda11.8-ubuntu22.04" + "BASE": "rapidsai/devcontainers:24.06-cpp-cuda11.8-ubuntu22.04" } }, "hostRequirements": {"gpu": "optional"}, "features": { - "ghcr.io/rapidsai/devcontainers/features/ucx:24.4": { + "ghcr.io/rapidsai/devcontainers/features/ucx:24.6": { "version": "1.14.1" }, - "ghcr.io/rapidsai/devcontainers/features/cuda:24.4": { + "ghcr.io/rapidsai/devcontainers/features/cuda:24.6": { "version": "11.8", "installcuBLAS": true, "installcuSOLVER": true, "installcuRAND": true, "installcuSPARSE": true }, - "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.4": {} + "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.6": {} }, "overrideFeatureInstallOrder": [ "ghcr.io/rapidsai/devcontainers/features/ucx", diff --git a/.devcontainer/cuda12.2-conda/devcontainer.json b/.devcontainer/cuda12.2-conda/devcontainer.json index 8750312f341..bcaabab572b 100644 --- a/.devcontainer/cuda12.2-conda/devcontainer.json +++ b/.devcontainer/cuda12.2-conda/devcontainer.json @@ -5,12 +5,12 @@ "args": { "CUDA": "12.2", "PYTHON_PACKAGE_MANAGER": "conda", - "BASE": "rapidsai/devcontainers:24.04-cpp-mambaforge-ubuntu22.04" + "BASE": "rapidsai/devcontainers:24.06-cpp-mambaforge-ubuntu22.04" } }, "hostRequirements": {"gpu": "optional"}, "features": { - "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.4": {} + "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.6": {} }, "overrideFeatureInstallOrder": [ "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils" diff --git a/.devcontainer/cuda12.2-pip/devcontainer.json b/.devcontainer/cuda12.2-pip/devcontainer.json index 5762aab9f6d..e472f4621f9 100644 --- a/.devcontainer/cuda12.2-pip/devcontainer.json +++ b/.devcontainer/cuda12.2-pip/devcontainer.json @@ -5,22 +5,22 @@ "args": { "CUDA": "12.2", "PYTHON_PACKAGE_MANAGER": "pip", - "BASE": "rapidsai/devcontainers:24.04-cpp-cuda12.2-ubuntu22.04" + "BASE": "rapidsai/devcontainers:24.06-cpp-cuda12.2-ubuntu22.04" } }, "hostRequirements": {"gpu": "optional"}, "features": { - "ghcr.io/rapidsai/devcontainers/features/ucx:24.4": { + "ghcr.io/rapidsai/devcontainers/features/ucx:24.6": { "version": "1.14.1" }, - "ghcr.io/rapidsai/devcontainers/features/cuda:24.4": { + "ghcr.io/rapidsai/devcontainers/features/cuda:24.6": { "version": "12.2", "installcuBLAS": true, "installcuSOLVER": true, "installcuRAND": true, "installcuSPARSE": true }, - "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.4": {} + "ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:24.6": {} }, "overrideFeatureInstallOrder": [ "ghcr.io/rapidsai/devcontainers/features/ucx", diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5ecff1f8a75..f50dd646817 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,7 +28,7 @@ concurrency: jobs: cpp-build: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -38,7 +38,7 @@ jobs: python-build: needs: [cpp-build] secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -47,7 +47,7 @@ jobs: upload-conda: needs: [cpp-build, python-build] secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -57,7 +57,7 @@ jobs: if: github.ref_type == 'branch' needs: python-build secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.06 with: arch: "amd64" branch: ${{ inputs.branch }} @@ -69,7 +69,7 @@ jobs: sha: ${{ inputs.sha }} wheel-build-pylibcugraph: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -77,13 +77,13 @@ jobs: date: ${{ inputs.date }} script: ci/build_wheel_pylibcugraph.sh extra-repo: rapidsai/cugraph-ops - extra-repo-sha: branch-24.04 + extra-repo-sha: branch-24.06 extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY node_type: cpu32 wheel-publish-pylibcugraph: needs: wheel-build-pylibcugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -93,7 +93,7 @@ jobs: wheel-build-cugraph: needs: wheel-publish-pylibcugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -101,12 +101,12 @@ jobs: date: ${{ inputs.date }} script: ci/build_wheel_cugraph.sh extra-repo: rapidsai/cugraph-ops - extra-repo-sha: branch-24.04 + extra-repo-sha: branch-24.06 extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY wheel-publish-cugraph: needs: wheel-build-cugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -116,7 +116,7 @@ jobs: wheel-build-nx-cugraph: needs: wheel-publish-pylibcugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -126,7 +126,7 @@ jobs: wheel-publish-nx-cugraph: needs: wheel-build-nx-cugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -136,7 +136,7 @@ jobs: wheel-build-cugraph-dgl: needs: wheel-publish-cugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -146,7 +146,7 @@ jobs: wheel-publish-cugraph-dgl: needs: wheel-build-cugraph-dgl secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -156,7 +156,7 @@ jobs: wheel-build-cugraph-pyg: needs: wheel-publish-cugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -166,7 +166,7 @@ jobs: wheel-publish-cugraph-pyg: needs: wheel-build-cugraph-pyg secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -175,7 +175,7 @@ jobs: package-name: cugraph-pyg wheel-build-cugraph-equivariant: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -185,7 +185,7 @@ jobs: wheel-publish-cugraph-equivariant: needs: wheel-build-cugraph-equivariant secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.06 with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7c8c9973462..c04e0e879d2 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -34,29 +34,29 @@ jobs: - wheel-tests-cugraph-equivariant - devcontainer secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-24.06 checks: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.06 with: enable_check_generated_files: false conda-cpp-build: needs: checks secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.06 with: build_type: pull-request node_type: cpu32 conda-cpp-tests: needs: conda-cpp-build secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.06 with: build_type: pull-request conda-cpp-checks: needs: conda-cpp-build secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@branch-24.06 with: build_type: pull-request enable_check_symbols: true @@ -64,19 +64,19 @@ jobs: conda-python-build: needs: conda-cpp-build secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.06 with: build_type: pull-request conda-python-tests: needs: conda-python-build secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.06 with: build_type: pull-request conda-notebook-tests: needs: conda-python-build secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.06 with: build_type: pull-request node_type: "gpu-v100-latest-1" @@ -86,7 +86,7 @@ jobs: docs-build: needs: conda-python-build secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.06 with: build_type: pull-request node_type: "gpu-v100-latest-1" @@ -96,63 +96,63 @@ jobs: wheel-build-pylibcugraph: needs: checks secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: pull-request script: ci/build_wheel_pylibcugraph.sh extra-repo: rapidsai/cugraph-ops - extra-repo-sha: branch-24.04 + extra-repo-sha: branch-24.06 extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY node_type: cpu32 wheel-tests-pylibcugraph: needs: wheel-build-pylibcugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 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.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: pull-request script: ci/build_wheel_cugraph.sh extra-repo: rapidsai/cugraph-ops - extra-repo-sha: branch-24.04 + extra-repo-sha: branch-24.06 extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY wheel-tests-cugraph: needs: wheel-build-cugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: pull-request script: ci/test_wheel_cugraph.sh wheel-build-nx-cugraph: needs: wheel-tests-pylibcugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: pull-request script: ci/build_wheel_nx-cugraph.sh wheel-tests-nx-cugraph: needs: wheel-build-nx-cugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 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.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: pull-request script: ci/build_wheel_cugraph-dgl.sh wheel-tests-cugraph-dgl: needs: wheel-build-cugraph-dgl secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: pull-request script: ci/test_wheel_cugraph-dgl.sh @@ -160,35 +160,35 @@ jobs: wheel-build-cugraph-pyg: needs: wheel-tests-cugraph secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: pull-request script: ci/build_wheel_cugraph-pyg.sh wheel-tests-cugraph-pyg: needs: wheel-build-cugraph-pyg secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 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.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.06 with: build_type: pull-request script: ci/build_wheel_cugraph-equivariant.sh wheel-tests-cugraph-equivariant: needs: wheel-build-cugraph-equivariant secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: pull-request script: ci/test_wheel_cugraph-equivariant.sh matrix_filter: map(select(.ARCH == "amd64")) devcontainer: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/build-in-devcontainer.yaml@fix/devcontainer-json-location + uses: rapidsai/shared-workflows/.github/workflows/build-in-devcontainer.yaml@branch-24.06 with: arch: '["amd64"]' cuda: '["12.2"]' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0bd095bfa94..29ea6723b64 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,7 +16,7 @@ on: jobs: conda-cpp-checks: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -26,7 +26,7 @@ jobs: symbol_exclusions: (cugraph::ops|hornet|void writeEdgeCountsKernel|void markUniqueOffsetsKernel) conda-cpp-tests: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -34,7 +34,7 @@ jobs: sha: ${{ inputs.sha }} conda-python-tests: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -42,7 +42,7 @@ jobs: sha: ${{ inputs.sha }} wheel-tests-pylibcugraph: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -51,7 +51,7 @@ jobs: script: ci/test_wheel_pylibcugraph.sh wheel-tests-cugraph: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -60,7 +60,7 @@ jobs: script: ci/test_wheel_cugraph.sh wheel-tests-nx-cugraph: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -69,7 +69,7 @@ jobs: script: ci/test_wheel_nx-cugraph.sh wheel-tests-cugraph-dgl: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -79,7 +79,7 @@ jobs: matrix_filter: map(select(.ARCH == "amd64")) wheel-tests-cugraph-pyg: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} @@ -89,7 +89,7 @@ jobs: matrix_filter: map(select(.ARCH == "amd64")) wheel-tests-cugraph-equivariant: secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04 + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.06 with: build_type: nightly branch: ${{ inputs.branch }} diff --git a/VERSION b/VERSION index 4a2fe8aa570..0bff6981a3d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -24.04.00 +24.06.00 diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index f0eff82e1ae..f656df9e32b 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -17,12 +17,12 @@ dependencies: - cuda-nvtx - cuda-version=11.8 - cudatoolkit -- cudf==24.4.* +- cudf==24.6.* - cupy>=12.0.0 - cxx-compiler - cython>=3.0.0 -- dask-cuda==24.4.* -- dask-cudf==24.4.* +- dask-cuda==24.6.* +- dask-cudf==24.6.* - doxygen - fsspec>=0.6.0 - gcc_linux-64=11.* @@ -30,11 +30,11 @@ dependencies: - graphviz - gtest>=1.13.0 - ipython -- libcudf==24.4.* -- libcugraphops==24.4.* -- libraft-headers==24.4.* -- libraft==24.4.* -- librmm==24.4.* +- libcudf==24.6.* +- libcugraphops==24.6.* +- libraft-headers==24.6.* +- libraft==24.6.* +- librmm==24.6.* - nbsphinx - nccl>=2.9.9 - networkx>=2.5.1 @@ -50,20 +50,20 @@ dependencies: - pandas - pre-commit - pydata-sphinx-theme -- pylibcugraphops==24.4.* -- pylibraft==24.4.* -- pylibwholegraph==24.4.* +- pylibcugraphops==24.6.* +- pylibraft==24.6.* +- pylibwholegraph==24.6.* - pytest - pytest-benchmark - pytest-cov - pytest-mpl - pytest-xdist - python-louvain -- raft-dask==24.4.* -- rapids-dask-dependency==24.4.* +- raft-dask==24.6.* +- rapids-dask-dependency==24.6.* - recommonmark - requests -- rmm==24.4.* +- rmm==24.6.* - scikit-build-core>=0.7.0 - scikit-learn>=0.23.1 - scipy @@ -73,7 +73,7 @@ dependencies: - sphinx<6 - sphinxcontrib-websupport - ucx-proc=*=gpu -- ucx-py==0.37.* +- ucx-py==0.38.* - wget - wheel name: all_cuda-118_arch-x86_64 diff --git a/conda/environments/all_cuda-122_arch-x86_64.yaml b/conda/environments/all_cuda-122_arch-x86_64.yaml index 93972f40d8b..2bd0746e49c 100644 --- a/conda/environments/all_cuda-122_arch-x86_64.yaml +++ b/conda/environments/all_cuda-122_arch-x86_64.yaml @@ -19,12 +19,12 @@ dependencies: - cuda-nvtx-dev - cuda-profiler-api - cuda-version=12.2 -- cudf==24.4.* +- cudf==24.6.* - cupy>=12.0.0 - cxx-compiler - cython>=3.0.0 -- dask-cuda==24.4.* -- dask-cudf==24.4.* +- dask-cuda==24.6.* +- dask-cudf==24.6.* - doxygen - fsspec>=0.6.0 - gcc_linux-64=11.* @@ -33,14 +33,14 @@ dependencies: - gtest>=1.13.0 - ipython - libcublas-dev -- libcudf==24.4.* -- libcugraphops==24.4.* +- libcudf==24.6.* +- libcugraphops==24.6.* - libcurand-dev - libcusolver-dev - libcusparse-dev -- libraft-headers==24.4.* -- libraft==24.4.* -- librmm==24.4.* +- libraft-headers==24.6.* +- libraft==24.6.* +- librmm==24.6.* - nbsphinx - nccl>=2.9.9 - networkx>=2.5.1 @@ -55,20 +55,20 @@ dependencies: - pandas - pre-commit - pydata-sphinx-theme -- pylibcugraphops==24.4.* -- pylibraft==24.4.* -- pylibwholegraph==24.4.* +- pylibcugraphops==24.6.* +- pylibraft==24.6.* +- pylibwholegraph==24.6.* - pytest - pytest-benchmark - pytest-cov - pytest-mpl - pytest-xdist - python-louvain -- raft-dask==24.4.* -- rapids-dask-dependency==24.4.* +- raft-dask==24.6.* +- rapids-dask-dependency==24.6.* - recommonmark - requests -- rmm==24.4.* +- rmm==24.6.* - scikit-build-core>=0.7.0 - scikit-learn>=0.23.1 - scipy @@ -78,7 +78,7 @@ dependencies: - sphinx<6 - sphinxcontrib-websupport - ucx-proc=*=gpu -- ucx-py==0.37.* +- ucx-py==0.38.* - wget - wheel name: all_cuda-122_arch-x86_64 diff --git a/conda/recipes/cugraph-service/conda_build_config.yaml b/conda/recipes/cugraph-service/conda_build_config.yaml index 11ec3d6ebe4..a54c7c2bb3e 100644 --- a/conda/recipes/cugraph-service/conda_build_config.yaml +++ b/conda/recipes/cugraph-service/conda_build_config.yaml @@ -1,2 +1,2 @@ ucx_py_version: - - "0.37.*" + - "0.38.*" diff --git a/conda/recipes/cugraph/conda_build_config.yaml b/conda/recipes/cugraph/conda_build_config.yaml index 6092360a404..e50e325b675 100644 --- a/conda/recipes/cugraph/conda_build_config.yaml +++ b/conda/recipes/cugraph/conda_build_config.yaml @@ -17,4 +17,4 @@ sysroot_version: - "2.17" ucx_py_version: - - "0.37.*" + - "0.38.*" diff --git a/conda/recipes/pylibcugraph/conda_build_config.yaml b/conda/recipes/pylibcugraph/conda_build_config.yaml index 6092360a404..e50e325b675 100644 --- a/conda/recipes/pylibcugraph/conda_build_config.yaml +++ b/conda/recipes/pylibcugraph/conda_build_config.yaml @@ -17,4 +17,4 @@ sysroot_version: - "2.17" ucx_py_version: - - "0.37.*" + - "0.38.*" diff --git a/dependencies.yaml b/dependencies.yaml index d8be5352c7d..85fb1344ce9 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -357,11 +357,11 @@ dependencies: - cxx-compiler - gmock>=1.13.0 - gtest>=1.13.0 - - libcudf==24.4.* - - libcugraphops==24.4.* - - libraft-headers==24.4.* - - libraft==24.4.* - - librmm==24.4.* + - libcudf==24.6.* + - libcugraphops==24.6.* + - libraft-headers==24.6.* + - libraft==24.6.* + - librmm==24.6.* - openmpi # Required for building cpp-mgtests (multi-GPU tests) specific: - output_types: [conda] @@ -446,11 +446,11 @@ dependencies: common: - output_types: [conda, pyproject] packages: - - &dask rapids-dask-dependency==24.4.* - - &dask_cuda dask-cuda==24.4.* + - &dask rapids-dask-dependency==24.6.* + - &dask_cuda dask-cuda==24.6.* - &numba numba>=0.57 - &numpy numpy>=1.23,<2.0a0 - - &ucx_py ucx-py==0.37.* + - &ucx_py ucx-py==0.38.* - output_types: conda packages: - aiohttp @@ -477,7 +477,7 @@ dependencies: - *numpy - output_types: [pyproject] packages: - - &cugraph cugraph==24.4.* + - &cugraph cugraph==24.6.* python_run_cugraph_pyg: common: - output_types: [conda, pyproject] @@ -505,7 +505,7 @@ dependencies: - output_types: pyproject packages: - *cugraph - - cugraph-service-client==24.4.* + - cugraph-service-client==24.6.* test_cpp: common: - output_types: conda @@ -540,7 +540,7 @@ dependencies: - scikit-learn>=0.23.1 - output_types: [conda] packages: - - pylibwholegraph==24.4.* + - pylibwholegraph==24.6.* test_python_pylibcugraph: common: - output_types: [conda, pyproject] @@ -557,7 +557,7 @@ dependencies: common: - output_types: [conda] packages: - - cugraph==24.4.* + - cugraph==24.6.* - pytorch>=2.0 - pytorch-cuda==11.8 - dgl>=1.1.0.cu* @@ -565,7 +565,7 @@ dependencies: common: - output_types: [conda] packages: - - cugraph==24.4.* + - cugraph==24.6.* - pytorch>=2.0 - pytorch-cuda==11.8 - pyg>=2.4.0 @@ -574,7 +574,7 @@ dependencies: common: - output_types: conda packages: - - &rmm_conda rmm==24.4.* + - &rmm_conda rmm==24.6.* - output_types: requirements packages: # pip recognizes the index as a global option for the requirements.txt file @@ -585,17 +585,17 @@ dependencies: matrices: - matrix: {cuda: "12.*"} packages: - - rmm-cu12==24.4.* + - rmm-cu12==24.6.* - matrix: {cuda: "11.*"} packages: - - rmm-cu11==24.4.* + - rmm-cu11==24.6.* - {matrix: null, packages: [*rmm_conda]} depends_on_cudf: common: - output_types: conda packages: - - &cudf_conda cudf==24.4.* + - &cudf_conda cudf==24.6.* - output_types: requirements packages: # pip recognizes the index as a global option for the requirements.txt file @@ -606,17 +606,17 @@ dependencies: matrices: - matrix: {cuda: "12.*"} packages: - - cudf-cu12==24.4.* + - cudf-cu12==24.6.* - matrix: {cuda: "11.*"} packages: - - cudf-cu11==24.4.* + - cudf-cu11==24.6.* - {matrix: null, packages: [*cudf_conda]} depends_on_dask_cudf: common: - output_types: conda packages: - - &dask_cudf_conda dask-cudf==24.4.* + - &dask_cudf_conda dask-cudf==24.6.* - output_types: requirements packages: # pip recognizes the index as a global option for the requirements.txt file @@ -627,17 +627,17 @@ dependencies: matrices: - matrix: {cuda: "12.*"} packages: - - dask-cudf-cu12==24.4.* + - dask-cudf-cu12==24.6.* - matrix: {cuda: "11.*"} packages: - - dask-cudf-cu11==24.4.* + - dask-cudf-cu11==24.6.* - {matrix: null, packages: [*dask_cudf_conda]} depends_on_pylibraft: common: - output_types: conda packages: - - &pylibraft_conda pylibraft==24.4.* + - &pylibraft_conda pylibraft==24.6.* - output_types: requirements packages: # pip recognizes the index as a global option for the requirements.txt file @@ -648,17 +648,17 @@ dependencies: matrices: - matrix: {cuda: "12.*"} packages: - - pylibraft-cu12==24.4.* + - pylibraft-cu12==24.6.* - matrix: {cuda: "11.*"} packages: - - pylibraft-cu11==24.4.* + - pylibraft-cu11==24.6.* - {matrix: null, packages: [*pylibraft_conda]} depends_on_raft_dask: common: - output_types: conda packages: - - &raft_dask_conda raft-dask==24.4.* + - &raft_dask_conda raft-dask==24.6.* - output_types: requirements packages: # pip recognizes the index as a global option for the requirements.txt file @@ -669,17 +669,17 @@ dependencies: matrices: - matrix: {cuda: "12.*"} packages: - - raft-dask-cu12==24.4.* + - raft-dask-cu12==24.6.* - matrix: {cuda: "11.*"} packages: - - raft-dask-cu11==24.4.* + - raft-dask-cu11==24.6.* - {matrix: null, packages: [*raft_dask_conda]} depends_on_pylibcugraph: common: - output_types: conda packages: - - &pylibcugraph_conda pylibcugraph==24.4.* + - &pylibcugraph_conda pylibcugraph==24.6.* - output_types: requirements packages: # pip recognizes the index as a global option for the requirements.txt file @@ -690,17 +690,17 @@ dependencies: matrices: - matrix: {cuda: "12.*"} packages: - - pylibcugraph-cu12==24.4.* + - pylibcugraph-cu12==24.6.* - matrix: {cuda: "11.*"} packages: - - pylibcugraph-cu11==24.4.* + - pylibcugraph-cu11==24.6.* - {matrix: null, packages: [*pylibcugraph_conda]} depends_on_pylibcugraphops: common: - output_types: conda packages: - - &pylibcugraphops_conda pylibcugraphops==24.4.* + - &pylibcugraphops_conda pylibcugraphops==24.6.* - output_types: requirements packages: # pip recognizes the index as a global option for the requirements.txt file @@ -711,10 +711,10 @@ dependencies: matrices: - matrix: {cuda: "12.*"} packages: - - pylibcugraphops-cu12==24.4.* + - pylibcugraphops-cu12==24.6.* - matrix: {cuda: "11.*"} packages: - - pylibcugraphops-cu11==24.4.* + - pylibcugraphops-cu11==24.6.* - {matrix: null, packages: [*pylibcugraphops_conda]} depends_on_cupy: diff --git a/docs/cugraph/source/nx_cugraph/nx_cugraph.md b/docs/cugraph/source/nx_cugraph/nx_cugraph.md index 8d497e3a1d7..92fbf90a43b 100644 --- a/docs/cugraph/source/nx_cugraph/nx_cugraph.md +++ b/docs/cugraph/source/nx_cugraph/nx_cugraph.md @@ -4,7 +4,7 @@ Whereas previous versions of cuGraph have included mechanisms to make it trivial to plug in cuGraph algorithm calls. Beginning with version 24.02, nx-cuGraph is now a [networkX backend](). -The user now need only [install nx-cugraph]() +The user now need only [install nx-cugraph]() to experience GPU speedups. Lets look at some examples of algorithm speedups comparing CPU based NetworkX to dispatched versions run on GPU with nx_cugraph. diff --git a/notebooks/README.md b/notebooks/README.md index 31660b21569..c7916da4642 100644 --- a/notebooks/README.md +++ b/notebooks/README.md @@ -67,13 +67,13 @@ The easiest way to run the notebooks is to get the latest [rapidsai/notebooks](h For example, get the latest (as of writing the document) nightly image (`a` after the version number indicates that an image is nightly) with cuda 12.0 using ```sh -docker pull rapidsai/notebooks:24.04a-cuda12.0-py3.9 +docker pull rapidsai/notebooks:24.06a-cuda12.0-py3.9 ``` And, then run a container based on the image using ```sh -docker run --rm -it --pull always --gpus all --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 -p 8888:8888 rapidsai/notebooks:24.04a-cuda12.0-py3.9 +docker run --rm -it --pull always --gpus all --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 -p 8888:8888 rapidsai/notebooks:24.06a-cuda12.0-py3.9 ``` You are all set. Run and edit cugraph notebooks from a browser at url http://127.0.0.1:8888/lab/tree/cugraph/cugraph_benchmarks @@ -89,8 +89,8 @@ ssh -L 127.0.0.1:8888:127.0.0.1:8888 [USER_NAME@][REMOTE_HOST_NAME or REMOTE_HO and then run the container in your remote machine. ```sh -docker pull rapidsai/notebooks:24.04a-cuda12.0-py3.9 -docker run --rm -it --pull always --gpus all --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 -p 8888:8888 rapidsai/notebooks:24.04a-cuda12.0-py3.9 +docker pull rapidsai/notebooks:24.06a-cuda12.0-py3.9 +docker run --rm -it --pull always --gpus all --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 -p 8888:8888 rapidsai/notebooks:24.06a-cuda12.0-py3.9 ``` You can run and edit cugraph notebooks at url http://127.0.0.1:8888/lab/tree/cugraph/cugraph_benchmarks as if they are running locally. diff --git a/python/cugraph-dgl/conda/cugraph_dgl_dev_cuda-118.yaml b/python/cugraph-dgl/conda/cugraph_dgl_dev_cuda-118.yaml index aab2834d445..feafe57246c 100644 --- a/python/cugraph-dgl/conda/cugraph_dgl_dev_cuda-118.yaml +++ b/python/cugraph-dgl/conda/cugraph_dgl_dev_cuda-118.yaml @@ -10,11 +10,11 @@ channels: - conda-forge - nvidia dependencies: -- cugraph==24.4.* +- cugraph==24.6.* - dgl>=1.1.0.cu* - pandas - pre-commit -- pylibcugraphops==24.4.* +- pylibcugraphops==24.6.* - pytest - pytest-benchmark - pytest-cov diff --git a/python/cugraph-dgl/pyproject.toml b/python/cugraph-dgl/pyproject.toml index f17292c5e70..37ea8b850bd 100644 --- a/python/cugraph-dgl/pyproject.toml +++ b/python/cugraph-dgl/pyproject.toml @@ -23,10 +23,10 @@ classifiers = [ "Programming Language :: Python", ] dependencies = [ - "cugraph==24.4.*", + "cugraph==24.6.*", "numba>=0.57", "numpy>=1.23,<2.0a0", - "pylibcugraphops==24.4.*", + "pylibcugraphops==24.6.*", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. [project.optional-dependencies] diff --git a/python/cugraph-equivariant/pyproject.toml b/python/cugraph-equivariant/pyproject.toml index d7d608daa56..8947f77d7c9 100644 --- a/python/cugraph-equivariant/pyproject.toml +++ b/python/cugraph-equivariant/pyproject.toml @@ -35,7 +35,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "pylibcugraphops==24.4.*", + "pylibcugraphops==24.6.*", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. [project.urls] diff --git a/python/cugraph-pyg/conda/cugraph_pyg_dev_cuda-118.yaml b/python/cugraph-pyg/conda/cugraph_pyg_dev_cuda-118.yaml index 84d5fea4eed..81c53044a1a 100644 --- a/python/cugraph-pyg/conda/cugraph_pyg_dev_cuda-118.yaml +++ b/python/cugraph-pyg/conda/cugraph_pyg_dev_cuda-118.yaml @@ -10,11 +10,11 @@ channels: - conda-forge - nvidia dependencies: -- cugraph==24.4.* +- cugraph==24.6.* - pandas - pre-commit - pyg>=2.4.0 -- pylibcugraphops==24.4.* +- pylibcugraphops==24.6.* - pytest - pytest-benchmark - pytest-cov diff --git a/python/cugraph-pyg/pyproject.toml b/python/cugraph-pyg/pyproject.toml index 150ecbf506b..dfa522e6047 100644 --- a/python/cugraph-pyg/pyproject.toml +++ b/python/cugraph-pyg/pyproject.toml @@ -27,10 +27,10 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "cugraph==24.4.*", + "cugraph==24.6.*", "numba>=0.57", "numpy>=1.23,<2.0a0", - "pylibcugraphops==24.4.*", + "pylibcugraphops==24.6.*", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. [project.urls] diff --git a/python/cugraph-service/server/pyproject.toml b/python/cugraph-service/server/pyproject.toml index d6cf48432cb..020007ed902 100644 --- a/python/cugraph-service/server/pyproject.toml +++ b/python/cugraph-service/server/pyproject.toml @@ -19,18 +19,18 @@ authors = [ license = { text = "Apache 2.0" } requires-python = ">=3.9" dependencies = [ - "cudf==24.4.*", - "cugraph-service-client==24.4.*", - "cugraph==24.4.*", + "cudf==24.6.*", + "cugraph-service-client==24.6.*", + "cugraph==24.6.*", "cupy-cuda11x>=12.0.0", - "dask-cuda==24.4.*", - "dask-cudf==24.4.*", + "dask-cuda==24.6.*", + "dask-cudf==24.6.*", "numba>=0.57", "numpy>=1.23,<2.0a0", - "rapids-dask-dependency==24.4.*", - "rmm==24.4.*", + "rapids-dask-dependency==24.6.*", + "rmm==24.6.*", "thriftpy2", - "ucx-py==0.37.*", + "ucx-py==0.38.*", ] # 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", diff --git a/python/cugraph/pyproject.toml b/python/cugraph/pyproject.toml index a6d3d841298..b29d6f80ff0 100644 --- a/python/cugraph/pyproject.toml +++ b/python/cugraph/pyproject.toml @@ -6,9 +6,9 @@ requires = [ "cmake>=3.26.4", "cython>=3.0.0", "ninja", - "pylibcugraph==24.4.*", - "pylibraft==24.4.*", - "rmm==24.4.*", + "pylibcugraph==24.6.*", + "pylibraft==24.6.*", + "rmm==24.6.*", "scikit-build-core[pyproject]>=0.7.0", "setuptools>=61.0.0", "wheel", @@ -29,18 +29,18 @@ authors = [ license = { text = "Apache 2.0" } requires-python = ">=3.9" dependencies = [ - "cudf==24.4.*", + "cudf==24.6.*", "cupy-cuda11x>=12.0.0", - "dask-cuda==24.4.*", - "dask-cudf==24.4.*", + "dask-cuda==24.6.*", + "dask-cudf==24.6.*", "fsspec[http]>=0.6.0", "numba>=0.57", "numpy>=1.23,<2.0a0", - "pylibcugraph==24.4.*", - "raft-dask==24.4.*", - "rapids-dask-dependency==24.4.*", - "rmm==24.4.*", - "ucx-py==0.37.*", + "pylibcugraph==24.6.*", + "raft-dask==24.6.*", + "rapids-dask-dependency==24.6.*", + "rmm==24.6.*", + "ucx-py==0.38.*", ] # 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", diff --git a/python/nx-cugraph/pyproject.toml b/python/nx-cugraph/pyproject.toml index 2ff53c1a3f6..1a4a98e5f8b 100644 --- a/python/nx-cugraph/pyproject.toml +++ b/python/nx-cugraph/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "cupy-cuda11x>=12.0.0", "networkx>=3.0", "numpy>=1.23,<2.0a0", - "pylibcugraph==24.4.*", + "pylibcugraph==24.6.*", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. [project.optional-dependencies] diff --git a/python/pylibcugraph/pyproject.toml b/python/pylibcugraph/pyproject.toml index d5f568a7a90..19eafe55b7c 100644 --- a/python/pylibcugraph/pyproject.toml +++ b/python/pylibcugraph/pyproject.toml @@ -6,8 +6,8 @@ requires = [ "cmake>=3.26.4", "cython>=3.0.0", "ninja", - "pylibraft==24.4.*", - "rmm==24.4.*", + "pylibraft==24.6.*", + "rmm==24.6.*", "scikit-build-core[pyproject]>=0.7.0", "setuptools>=61.0.0", "wheel", @@ -28,8 +28,8 @@ authors = [ license = { text = "Apache 2.0" } requires-python = ">=3.9" dependencies = [ - "pylibraft==24.4.*", - "rmm==24.4.*", + "pylibraft==24.6.*", + "rmm==24.6.*", ] # 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", @@ -41,7 +41,7 @@ classifiers = [ [project.optional-dependencies] test = [ - "cudf==24.4.*", + "cudf==24.6.*", "numpy>=1.23,<2.0a0", "pandas", "pytest", From 1be5e27216b74fdc340e7397a326a330e31d8433 Mon Sep 17 00:00:00 2001 From: Naim <110031745+naimnv@users.noreply.github.com> Date: Fri, 15 Mar 2024 18:32:43 +0100 Subject: [PATCH 2/9] cugraph examples (#4128) This PR adds example on how to use libcugraph to run different algorithms. Closes #2676 Authors: - Naim (https://github.com/naimnv) - Ralph Liu (https://github.com/nv-rliu) Approvers: - Chuck Hastings (https://github.com/ChuckHastings) - Joseph Nke (https://github.com/jnke2016) - Don Acosta (https://github.com/acostadon) - Seunghwa Kang (https://github.com/seunghwak) URL: https://github.com/rapidsai/cugraph/pull/4128 --- cpp/examples/README.md | 34 ++ cpp/examples/build.sh | 32 ++ .../graph_operations/CMakeLists.txt | 39 ++ .../graph_operations/graph_operations.cu | 334 +++++++++++++ .../vertex_and_edge_partition/CMakeLists.txt | 33 ++ .../vertex_and_edge_partition.cu | 438 ++++++++++++++++++ cpp/examples/fetch_dependencies.cmake | 33 ++ .../multi_gpu_application/CMakeLists.txt | 33 ++ .../mg_graph_algorithms.cpp | 296 ++++++++++++ .../single_gpu_application/CMakeLists.txt | 30 ++ .../sg_graph_algorithms.cpp | 233 ++++++++++ 11 files changed, 1535 insertions(+) create mode 100644 cpp/examples/README.md create mode 100755 cpp/examples/build.sh create mode 100644 cpp/examples/developers/graph_operations/CMakeLists.txt create mode 100644 cpp/examples/developers/graph_operations/graph_operations.cu create mode 100644 cpp/examples/developers/vertex_and_edge_partition/CMakeLists.txt create mode 100644 cpp/examples/developers/vertex_and_edge_partition/vertex_and_edge_partition.cu create mode 100644 cpp/examples/fetch_dependencies.cmake create mode 100644 cpp/examples/users/multi_gpu_application/CMakeLists.txt create mode 100644 cpp/examples/users/multi_gpu_application/mg_graph_algorithms.cpp create mode 100644 cpp/examples/users/single_gpu_application/CMakeLists.txt create mode 100644 cpp/examples/users/single_gpu_application/sg_graph_algorithms.cpp diff --git a/cpp/examples/README.md b/cpp/examples/README.md new file mode 100644 index 00000000000..2859d05c692 --- /dev/null +++ b/cpp/examples/README.md @@ -0,0 +1,34 @@ +# libcugraph examples + + +## Contents + +- users: Example codes on how to use libcugraph. + + - single_gpu_application: example code on how to use libgraph to run different graph algorithms in single-GPU. + + - multi_gpu_application: example code on how to use libgraph to run different graph algorithms in multi-GPU. + +- developers: Example codes to demonstrate graph partition and primitives in cugraph. + + - graph_partition: code to explain vertex and edge partitioning in cugraph. + + - cugraph_operations: example code for using cugraph primitives for simple graph operations needed to implement graph algorithms. + +## Build instructions: + +Run `build.sh` from the examples dir to build the above listed examples. + +```sh +~/cugraph/cpp/examples$./build.sh +``` + +## Run instructions + +For single-GPU application + +`./path_to_executable path_to_a_csv_graph_file` + +For muti-GPU application + +`mpirun -np 2 path_to_executable path_to_a_csv_graph_file` diff --git a/cpp/examples/build.sh b/cpp/examples/build.sh new file mode 100755 index 00000000000..050ac3771d8 --- /dev/null +++ b/cpp/examples/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright (c) 2024, NVIDIA CORPORATION. + +# script for building libcugraph examples + +# Parallelism control +PARALLEL_LEVEL=${PARALLEL_LEVEL:-8} + +# Root of examples +EXAMPLES_DIR=$(dirname "$(realpath "$0")") + +LIB_BUILD_DIR=${LIB_BUILD_DIR:-$(readlink -f "${EXAMPLES_DIR}/../build")} + +################################################################################ +# Add individual libcudf examples build scripts down below + +build_example() { + example_dir=${1} + example_dir="${EXAMPLES_DIR}/${example_dir}" + build_dir="${example_dir}/build" + + # Configure + cmake -S ${example_dir} -B ${build_dir} -Dcugraph_ROOT="${LIB_BUILD_DIR}" + # Build + cmake --build ${build_dir} -j${PARALLEL_LEVEL} +} + +build_example users/single_gpu_application +build_example users/multi_gpu_application +build_example developers/vertex_and_edge_partition +build_example developers/graph_operations diff --git a/cpp/examples/developers/graph_operations/CMakeLists.txt b/cpp/examples/developers/graph_operations/CMakeLists.txt new file mode 100644 index 00000000000..db573592aff --- /dev/null +++ b/cpp/examples/developers/graph_operations/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.23.1) + +project( + graph_operations + VERSION 0.0.1 + LANGUAGES CXX CUDA +) + +include(../../fetch_dependencies.cmake) + +find_package(MPI REQUIRED COMPONENTS CXX) +include(../../../cmake/thirdparty/get_nccl.cmake) + +add_executable(graph_operations graph_operations.cu) + +target_include_directories(graph_operations + PRIVATE + "../../../src" +) + +set_target_properties(graph_operations PROPERTIES CUDA_ARCHITECTURES "native") +target_link_libraries(graph_operations PRIVATE cugraph::cugraph NCCL::NCCL MPI::MPI_CXX) +target_compile_features(graph_operations PRIVATE cxx_std_17) diff --git a/cpp/examples/developers/graph_operations/graph_operations.cu b/cpp/examples/developers/graph_operations/graph_operations.cu new file mode 100644 index 00000000000..014cedcab7e --- /dev/null +++ b/cpp/examples/developers/graph_operations/graph_operations.cu @@ -0,0 +1,334 @@ +/* + * 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. + */ + +#include "prims/per_v_transform_reduce_incoming_outgoing_e.cuh" +#include "prims/reduce_op.cuh" +#include "prims/update_edge_src_dst_property.cuh" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +void initialize_mpi_and_set_device(int argc, char** argv) +{ + RAFT_MPI_TRY(MPI_Init(&argc, &argv)); + + int comm_rank{}; + RAFT_MPI_TRY(MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank)); + + int num_gpus_per_node{}; + RAFT_CUDA_TRY(cudaGetDeviceCount(&num_gpus_per_node)); + RAFT_CUDA_TRY(cudaSetDevice(comm_rank % num_gpus_per_node)); +} + +std::unique_ptr initialize_mg_handle() +{ + int comm_rank{}; + RAFT_MPI_TRY(MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank)); + + std::shared_ptr resource = + std::make_shared(); + rmm::mr::set_current_device_resource(resource.get()); + + std::unique_ptr handle = + std::make_unique(rmm::cuda_stream_per_thread, resource); + + raft::comms::initialize_mpi_comms(handle.get(), MPI_COMM_WORLD); + auto& comm = handle->get_comms(); + auto const comm_size = comm.get_size(); + + auto gpu_row_comm_size = static_cast(sqrt(static_cast(comm_size))); + while (comm_size % gpu_row_comm_size != 0) { + --gpu_row_comm_size; + } + + cugraph::partition_manager::init_subcomm(*handle, gpu_row_comm_size); + + return std::move(handle); +} + +/** + * @brief Create a graph from edge sources, destinations, and optional weights + */ +template + +std::tuple, + std::optional, + weight_t>>, + std::optional>> +create_graph(raft::handle_t const& handle, + std::vector&& edge_srcs, + std::vector&& edge_dsts, + std::optional>&& edge_wgts, + bool renumber, + bool is_symmetric) +{ + size_t num_edges = edge_srcs.size(); + assert(edge_dsts.size() == num_edges); + if (edge_wgts.has_value()) { assert((*edge_wgts).size() == num_edges); } + + auto const comm_rank = handle.get_comms().get_rank(); + auto const comm_size = handle.get_comms().get_size(); + + // + // Assign part of the edge list to each GPU. If there are N edges and P GPUs, each GPU except the + // one with rank P-1 reads N/P edges and the GPU with rank P -1 reads (N/P + N%P) edges into GPU + // memory. + // + + auto start = comm_rank * (num_edges / comm_size); + auto end = (comm_rank + 1) * (num_edges / comm_size); + if (comm_rank == comm_size - 1) { end = num_edges; } + + auto work_size = end - start; + rmm::device_uvector d_edge_srcs(work_size, handle.get_stream()); + rmm::device_uvector d_edge_dsts(work_size, handle.get_stream()); + + auto d_edge_wgts = edge_wgts.has_value() ? std::make_optional>( + work_size, handle.get_stream()) + : std::nullopt; + + raft::update_device(d_edge_srcs.data(), edge_srcs.data() + start, work_size, handle.get_stream()); + raft::update_device(d_edge_dsts.data(), edge_dsts.data() + start, work_size, handle.get_stream()); + if (d_edge_wgts.has_value()) { + raft::update_device( + (*d_edge_wgts).data(), (*edge_wgts).data() + start, work_size, handle.get_stream()); + } + + // + // In cugraph, each vertex and edge is assigned to a specific GPU using hash functions. Before + // creating a graph from edges, we need to ensure that all edges are already assigned to the + // proper GPU. + // + + if (multi_gpu) { + std::tie(d_edge_srcs, d_edge_dsts, d_edge_wgts, std::ignore, std::ignore) = + cugraph::shuffle_external_edges(handle, + std::move(d_edge_srcs), + std::move(d_edge_dsts), + std::move(d_edge_wgts), + std::nullopt, + std::nullopt); + } + + // + // Create graph + // + + cugraph::graph_t graph(handle); + + std::optional> edge_weights{ + std::nullopt}; + + std::optional> renumber_map{std::nullopt}; + + std::tie(graph, edge_weights, std::ignore, std::ignore, renumber_map) = + cugraph::create_graph_from_edgelist(handle, + std::nullopt, + std::move(d_edge_srcs), + std::move(d_edge_dsts), + std::move(d_edge_wgts), + std::nullopt, + std::nullopt, + cugraph::graph_properties_t{is_symmetric, false}, + renumber, + true); + + auto graph_view = graph.view(); + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + return std::make_tuple(std::move(graph), std::move(edge_weights), std::move(renumber_map)); +} + +/** + * @brief This function shows an example graph operation using cugraph primitive + */ +template +void perform_example_graph_operations( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view) +{ + auto const comm_rank = handle.get_comms().get_rank(); + + // Number of vertices mapped to this process, ie the size of + // the vertex partition assigned to this process. We are using + // one-process-per-GPU model + vertex_t size_of_the_vertex_partition_assigned_to_this_process = + graph_view.local_vertex_partition_range_size(); + + using graph_view_t = cugraph::graph_view_t; + + // + // As an example operation, for each vertex, compute the weighted average of the + // properties of neighboring vertices, weighted by the edge weights, if the input + // graph is weighted; Otherwise, compute the simple average. + // + + if (edge_weight_view.has_value()) { + using result_t = weight_t; + auto vertex_weights = cugraph::compute_out_weight_sums(handle, graph_view, *edge_weight_view); + + cugraph::edge_src_property_t src_vertex_weights_cache(handle, + graph_view); + + cugraph::edge_dst_property_t dst_vertex_weights_cache(handle, + graph_view); + + cugraph::update_edge_src_property( + handle, graph_view, vertex_weights.begin(), src_vertex_weights_cache); + + cugraph::update_edge_dst_property( + handle, graph_view, vertex_weights.begin(), dst_vertex_weights_cache); + + rmm::device_uvector weighted_averages( + size_of_the_vertex_partition_assigned_to_this_process, handle.get_stream()); + + cugraph::per_v_transform_reduce_incoming_e( + handle, + graph_view, + src_vertex_weights_cache.view(), + dst_vertex_weights_cache.view(), + (*edge_weight_view), + [] __device__(auto src, auto dst, auto src_prop, auto dst_prop, auto edge_prop) { + printf("src = %d ---> dst = %d : src_prop = %f dst_prop = %f edge_prop = %f\n", + static_cast(src), + static_cast(dst), + static_cast(src_prop), + static_cast(dst_prop), + static_cast(edge_prop)); + return dst_prop * edge_prop; + }, + result_t{0}, + cugraph::reduce_op::plus{}, + weighted_averages.begin()); + + auto weighted_averages_title = + std::string("weighted_averages_").append(std::to_string(comm_rank)); + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + raft::print_device_vector(weighted_averages_title.c_str(), + weighted_averages.begin(), + weighted_averages.size(), + std::cout); + } else { + using result_t = edge_t; + auto vertex_weights = graph_view.compute_out_degrees(handle); + + cugraph::edge_src_property_t src_vertex_weights_cache(handle, + graph_view); + cugraph::edge_dst_property_t dst_vertex_weights_cache(handle, + graph_view); + + cugraph::update_edge_src_property( + handle, graph_view, vertex_weights.begin(), src_vertex_weights_cache); + + cugraph::update_edge_dst_property( + handle, graph_view, vertex_weights.begin(), dst_vertex_weights_cache); + + rmm::device_uvector weighted_averages( + size_of_the_vertex_partition_assigned_to_this_process, handle.get_stream()); + + cugraph::per_v_transform_reduce_incoming_e( + handle, + graph_view, + src_vertex_weights_cache.view(), + dst_vertex_weights_cache.view(), + cugraph::edge_dummy_property_t{}.view(), + [] __device__(auto src, auto dst, auto src_prop, auto dst_prop, auto) { + printf("src = %d ---> dst = %d : src_prop = %f dst_prop = %f\n", + static_cast(src), + static_cast(dst), + static_cast(src_prop), + static_cast(dst_prop)); + return dst_prop; + }, + result_t{0}, + cugraph::reduce_op::plus{}, + weighted_averages.begin()); + + auto weighted_averages_title = + std::string("weighted_averages_").append(std::to_string(comm_rank)); + + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + raft::print_device_vector(weighted_averages_title.c_str(), + weighted_averages.begin(), + weighted_averages.size(), + std::cout); + } +} + +int main(int argc, char** argv) +{ + initialize_mpi_and_set_device(argc, argv); + std::unique_ptr handle = initialize_mg_handle(); + + using vertex_t = int32_t; + using edge_t = int32_t; + using weight_t = float; + bool is_symmetric = true; + + std::vector edge_srcs = {3, 5, 7, 8, 8, 8}; + std::vector edge_dsts = {8, 8, 8, 3, 5, 7}; + std::vector edge_wgts = {38.0, 58.0, 78.0, 38.0, 58.0, 78.0}; + + constexpr bool multi_gpu = true; + constexpr bool store_transposed = false; + bool renumber = true; // must be true for multi-GPU applications + + auto [graph, edge_weights, renumber_map] = + create_graph( + *handle, + std::move(edge_srcs), + std::move(edge_dsts), + std::move(std::make_optional(edge_wgts)), + renumber, + is_symmetric); + + // Non-owning view of the graph object + auto graph_view = graph.view(); + + // Non-owning of the edge_weights object + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + perform_example_graph_operations( + *handle, graph_view, edge_weight_view); +} diff --git a/cpp/examples/developers/vertex_and_edge_partition/CMakeLists.txt b/cpp/examples/developers/vertex_and_edge_partition/CMakeLists.txt new file mode 100644 index 00000000000..431bd60dcb2 --- /dev/null +++ b/cpp/examples/developers/vertex_and_edge_partition/CMakeLists.txt @@ -0,0 +1,33 @@ +#============================================================================= +# 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.23.1) + +project( + graph_partition + VERSION 0.0.1 + LANGUAGES CXX CUDA +) + +include(../../fetch_dependencies.cmake) + +find_package(MPI REQUIRED COMPONENTS CXX) +include(../../../cmake/thirdparty/get_nccl.cmake) + +add_executable(vertex_and_edge_partition vertex_and_edge_partition.cu) +set_target_properties(vertex_and_edge_partition PROPERTIES CUDA_ARCHITECTURES "native") +target_link_libraries(vertex_and_edge_partition PRIVATE cugraph::cugraph NCCL::NCCL MPI::MPI_CXX) +target_compile_features(vertex_and_edge_partition PRIVATE cxx_std_17) diff --git a/cpp/examples/developers/vertex_and_edge_partition/vertex_and_edge_partition.cu b/cpp/examples/developers/vertex_and_edge_partition/vertex_and_edge_partition.cu new file mode 100644 index 00000000000..ce02e3b2639 --- /dev/null +++ b/cpp/examples/developers/vertex_and_edge_partition/vertex_and_edge_partition.cu @@ -0,0 +1,438 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +void initialize_mpi_and_set_device(int argc, char** argv) +{ + RAFT_MPI_TRY(MPI_Init(&argc, &argv)); + + int comm_rank{}; + RAFT_MPI_TRY(MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank)); + + int num_gpus_per_node{}; + RAFT_CUDA_TRY(cudaGetDeviceCount(&num_gpus_per_node)); + RAFT_CUDA_TRY(cudaSetDevice(comm_rank % num_gpus_per_node)); +} + +std::unique_ptr initialize_mg_handle() +{ + int comm_rank{}; + RAFT_MPI_TRY(MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank)); + + std::shared_ptr resource = + std::make_shared(); + rmm::mr::set_current_device_resource(resource.get()); + + std::unique_ptr handle = + std::make_unique(rmm::cuda_stream_per_thread, resource); + + raft::comms::initialize_mpi_comms(handle.get(), MPI_COMM_WORLD); + auto& comm = handle->get_comms(); + auto const comm_size = comm.get_size(); + + auto gpu_row_comm_size = static_cast(sqrt(static_cast(comm_size))); + while (comm_size % gpu_row_comm_size != 0) { + --gpu_row_comm_size; + } + + cugraph::partition_manager::init_subcomm(*handle, gpu_row_comm_size); + + return std::move(handle); +} + +/** + * @brief Create a graph from edge sources, destinations, and optional weights + */ +template + +std::tuple, + std::optional, + weight_t>>, + std::optional>> +create_graph(raft::handle_t const& handle, + std::vector&& edge_srcs, + std::vector&& edge_dsts, + std::optional>&& edge_wgts, + bool renumber, + bool is_symmetric) +{ + size_t num_edges = edge_srcs.size(); + assert(edge_dsts.size() == num_edges); + if (edge_wgts.has_value()) { assert((*edge_wgts).size() == num_edges); } + + auto const comm_rank = handle.get_comms().get_rank(); + auto const comm_size = handle.get_comms().get_size(); + + // + // Assign part of the edge list to each GPU. If there are N edges and P GPUs, each GPU except the + // one with rank P-1 reads N/P edges and the GPU with rank P -1 reads (N/P + N%P) edges into GPU + // memory. + // + + auto start = comm_rank * (num_edges / comm_size); + auto end = (comm_rank + 1) * (num_edges / comm_size); + if (comm_rank == comm_size - 1) { end = num_edges; } + + auto work_size = end - start; + rmm::device_uvector d_edge_srcs(work_size, handle.get_stream()); + rmm::device_uvector d_edge_dsts(work_size, handle.get_stream()); + + auto d_edge_wgts = edge_wgts.has_value() ? std::make_optional>( + work_size, handle.get_stream()) + : std::nullopt; + + raft::update_device(d_edge_srcs.data(), edge_srcs.data() + start, work_size, handle.get_stream()); + raft::update_device(d_edge_dsts.data(), edge_dsts.data() + start, work_size, handle.get_stream()); + if (d_edge_wgts.has_value()) { + raft::update_device( + (*d_edge_wgts).data(), (*edge_wgts).data() + start, work_size, handle.get_stream()); + } + + // + // In cugraph, each vertex and edge is assigned to a specific GPU using hash functions. Before + // creating a graph from edges, we need to ensure that all edges are already assigned to the + // proper GPU. + // + + if (multi_gpu) { + std::tie(d_edge_srcs, d_edge_dsts, d_edge_wgts, std::ignore, std::ignore) = + cugraph::shuffle_external_edges(handle, + std::move(d_edge_srcs), + std::move(d_edge_dsts), + std::move(d_edge_wgts), + std::nullopt, + std::nullopt); + } + + // + // Create graph + // + + cugraph::graph_t graph(handle); + + std::optional> edge_weights{ + std::nullopt}; + + std::optional> renumber_map{std::nullopt}; + + std::tie(graph, edge_weights, std::ignore, std::ignore, renumber_map) = + cugraph::create_graph_from_edgelist(handle, + std::nullopt, + std::move(d_edge_srcs), + std::move(d_edge_dsts), + std::move(d_edge_wgts), + std::nullopt, + std::nullopt, + cugraph::graph_properties_t{is_symmetric, false}, + renumber, + true); + + auto graph_view = graph.view(); + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + return std::make_tuple(std::move(graph), std::move(edge_weights), std::move(renumber_map)); +} + +/** + * @brief This function prints vertex and edge partitions. + */ +template +void look_into_vertex_and_edge_partitions( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view, + std::optional>&& renumber_map) +{ + auto const comm_rank = handle.get_comms().get_rank(); + + // Total number of vertices + vertex_t global_number_of_vertices = graph_view.number_of_vertices(); + + // + // Look into vertex partitions + // + + // Number of vertices mapped to this process, ie the size of + // the vertex partition assigned to this process. We are using + // one-process-per-GPU model + vertex_t size_of_the_vertex_partition_assigned_to_this_process = + graph_view.local_vertex_partition_range_size(); + + // The `renumber_map` contains the vertices assigned to this process. + // Print verties mapped to this process + // + + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + + if (renumber_map) { + auto vertex_partition_title = std::string("vertices@rank_").append(std::to_string(comm_rank)); + raft::print_device_vector( + vertex_partition_title.c_str(), (*renumber_map).data(), (*renumber_map).size(), std::cout); + } + + std::vector h_vertices_in_this_proces((*renumber_map).size()); + + raft::update_host(h_vertices_in_this_proces.data(), + (*renumber_map).data(), + (*renumber_map).size(), + handle.get_stream()); + handle.sync_stream(); + + assert(size_of_the_vertex_partition_assigned_to_this_process == (*renumber_map).size()); + + // The position of a vertex in the `renumber_map` is indicative of its new (aka renumberd) + // vertex id. The new (aka renumbered) id of the first vertex, ie the vertex at position 0 + // of `renumber_map`, assigned to this process + vertex_t renumbered_vertex_id_of_local_first = graph_view.local_vertex_partition_range_first(); + + // The new (aka renumbered) id of the last vertex, ie the vertex at position + // `size_of_the_vertex_partition_assigned_to_this_process` - 1 of `renumber_map`, + // assigned to this process + vertex_t renumbered_vertex_id_of_local_last = graph_view.local_vertex_partition_range_last(); + + // + // Print original vertex ids, new (aka renumbered) vertex ids and the ranks of the owner processes + // + + if (renumber_map) { + thrust::for_each(thrust::host, + thrust::make_zip_iterator(thrust::make_tuple( + h_vertices_in_this_proces.begin(), + thrust::make_counting_iterator(renumbered_vertex_id_of_local_first))), + thrust::make_zip_iterator(thrust::make_tuple( + h_vertices_in_this_proces.end(), + thrust::make_counting_iterator(renumbered_vertex_id_of_local_last))), + [comm_rank](auto old_and_new_id_pair) { + auto old_id = thrust::get<0>(old_and_new_id_pair); + auto new_id = thrust::get<1>(old_and_new_id_pair); + printf("owner rank = %d, original vertex id %d is renumbered to %d\n", + comm_rank, + static_cast(old_id), + static_cast(new_id)); + }); + } + + // + // Look into edge partitions and their associated edge properties (if any) + // + + bool is_weighted = false; + if (edge_weight_view.has_value()) { is_weighted = true; } + + for (size_t ep_idx = 0; ep_idx < graph_view.number_of_local_edge_partitions(); ++ep_idx) { + auto edge_partition_view = graph_view.local_edge_partition_view(ep_idx); + + auto number_of_edges_in_edge_partition = edge_partition_view.number_of_edges(); + auto offsets = edge_partition_view.offsets(); + auto indices = edge_partition_view.indices(); + + assert(number_of_edges_in_edge_partition == indices.size()); + + auto major_range_first = edge_partition_view.major_range_first(); + auto major_range_last = edge_partition_view.major_range_last(); + + auto major_hypersparse_first = edge_partition_view.major_hypersparse_first(); + auto dcs_nzd_vertices = edge_partition_view.dcs_nzd_vertices(); + + // + // Print sources and destinations of edges stored in current edge partition + // + + // print sources and destinations stored in CSR/CSC format + raft::device_span weights_of_edges_stored_in_this_edge_partition{}; + + if (is_weighted) { + auto value_firsts = edge_weight_view->value_firsts(); + auto edge_counts = edge_weight_view->edge_counts(); + + weights_of_edges_stored_in_this_edge_partition = + raft::device_span(value_firsts[ep_idx], edge_counts[ep_idx]); + } + + thrust::for_each( + handle.get_thrust_policy(), + thrust::make_counting_iterator(vertex_t{0}), + thrust::make_counting_iterator( + (major_hypersparse_first ? (*major_hypersparse_first) : major_range_last) - + major_range_first), + [comm_rank, + ep_idx, + offsets, + indices, + major_range_first, + is_weighted, + weights = weights_of_edges_stored_in_this_edge_partition.begin()] __device__(auto i) { + auto v = major_range_first + i; + auto deg_of_v_in_this_edge_partition = offsets[i + 1] - offsets[i]; + + thrust::for_each( + thrust::seq, + thrust::make_counting_iterator(edge_t{offsets[i]}), + thrust::make_counting_iterator(edge_t{offsets[i + 1]}), + [comm_rank, ep_idx, v, indices, is_weighted, weights] __device__(auto pos) { + if (is_weighted) { + printf( + "\n[comm_rank = %d local edge partition id = %d] edge: source = %d " + "destination = %d weight = %f\n", + static_cast(comm_rank), + static_cast(ep_idx), + static_cast(v), + static_cast(indices[pos]), + static_cast(weights[pos])); + + } else { + printf( + "\n[comm_rank = %d local edge partition id = %d] edge: source = %d " + "destination = %d\n", + static_cast(comm_rank), + static_cast(ep_idx), + static_cast(v), + static_cast(indices[pos])); + } + }); + }); + + // print sources and destinations stored in DCSR/DCSC format + if (major_hypersparse_first.has_value()) { + thrust::for_each( + handle.get_thrust_policy(), + thrust::make_counting_iterator(vertex_t{0}), + thrust::make_counting_iterator(static_cast((*dcs_nzd_vertices).size())), + [comm_rank, + ep_idx, + offsets, + indices, + major_range_first, + is_weighted, + weights = weights_of_edges_stored_in_this_edge_partition.begin(), + dcs_nzd_vertices = (*dcs_nzd_vertices), + major_hypersparse_first = (*major_hypersparse_first)] __device__(auto i) { + auto v = dcs_nzd_vertices[i]; + auto major_idx = (major_hypersparse_first - major_range_first) + i; + auto deg_of_v_in_this_edge_partition = offsets[major_idx + 1] - offsets[major_idx]; + + thrust::for_each( + thrust::seq, + thrust::make_counting_iterator(edge_t{offsets[major_idx]}), + thrust::make_counting_iterator(edge_t{offsets[major_idx + 1]}), + [comm_rank, ep_idx, v, indices, is_weighted, weights] __device__(auto pos) { + if (is_weighted) { + printf( + "\n[comm_rank = %d local edge partition id = %d] edge: source = %d " + "destination = %d weight = %f\n", + static_cast(comm_rank), + static_cast(ep_idx), + static_cast(v), + static_cast(indices[pos]), + static_cast(weights[pos])); + + } else { + printf( + "\n[comm_rank = %d local edge partition id = %d] edge: source = %d " + "destination = %d\n", + static_cast(comm_rank), + static_cast(ep_idx), + static_cast(v), + static_cast(indices[pos])); + } + }); + }); + } + + // Edge property values + if (edge_weight_view) { + auto value_firsts = edge_weight_view->value_firsts(); + auto edge_counts = edge_weight_view->edge_counts(); + + assert(number_of_edges_in_edge_partition == edge_counts[ep_idx]); + + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + auto weights_title = std::string("weights_") + .append(std::to_string(comm_rank)) + .append("_") + .append(std::to_string(ep_idx)); + raft::print_device_vector( + weights_title.c_str(), value_firsts[ep_idx], number_of_edges_in_edge_partition, std::cout); + } + } +} + +int main(int argc, char** argv) +{ + initialize_mpi_and_set_device(argc, argv); + std::unique_ptr handle = initialize_mg_handle(); + + using vertex_t = int32_t; + using edge_t = int32_t; + using weight_t = float; + bool is_symmetric = true; + + std::vector edge_srcs = {0, 1, 1, 2, 2, 2, 3, 4, 1, 3, 4, 0, 1, 3, 5, 5}; + std::vector edge_dsts = {1, 3, 4, 0, 1, 3, 5, 5, 0, 1, 1, 2, 2, 2, 3, 4}; + std::vector edge_wgts = { + 0.1f, 2.1f, 1.1f, 5.1f, 3.1f, 4.1f, 7.2f, 3.2f, 0.1f, 2.1f, 1.1f, 5.1f, 3.1f, 4.1f, 7.2f, 3.2f}; + + constexpr bool multi_gpu = true; + constexpr bool store_transposed = false; + bool renumber = true; // must be true for multi-GPU applications + + auto [graph, edge_weights, renumber_map] = + create_graph( + *handle, + std::move(edge_srcs), + std::move(edge_dsts), + std::move(std::make_optional(edge_wgts)), + renumber, + is_symmetric); + + // Non-owning view of the graph object + auto graph_view = graph.view(); + + // Non-owning of the edge_weights object + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + look_into_vertex_and_edge_partitions( + *handle, graph_view, edge_weight_view, std::move(renumber_map)); +} diff --git a/cpp/examples/fetch_dependencies.cmake b/cpp/examples/fetch_dependencies.cmake new file mode 100644 index 00000000000..9944dc09155 --- /dev/null +++ b/cpp/examples/fetch_dependencies.cmake @@ -0,0 +1,33 @@ +# ============================================================================= +# 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. +# ============================================================================= +set(CPM_DOWNLOAD_VERSION v0.35.3) +file( + DOWNLOAD + https://github.com/cpm-cmake/CPM.cmake/releases/download/${CPM_DOWNLOAD_VERSION}/get_cpm.cmake + ${CMAKE_BINARY_DIR}/cmake/get_cpm.cmake +) +include(${CMAKE_BINARY_DIR}/cmake/get_cpm.cmake) + +set(CUGRAPH_TAG branch-23.12) +CPMFindPackage( + NAME cugraph GIT_REPOSITORY https://github.com/rapidsai/cugraph + GIT_TAG ${CUGRAPH_TAG} + GIT_SHALLOW + TRUE + SOURCE_SUBDIR + cpp +) + +include(../../../../rapids_config.cmake) +include(rapids-find) diff --git a/cpp/examples/users/multi_gpu_application/CMakeLists.txt b/cpp/examples/users/multi_gpu_application/CMakeLists.txt new file mode 100644 index 00000000000..357f2e539a7 --- /dev/null +++ b/cpp/examples/users/multi_gpu_application/CMakeLists.txt @@ -0,0 +1,33 @@ +#============================================================================= +# 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.23.1) + +project( + mg_graph_algorithms + VERSION 0.0.1 + LANGUAGES CXX CUDA +) + +include(../../fetch_dependencies.cmake) + +find_package(MPI REQUIRED COMPONENTS CXX) +include(../../../cmake/thirdparty/get_nccl.cmake) + +add_executable(mg_graph_algorithms mg_graph_algorithms.cpp) +set_target_properties(mg_graph_algorithms PROPERTIES CUDA_ARCHITECTURES "native") +target_link_libraries(mg_graph_algorithms PRIVATE cugraph::cugraph NCCL::NCCL MPI::MPI_CXX) +target_compile_features(mg_graph_algorithms PRIVATE cxx_std_17) diff --git a/cpp/examples/users/multi_gpu_application/mg_graph_algorithms.cpp b/cpp/examples/users/multi_gpu_application/mg_graph_algorithms.cpp new file mode 100644 index 00000000000..a9e2a170208 --- /dev/null +++ b/cpp/examples/users/multi_gpu_application/mg_graph_algorithms.cpp @@ -0,0 +1,296 @@ +/* + * 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. + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +void initialize_mpi_and_set_device(int argc, char** argv) +{ + RAFT_MPI_TRY(MPI_Init(&argc, &argv)); + + int comm_rank{}; + RAFT_MPI_TRY(MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank)); + + int num_gpus_per_node{}; + RAFT_CUDA_TRY(cudaGetDeviceCount(&num_gpus_per_node)); + RAFT_CUDA_TRY(cudaSetDevice(comm_rank % num_gpus_per_node)); +} + +std::unique_ptr initialize_mg_handle() +{ + int comm_rank{}; + RAFT_MPI_TRY(MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank)); + + std::shared_ptr resource = + std::make_shared(); + rmm::mr::set_current_device_resource(resource.get()); + + std::unique_ptr handle = + std::make_unique(rmm::cuda_stream_per_thread, resource); + + raft::comms::initialize_mpi_comms(handle.get(), MPI_COMM_WORLD); + auto& comm = handle->get_comms(); + auto const comm_size = comm.get_size(); + + auto gpu_row_comm_size = static_cast(sqrt(static_cast(comm_size))); + while (comm_size % gpu_row_comm_size != 0) { + --gpu_row_comm_size; + } + + cugraph::partition_manager::init_subcomm(*handle, gpu_row_comm_size); + + return std::move(handle); +} + +/** + * @brief Create a graph from edge sources, destination, and optional weights. + */ +template + +std::tuple, + std::optional, + weight_t>>, + std::optional>> +create_graph(raft::handle_t const& handle, + std::vector&& edge_srcs, + std::vector&& edge_dsts, + std::optional>&& edge_wgts, + bool renumber, + bool is_symmetric) +{ + size_t num_edges = edge_srcs.size(); + assert(edge_dsts.size() == num_edges); + if (edge_wgts.has_value()) { assert((*edge_wgts).size() == num_edges); } + + auto const comm_rank = handle.get_comms().get_rank(); + auto const comm_size = handle.get_comms().get_size(); + + // + // Assign part of the edge list to each GPU. If there are N edges and P GPUs, each GPU except the + // one with rank P-1 reads N/P edges and the GPU with rank P -1 reads (N/P + N%P) edges into GPU + // memory. + // + + auto start = comm_rank * (num_edges / comm_size); + auto end = (comm_rank + 1) * (num_edges / comm_size); + if (comm_rank == comm_size - 1) { end = num_edges; } + auto work_size = end - start; + + rmm::device_uvector d_edge_srcs(work_size, handle.get_stream()); + rmm::device_uvector d_edge_dsts(work_size, handle.get_stream()); + + auto d_edge_wgts = edge_wgts.has_value() ? std::make_optional>( + work_size, handle.get_stream()) + : std::nullopt; + + raft::update_device(d_edge_srcs.data(), edge_srcs.data() + start, work_size, handle.get_stream()); + raft::update_device(d_edge_dsts.data(), edge_dsts.data() + start, work_size, handle.get_stream()); + if (d_edge_wgts.has_value()) { + raft::update_device( + (*d_edge_wgts).data(), (*edge_wgts).data() + start, work_size, handle.get_stream()); + } + + // + // In cugraph, each vertex and edge is assigned to a specific GPU using hash functions. Before + // creating a graph from edges, we need to ensure that all edges are already assigned to the + // proper GPU. + // + + if (multi_gpu) { + std::tie(d_edge_srcs, d_edge_dsts, d_edge_wgts, std::ignore, std::ignore) = + cugraph::shuffle_external_edges(handle, + std::move(d_edge_srcs), + std::move(d_edge_dsts), + std::move(d_edge_wgts), + std::nullopt, + std::nullopt); + } + + // + // Create graph + // + + cugraph::graph_t graph(handle); + + std::optional> edge_weights{ + std::nullopt}; + + std::optional> renumber_map{std::nullopt}; + + std::tie(graph, edge_weights, std::ignore, std::ignore, renumber_map) = + cugraph::create_graph_from_edgelist(handle, + std::nullopt, + std::move(d_edge_srcs), + std::move(d_edge_dsts), + std::move(d_edge_wgts), + std::nullopt, + std::nullopt, + cugraph::graph_properties_t{is_symmetric, false}, + renumber, + true); + + auto graph_view = graph.view(); + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + return std::make_tuple(std::move(graph), std::move(edge_weights), std::move(renumber_map)); +} + +/** + * @brief Run BFS and Louvain on input graph. + */ +template +void run_graph_algorithms( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view) +{ + auto const comm_rank = handle.get_comms().get_rank(); + auto const comm_size = handle.get_comms().get_size(); + + // + // BFS + // + + rmm::device_uvector d_distances(graph_view.local_vertex_partition_range_size(), + handle.get_stream()); + rmm::device_uvector d_predecessors(graph_view.local_vertex_partition_range_size(), + handle.get_stream()); + + rmm::device_uvector d_sources(1, handle.get_stream()); + std::vector h_sources = {0}; + raft::update_device(d_sources.data(), h_sources.data(), h_sources.size(), handle.get_stream()); + + cugraph::bfs(handle, + graph_view, + d_distances.data(), + d_predecessors.data(), + d_sources.data(), + d_sources.size(), + false, + std::numeric_limits::max()); + + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + + auto distances_title = std::string("distances_").append(std::to_string(comm_rank)); + raft::print_device_vector( + distances_title.c_str(), d_distances.begin(), d_distances.size(), std::cout); + + auto predecessors_title = std::string("predecessors_").append(std::to_string(comm_rank)); + raft::print_device_vector( + predecessors_title.c_str(), d_predecessors.begin(), d_predecessors.size(), std::cout); + + // + // Louvain + // + + rmm::device_uvector d_cluster_assignments( + graph_view.local_vertex_partition_range_size(), handle.get_stream()); + + weight_t threshold = 1e-7; + weight_t resolution = 1.0; + size_t max_level = 10; + + weight_t modularity{-1.0}; + std::tie(std::ignore, modularity) = + cugraph::louvain(handle, + std::optional>{std::nullopt}, + graph_view, + edge_weight_view, + d_cluster_assignments.data(), + max_level, + threshold, + resolution); + + std::cout << "rank : " << comm_rank << ", modularity : " << modularity << std::endl; + + auto cluster_assignments_title = + std::string("cluster_assignments_").append(std::to_string(comm_rank)); + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + raft::print_device_vector(cluster_assignments_title.c_str(), + d_cluster_assignments.begin(), + d_cluster_assignments.size(), + std::cout); +} + +int main(int argc, char** argv) +{ + initialize_mpi_and_set_device(argc, argv); + std::unique_ptr handle = initialize_mg_handle(); + + // + // Create graph from edge source, destination and weight list + // + + using vertex_t = int32_t; + using edge_t = int32_t; + using weight_t = float; + bool is_symmetric = true; + + std::vector edge_srcs = {0, 1, 1, 2, 2, 2, 3, 4, 1, 3, 4, 0, 1, 3, 5, 5}; + std::vector edge_dsts = {1, 3, 4, 0, 1, 3, 5, 5, 0, 1, 1, 2, 2, 2, 3, 4}; + std::vector edge_wgts = { + 0.1f, 2.1f, 1.1f, 5.1f, 3.1f, 4.1f, 7.2f, 3.2f, 0.1f, 2.1f, 1.1f, 5.1f, 3.1f, 4.1f, 7.2f, 3.2f}; + + constexpr bool multi_gpu = true; + constexpr bool store_transposed = false; + bool renumber = true; // must be true for multi-GPU applications + + auto [graph, edge_weights, renumber_map] = + create_graph( + *handle, + std::move(edge_srcs), + std::move(edge_dsts), + std::move(std::make_optional(edge_wgts)), + renumber, + is_symmetric); + // Non-owning view of the graph object + auto graph_view = graph.view(); + + // Non-owning of the edge_weights object + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + // + // Run example graph algorithms + // + + run_graph_algorithms( + *handle, graph_view, edge_weight_view); + + RAFT_MPI_TRY(MPI_Finalize()); +} diff --git a/cpp/examples/users/single_gpu_application/CMakeLists.txt b/cpp/examples/users/single_gpu_application/CMakeLists.txt new file mode 100644 index 00000000000..276be3728a8 --- /dev/null +++ b/cpp/examples/users/single_gpu_application/CMakeLists.txt @@ -0,0 +1,30 @@ +#============================================================================= +# 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.23.1) + +project( + mg_graph_algorithms + VERSION 0.0.1 + LANGUAGES CXX CUDA +) + +include(../../fetch_dependencies.cmake) + +add_executable(sg_graph_algorithms sg_graph_algorithms.cpp) +set_target_properties(sg_graph_algorithms PROPERTIES CUDA_ARCHITECTURES "native") +target_link_libraries(sg_graph_algorithms PRIVATE cugraph::cugraph) +target_compile_features(sg_graph_algorithms PRIVATE cxx_std_17) diff --git a/cpp/examples/users/single_gpu_application/sg_graph_algorithms.cpp b/cpp/examples/users/single_gpu_application/sg_graph_algorithms.cpp new file mode 100644 index 00000000000..0233d4f0e84 --- /dev/null +++ b/cpp/examples/users/single_gpu_application/sg_graph_algorithms.cpp @@ -0,0 +1,233 @@ +/* + * 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. + */ + +#include +#include + +#include +#include + +#include +#include + +std::unique_ptr initialize_sg_handle() +{ + RAFT_CUDA_TRY(cudaSetDevice(0)); + std::shared_ptr resource = + std::make_shared(); + rmm::mr::set_current_device_resource(resource.get()); + + std::unique_ptr handle = + std::make_unique(rmm::cuda_stream_per_thread, resource); + return std::move(handle); +} + +/** + * @brief Create a graph from edge sources, destinations, and optional weights + */ +template + +std::tuple, + std::optional, + weight_t>>, + std::optional>> +create_graph(raft::handle_t const& handle, + std::vector&& edge_srcs, + std::vector&& edge_dsts, + std::optional>&& edge_wgts, + bool renumber, + bool is_symmetric) +{ + size_t num_edges = edge_srcs.size(); + assert(edge_dsts.size() == num_edges); + if (edge_wgts.has_value()) { assert((*edge_wgts).size() == num_edges); } + + std::cout << "#E = " << num_edges << std::endl; + + rmm::device_uvector d_edge_srcs(num_edges, handle.get_stream()); + rmm::device_uvector d_edge_dsts(num_edges, handle.get_stream()); + + auto d_edge_wgts = edge_wgts.has_value() ? std::make_optional>( + num_edges, handle.get_stream()) + : std::nullopt; + + raft::update_device(d_edge_srcs.data(), edge_srcs.data(), num_edges, handle.get_stream()); + raft::update_device(d_edge_dsts.data(), edge_dsts.data(), num_edges, handle.get_stream()); + if (d_edge_wgts.has_value()) { + raft::update_device((*d_edge_wgts).data(), (*edge_wgts).data(), num_edges, handle.get_stream()); + } + + // + // Create graph + // + + cugraph::graph_t graph(handle); + + std::optional> edge_weights{ + std::nullopt}; + + std::optional> renumber_map{std::nullopt}; + + std::tie(graph, edge_weights, std::ignore, std::ignore, renumber_map) = + cugraph::create_graph_from_edgelist(handle, + std::nullopt, + std::move(d_edge_srcs), + std::move(d_edge_dsts), + std::move(d_edge_wgts), + std::nullopt, + std::nullopt, + cugraph::graph_properties_t{is_symmetric, false}, + renumber, + true); + + auto graph_view = graph.view(); + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + return std::make_tuple(std::move(graph), std::move(edge_weights), std::move(renumber_map)); +} + +/** + * @brief Run BFS and Louvain on input graph. + */ +template +void run_graph_algorithms( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view) +{ + // + // BFS + // + + rmm::device_uvector d_distances(graph_view.local_vertex_partition_range_size(), + handle.get_stream()); + rmm::device_uvector d_predecessors(graph_view.local_vertex_partition_range_size(), + handle.get_stream()); + + rmm::device_uvector d_sources(1, handle.get_stream()); + std::vector h_sources = {0}; + raft::update_device(d_sources.data(), h_sources.data(), h_sources.size(), handle.get_stream()); + + cugraph::bfs(handle, + graph_view, + d_distances.data(), + d_predecessors.data(), + d_sources.data(), + d_sources.size(), + false, + std::numeric_limits::max()); + + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + + auto distances_title = std::string("distances"); + raft::print_device_vector( + distances_title.c_str(), d_distances.begin(), d_distances.size(), std::cout); + + auto predecessors_title = std::string("predecessors"); + raft::print_device_vector( + predecessors_title.c_str(), d_predecessors.begin(), d_predecessors.size(), std::cout); + + // + // Louvain + // + + rmm::device_uvector d_cluster_assignments( + graph_view.local_vertex_partition_range_size(), handle.get_stream()); + + weight_t threshold = 1e-7; + weight_t resolution = 1.0; + size_t max_level = 10; + + weight_t modularity{-1.0}; + std::tie(std::ignore, modularity) = + cugraph::louvain(handle, + std::optional>{std::nullopt}, + graph_view, + edge_weight_view, + d_cluster_assignments.data(), + max_level, + threshold, + resolution); + + std::cout << "modularity : " << modularity << std::endl; + + auto cluster_assignments_title = std::string("cluster_assignments"); + RAFT_CUDA_TRY(cudaDeviceSynchronize()); + raft::print_device_vector(cluster_assignments_title.c_str(), + d_cluster_assignments.begin(), + d_cluster_assignments.size(), + std::cout); +} + +int main(int argc, char** argv) +{ + std::unique_ptr handle = initialize_sg_handle(); + + // + // Create graph from edge source, destination and weight list + // + + using vertex_t = int32_t; + using edge_t = int32_t; + using weight_t = float; + bool is_symmetric = true; + + std::vector edge_srcs = {0, 1, 1, 2, 2, 2, 3, 4, 1, 3, 4, 0, 1, 3, 5, 5}; + std::vector edge_dsts = {1, 3, 4, 0, 1, 3, 5, 5, 0, 1, 1, 2, 2, 2, 3, 4}; + std::vector edge_wgts = { + 0.1f, 2.1f, 1.1f, 5.1f, 3.1f, 4.1f, 7.2f, 3.2f, 0.1f, 2.1f, 1.1f, 5.1f, 3.1f, 4.1f, 7.2f, 3.2f}; + + constexpr bool multi_gpu = false; + constexpr bool store_transposed = false; + bool renumber = true; + + auto [graph, edge_weights, renumber_map] = + create_graph( + *handle, + std::move(edge_srcs), + std::move(edge_dsts), + std::move(std::make_optional(edge_wgts)), + renumber, + is_symmetric); + + // Non-owning view of the graph object + auto graph_view = graph.view(); + + // Non-owning of the edge_weights object + auto edge_weight_view = edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; + + // + // Run example graph algorithms + // + + run_graph_algorithms( + *handle, graph_view, edge_weight_view); +} From 7aeaec971b15e2a9bd0d4698cac7e26dcc4a531b Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Fri, 15 Mar 2024 13:37:38 -0500 Subject: [PATCH 3/9] nx-cugraph: add `is_negatively_weighted` (#4242) Authors: - Erik Welch (https://github.com/eriknw) Approvers: - Rick Ratzel (https://github.com/rlratzel) URL: https://github.com/rapidsai/cugraph/pull/4242 --- python/nx-cugraph/_nx_cugraph/__init__.py | 1 + .../nx-cugraph/nx_cugraph/classes/function.py | 22 +++++++++++- .../nx_cugraph/tests/test_classes_function.py | 35 +++++++++++++++++++ python/nx-cugraph/pyproject.toml | 2 ++ python/nx-cugraph/scripts/update_readme.py | 9 +++-- 5 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 python/nx-cugraph/nx_cugraph/tests/test_classes_function.py diff --git a/python/nx-cugraph/_nx_cugraph/__init__.py b/python/nx-cugraph/_nx_cugraph/__init__.py index 098de46af8e..013f1236725 100644 --- a/python/nx-cugraph/_nx_cugraph/__init__.py +++ b/python/nx-cugraph/_nx_cugraph/__init__.py @@ -96,6 +96,7 @@ "is_connected", "is_forest", "is_isolate", + "is_negatively_weighted", "is_tree", "is_weakly_connected", "isolates", diff --git a/python/nx-cugraph/nx_cugraph/classes/function.py b/python/nx-cugraph/nx_cugraph/classes/function.py index 7212a4d2da9..3dac6c2fd08 100644 --- a/python/nx-cugraph/nx_cugraph/classes/function.py +++ b/python/nx-cugraph/nx_cugraph/classes/function.py @@ -11,11 +11,31 @@ # See the License for the specific language governing permissions and # limitations under the License. import cupy as cp +import networkx as nx from nx_cugraph.convert import _to_graph from nx_cugraph.utils import networkx_algorithm -__all__ = ["number_of_selfloops"] +__all__ = [ + "is_negatively_weighted", + "number_of_selfloops", +] + + +@networkx_algorithm(version_added="24.04") +def is_negatively_weighted(G, edge=None, weight="weight"): + G = _to_graph(G, weight) + if edge is not None: + data = G.get_edge_data(*edge) + if data is None: + raise nx.NetworkXError(f"Edge {edge!r} does not exist.") + return weight in data and data[weight] < 0 + if weight not in G.edge_values: + return False + edge_vals = G.edge_values[weight] + if weight in G.edge_masks: + edge_vals = edge_vals[G.edge_masks[weight]] + return bool((edge_vals < 0).any()) @networkx_algorithm(version_added="23.12") diff --git a/python/nx-cugraph/nx_cugraph/tests/test_classes_function.py b/python/nx-cugraph/nx_cugraph/tests/test_classes_function.py new file mode 100644 index 00000000000..d6152f650fb --- /dev/null +++ b/python/nx-cugraph/nx_cugraph/tests/test_classes_function.py @@ -0,0 +1,35 @@ +# 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. +"""Test functions from nx_cugraph/classes/function.py""" +import networkx as nx + +import nx_cugraph as nxcg + + +def test_is_negatively_weighted(): + Gnx = nx.MultiGraph() + Gnx.add_edge(0, 1, 2, weight=-3) + Gnx.add_edge(2, 3, foo=3) + Gcg = nxcg.from_networkx(Gnx, preserve_edge_attrs=True) + assert nx.is_negatively_weighted(Gnx) + assert nxcg.is_negatively_weighted(Gnx) + assert nxcg.is_negatively_weighted(Gcg) + assert not nx.is_negatively_weighted(Gnx, weight="foo") + assert not nxcg.is_negatively_weighted(Gcg, weight="foo") + assert not nx.is_negatively_weighted(Gnx, weight="bar") + assert not nxcg.is_negatively_weighted(Gcg, weight="bar") + assert nx.is_negatively_weighted(Gnx, (0, 1, 2)) + assert nxcg.is_negatively_weighted(Gcg, (0, 1, 2)) + assert nx.is_negatively_weighted(Gnx, (0, 1)) == nxcg.is_negatively_weighted( + Gcg, (0, 1) + ) diff --git a/python/nx-cugraph/pyproject.toml b/python/nx-cugraph/pyproject.toml index 2ff53c1a3f6..c662e710fee 100644 --- a/python/nx-cugraph/pyproject.toml +++ b/python/nx-cugraph/pyproject.toml @@ -175,6 +175,7 @@ ignore = [ # "SIM401", # Use dict.get ... instead of if-else-block (Note: if-else better for coverage and sometimes clearer) # "TRY004", # Prefer `TypeError` exception for invalid type (Note: good advice, but not worth the nuisance) "B904", # Bare `raise` inside exception clause (like TRY200; sometimes okay) + "S310", # Audit URL open for permitted schemes (Note: we don't download URLs in normal usage) # Intentionally ignored "A003", # Class attribute ... is shadowing a python builtin @@ -232,6 +233,7 @@ ignore = [ "nx_cugraph/**/tests/*py" = ["S101", "S311", "T201", "D103", "D100"] "_nx_cugraph/__init__.py" = ["E501"] "nx_cugraph/algorithms/**/*py" = ["D205", "D401"] # Allow flexible docstrings for algorithms +"scripts/update_readme.py" = ["INP001"] # Not part of a package [tool.ruff.lint.flake8-annotations] mypy-init-return = true diff --git a/python/nx-cugraph/scripts/update_readme.py b/python/nx-cugraph/scripts/update_readme.py index fcaa1769d8b..5ee49e63ac8 100755 --- a/python/nx-cugraph/scripts/update_readme.py +++ b/python/nx-cugraph/scripts/update_readme.py @@ -70,6 +70,9 @@ def replace_body(text, match, new_body): "https://networkx.org/documentation/stable/reference/" "algorithms/component.html#weak-connectivity" ), + "networkx.classes": ( + "https://networkx.org/documentation/stable/reference/classes/index.html" + ), } @@ -193,9 +196,9 @@ def get_payload_internal(keys): def find_or_download_objs_file(objs_file_dir): - """ - Returns the path to /objects.inv, downloading it from - _objs_file_url if it does not already exist. + """Return the path to /objects.inv and download it if necessary. + + Download objects.inv from _objs_file_url if it does not already exist. """ objs_file_path = objs_file_dir / "objects.inv" if not objs_file_path.exists(): From a467da95231c5140ebb5dafa469f56bf20c4f4f2 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sun, 17 Mar 2024 12:11:55 -1000 Subject: [PATCH 4/9] Enable pytest failures on warnings from cudf (#4223) In 24.04, cudf issues a FutureWarning when using positional indexing with `__getitem__`. The change here is to use `iloc` instead. Additionally the test suite will now fail when a warning comes from cudf as apart of https://github.com/rapidsai/build-planning/issues/26 Authors: - Matthew Roeschke (https://github.com/mroeschke) - Ralph Liu (https://github.com/nv-rliu) - Brad Rees (https://github.com/BradReesWork) Approvers: - Rick Ratzel (https://github.com/rlratzel) - Don Acosta (https://github.com/acostadon) URL: https://github.com/rapidsai/cugraph/pull/4223 --- .../centrality/betweenness_centrality.py | 6 ++--- .../cugraph/community/spectral_clustering.py | 24 +++++++++---------- .../cugraph/community/triangle_count.py | 4 ++-- .../cugraph/cugraph/dask/community/leiden.py | 4 ++-- .../cugraph/cugraph/dask/community/louvain.py | 4 ++-- .../cugraph/dask/link_analysis/pagerank.py | 6 ++--- .../cugraph/dask/sampling/random_walks.py | 4 ++-- .../gnn/dgl_extensions/dgl_uniform_sampler.py | 2 +- .../cugraph/cugraph/link_analysis/pagerank.py | 4 ++-- .../cugraph/link_prediction/jaccard.py | 7 ++++-- .../cugraph/link_prediction/overlap.py | 9 ++++--- .../cugraph/link_prediction/sorensen.py | 9 ++++--- .../cugraph/cugraph/sampling/random_walks.py | 4 ++-- .../sampling/uniform_neighbor_sample.py | 6 ++--- .../test_edge_betweenness_centrality_mg.py | 3 ++- .../cugraph/tests/layout/test_force_atlas2.py | 8 +++---- python/cugraph/pytest.ini | 7 +++++- 17 files changed, 63 insertions(+), 48 deletions(-) diff --git a/python/cugraph/cugraph/centrality/betweenness_centrality.py b/python/cugraph/cugraph/centrality/betweenness_centrality.py index 80ad2e630bd..dd47b1e8df0 100644 --- a/python/cugraph/cugraph/centrality/betweenness_centrality.py +++ b/python/cugraph/cugraph/centrality/betweenness_centrality.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-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 @@ -160,7 +160,7 @@ def betweenness_centrality( if not isinstance(k, (cudf.DataFrame, cudf.Series)): if isinstance(k, list): - vertex_dtype = G.edgelist.edgelist_df.dtypes[0] + vertex_dtype = G.edgelist.edgelist_df.dtypes.iloc[0] k = cudf.Series(k, dtype=vertex_dtype) if isinstance(k, (cudf.DataFrame, cudf.Series)): @@ -300,7 +300,7 @@ def edge_betweenness_centrality( if not isinstance(k, (cudf.DataFrame, cudf.Series)): if isinstance(k, list): - vertex_dtype = G.edgelist.edgelist_df.dtypes[0] + vertex_dtype = G.edgelist.edgelist_df.dtypes.iloc[0] k = cudf.Series(k, dtype=vertex_dtype) if isinstance(k, (cudf.DataFrame, cudf.Series)): diff --git a/python/cugraph/cugraph/community/spectral_clustering.py b/python/cugraph/cugraph/community/spectral_clustering.py index 864c1005d20..8b4dbce830f 100644 --- a/python/cugraph/cugraph/community/spectral_clustering.py +++ b/python/cugraph/cugraph/community/spectral_clustering.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-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 @@ -92,8 +92,8 @@ def spectralBalancedCutClustering( G, isNx = ensure_cugraph_obj_for_nx(G) # Check if vertex type is "int32" if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'spectralBalancedCutClustering' requires the input graph's vertex to be " @@ -186,8 +186,8 @@ def spectralModularityMaximizationClustering( G, isNx = ensure_cugraph_obj_for_nx(G) if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'spectralModularityMaximizationClustering' requires the input graph's " @@ -271,8 +271,8 @@ def analyzeClustering_modularity( G, isNx = ensure_cugraph_obj_for_nx(G) if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'analyzeClustering_modularity' requires the input graph's " @@ -284,7 +284,7 @@ def analyzeClustering_modularity( clustering, "vertex", vertex_col_name, drop=True ) - if clustering.dtypes[0] != np.int32 or clustering.dtypes[1] != np.int32: + if clustering.dtypes.iloc[0] != np.int32 or clustering.dtypes.iloc[1] != np.int32: raise ValueError( "'analyzeClustering_modularity' requires both the clustering 'vertex' " "and 'cluster' to be of type 'int32'" @@ -354,8 +354,8 @@ def analyzeClustering_edge_cut( G, isNx = ensure_cugraph_obj_for_nx(G) if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'analyzeClustering_edge_cut' requires the input graph's vertex to be " @@ -367,7 +367,7 @@ def analyzeClustering_edge_cut( clustering, "vertex", vertex_col_name, drop=True ) - if clustering.dtypes[0] != np.int32 or clustering.dtypes[1] != np.int32: + if clustering.dtypes.iloc[0] != np.int32 or clustering.dtypes.iloc[1] != np.int32: raise ValueError( "'analyzeClustering_edge_cut' requires both the clustering 'vertex' " "and 'cluster' to be of type 'int32'" @@ -437,7 +437,7 @@ def analyzeClustering_ratio_cut( clustering, "vertex", vertex_col_name, drop=True ) - if clustering.dtypes[0] != np.int32 or clustering.dtypes[1] != np.int32: + if clustering.dtypes.iloc[0] != np.int32 or clustering.dtypes.iloc[1] != np.int32: raise ValueError( "'analyzeClustering_ratio_cut' requires both the clustering 'vertex' " "and 'cluster' to be of type 'int32'" diff --git a/python/cugraph/cugraph/community/triangle_count.py b/python/cugraph/cugraph/community/triangle_count.py index 306cdb2333f..247327b6e4c 100644 --- a/python/cugraph/cugraph/community/triangle_count.py +++ b/python/cugraph/cugraph/community/triangle_count.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-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 @@ -24,7 +24,7 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, start_list): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] if isinstance(start_list, cudf.Series): start_list_dtypes = start_list.dtype else: diff --git a/python/cugraph/cugraph/dask/community/leiden.py b/python/cugraph/cugraph/dask/community/leiden.py index 10a266ed519..24a077d1845 100644 --- a/python/cugraph/cugraph/dask/community/leiden.py +++ b/python/cugraph/cugraph/dask/community/leiden.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-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. @@ -170,7 +170,7 @@ def leiden( part_mod_score = [client.submit(convert_to_cudf, r) for r in result] wait(part_mod_score) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] empty_df = cudf.DataFrame( { "vertex": numpy.empty(shape=0, dtype=vertex_dtype), diff --git a/python/cugraph/cugraph/dask/community/louvain.py b/python/cugraph/cugraph/dask/community/louvain.py index e83d41811ea..2d894d9665f 100644 --- a/python/cugraph/cugraph/dask/community/louvain.py +++ b/python/cugraph/cugraph/dask/community/louvain.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-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. @@ -191,7 +191,7 @@ def louvain( part_mod_score = [client.submit(convert_to_cudf, r) for r in result] wait(part_mod_score) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] empty_df = cudf.DataFrame( { "vertex": numpy.empty(shape=0, dtype=vertex_dtype), diff --git a/python/cugraph/cugraph/dask/link_analysis/pagerank.py b/python/cugraph/cugraph/dask/link_analysis/pagerank.py index 1dffb3cba78..62ae9109624 100644 --- a/python/cugraph/cugraph/dask/link_analysis/pagerank.py +++ b/python/cugraph/cugraph/dask/link_analysis/pagerank.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-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. @@ -76,7 +76,7 @@ def ensure_valid_dtype(input_graph, input_df, input_df_name): warnings.warn(warning_msg, UserWarning) input_df = input_df.astype({"values": edge_attr_dtype}) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] input_df_vertex_dtype = input_df["vertex"].dtype if input_df_vertex_dtype != vertex_dtype: warning_msg = ( @@ -406,7 +406,7 @@ def pagerank( wait(result) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] # Have each worker convert tuple of arrays and bool from PLC to cudf # DataFrames and bools. This will be a list of futures. diff --git a/python/cugraph/cugraph/dask/sampling/random_walks.py b/python/cugraph/cugraph/dask/sampling/random_walks.py index bb9baf2c92c..99996153d30 100644 --- a/python/cugraph/cugraph/dask/sampling/random_walks.py +++ b/python/cugraph/cugraph/dask/sampling/random_walks.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-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. @@ -123,7 +123,7 @@ def random_walks( start_vertices_type = input_graph.edgelist.edgelist_df.dtypes[0] else: # FIXME: Get the 'src' column names instead and retrieve the type - start_vertices_type = input_graph.input_df.dtypes[0] + start_vertices_type = input_graph.input_df.dtypes.iloc[0] start_vertices = dask_cudf.from_cudf( start_vertices, npartitions=min(input_graph._npartitions, len(start_vertices)) ) diff --git a/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py b/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py index e4f6dd3745a..538f6426ac2 100644 --- a/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py +++ b/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py @@ -150,7 +150,7 @@ def _get_type_id_from_indices(indices, etype_id_range_dict): for etype_id, (start, stop) in etype_id_range_dict.items(): range_types = (start <= indices) & (indices < stop) - type_ser[range_types] = etype_id + type_ser[range_types] = type_ser.dtype.type(etype_id) return type_ser diff --git a/python/cugraph/cugraph/link_analysis/pagerank.py b/python/cugraph/cugraph/link_analysis/pagerank.py index 3b39ac597ab..ef0705c6be9 100644 --- a/python/cugraph/cugraph/link_analysis/pagerank.py +++ b/python/cugraph/cugraph/link_analysis/pagerank.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-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 @@ -64,7 +64,7 @@ def ensure_valid_dtype(input_graph, input_df, input_df_name): warnings.warn(warning_msg, UserWarning) input_df = input_df.astype({"values": edge_attr_dtype}) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] input_df_vertex_dtype = input_df["vertex"].dtype if input_df_vertex_dtype != vertex_dtype: warning_msg = ( diff --git a/python/cugraph/cugraph/link_prediction/jaccard.py b/python/cugraph/cugraph/link_prediction/jaccard.py index f114b4a6d03..06644a7e1b7 100644 --- a/python/cugraph/cugraph/link_prediction/jaccard.py +++ b/python/cugraph/cugraph/link_prediction/jaccard.py @@ -38,10 +38,13 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, vertex_pair): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] vertex_pair_dtypes = vertex_pair.dtypes - if vertex_pair_dtypes[0] != vertex_dtype or vertex_pair_dtypes[1] != vertex_dtype: + if ( + vertex_pair_dtypes.iloc[0] != vertex_dtype + or vertex_pair_dtypes.iloc[1] != vertex_dtype + ): warning_msg = ( "Jaccard requires 'vertex_pair' to match the graph's 'vertex' type. " f"input graph's vertex type is: {vertex_dtype} and got " diff --git a/python/cugraph/cugraph/link_prediction/overlap.py b/python/cugraph/cugraph/link_prediction/overlap.py index 3a25526679c..b6e9cfb58c4 100644 --- a/python/cugraph/cugraph/link_prediction/overlap.py +++ b/python/cugraph/cugraph/link_prediction/overlap.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-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 @@ -38,10 +38,13 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, vertex_pair): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] vertex_pair_dtypes = vertex_pair.dtypes - if vertex_pair_dtypes[0] != vertex_dtype or vertex_pair_dtypes[1] != vertex_dtype: + if ( + vertex_pair_dtypes.iloc[0] != vertex_dtype + or vertex_pair_dtypes.iloc[1] != vertex_dtype + ): warning_msg = ( "Overlap requires 'vertex_pair' to match the graph's 'vertex' type. " f"input graph's vertex type is: {vertex_dtype} and got " diff --git a/python/cugraph/cugraph/link_prediction/sorensen.py b/python/cugraph/cugraph/link_prediction/sorensen.py index a8ccced1e68..cac8bfb9cc6 100644 --- a/python/cugraph/cugraph/link_prediction/sorensen.py +++ b/python/cugraph/cugraph/link_prediction/sorensen.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-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 @@ -38,10 +38,13 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, vertex_pair): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] vertex_pair_dtypes = vertex_pair.dtypes - if vertex_pair_dtypes[0] != vertex_dtype or vertex_pair_dtypes[1] != vertex_dtype: + if ( + vertex_pair_dtypes.iloc[0] != vertex_dtype + or vertex_pair_dtypes.iloc[1] != vertex_dtype + ): warning_msg = ( "Sorensen requires 'vertex_pair' to match the graph's 'vertex' type. " f"input graph's vertex type is: {vertex_dtype} and got " diff --git a/python/cugraph/cugraph/sampling/random_walks.py b/python/cugraph/cugraph/sampling/random_walks.py index 7b04dba82a5..1bd7394164f 100644 --- a/python/cugraph/cugraph/sampling/random_walks.py +++ b/python/cugraph/cugraph/sampling/random_walks.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-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 @@ -145,7 +145,7 @@ def random_walks( if isinstance(start_vertices, list): # Ensure the 'start_vertices' have the same dtype as the edge list. # Failing to do that may produce erroneous results. - vertex_dtype = G.edgelist.edgelist_df.dtypes[0] + vertex_dtype = G.edgelist.edgelist_df.dtypes.iloc[0] start_vertices = cudf.Series(start_vertices, dtype=vertex_dtype) if G.renumbered is True: diff --git a/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py b/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py index 1832585c0ab..86b33594ed7 100644 --- a/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py +++ b/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-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 @@ -38,11 +38,11 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, start_list): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] if isinstance(start_list, cudf.Series): start_list_dtypes = start_list.dtype else: - start_list_dtypes = start_list.dtypes[0] + start_list_dtypes = start_list.dtypes.iloc[0] if start_list_dtypes != vertex_dtype: warning_msg = ( diff --git a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py index c3a559da5c9..80acfe1c4ad 100644 --- a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py @@ -53,6 +53,7 @@ def get_sg_graph(dataset, directed, edge_ids): if not directed: # Edge ids not supported for undirected graph return None + dtype = df.dtypes.iloc[0] edge_id = "edge_id" df[edge_id] = df.index @@ -79,7 +80,7 @@ def get_mg_graph(dataset, directed, edge_ids, weight): weight = None if edge_ids: - dtype = ddf.dtypes[0] + dtype = ddf.dtypes.iloc[0] edge_id = "edge_id" ddf = ddf.assign(idx=1) ddf["edge_id"] = ddf.idx.cumsum().astype(dtype) - 1 diff --git a/python/cugraph/cugraph/tests/layout/test_force_atlas2.py b/python/cugraph/cugraph/tests/layout/test_force_atlas2.py index 6b1fd6bcc4e..1adfa104212 100644 --- a/python/cugraph/cugraph/tests/layout/test_force_atlas2.py +++ b/python/cugraph/cugraph/tests/layout/test_force_atlas2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023, NVIDIA CORPORATION. +# Copyright (c) 2020-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 @@ -122,9 +122,9 @@ def cugraph_call( BARNES_HUT_OPTIMIZE = [False, True] -class TestCallback(GraphBasedDimRedCallback): +class ExampleCallback(GraphBasedDimRedCallback): def __init__(self): - super(TestCallback, self).__init__() + super().__init__() self.on_preprocess_end_called_count = 0 self.on_epoch_end_called_count = 0 self.on_train_end_called_count = 0 @@ -145,7 +145,7 @@ def on_train_end(self, positions): @pytest.mark.parametrize("barnes_hut_optimize", BARNES_HUT_OPTIMIZE) def test_force_atlas2(graph_file, score, max_iter, barnes_hut_optimize): cu_M = graph_file.get_edgelist(download=True) - test_callback = TestCallback() + test_callback = ExampleCallback() cu_pos = cugraph_call( cu_M, max_iter=max_iter, diff --git a/python/cugraph/pytest.ini b/python/cugraph/pytest.ini index af15c94078c..ebbd6a7eaad 100644 --- a/python/cugraph/pytest.ini +++ b/python/cugraph/pytest.ini @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022, NVIDIA CORPORATION. +# Copyright (c) 2021-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 @@ -56,3 +56,8 @@ python_files = python_functions = bench_* test_* + +filterwarnings = + error:::cudf + # Called via dask. Not obviously addressable in cugraph. + ignore:The behavior of array concatenation with empty entries is deprecated:FutureWarning:cudf From 7904ff07d4a9a9b567193e46f9a6ed50ab6649f2 Mon Sep 17 00:00:00 2001 From: Naim <110031745+naimnv@users.noreply.github.com> Date: Mon, 18 Mar 2024 03:53:24 +0100 Subject: [PATCH 5/9] update example build script with targets and options/help (#4254) update example build script with targets and options/help Authors: - Naim (https://github.com/naimnv) Approvers: - Brad Rees (https://github.com/BradReesWork) - Chuck Hastings (https://github.com/ChuckHastings) URL: https://github.com/rapidsai/cugraph/pull/4254 --- cpp/examples/README.md | 4 +- cpp/examples/build.sh | 101 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 92 insertions(+), 13 deletions(-) diff --git a/cpp/examples/README.md b/cpp/examples/README.md index 2859d05c692..3d8a1674c2e 100644 --- a/cpp/examples/README.md +++ b/cpp/examples/README.md @@ -17,10 +17,10 @@ ## Build instructions: -Run `build.sh` from the examples dir to build the above listed examples. +Run `build.sh all` from the examples dir to build the above listed examples. ```sh -~/cugraph/cpp/examples$./build.sh +~/cugraph/cpp/examples$./build.sh all ``` ## Run instructions diff --git a/cpp/examples/build.sh b/cpp/examples/build.sh index 050ac3771d8..37b0a8bb391 100755 --- a/cpp/examples/build.sh +++ b/cpp/examples/build.sh @@ -4,29 +4,108 @@ # script for building libcugraph examples +set -e + +NUMARGS=$# +ARGS=$* + +VALIDARGS=" + clean + all + -v + -h + --help +" + +VERBOSE_FLAG="" +CMAKE_VERBOSE_OPTION="" + # Parallelism control PARALLEL_LEVEL=${PARALLEL_LEVEL:-8} # Root of examples -EXAMPLES_DIR=$(dirname "$(realpath "$0")") +EXAMPLES_ROOT_DIR=$(dirname "$(realpath "$0")") +EXAMPLES=( + "users/single_gpu_application" + "users/multi_gpu_application" + "developers/vertex_and_edge_partition" + "developers/graph_operations") + +CUGRAPH_BUILD_DIR=${CUGRAPH_BUILD_DIR:-$(readlink -f "${EXAMPLES_ROOT_DIR}/../build")} + +HELP="$0 [ ...] [ ...] + where is: + clean - remove all existing build artifacts and configuration (start over) + all - build all of the examples from the following directories + ${EXAMPLES_ROOT_DIR}/users + ${EXAMPLES_ROOT_DIR}/developers + where is: + -v - verbose build mode + -h - print this text + --help - print this text +" + +if (( ${NUMARGS} == 0 )); then + echo "${HELP}" +fi + +# Check for valid usage +if (( ${NUMARGS} != 0 )); then + for a in ${ARGS}; do + if ! (echo "${VALIDARGS}" | grep -q "^[[:blank:]]*${a}$"); then + echo "Invalid option: ${a}" + exit 1 + fi + done +fi + +function hasArg { + (( ${NUMARGS} != 0 )) && (echo " ${ARGS} " | grep -q " $1 ") +} + +if hasArg -h || hasArg --help; then + echo "${HELP}" + exit 0 +fi -LIB_BUILD_DIR=${LIB_BUILD_DIR:-$(readlink -f "${EXAMPLES_DIR}/../build")} +if hasArg -v; then + VERBOSE_FLAG="-v" + CMAKE_VERBOSE_OPTION="--log-level=VERBOSE" +fi -################################################################################ -# Add individual libcudf examples build scripts down below +if hasArg clean; then + # Ignore errors for clean since missing files, etc. are not failures + set +e + for idx in ${!EXAMPLES[@]} + do + current_example=${EXAMPLES[$idx]} + build_dir="${EXAMPLES_ROOT_DIR}/${current_example}/build" + if [ -d ${build_dir} ]; then + find ${build_dir} -mindepth 1 -delete + rmdir ${build_dir} || true + echo "Removed ${build_dir}" + fi + done + # Go back to failing on first error for all other operations + set -e +fi build_example() { + echo "building ${1}" example_dir=${1} - example_dir="${EXAMPLES_DIR}/${example_dir}" + example_dir="${EXAMPLES_ROOT_DIR}/${example_dir}" build_dir="${example_dir}/build" # Configure - cmake -S ${example_dir} -B ${build_dir} -Dcugraph_ROOT="${LIB_BUILD_DIR}" + cmake -S ${example_dir} -B ${build_dir} -Dcugraph_ROOT="${CUGRAPH_BUILD_DIR}" ${CMAKE_VERBOSE_OPTION} # Build - cmake --build ${build_dir} -j${PARALLEL_LEVEL} + cmake --build ${build_dir} -j${PARALLEL_LEVEL} ${VERBOSE_FLAG} } -build_example users/single_gpu_application -build_example users/multi_gpu_application -build_example developers/vertex_and_edge_partition -build_example developers/graph_operations +if hasArg all; then + for idx in ${!EXAMPLES[@]} + do + current_example=${EXAMPLES[$idx]} + build_example $current_example + done +fi From 47cd8c71fd5805fc96400f24acdd86b064d9442c Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Tue, 19 Mar 2024 08:22:51 -0500 Subject: [PATCH 6/9] Remove outdated conda_build.sh. (#4257) This PR removes the `conda_build.sh` script from the repository root. This script appears to be outdated and unusable with the current cugraph recipes. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Ray Douglass (https://github.com/raydouglass) URL: https://github.com/rapidsai/cugraph/pull/4257 --- conda_build.sh | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100755 conda_build.sh diff --git a/conda_build.sh b/conda_build.sh deleted file mode 100755 index 9bcabec9694..00000000000 --- a/conda_build.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2021-2022, NVIDIA CORPORATION - -set -xe - -CUDA_REL=${CUDA_VERSION%.*} - -conda install conda-build anaconda-client conda-verify -y -conda build -c rapidsai -c rapidsai-nightly/label/cuda${CUDA_REL} -c conda-forge -c nvidia --python=${PYTHON} conda/recipes/cugraph - -if [ "$UPLOAD_PACKAGE" == '1' ]; then - export UPLOADFILE=`conda build -c rapidsai -c conda-forge -c nvidia --python=${PYTHON} conda/recipes/cugraph --output` - SOURCE_BRANCH=main - - test -e ${UPLOADFILE} - - - LABEL_OPTION="--label dev" - if [ "${LABEL_MAIN}" == '1' ]; then - LABEL_OPTION="--label main" - fi - echo "LABEL_OPTION=${LABEL_OPTION}" - - if [ -z "$MY_UPLOAD_KEY" ]; then - echo "No upload key" - return 0 - fi - - echo "Upload" - echo ${UPLOADFILE} - anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --force ${UPLOADFILE} --no-progress -else - echo "Skipping upload" -fi From d6fa29e7888030f669e570876558dfb6805e01c6 Mon Sep 17 00:00:00 2001 From: Seunghwa Kang <45857425+seunghwak@users.noreply.github.com> Date: Tue, 19 Mar 2024 13:38:15 -0700 Subject: [PATCH 7/9] Refactor test utility functions and update SG & MG core_number tests to test with edge masking (#4253) We previously had `test_utilities.hpp` having all different sorts of function declarations and `property_generator.cuh` (which is necessary to create an edge mask) was only for primitives testing. This PR divides `test_utilities.hpp` to multiple files (`check_utilities.hpp`, `conversion_utilities.hpp`, `csv_file_utilities.hpp`, `matrix_market_file_utilities.hpp`, and `misc_utilties.hpp`) renamed/moved `tests/prims/property_generator.cuh` to `tests/utilities/property_generator_utilities.hpp` (now this file can be included from .cpp files). Updated SG & MG core_number tests to use property generator to create an edge mask. Authors: - Seunghwa Kang (https://github.com/seunghwak) Approvers: - Naim (https://github.com/naimnv) - Joseph Nke (https://github.com/jnke2016) - Chuck Hastings (https://github.com/ChuckHastings) URL: https://github.com/rapidsai/cugraph/pull/4253 --- cpp/src/cores/core_number_impl.cuh | 2 - .../transform_reduce_e_by_src_dst_key.cuh | 1 + cpp/tests/CMakeLists.txt | 6 +- cpp/tests/c_api/mg_test_utils.cpp | 2 +- .../betweenness_centrality_reference.hpp | 2 - .../betweenness_centrality_test.cpp | 9 +- .../betweenness_centrality_validate.cu | 2 +- .../edge_betweenness_centrality_test.cpp | 20 +- .../eigenvector_centrality_test.cpp | 2 +- cpp/tests/centrality/katz_centrality_test.cpp | 2 +- .../mg_betweenness_centrality_test.cpp | 2 +- .../mg_edge_betweenness_centrality_test.cpp | 12 +- .../mg_eigenvector_centrality_test.cpp | 2 +- .../centrality/mg_katz_centrality_test.cpp | 2 +- cpp/tests/community/egonet_test.cpp | 1 - cpp/tests/community/egonet_validate.cu | 2 +- cpp/tests/community/legacy_ecg_test.cpp | 2 + cpp/tests/community/leiden_test.cpp | 1 - cpp/tests/community/louvain_test.cpp | 2 +- cpp/tests/community/mg_ecg_test.cpp | 2 +- cpp/tests/community/mg_egonet_test.cu | 2 +- cpp/tests/community/mg_leiden_test.cpp | 2 +- cpp/tests/community/mg_louvain_test.cpp | 3 +- .../community/mg_triangle_count_test.cpp | 2 +- cpp/tests/community/triangle_count_test.cpp | 2 +- cpp/tests/components/mg_mis_test.cu | 2 - .../components/mg_vertex_coloring_test.cu | 2 - .../mg_weakly_connected_components_test.cpp | 1 + cpp/tests/components/mis_test.cu | 1 - cpp/tests/components/scc_test.cu | 1 - cpp/tests/components/vertex_coloring_test.cu | 1 - .../weakly_connected_components_test.cpp | 2 +- cpp/tests/cores/core_number_test.cpp | 80 ++- cpp/tests/cores/k_core_test.cpp | 1 - cpp/tests/cores/mg_core_number_test.cpp | 56 +- cpp/tests/cores/mg_k_core_test.cpp | 1 + cpp/tests/generators/erdos_renyi_test.cpp | 2 +- .../generate_bipartite_rmat_test.cpp | 2 +- cpp/tests/generators/generate_rmat_test.cpp | 2 +- cpp/tests/generators/generators_test.cpp | 3 +- cpp/tests/layout/legacy/force_atlas2_test.cu | 1 - cpp/tests/linear_assignment/hungarian_test.cu | 2 +- cpp/tests/link_analysis/hits_test.cpp | 30 +- cpp/tests/link_analysis/mg_hits_test.cpp | 38 +- cpp/tests/link_analysis/mg_pagerank_test.cpp | 4 +- cpp/tests/link_analysis/pagerank_test.cpp | 4 +- .../link_prediction/mg_similarity_test.cpp | 9 +- .../mg_weighted_similarity_test.cpp | 9 +- .../link_prediction/similarity_compare.cpp | 2 +- cpp/tests/link_prediction/similarity_test.cpp | 330 ---------- cpp/tests/link_prediction/similarity_test.cu | 19 +- .../weighted_similarity_test.cpp | 14 +- cpp/tests/prims/mg_count_if_e.cu | 32 +- cpp/tests/prims/mg_count_if_v.cu | 2 +- cpp/tests/prims/mg_extract_transform_e.cu | 21 +- ...extract_transform_v_frontier_outgoing_e.cu | 21 +- ...r_v_pair_transform_dst_nbr_intersection.cu | 8 +- ...transform_dst_nbr_weighted_intersection.cu | 8 +- ...er_v_random_select_transform_outgoing_e.cu | 18 +- ...rm_reduce_dst_key_aggregated_outgoing_e.cu | 68 +- ..._v_transform_reduce_incoming_outgoing_e.cu | 40 +- cpp/tests/prims/mg_reduce_v.cu | 22 +- cpp/tests/prims/mg_transform_e.cu | 18 +- ...st_nbr_intersection_of_e_endpoints_by_v.cu | 45 +- cpp/tests/prims/mg_transform_reduce_e.cu | 34 +- .../mg_transform_reduce_e_by_src_dst_key.cu | 74 +-- cpp/tests/prims/mg_transform_reduce_v.cu | 7 +- ...orm_reduce_v_frontier_outgoing_e_by_dst.cu | 38 +- cpp/tests/prims/property_generator.cuh | 176 ------ .../sampling/detail/nbr_sampling_utils.cuh | 1 - cpp/tests/sampling/mg_random_walks_test.cpp | 1 - cpp/tests/sampling/sg_random_walks_test.cpp | 1 - cpp/tests/structure/coarsen_graph_test.cpp | 2 +- .../count_self_loops_and_multi_edges_test.cpp | 2 +- cpp/tests/structure/degree_test.cpp | 2 +- ...has_edge_and_compute_multiplicity_test.cpp | 2 +- cpp/tests/structure/induced_subgraph_test.cpp | 8 +- ..._count_self_loops_and_multi_edges_test.cpp | 2 +- ...has_edge_and_compute_multiplicity_test.cpp | 2 +- .../structure/mg_induced_subgraph_test.cu | 1 + .../mg_select_random_vertices_test.cpp | 2 +- cpp/tests/structure/mg_symmetrize_test.cpp | 2 +- .../structure/mg_transpose_storage_test.cpp | 2 +- cpp/tests/structure/mg_transpose_test.cpp | 2 +- cpp/tests/structure/renumbering_test.cpp | 2 +- cpp/tests/structure/symmetrize_test.cpp | 2 +- .../structure/transpose_storage_test.cpp | 2 +- cpp/tests/structure/transpose_test.cpp | 2 +- cpp/tests/structure/weight_sum_test.cpp | 9 +- cpp/tests/traversal/bfs_test.cpp | 2 +- cpp/tests/traversal/extract_bfs_paths_test.cu | 2 +- cpp/tests/traversal/k_hop_nbrs_test.cpp | 2 +- cpp/tests/traversal/mg_bfs_test.cpp | 2 +- .../traversal/mg_extract_bfs_paths_test.cu | 2 +- cpp/tests/traversal/mg_k_hop_nbrs_test.cpp | 2 +- cpp/tests/traversal/mg_sssp_test.cpp | 2 +- cpp/tests/traversal/ms_bfs_test.cu | 1 - .../traversal/od_shortest_distances_test.cpp | 2 +- cpp/tests/traversal/sssp_test.cpp | 2 +- cpp/tests/tree/mst_test.cu | 1 - cpp/tests/utilities/check_utilities.hpp | 103 +++ cpp/tests/utilities/conversion_utilities.hpp | 234 +++++++ ...impl.cuh => conversion_utilities_impl.cuh} | 25 +- ...ities_mg.cu => conversion_utilities_mg.cu} | 134 ++-- ...ities_sg.cu => conversion_utilities_sg.cu} | 110 ++-- cpp/tests/utilities/csv_file_utilities.cu | 2 +- cpp/tests/utilities/csv_file_utilities.hpp | 59 ++ .../utilities/matrix_market_file_utilities.cu | 2 +- .../matrix_market_file_utilities.hpp | 122 ++++ cpp/tests/utilities/mg_utilities.cpp | 4 +- cpp/tests/utilities/misc_utilities.cpp | 2 +- cpp/tests/utilities/misc_utilities.hpp | 44 ++ .../utilities/property_generator_kernels.cuh | 85 +++ .../property_generator_utilities.hpp | 68 ++ .../property_generator_utilities_impl.cuh | 127 ++++ .../property_generator_utilities_mg.cu | 58 ++ .../property_generator_utilities_sg.cu | 58 ++ cpp/tests/utilities/test_graphs.hpp | 4 +- cpp/tests/utilities/test_utilities.hpp | 584 ------------------ 119 files changed, 1662 insertions(+), 1570 deletions(-) delete mode 100644 cpp/tests/link_prediction/similarity_test.cpp delete mode 100644 cpp/tests/prims/property_generator.cuh create mode 100644 cpp/tests/utilities/check_utilities.hpp create mode 100644 cpp/tests/utilities/conversion_utilities.hpp rename cpp/tests/utilities/{test_utilities_impl.cuh => conversion_utilities_impl.cuh} (96%) rename cpp/tests/utilities/{test_utilities_mg.cu => conversion_utilities_mg.cu} (84%) rename cpp/tests/utilities/{test_utilities_sg.cu => conversion_utilities_sg.cu} (78%) create mode 100644 cpp/tests/utilities/csv_file_utilities.hpp create mode 100644 cpp/tests/utilities/matrix_market_file_utilities.hpp create mode 100644 cpp/tests/utilities/misc_utilities.hpp create mode 100644 cpp/tests/utilities/property_generator_kernels.cuh create mode 100644 cpp/tests/utilities/property_generator_utilities.hpp create mode 100644 cpp/tests/utilities/property_generator_utilities_impl.cuh create mode 100644 cpp/tests/utilities/property_generator_utilities_mg.cu create mode 100644 cpp/tests/utilities/property_generator_utilities_sg.cu delete mode 100644 cpp/tests/utilities/test_utilities.hpp diff --git a/cpp/src/cores/core_number_impl.cuh b/cpp/src/cores/core_number_impl.cuh index 8c9234d6f7d..358b0ac2e00 100644 --- a/cpp/src/cores/core_number_impl.cuh +++ b/cpp/src/cores/core_number_impl.cuh @@ -88,8 +88,6 @@ void core_number(raft::handle_t const& handle, { // check input arguments. - CUGRAPH_EXPECTS(!graph_view.has_edge_mask(), "unimplemented."); - CUGRAPH_EXPECTS(graph_view.is_symmetric(), "Invalid input argument: core_number currently supports only undirected graphs."); CUGRAPH_EXPECTS(!graph_view.is_multigraph(), diff --git a/cpp/src/prims/transform_reduce_e_by_src_dst_key.cuh b/cpp/src/prims/transform_reduce_e_by_src_dst_key.cuh index 00876012906..2fb87527c62 100644 --- a/cpp/src/prims/transform_reduce_e_by_src_dst_key.cuh +++ b/cpp/src/prims/transform_reduce_e_by_src_dst_key.cuh @@ -19,6 +19,7 @@ #include "prims/property_op_utils.cuh" #include +#include #include #include #include diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 4d37c93326d..f2eb4c38a2b 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -25,9 +25,10 @@ rapids_test_init() add_library(cugraphtestutil STATIC utilities/matrix_market_file_utilities.cu utilities/csv_file_utilities.cu + utilities/property_generator_utilities_sg.cu utilities/thrust_wrapper.cu utilities/misc_utilities.cpp - utilities/test_utilities_sg.cu + utilities/conversion_utilities_sg.cu link_prediction/similarity_compare.cpp centrality/betweenness_centrality_validate.cu community/egonet_validate.cu @@ -438,7 +439,8 @@ if(BUILD_CUGRAPH_MG_TESTS) add_library(cugraphmgtestutil STATIC utilities/device_comm_wrapper.cu utilities/mg_utilities.cpp - utilities/test_utilities_mg.cu + utilities/conversion_utilities_mg.cu + utilities/property_generator_utilities_mg.cu sampling/random_walks_check_mg.cu c_api/mg_test_utils.cpp ) diff --git a/cpp/tests/c_api/mg_test_utils.cpp b/cpp/tests/c_api/mg_test_utils.cpp index 956f7872b5d..58c5e59c16f 100644 --- a/cpp/tests/c_api/mg_test_utils.cpp +++ b/cpp/tests/c_api/mg_test_utils.cpp @@ -19,8 +19,8 @@ #include "c_api/array.hpp" #include "c_api/c_test_utils.h" #include "c_api/resource_handle.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/centrality/betweenness_centrality_reference.hpp b/cpp/tests/centrality/betweenness_centrality_reference.hpp index cf197d19312..e0f094ee9cd 100644 --- a/cpp/tests/centrality/betweenness_centrality_reference.hpp +++ b/cpp/tests/centrality/betweenness_centrality_reference.hpp @@ -16,8 +16,6 @@ #pragma once -#include "utilities/test_utilities.hpp" - #include #include diff --git a/cpp/tests/centrality/betweenness_centrality_test.cpp b/cpp/tests/centrality/betweenness_centrality_test.cpp index 8f4b45516fd..a9a11d20f6f 100644 --- a/cpp/tests/centrality/betweenness_centrality_test.cpp +++ b/cpp/tests/centrality/betweenness_centrality_test.cpp @@ -16,8 +16,8 @@ #include "betweenness_centrality_reference.hpp" #include "betweenness_centrality_validate.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -116,8 +116,11 @@ class Tests_BetweennessCentrality } if (betweenness_usecase.check_correctness) { - auto [h_offsets, h_indices, h_wgt] = - cugraph::test::graph_to_host_csr(handle, graph_view, edge_weight_view); + auto [h_offsets, h_indices, h_wgt] = cugraph::test::graph_to_host_csr( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); auto h_seeds = cugraph::test::to_host(handle, d_seeds); auto h_reference_centralities = diff --git a/cpp/tests/centrality/betweenness_centrality_validate.cu b/cpp/tests/centrality/betweenness_centrality_validate.cu index 3983c3b004c..7d5df4d754e 100644 --- a/cpp/tests/centrality/betweenness_centrality_validate.cu +++ b/cpp/tests/centrality/betweenness_centrality_validate.cu @@ -15,7 +15,7 @@ */ #include "betweenness_centrality_validate.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/check_utilities.hpp" #include diff --git a/cpp/tests/centrality/edge_betweenness_centrality_test.cpp b/cpp/tests/centrality/edge_betweenness_centrality_test.cpp index f2f40e1d4cb..6e1e24e64d8 100644 --- a/cpp/tests/centrality/edge_betweenness_centrality_test.cpp +++ b/cpp/tests/centrality/edge_betweenness_centrality_test.cpp @@ -16,8 +16,8 @@ #include "centrality/betweenness_centrality_reference.hpp" #include "centrality/betweenness_centrality_validate.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -116,8 +116,11 @@ class Tests_EdgeBetweennessCentrality if (betweenness_usecase.check_correctness) { // Compute reference edge betweenness result - auto [h_offsets, h_indices, h_wgt] = - cugraph::test::graph_to_host_csr(handle, graph_view, edge_weight_view); + auto [h_offsets, h_indices, h_wgt] = cugraph::test::graph_to_host_csr( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); auto h_seeds = cugraph::test::to_host(handle, d_seeds); @@ -133,13 +136,20 @@ class Tests_EdgeBetweennessCentrality rmm::device_uvector d_reference_dst_vertex_ids(0, handle.get_stream()); std::tie(d_reference_src_vertex_ids, d_reference_dst_vertex_ids, std::ignore) = - cugraph::test::graph_to_device_coo(handle, graph_view, edge_weight_view); + cugraph::test::graph_to_device_coo( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); auto d_reference_centralities = cugraph::test::to_device(handle, h_reference_centralities); auto [d_cugraph_src_vertex_ids, d_cugraph_dst_vertex_ids, d_cugraph_results] = cugraph::test::graph_to_device_coo( - handle, graph_view, std::make_optional(d_centralities.view())); + handle, + graph_view, + std::make_optional(d_centralities.view()), + std::optional>(std::nullopt)); cugraph::test::edge_betweenness_centrality_validate(handle, d_cugraph_src_vertex_ids, diff --git a/cpp/tests/centrality/eigenvector_centrality_test.cpp b/cpp/tests/centrality/eigenvector_centrality_test.cpp index b3e6d148237..3387f11c1f2 100644 --- a/cpp/tests/centrality/eigenvector_centrality_test.cpp +++ b/cpp/tests/centrality/eigenvector_centrality_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/centrality/katz_centrality_test.cpp b/cpp/tests/centrality/katz_centrality_test.cpp index b3ffd2f053b..52481c1f4a8 100644 --- a/cpp/tests/centrality/katz_centrality_test.cpp +++ b/cpp/tests/centrality/katz_centrality_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/centrality/mg_betweenness_centrality_test.cpp b/cpp/tests/centrality/mg_betweenness_centrality_test.cpp index c9ebd192d6c..8c28d493c65 100644 --- a/cpp/tests/centrality/mg_betweenness_centrality_test.cpp +++ b/cpp/tests/centrality/mg_betweenness_centrality_test.cpp @@ -15,9 +15,9 @@ */ #include "centrality/betweenness_centrality_validate.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/centrality/mg_edge_betweenness_centrality_test.cpp b/cpp/tests/centrality/mg_edge_betweenness_centrality_test.cpp index ae4a02e537f..7b3613f8210 100644 --- a/cpp/tests/centrality/mg_edge_betweenness_centrality_test.cpp +++ b/cpp/tests/centrality/mg_edge_betweenness_centrality_test.cpp @@ -15,9 +15,9 @@ */ #include "centrality/betweenness_centrality_validate.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -119,7 +119,10 @@ class Tests_MGEdgeBetweennessCentrality // Extract MG results auto [d_cugraph_src_vertex_ids, d_cugraph_dst_vertex_ids, d_cugraph_results] = cugraph::test::graph_to_device_coo( - *handle_, mg_graph_view, std::make_optional(d_centralities.view())); + *handle_, + mg_graph_view, + std::make_optional(d_centralities.view()), + std::optional>(std::nullopt)); // Create SG graph so we can generate SG results cugraph::graph_t sg_graph(*handle_); @@ -152,7 +155,10 @@ class Tests_MGEdgeBetweennessCentrality auto [d_sg_src_vertex_ids, d_sg_dst_vertex_ids, d_sg_reference_centralities] = cugraph::test::graph_to_device_coo( - *handle_, sg_graph.view(), std::make_optional(d_sg_centralities.view())); + *handle_, + sg_graph.view(), + std::make_optional(d_sg_centralities.view()), + std::optional>(std::nullopt)); cugraph::test::edge_betweenness_centrality_validate(*handle_, d_cugraph_src_vertex_ids, diff --git a/cpp/tests/centrality/mg_eigenvector_centrality_test.cpp b/cpp/tests/centrality/mg_eigenvector_centrality_test.cpp index 4bd93bf87df..2081aea56b0 100644 --- a/cpp/tests/centrality/mg_eigenvector_centrality_test.cpp +++ b/cpp/tests/centrality/mg_eigenvector_centrality_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/centrality/mg_katz_centrality_test.cpp b/cpp/tests/centrality/mg_katz_centrality_test.cpp index e8a3b2024d4..4455e6d7b99 100644 --- a/cpp/tests/centrality/mg_katz_centrality_test.cpp +++ b/cpp/tests/centrality/mg_katz_centrality_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/community/egonet_test.cpp b/cpp/tests/community/egonet_test.cpp index 848626d3df9..4795142d4ef 100644 --- a/cpp/tests/community/egonet_test.cpp +++ b/cpp/tests/community/egonet_test.cpp @@ -16,7 +16,6 @@ #include "community/egonet_validate.hpp" #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/community/egonet_validate.cu b/cpp/tests/community/egonet_validate.cu index ec7b5386cd5..9830deb8e1b 100644 --- a/cpp/tests/community/egonet_validate.cu +++ b/cpp/tests/community/egonet_validate.cu @@ -15,7 +15,7 @@ */ #include "community/egonet_validate.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include diff --git a/cpp/tests/community/legacy_ecg_test.cpp b/cpp/tests/community/legacy_ecg_test.cpp index c061215415a..c1b35cb975b 100644 --- a/cpp/tests/community/legacy_ecg_test.cpp +++ b/cpp/tests/community/legacy_ecg_test.cpp @@ -8,6 +8,8 @@ * license agreement from NVIDIA CORPORATION is strictly prohibited. * */ +#include "utilities/conversion_utilities.hpp" + #include #include diff --git a/cpp/tests/community/leiden_test.cpp b/cpp/tests/community/leiden_test.cpp index 0594fa39f9b..5ce0903f723 100644 --- a/cpp/tests/community/leiden_test.cpp +++ b/cpp/tests/community/leiden_test.cpp @@ -10,7 +10,6 @@ */ #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/community/louvain_test.cpp b/cpp/tests/community/louvain_test.cpp index b4445119367..0f30e0a7f12 100644 --- a/cpp/tests/community/louvain_test.cpp +++ b/cpp/tests/community/louvain_test.cpp @@ -9,8 +9,8 @@ * */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/community/mg_ecg_test.cpp b/cpp/tests/community/mg_ecg_test.cpp index e021d381ee6..a5e02c4f532 100644 --- a/cpp/tests/community/mg_ecg_test.cpp +++ b/cpp/tests/community/mg_ecg_test.cpp @@ -15,9 +15,9 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/community/mg_egonet_test.cu b/cpp/tests/community/mg_egonet_test.cu index 4f4a3cec925..66ab1f47312 100644 --- a/cpp/tests/community/mg_egonet_test.cu +++ b/cpp/tests/community/mg_egonet_test.cu @@ -17,9 +17,9 @@ #include "egonet_validate.hpp" #include "structure/detail/structure_utils.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/community/mg_leiden_test.cpp b/cpp/tests/community/mg_leiden_test.cpp index ff5b315f4a1..f1a2fc83192 100644 --- a/cpp/tests/community/mg_leiden_test.cpp +++ b/cpp/tests/community/mg_leiden_test.cpp @@ -15,9 +15,9 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/community/mg_louvain_test.cpp b/cpp/tests/community/mg_louvain_test.cpp index 53117d7823c..733ee9368ac 100644 --- a/cpp/tests/community/mg_louvain_test.cpp +++ b/cpp/tests/community/mg_louvain_test.cpp @@ -15,9 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/check_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/community/mg_triangle_count_test.cpp b/cpp/tests/community/mg_triangle_count_test.cpp index 70a3b38f09d..96e6fbb9f16 100644 --- a/cpp/tests/community/mg_triangle_count_test.cpp +++ b/cpp/tests/community/mg_triangle_count_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/community/triangle_count_test.cpp b/cpp/tests/community/triangle_count_test.cpp index ae41df072ca..90defcdc91b 100644 --- a/cpp/tests/community/triangle_count_test.cpp +++ b/cpp/tests/community/triangle_count_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/components/mg_mis_test.cu b/cpp/tests/components/mg_mis_test.cu index 04c346b0f00..c2469ba867d 100644 --- a/cpp/tests/components/mg_mis_test.cu +++ b/cpp/tests/components/mg_mis_test.cu @@ -16,12 +16,10 @@ #include "prims/fill_edge_src_dst_property.cuh" #include "prims/per_v_transform_reduce_incoming_outgoing_e.cuh" -#include "prims/property_generator.cuh" #include "prims/reduce_op.cuh" #include "prims/update_edge_src_dst_property.cuh" #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/components/mg_vertex_coloring_test.cu b/cpp/tests/components/mg_vertex_coloring_test.cu index ce4dadaa786..2c54e3cf065 100644 --- a/cpp/tests/components/mg_vertex_coloring_test.cu +++ b/cpp/tests/components/mg_vertex_coloring_test.cu @@ -16,13 +16,11 @@ #include "prims/fill_edge_src_dst_property.cuh" #include "prims/per_v_transform_reduce_incoming_outgoing_e.cuh" -#include "prims/property_generator.cuh" #include "prims/reduce_op.cuh" #include "prims/transform_reduce_e.cuh" #include "prims/update_edge_src_dst_property.cuh" #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/components/mg_weakly_connected_components_test.cpp b/cpp/tests/components/mg_weakly_connected_components_test.cpp index 88ffcdd5793..c510e3139fb 100644 --- a/cpp/tests/components/mg_weakly_connected_components_test.cpp +++ b/cpp/tests/components/mg_weakly_connected_components_test.cpp @@ -15,6 +15,7 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" diff --git a/cpp/tests/components/mis_test.cu b/cpp/tests/components/mis_test.cu index f3bdd3d0e8b..f98aa1fe0c7 100644 --- a/cpp/tests/components/mis_test.cu +++ b/cpp/tests/components/mis_test.cu @@ -18,7 +18,6 @@ #include "prims/reduce_op.cuh" #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/components/scc_test.cu b/cpp/tests/components/scc_test.cu index 914e7bb5004..c6c0af50528 100644 --- a/cpp/tests/components/scc_test.cu +++ b/cpp/tests/components/scc_test.cu @@ -15,7 +15,6 @@ #include "components/legacy/scc_matrix.cuh" #include "converters/legacy/COOtoCSR.cuh" #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/components/vertex_coloring_test.cu b/cpp/tests/components/vertex_coloring_test.cu index 27a0c5013bd..c7c37c6ad56 100644 --- a/cpp/tests/components/vertex_coloring_test.cu +++ b/cpp/tests/components/vertex_coloring_test.cu @@ -19,7 +19,6 @@ #include "prims/transform_reduce_e.cuh" #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/components/weakly_connected_components_test.cpp b/cpp/tests/components/weakly_connected_components_test.cpp index 747b49346e6..2dd82316b00 100644 --- a/cpp/tests/components/weakly_connected_components_test.cpp +++ b/cpp/tests/components/weakly_connected_components_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/thrust_wrapper.hpp" #include #include diff --git a/cpp/tests/cores/core_number_test.cpp b/cpp/tests/cores/core_number_test.cpp index 026a4a5f0df..fb6f26278af 100644 --- a/cpp/tests/cores/core_number_test.cpp +++ b/cpp/tests/cores/core_number_test.cpp @@ -15,11 +15,13 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include +#include #include #include #include @@ -198,6 +200,7 @@ struct CoreNumber_Usecase { size_t k_last{std::numeric_limits::max()}; // vertices that belong (k_last + 1)-core will // have core numbers of k_last + bool edge_masking{false}; bool check_correctness{true}; }; @@ -242,6 +245,13 @@ class Tests_CoreNumber } auto graph_view = graph.view(); + std::optional> edge_mask{std::nullopt}; + if (core_number_usecase.edge_masking) { + edge_mask = + cugraph::test::generate::edge_property(handle, graph_view, 2); + graph_view.attach_edge_mask((*edge_mask).view()); + } + ASSERT_TRUE(core_number_usecase.k_first <= core_number_usecase.k_last) << "Invalid pair of (k_first, k_last)."; @@ -267,18 +277,17 @@ class Tests_CoreNumber } if (core_number_usecase.check_correctness) { - cugraph::graph_t unrenumbered_graph(handle); - if (renumber) { - std::tie(unrenumbered_graph, std::ignore, std::ignore) = - cugraph::test::construct_graph( - handle, input_usecase, false, false, true, true); - } - auto unrenumbered_graph_view = renumber ? unrenumbered_graph.view() : graph_view; - - auto h_offsets = cugraph::test::to_host( - handle, unrenumbered_graph_view.local_edge_partition_view().offsets()); - auto h_indices = cugraph::test::to_host( - handle, unrenumbered_graph_view.local_edge_partition_view().indices()); + std::vector h_offsets{}; + std::vector h_indices{}; + std::tie(h_offsets, h_indices, std::ignore) = + cugraph::test::graph_to_host_csr( + handle, + graph_view, + std::nullopt, + d_renumber_map_labels + ? std::make_optional>((*d_renumber_map_labels).data(), + (*d_renumber_map_labels).size()) + : std::nullopt); auto h_reference_core_numbers = core_number_reference(h_offsets.data(), h_indices.data(), @@ -342,14 +351,23 @@ INSTANTIATE_TEST_SUITE_P( // enable correctness checks testing::Values( CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), false}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::IN, size_t{2}, size_t{2}, false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, size_t{1}, size_t{3}, false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::INOUT, size_t{2}, size_t{4}, false}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max()}, - CoreNumber_Usecase{cugraph::k_core_degree_type_t::IN, size_t{2}, size_t{2}}, - CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, size_t{1}, size_t{3}}, - CoreNumber_Usecase{cugraph::k_core_degree_type_t::INOUT, size_t{2}, size_t{4}}), + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), true}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), true}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), true}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::IN, size_t{2}, size_t{2}, true}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, size_t{1}, size_t{3}, true}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::INOUT, size_t{2}, size_t{4}, true}), testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"), cugraph::test::File_Usecase("test/datasets/polbooks.mtx"), cugraph::test::File_Usecase("test/datasets/netscience.mtx")))); @@ -361,11 +379,17 @@ INSTANTIATE_TEST_SUITE_P( // enable correctness checks testing::Values( CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), true}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), true}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max()}), + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), true}), testing::Values(cugraph::test::Rmat_Usecase(10, 16, 0.57, 0.19, 0.19, 0, true, false)))); INSTANTIATE_TEST_SUITE_P( @@ -377,8 +401,16 @@ INSTANTIATE_TEST_SUITE_P( Tests_CoreNumber_Rmat, ::testing::Combine( // disable correctness checks for large graphs - testing::Values(CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), false}), + testing::Values(CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, + size_t{0}, + std::numeric_limits::max(), + false, + false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, + size_t{0}, + std::numeric_limits::max(), + true, + false}), testing::Values(cugraph::test::Rmat_Usecase(20, 32, 0.57, 0.19, 0.19, 0, true, false)))); CUGRAPH_TEST_PROGRAM_MAIN() diff --git a/cpp/tests/cores/k_core_test.cpp b/cpp/tests/cores/k_core_test.cpp index ce5637a49f8..064b7862842 100644 --- a/cpp/tests/cores/k_core_test.cpp +++ b/cpp/tests/cores/k_core_test.cpp @@ -17,7 +17,6 @@ #include "k_core_validate.hpp" #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/cores/mg_core_number_test.cpp b/cpp/tests/cores/mg_core_number_test.cpp index ed6e9b86111..ac99d7d4a93 100644 --- a/cpp/tests/cores/mg_core_number_test.cpp +++ b/cpp/tests/cores/mg_core_number_test.cpp @@ -15,10 +15,11 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -44,6 +45,7 @@ struct CoreNumber_Usecase { size_t k_last{std::numeric_limits::max()}; // vertices that belong (k_last + 1)-core will // have core numbers of k_last + bool edge_masking{false}; bool check_correctness{true}; }; @@ -92,6 +94,13 @@ class Tests_MGCoreNumber auto mg_graph_view = mg_graph.view(); + std::optional> edge_mask{std::nullopt}; + if (core_number_usecase.edge_masking) { + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); + mg_graph_view.attach_edge_mask((*edge_mask).view()); + } + // 2. run MG CoreNumber rmm::device_uvector d_mg_core_numbers(mg_graph_view.local_vertex_partition_range_size(), @@ -215,14 +224,23 @@ INSTANTIATE_TEST_SUITE_P( // enable correctness checks ::testing::Values( CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::IN, size_t{2}, size_t{2}, false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, size_t{1}, size_t{3}, false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::INOUT, size_t{2}, size_t{4}, false}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), true}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max()}, - CoreNumber_Usecase{cugraph::k_core_degree_type_t::IN, size_t{2}, size_t{2}}, - CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, size_t{1}, size_t{3}}, - CoreNumber_Usecase{cugraph::k_core_degree_type_t::INOUT, size_t{2}, size_t{4}}), + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), true}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), true}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::IN, size_t{2}, size_t{2}, true}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, size_t{1}, size_t{3}, true}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::INOUT, size_t{2}, size_t{4}, true}), ::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"), cugraph::test::File_Usecase("test/datasets/polbooks.mtx"), cugraph::test::File_Usecase("test/datasets/netscience.mtx")))); @@ -233,11 +251,17 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Combine( ::testing::Values( CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), false}, + CoreNumber_Usecase{ + cugraph::k_core_degree_type_t::IN, size_t{0}, std::numeric_limits::max(), true}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max()}, + cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), true}, CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max()}), + cugraph::k_core_degree_type_t::INOUT, size_t{0}, std::numeric_limits::max(), true}), ::testing::Values(cugraph::test::Rmat_Usecase(10, 16, 0.57, 0.19, 0.19, 0, true, false)))); INSTANTIATE_TEST_SUITE_P( @@ -248,8 +272,16 @@ INSTANTIATE_TEST_SUITE_P( factor (to avoid running same benchmarks more than once) */ Tests_MGCoreNumber_Rmat, ::testing::Combine( - ::testing::Values(CoreNumber_Usecase{ - cugraph::k_core_degree_type_t::OUT, size_t{0}, std::numeric_limits::max(), false}), + ::testing::Values(CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, + size_t{0}, + std::numeric_limits::max(), + false, + false}, + CoreNumber_Usecase{cugraph::k_core_degree_type_t::OUT, + size_t{0}, + std::numeric_limits::max(), + true, + false}), ::testing::Values(cugraph::test::Rmat_Usecase(20, 32, 0.57, 0.19, 0.19, 0, true, false)))); CUGRAPH_MG_TEST_PROGRAM_MAIN() diff --git a/cpp/tests/cores/mg_k_core_test.cpp b/cpp/tests/cores/mg_k_core_test.cpp index 1a30fff2d5b..100c7fa3bcf 100644 --- a/cpp/tests/cores/mg_k_core_test.cpp +++ b/cpp/tests/cores/mg_k_core_test.cpp @@ -16,6 +16,7 @@ #include "k_core_validate.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" diff --git a/cpp/tests/generators/erdos_renyi_test.cpp b/cpp/tests/generators/erdos_renyi_test.cpp index af38a2796b8..348799e041a 100644 --- a/cpp/tests/generators/erdos_renyi_test.cpp +++ b/cpp/tests/generators/erdos_renyi_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/generators/generate_bipartite_rmat_test.cpp b/cpp/tests/generators/generate_bipartite_rmat_test.cpp index 3fbc5df794d..996d6a34dd1 100644 --- a/cpp/tests/generators/generate_bipartite_rmat_test.cpp +++ b/cpp/tests/generators/generate_bipartite_rmat_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/generators/generate_rmat_test.cpp b/cpp/tests/generators/generate_rmat_test.cpp index d821fd51e07..1abac4289f8 100644 --- a/cpp/tests/generators/generate_rmat_test.cpp +++ b/cpp/tests/generators/generate_rmat_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/generators/generators_test.cpp b/cpp/tests/generators/generators_test.cpp index 97e873b136b..34a95aa5542 100644 --- a/cpp/tests/generators/generators_test.cpp +++ b/cpp/tests/generators/generators_test.cpp @@ -15,7 +15,8 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/check_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include diff --git a/cpp/tests/layout/legacy/force_atlas2_test.cu b/cpp/tests/layout/legacy/force_atlas2_test.cu index fa19d092cb9..6ed33b6bf15 100644 --- a/cpp/tests/layout/legacy/force_atlas2_test.cu +++ b/cpp/tests/layout/legacy/force_atlas2_test.cu @@ -14,7 +14,6 @@ #include "layout/legacy/trust_worthiness.h" #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/linear_assignment/hungarian_test.cu b/cpp/tests/linear_assignment/hungarian_test.cu index 6c812d8f995..7962161a564 100644 --- a/cpp/tests/linear_assignment/hungarian_test.cu +++ b/cpp/tests/linear_assignment/hungarian_test.cu @@ -11,7 +11,7 @@ #include "cuda_profiler_api.h" #include "gtest/gtest.h" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/link_analysis/hits_test.cpp b/cpp/tests/link_analysis/hits_test.cpp index c67259697d9..ad82dc3a1d1 100644 --- a/cpp/tests/link_analysis/hits_test.cpp +++ b/cpp/tests/link_analysis/hits_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -187,13 +187,22 @@ class Tests_Hits : public ::testing::TestWithParam d_authorities(graph_view.local_vertex_partition_range_size(), handle.get_stream()); - std::vector initial_random_hubs = - (hits_usecase.check_initial_input) ? cugraph::test::random_vector(d_hubs.size()) - : std::vector(0); - + std::optional> d_initial_random_hubs{std::nullopt}; if (hits_usecase.check_initial_input) { - raft::update_device( - d_hubs.data(), initial_random_hubs.data(), initial_random_hubs.size(), handle.get_stream()); + raft::random::RngState rng_state(0); + d_initial_random_hubs = rmm::device_uvector(d_hubs.size(), handle.get_stream()); + cugraph::detail::uniform_random_fill(handle.get_stream(), + (*d_initial_random_hubs).data(), + (*d_initial_random_hubs).size(), + weight_t{0.0}, + weight_t{1.0}, + rng_state); + raft::copy(d_hubs.data(), + (*d_initial_random_hubs).data(), + (*d_initial_random_hubs).size(), + handle.get_stream()); + + handle.sync_stream(); // before rng_state goes out-of-scope } if (cugraph::test::g_perf) { @@ -227,14 +236,15 @@ class Tests_Hits : public ::testing::TestWithParam( + auto h_initial_random_hubs = cugraph::test::to_host(handle, *d_initial_random_hubs); + auto reference_result = hits_reference( offsets.data(), indices.data(), unrenumbered_graph_view.number_of_vertices(), unrenumbered_graph_view.compute_number_of_edges(handle), maximum_iterations, - (hits_usecase.check_initial_input) ? std::make_optional(initial_random_hubs.data()) - : std::nullopt, + (hits_usecase.check_initial_input) ? std::make_optional(h_initial_random_hubs.data()) + : std::nullopt, true, epsilon); diff --git a/cpp/tests/link_analysis/mg_hits_test.cpp b/cpp/tests/link_analysis/mg_hits_test.cpp index 31e495ae682..cc835e099c7 100644 --- a/cpp/tests/link_analysis/mg_hits_test.cpp +++ b/cpp/tests/link_analysis/mg_hits_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -89,16 +89,23 @@ class Tests_MGHits : public ::testing::TestWithParam d_mg_authorities( mg_graph_view.local_vertex_partition_range_size(), handle_->get_stream()); - std::vector initial_random_hubs = - (hits_usecase.check_initial_input) - ? cugraph::test::random_vector(d_mg_hubs.size(), handle_->get_comms().get_rank()) - : std::vector(0); - + std::optional> d_mg_initial_random_hubs{std::nullopt}; if (hits_usecase.check_initial_input) { - raft::update_device(d_mg_hubs.data(), - initial_random_hubs.data(), - initial_random_hubs.size(), - handle_->get_stream()); + raft::random::RngState rng_state(handle_->get_comms().get_rank()); + d_mg_initial_random_hubs = + rmm::device_uvector(d_mg_hubs.size(), handle_->get_stream()); + cugraph::detail::uniform_random_fill(handle_->get_stream(), + (*d_mg_initial_random_hubs).data(), + (*d_mg_initial_random_hubs).size(), + weight_t{0.0}, + weight_t{1.0}, + rng_state); + raft::copy(d_mg_hubs.data(), + (*d_mg_initial_random_hubs).data(), + (*d_mg_initial_random_hubs).size(), + handle_->get_stream()); + + handle_->sync_stream(); // before rng_state goes out-of-scope } if (cugraph::test::g_perf) { @@ -153,13 +160,6 @@ class Tests_MGHits : public ::testing::TestWithParam d_mg_aggregate_initial_random_hubs(0, handle_->get_stream()); if (hits_usecase.check_initial_input) { - rmm::device_uvector d_mg_initial_random_hubs(initial_random_hubs.size(), - handle_->get_stream()); - raft::update_device(d_mg_initial_random_hubs.data(), - initial_random_hubs.data(), - initial_random_hubs.size(), - handle_->get_stream()); - std::tie(std::ignore, d_mg_aggregate_initial_random_hubs) = cugraph::test::mg_vertex_property_values_to_sg_vertex_property_values( *handle_, @@ -168,8 +168,8 @@ class Tests_MGHits : public ::testing::TestWithParam>{std::nullopt}, std::optional>{std::nullopt}, - raft::device_span(d_mg_initial_random_hubs.data(), - d_mg_initial_random_hubs.size())); + raft::device_span((*d_mg_initial_random_hubs).data(), + (*d_mg_initial_random_hubs).size())); } cugraph::graph_t sg_graph(*handle_); diff --git a/cpp/tests/link_analysis/mg_pagerank_test.cpp b/cpp/tests/link_analysis/mg_pagerank_test.cpp index c8392916872..58533769adf 100644 --- a/cpp/tests/link_analysis/mg_pagerank_test.cpp +++ b/cpp/tests/link_analysis/mg_pagerank_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -114,6 +114,8 @@ class Tests_MGPageRank result_t{0.0}, result_t{1.0}, rng_state); + + handle_->sync_stream(); // before rng_state goes out-of-scope } // 3. run MG PageRank diff --git a/cpp/tests/link_analysis/pagerank_test.cpp b/cpp/tests/link_analysis/pagerank_test.cpp index 40788be6a05..85ff62f893e 100644 --- a/cpp/tests/link_analysis/pagerank_test.cpp +++ b/cpp/tests/link_analysis/pagerank_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -202,6 +202,8 @@ class Tests_PageRank result_t{0.0}, result_t{1.0}, rng_state); + + handle.sync_stream(); // before rng_state goes out-of-scope } result_t constexpr alpha{0.85}; diff --git a/cpp/tests/link_prediction/mg_similarity_test.cpp b/cpp/tests/link_prediction/mg_similarity_test.cpp index a450c5ce2d5..3a71f8ee221 100644 --- a/cpp/tests/link_prediction/mg_similarity_test.cpp +++ b/cpp/tests/link_prediction/mg_similarity_test.cpp @@ -16,10 +16,10 @@ #include "link_prediction/similarity_compare.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -141,8 +141,11 @@ class Tests_MGSimilarity // 3. compare SG & MG results if (similarity_usecase.check_correctness) { - auto [src, dst, wgt] = - cugraph::test::graph_to_host_coo(*handle_, mg_graph_view, mg_edge_weight_view); + auto [src, dst, wgt] = cugraph::test::graph_to_host_coo( + *handle_, + mg_graph_view, + mg_edge_weight_view, + std::optional>(std::nullopt)); d_v1 = cugraph::test::device_gatherv(*handle_, d_v1.data(), d_v1.size()); d_v2 = cugraph::test::device_gatherv(*handle_, d_v2.data(), d_v2.size()); diff --git a/cpp/tests/link_prediction/mg_weighted_similarity_test.cpp b/cpp/tests/link_prediction/mg_weighted_similarity_test.cpp index 92dcb3b9096..3d891484818 100644 --- a/cpp/tests/link_prediction/mg_weighted_similarity_test.cpp +++ b/cpp/tests/link_prediction/mg_weighted_similarity_test.cpp @@ -16,10 +16,10 @@ #include "link_prediction/similarity_compare.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -143,8 +143,11 @@ class Tests_MGSimilarity // 3. compare SG & MG results if (similarity_usecase.check_correctness) { - auto [src, dst, wgt] = - cugraph::test::graph_to_host_coo(*handle_, mg_graph_view, mg_edge_weight_view); + auto [src, dst, wgt] = cugraph::test::graph_to_host_coo( + *handle_, + mg_graph_view, + mg_edge_weight_view, + std::optional>(std::nullopt)); d_v1 = cugraph::test::device_gatherv(*handle_, d_v1.data(), d_v1.size()); d_v2 = cugraph::test::device_gatherv(*handle_, d_v2.data(), d_v2.size()); diff --git a/cpp/tests/link_prediction/similarity_compare.cpp b/cpp/tests/link_prediction/similarity_compare.cpp index d2b1c4d203b..b5da85cd36f 100644 --- a/cpp/tests/link_prediction/similarity_compare.cpp +++ b/cpp/tests/link_prediction/similarity_compare.cpp @@ -16,7 +16,7 @@ #include "link_prediction/similarity_compare.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/check_utilities.hpp" #include #include diff --git a/cpp/tests/link_prediction/similarity_test.cpp b/cpp/tests/link_prediction/similarity_test.cpp deleted file mode 100644 index cd58d400627..00000000000 --- a/cpp/tests/link_prediction/similarity_test.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2022-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 governin_from_mtxg permissions and - * limitations under the License. - */ -#include "link_prediction/similarity_compare.hpp" -#include "utilities/base_fixture.hpp" -#include "utilities/device_comm_wrapper.hpp" -#include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" -#include "utilities/thrust_wrapper.hpp" - -#include -#include - -#include - -struct Similarity_Usecase { - bool use_weights{false}; - bool check_correctness{true}; - size_t max_seeds{std::numeric_limits::max()}; - size_t max_vertex_pairs_to_check{std::numeric_limits::max()}; -}; - -template -class Tests_Similarity - : public ::testing::TestWithParam> { - public: - Tests_Similarity() {} - - static void SetUpTestCase() {} - static void TearDownTestCase() {} - - virtual void SetUp() {} - virtual void TearDown() {} - - template - void run_current_test(std::tuple const& param, - test_functor_t const& test_functor) - { - constexpr bool renumber = true; - auto [similarity_usecase, input_usecase] = param; - - // 1. initialize handle - - raft::handle_t handle{}; - HighResTimer hr_timer{}; - - // 2. create SG graph - - if (cugraph::test::g_perf) { - RAFT_CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement - hr_timer.start("Construct graph"); - } - - auto [graph, edge_weights, d_renumber_map_labels] = - cugraph::test::construct_graph( - handle, input_usecase, similarity_usecase.use_weights, renumber); - - if (cugraph::test::g_perf) { - RAFT_CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement - hr_timer.stop(); - hr_timer.display_and_clear(std::cout); - } - - // 3. run similarity - - auto graph_view = graph.view(); - auto edge_weight_view = - edge_weights ? std::make_optional((*edge_weights).view()) : std::nullopt; - - if (cugraph::test::g_perf) { - RAFT_CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement - hr_timer.start("Similarity test"); - } - - // - // FIXME: Don't currently have an MG implementation of 2-hop neighbors. - // For now we'll do that on the CPU (really slowly, so keep max_seed - // small) - // - rmm::device_uvector d_v1(0, handle.get_stream()); - rmm::device_uvector d_v2(0, handle.get_stream()); - - { - auto [src, dst, wgt] = cugraph::test::graph_to_host_coo(handle, graph_view, edge_weight_view); - - size_t max_vertices = std::min(static_cast(graph_view.number_of_vertices()), - similarity_usecase.max_seeds); - std::vector h_v1; - std::vector h_v2; - std::vector one_hop_v1; - std::vector one_hop_v2; - - for (size_t seed = 0; seed < max_vertices; ++seed) { - std::for_each(thrust::make_zip_iterator(src.begin(), dst.begin()), - thrust::make_zip_iterator(src.end(), dst.end()), - [&one_hop_v1, &one_hop_v2, seed](auto t) { - auto u = thrust::get<0>(t); - auto v = thrust::get<1>(t); - if (u == seed) { - one_hop_v1.push_back(u); - one_hop_v2.push_back(v); - } - }); - } - - std::for_each(thrust::make_zip_iterator(one_hop_v1.begin(), one_hop_v2.begin()), - thrust::make_zip_iterator(one_hop_v1.end(), one_hop_v2.end()), - [&](auto t1) { - auto seed = thrust::get<0>(t1); - auto neighbor = thrust::get<1>(t1); - std::for_each(thrust::make_zip_iterator(src.begin(), dst.begin()), - thrust::make_zip_iterator(src.end(), dst.end()), - [&](auto t2) { - auto u = thrust::get<0>(t2); - auto v = thrust::get<1>(t2); - if (u == neighbor) { - h_v1.push_back(seed); - h_v2.push_back(v); - } - }); - }); - - std::sort(thrust::make_zip_iterator(h_v1.begin(), h_v2.begin()), - thrust::make_zip_iterator(h_v1.end(), h_v2.end())); - - auto end_iter = std::unique(thrust::make_zip_iterator(h_v1.begin(), h_v2.begin()), - thrust::make_zip_iterator(h_v1.end(), h_v2.end()), - [](auto t1, auto t2) { - return (thrust::get<0>(t1) == thrust::get<0>(t2)) && - (thrust::get<1>(t1) == thrust::get<1>(t2)); - }); - - h_v1.resize( - thrust::distance(thrust::make_zip_iterator(h_v1.begin(), h_v2.begin()), end_iter)); - h_v2.resize(h_v1.size()); - - d_v1.resize(h_v1.size(), handle.get_stream()); - d_v2.resize(h_v2.size(), handle.get_stream()); - - raft::update_device(d_v1.data(), h_v1.data(), h_v1.size(), handle.get_stream()); - raft::update_device(d_v2.data(), h_v2.data(), h_v2.size(), handle.get_stream()); - } - - // FIXME: Need to add some tests that specify actual vertex pairs - // FIXME: Need to a variation that calls call the two hop neighbors function - // FIXME: Debugging state as of EOD 9/28: - // 1) Tested case of no vertex pairs... works great :-) - // 2) Don't have a 2-hop on GPU yet. Perhaps write a 2-hop on CPU - // for now? We could then use that for testing the 2-hop function - // later. - std::tuple, raft::device_span> vertex_pairs{ - {d_v1.data(), d_v1.size()}, {d_v2.data(), d_v2.size()}}; - - auto result_score = test_functor.run( - handle, graph_view, edge_weight_view, vertex_pairs, similarity_usecase.use_weights); - - if (cugraph::test::g_perf) { - RAFT_CUDA_TRY(cudaDeviceSynchronize()); // for consistent performance measurement - hr_timer.stop(); - hr_timer.display_and_clear(std::cout); - } - - if (similarity_usecase.check_correctness) { - auto [src, dst, wgt] = cugraph::test::graph_to_host_coo(handle, graph_view, edge_weight_view); - - size_t check_size = std::min(d_v1.size(), similarity_usecase.max_vertex_pairs_to_check); - - // - // FIXME: Need to reorder here. thrust::shuffle on the tuples (vertex_pairs_1, - // vertex_pairs_2, result_score) would - // be sufficient. - // - std::vector h_vertex_pair_1(check_size); - std::vector h_vertex_pair_2(check_size); - std::vector h_result_score(check_size); - - raft::update_host( - h_vertex_pair_1.data(), std::get<0>(vertex_pairs).data(), check_size, handle.get_stream()); - raft::update_host( - h_vertex_pair_2.data(), std::get<1>(vertex_pairs).data(), check_size, handle.get_stream()); - raft::update_host( - h_result_score.data(), result_score.data(), check_size, handle.get_stream()); - - similarity_compare(graph_view.number_of_vertices(), - std::tie(src, dst, wgt), - std::tie(h_vertex_pair_1, h_vertex_pair_2), - h_result_score, - test_functor); - } - } -}; - -using Tests_Similarity_File = Tests_Similarity; -using Tests_Similarity_Rmat = Tests_Similarity; - -TEST_P(Tests_Similarity_File, CheckInt32Int32FloatJaccard) -{ - run_current_test( - override_File_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_jaccard_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt32Int32FloatJaccard) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_jaccard_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt32Int64FloatJaccard) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_jaccard_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt64Int64FloatJaccard) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_jaccard_t{}); -} - -TEST_P(Tests_Similarity_File, CheckInt32Int32FloatSorensen) -{ - run_current_test( - override_File_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_sorensen_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt32Int32FloatSorensen) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_sorensen_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt32Int64FloatSorensen) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_sorensen_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt64Int64FloatSorensen) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_sorensen_t{}); -} - -TEST_P(Tests_Similarity_File, CheckInt32Int32FloatOverlap) -{ - run_current_test( - override_File_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_overlap_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt32Int32FloatOverlap) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_overlap_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt32Int64FloatOverlap) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_overlap_t{}); -} - -TEST_P(Tests_Similarity_Rmat, CheckInt64Int64FloatOverlap) -{ - run_current_test( - override_Rmat_Usecase_with_cmd_line_arguments(GetParam()), cugraph::test::test_overlap_t{}); -} - -INSTANTIATE_TEST_SUITE_P( - file_test, - Tests_Similarity_File, - ::testing::Combine( - // enable correctness checks - // Disable weighted computation testing in 22.10 - //::testing::Values(Similarity_Usecase{true, true, 20, 100}, Similarity_Usecase{false, true, 20, - // 100}), - ::testing::Values(Similarity_Usecase{false, true, 20, 100}), - ::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"), - cugraph::test::File_Usecase("test/datasets/dolphins.mtx")))); - -INSTANTIATE_TEST_SUITE_P( - rmat_small_test, - Tests_Similarity_Rmat, - ::testing::Combine( - // enable correctness checks - // Disable weighted computation testing in 22.10 - //::testing::Values(Similarity_Usecase{true, true, 20, 100}, Similarity_Usecase{false, true, 20, - // 100}), - ::testing::Values(Similarity_Usecase{false, true, 20, 100}), - ::testing::Values(cugraph::test::Rmat_Usecase(10, 16, 0.57, 0.19, 0.19, 0, true, false)))); - -INSTANTIATE_TEST_SUITE_P( - file_benchmark_test, /* note that the test filename can be overridden in benchmarking (with - --gtest_filter to select only the file_benchmark_test with a specific - vertex & edge type combination) by command line arguments and do not - include more than one File_Usecase that differ only in filename - (to avoid running same benchmarks more than once) */ - Tests_Similarity_File, - ::testing::Combine( - // disable correctness checks - // Disable weighted computation testing in 22.10 - //::testing::Values(Similarity_Usecase{false, false}, Similarity_Usecase{true, false}), - ::testing::Values(Similarity_Usecase{false, false}), - ::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx")))); - -INSTANTIATE_TEST_SUITE_P( - rmat_benchmark_test, /* note that scale & edge factor can be overridden in benchmarking (with - --gtest_filter to select only the rmat_benchmark_test with a specific - vertex & edge type combination) by command line arguments and do not - include more than one Rmat_Usecase that differ only in scale or edge - factor (to avoid running same benchmarks more than once) */ - Tests_Similarity_Rmat, - ::testing::Combine( - // disable correctness checks for large graphs - //::testing::Values(Similarity_Usecase{false, false}, Similarity_Usecase{true, false}), - ::testing::Values(Similarity_Usecase{false, false}), - ::testing::Values(cugraph::test::Rmat_Usecase(10, 16, 0.57, 0.19, 0.19, 0, true, false)))); - -CUGRAPH_TEST_PROGRAM_MAIN() diff --git a/cpp/tests/link_prediction/similarity_test.cu b/cpp/tests/link_prediction/similarity_test.cu index f5c15c760e2..feeea257597 100644 --- a/cpp/tests/link_prediction/similarity_test.cu +++ b/cpp/tests/link_prediction/similarity_test.cu @@ -13,18 +13,19 @@ * See the License for the specific language governin_from_mtxg permissions and * limitations under the License. */ +#include "link_prediction/similarity_compare.hpp" +#include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" +#include "utilities/device_comm_wrapper.hpp" +#include "utilities/test_graphs.hpp" +#include "utilities/thrust_wrapper.hpp" + #include #include #include #include #include -#include -#include -#include -#include -#include -#include struct Similarity_Usecase { bool use_weights{false}; @@ -166,7 +167,11 @@ class Tests_Similarity } if (similarity_usecase.check_correctness) { - auto [src, dst, wgt] = cugraph::test::graph_to_host_coo(handle, graph_view, edge_weight_view); + auto [src, dst, wgt] = cugraph::test::graph_to_host_coo( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); size_t check_size = similarity_usecase.max_vertex_pairs_to_check ? std::min(v1.size(), *similarity_usecase.max_vertex_pairs_to_check) diff --git a/cpp/tests/link_prediction/weighted_similarity_test.cpp b/cpp/tests/link_prediction/weighted_similarity_test.cpp index 694b0fa625c..570369a0236 100644 --- a/cpp/tests/link_prediction/weighted_similarity_test.cpp +++ b/cpp/tests/link_prediction/weighted_similarity_test.cpp @@ -15,9 +15,9 @@ */ #include "link_prediction/similarity_compare.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -93,7 +93,11 @@ class Tests_Similarity rmm::device_uvector d_v2(0, handle.get_stream()); { - auto [src, dst, wgt] = cugraph::test::graph_to_host_coo(handle, graph_view, edge_weight_view); + auto [src, dst, wgt] = cugraph::test::graph_to_host_coo( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); size_t max_vertices = std::min(static_cast(graph_view.number_of_vertices()), similarity_usecase.max_seeds); @@ -173,7 +177,11 @@ class Tests_Similarity } if (similarity_usecase.check_correctness) { - auto [src, dst, wgt] = cugraph::test::graph_to_host_coo(handle, graph_view, edge_weight_view); + auto [src, dst, wgt] = cugraph::test::graph_to_host_coo( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); size_t check_size = std::min(d_v1.size(), similarity_usecase.max_vertex_pairs_to_check); diff --git a/cpp/tests/prims/mg_count_if_e.cu b/cpp/tests/prims/mg_count_if_e.cu index c3a1f08475f..8ad1a20e585 100644 --- a/cpp/tests/prims/mg_count_if_e.cu +++ b/cpp/tests/prims/mg_count_if_e.cu @@ -16,12 +16,12 @@ #include "prims/count_if_e.cuh" #include "prims/update_edge_src_dst_property.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -105,8 +105,8 @@ class Tests_MGCountIfE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -114,11 +114,12 @@ class Tests_MGCountIfE const int hash_bin_count = 5; - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); if (cugraph::test::g_perf) { @@ -159,14 +160,15 @@ class Tests_MGCountIfE if (handle_->get_comms().get_rank() == 0) { auto sg_graph_view = sg_graph.view(); - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); - auto sg_src_prop = cugraph::test::generate::src_property( + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); + auto sg_src_prop = cugraph::test::generate::src_property( *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( + auto sg_dst_prop = cugraph::test::generate::dst_property( *handle_, sg_graph_view, sg_vertex_prop); auto expected_result = count_if_e( diff --git a/cpp/tests/prims/mg_count_if_v.cu b/cpp/tests/prims/mg_count_if_v.cu index e4e6c9051f3..eb0e8cf9835 100644 --- a/cpp/tests/prims/mg_count_if_v.cu +++ b/cpp/tests/prims/mg_count_if_v.cu @@ -16,10 +16,10 @@ #include "prims/count_if_v.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/prims/mg_extract_transform_e.cu b/cpp/tests/prims/mg_extract_transform_e.cu index ef50a6e025b..48b893f6fea 100644 --- a/cpp/tests/prims/mg_extract_transform_e.cu +++ b/cpp/tests/prims/mg_extract_transform_e.cu @@ -18,12 +18,12 @@ #include "prims/extract_transform_e.cuh" #include "prims/update_edge_src_dst_property.cuh" #include "prims/vertex_frontier.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -183,8 +183,8 @@ class Tests_MGExtractTransformE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -192,11 +192,12 @@ class Tests_MGExtractTransformE const int hash_bin_count = 5; - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *d_mg_renumber_map_labels, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *d_mg_renumber_map_labels, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); if (cugraph::test::g_perf) { @@ -278,9 +279,9 @@ class Tests_MGExtractTransformE auto sg_graph_view = sg_graph.view(); - auto sg_src_prop = cugraph::test::generate::src_property( + auto sg_src_prop = cugraph::test::generate::src_property( *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( + auto sg_dst_prop = cugraph::test::generate::dst_property( *handle_, sg_graph_view, sg_vertex_prop); auto sg_extract_transform_output_buffer = diff --git a/cpp/tests/prims/mg_extract_transform_v_frontier_outgoing_e.cu b/cpp/tests/prims/mg_extract_transform_v_frontier_outgoing_e.cu index 1b90619bbc9..3611a250afd 100644 --- a/cpp/tests/prims/mg_extract_transform_v_frontier_outgoing_e.cu +++ b/cpp/tests/prims/mg_extract_transform_v_frontier_outgoing_e.cu @@ -17,12 +17,12 @@ #include "prims/extract_transform_v_frontier_outgoing_e.cuh" #include "prims/update_edge_src_dst_property.cuh" #include "prims/vertex_frontier.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -183,8 +183,8 @@ class Tests_MGExtractTransformVFrontierOutgoingE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -192,11 +192,12 @@ class Tests_MGExtractTransformVFrontierOutgoingE const int hash_bin_count = 5; - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *d_mg_renumber_map_labels, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *d_mg_renumber_map_labels, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); auto mg_key_buffer = cugraph::allocate_dataframe_buffer( @@ -308,9 +309,9 @@ class Tests_MGExtractTransformVFrontierOutgoingE auto sg_graph_view = sg_graph.view(); - auto sg_src_prop = cugraph::test::generate::src_property( + auto sg_src_prop = cugraph::test::generate::src_property( *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( + auto sg_dst_prop = cugraph::test::generate::dst_property( *handle_, sg_graph_view, sg_vertex_prop); auto sg_key_buffer = cugraph::allocate_dataframe_buffer( diff --git a/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_intersection.cu b/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_intersection.cu index 0a519e30b9c..762da62eeb8 100644 --- a/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_intersection.cu +++ b/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_intersection.cu @@ -17,12 +17,12 @@ #include "prims/per_v_pair_transform_dst_nbr_intersection.cuh" #include "prims/transform_e.cuh" #include "prims/update_edge_src_dst_property.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include @@ -117,8 +117,8 @@ class Tests_MGPerVPairTransformDstNbrIntersection std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } diff --git a/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_weighted_intersection.cu b/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_weighted_intersection.cu index 84186908b1d..de78b42603d 100644 --- a/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_weighted_intersection.cu +++ b/cpp/tests/prims/mg_per_v_pair_transform_dst_nbr_weighted_intersection.cu @@ -15,12 +15,12 @@ */ #include "prims/per_v_pair_transform_dst_nbr_intersection.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -141,8 +141,8 @@ class Tests_MGPerVPairTransformDstNbrIntersection std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } diff --git a/cpp/tests/prims/mg_per_v_random_select_transform_outgoing_e.cu b/cpp/tests/prims/mg_per_v_random_select_transform_outgoing_e.cu index 9c6e46f22dc..2ea8635fe36 100644 --- a/cpp/tests/prims/mg_per_v_random_select_transform_outgoing_e.cu +++ b/cpp/tests/prims/mg_per_v_random_select_transform_outgoing_e.cu @@ -16,12 +16,13 @@ #include "prims/per_v_random_select_transform_outgoing_e.cuh" #include "prims/vertex_frontier.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_kernels.cuh" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -128,8 +129,8 @@ class Tests_MGPerVRandomSelectTransformOutgoingE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -137,11 +138,12 @@ class Tests_MGPerVRandomSelectTransformOutgoingE const int hash_bin_count = 5; - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); raft::random::RngState rng_state(static_cast(handle_->get_comms().get_rank())); diff --git a/cpp/tests/prims/mg_per_v_transform_reduce_dst_key_aggregated_outgoing_e.cu b/cpp/tests/prims/mg_per_v_transform_reduce_dst_key_aggregated_outgoing_e.cu index 89d3205d051..efcfee9fc66 100644 --- a/cpp/tests/prims/mg_per_v_transform_reduce_dst_key_aggregated_outgoing_e.cu +++ b/cpp/tests/prims/mg_per_v_transform_reduce_dst_key_aggregated_outgoing_e.cu @@ -17,13 +17,13 @@ #include "prims/per_v_transform_reduce_dst_key_aggregated_outgoing_e.cuh" #include "prims/reduce_op.cuh" #include "prims/update_edge_src_dst_property.cuh" -#include "property_generator.cuh" #include "result_compare.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -125,8 +125,8 @@ class Tests_MGPerVTransformReduceDstKeyAggregatedOutgoingE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -138,16 +138,18 @@ class Tests_MGPerVTransformReduceDstKeyAggregatedOutgoingE const int initial_value = 4; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); + cugraph::test::generate::initial_value(initial_value); - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, vertex_prop_hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, vertex_prop_hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_vertex_key = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, key_hash_bin_count); - auto mg_dst_key = cugraph::test::generate::dst_property( + auto mg_vertex_key = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, key_hash_bin_count); + auto mg_dst_key = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_key); rmm::device_uvector mg_kv_store_keys(comm_rank == 0 ? key_hash_bin_count : int{0}, @@ -156,8 +158,9 @@ class Tests_MGPerVTransformReduceDstKeyAggregatedOutgoingE handle_->get_thrust_policy(), mg_kv_store_keys.begin(), mg_kv_store_keys.end(), vertex_t{0}); mg_kv_store_keys = cugraph::detail::shuffle_ext_vertices_to_local_gpu_by_vertex_partitioning( *handle_, std::move(mg_kv_store_keys)); - auto mg_kv_store_values = cugraph::test::generate::vertex_property( - *handle_, mg_kv_store_keys, key_prop_hash_bin_count); + auto mg_kv_store_values = + cugraph::test::generate::vertex_property( + *handle_, mg_kv_store_keys, key_prop_hash_bin_count); static_assert(std::is_same_v || std::is_same_v>); @@ -346,29 +349,34 @@ class Tests_MGPerVTransformReduceDstKeyAggregatedOutgoingE auto sg_edge_weight_view = sg_edge_weights ? std::make_optional((*sg_edge_weights).view()) : std::nullopt; - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - vertex_prop_hash_bin_count); - auto sg_src_prop = cugraph::test::generate::src_property( - *handle_, sg_graph_view, sg_vertex_prop); - - auto sg_vertex_key = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - key_hash_bin_count); - auto sg_dst_key = cugraph::test::generate::dst_property( - *handle_, sg_graph_view, sg_vertex_key); + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + vertex_prop_hash_bin_count); + auto sg_src_prop = + cugraph::test::generate::src_property( + *handle_, sg_graph_view, sg_vertex_prop); + + auto sg_vertex_key = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + key_hash_bin_count); + auto sg_dst_key = + cugraph::test::generate::dst_property( + *handle_, sg_graph_view, sg_vertex_key); rmm::device_uvector sg_kv_store_keys(key_hash_bin_count, handle_->get_stream()); thrust::sequence(handle_->get_thrust_policy(), sg_kv_store_keys.begin(), sg_kv_store_keys.end(), vertex_t{0}); - auto sg_kv_store_values = cugraph::test::generate::vertex_property( - *handle_, sg_kv_store_keys, key_prop_hash_bin_count); + auto sg_kv_store_values = + cugraph::test::generate::vertex_property( + *handle_, sg_kv_store_keys, key_prop_hash_bin_count); cugraph::kv_store_t sg_kv_store( sg_kv_store_keys.begin(), diff --git a/cpp/tests/prims/mg_per_v_transform_reduce_incoming_outgoing_e.cu b/cpp/tests/prims/mg_per_v_transform_reduce_incoming_outgoing_e.cu index a459a677569..e3eb56d5a6e 100644 --- a/cpp/tests/prims/mg_per_v_transform_reduce_incoming_outgoing_e.cu +++ b/cpp/tests/prims/mg_per_v_transform_reduce_incoming_outgoing_e.cu @@ -17,13 +17,13 @@ #include "prims/per_v_transform_reduce_incoming_outgoing_e.cuh" #include "prims/reduce_op.cuh" #include "prims/update_edge_src_dst_property.cuh" -#include "property_generator.cuh" #include "result_compare.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -127,8 +127,8 @@ class Tests_MGPerVTransformReduceIncomingOutgoingE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -138,13 +138,14 @@ class Tests_MGPerVTransformReduceIncomingOutgoingE const int initial_value = 4; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); + cugraph::test::generate::initial_value(initial_value); - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); enum class reduction_type_t { PLUS, ELEMWISE_MIN, ELEMWISE_MAX }; @@ -355,15 +356,18 @@ class Tests_MGPerVTransformReduceIncomingOutgoingE if (handle_->get_comms().get_rank() == int{0}) { auto sg_graph_view = sg_graph.view(); - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); - auto sg_src_prop = cugraph::test::generate::src_property( - *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( - *handle_, sg_graph_view, sg_vertex_prop); + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); + auto sg_src_prop = + cugraph::test::generate::src_property( + *handle_, sg_graph_view, sg_vertex_prop); + auto sg_dst_prop = + cugraph::test::generate::dst_property( + *handle_, sg_graph_view, sg_vertex_prop); cugraph::test::vector_result_compare compare{*handle_}; auto global_in_result = cugraph::allocate_dataframe_buffer( diff --git a/cpp/tests/prims/mg_reduce_v.cu b/cpp/tests/prims/mg_reduce_v.cu index 783e17b6d8f..1449e8f9910 100644 --- a/cpp/tests/prims/mg_reduce_v.cu +++ b/cpp/tests/prims/mg_reduce_v.cu @@ -16,13 +16,13 @@ #include "prims/property_op_utils.cuh" #include "prims/reduce_v.cuh" -#include "property_generator.cuh" #include "result_compare.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -106,10 +106,11 @@ class Tests_MGReduceV const int initial_value = 10; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); + cugraph::test::generate::initial_value(initial_value); - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, (*mg_renumber_map), hash_bin_count); + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, (*mg_renumber_map), hash_bin_count); auto property_iter = cugraph::get_dataframe_buffer_begin(mg_vertex_prop); enum class reduction_type_t { PLUS, MINIMUM, MAXIMUM }; @@ -173,11 +174,12 @@ class Tests_MGReduceV if (handle_->get_comms().get_rank() == 0) { auto sg_graph_view = sg_graph.view(); - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); auto sg_property_iter = cugraph::get_dataframe_buffer_begin(sg_vertex_prop); for (auto reduction_type : reduction_types) { diff --git a/cpp/tests/prims/mg_transform_e.cu b/cpp/tests/prims/mg_transform_e.cu index c569636f0e1..92046bdd8f8 100644 --- a/cpp/tests/prims/mg_transform_e.cu +++ b/cpp/tests/prims/mg_transform_e.cu @@ -18,12 +18,11 @@ #include "prims/edge_bucket.cuh" #include "prims/fill_edge_property.cuh" #include "prims/transform_e.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -103,8 +102,8 @@ class Tests_MGTransformE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -114,12 +113,13 @@ class Tests_MGTransformE const int initial_value = 4; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + cugraph::test::generate::initial_value(initial_value); + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); cugraph::edge_bucket_t edge_list( diff --git a/cpp/tests/prims/mg_transform_reduce_dst_nbr_intersection_of_e_endpoints_by_v.cu b/cpp/tests/prims/mg_transform_reduce_dst_nbr_intersection_of_e_endpoints_by_v.cu index 5fa37250e21..71cdf27fda1 100644 --- a/cpp/tests/prims/mg_transform_reduce_dst_nbr_intersection_of_e_endpoints_by_v.cu +++ b/cpp/tests/prims/mg_transform_reduce_dst_nbr_intersection_of_e_endpoints_by_v.cu @@ -14,7 +14,15 @@ * limitations under the License. */ -#include "property_generator.cuh" +#include "prims/transform_e.cuh" +#include "prims/transform_reduce_dst_nbr_intersection_of_e_endpoints_by_v.cuh" +#include "prims/update_edge_src_dst_property.cuh" +#include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" +#include "utilities/device_comm_wrapper.hpp" +#include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" +#include "utilities/test_graphs.hpp" #include #include @@ -37,14 +45,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include @@ -114,8 +114,8 @@ class Tests_MGTransformReduceDstNbrIntersectionOfEEndpointsByV std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -125,13 +125,13 @@ class Tests_MGTransformReduceDstNbrIntersectionOfEEndpointsByV const int initial_value = 4; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); + cugraph::test::generate::initial_value(initial_value); - auto mg_vertex_prop = cugraph::test::generate::vertex_property( + auto mg_vertex_prop = cugraph::test::generate::vertex_property( *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); auto mg_result_buffer = rmm::device_uvector( @@ -185,14 +185,15 @@ class Tests_MGTransformReduceDstNbrIntersectionOfEEndpointsByV if (handle_->get_comms().get_rank() == 0) { auto sg_graph_view = sg_graph.view(); - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); - auto sg_src_prop = cugraph::test::generate::src_property( + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); + auto sg_src_prop = cugraph::test::generate::src_property( *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( + auto sg_dst_prop = cugraph::test::generate::dst_property( *handle_, sg_graph_view, sg_vertex_prop); auto sg_result_buffer = cugraph::allocate_dataframe_buffer( diff --git a/cpp/tests/prims/mg_transform_reduce_e.cu b/cpp/tests/prims/mg_transform_reduce_e.cu index 53f37e83b30..a086571d6e0 100644 --- a/cpp/tests/prims/mg_transform_reduce_e.cu +++ b/cpp/tests/prims/mg_transform_reduce_e.cu @@ -16,13 +16,13 @@ #include "prims/transform_reduce_e.cuh" #include "prims/update_edge_src_dst_property.cuh" -#include "property_generator.cuh" #include "result_compare.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -107,8 +107,8 @@ class Tests_MGTransformReduceE std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -118,12 +118,13 @@ class Tests_MGTransformReduceE const int initial_value = 4; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + cugraph::test::generate::initial_value(initial_value); + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); if (cugraph::test::g_perf) { @@ -169,14 +170,15 @@ class Tests_MGTransformReduceE if (handle_->get_comms().get_rank() == 0) { auto sg_graph_view = sg_graph.view(); - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); - auto sg_src_prop = cugraph::test::generate::src_property( + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); + auto sg_src_prop = cugraph::test::generate::src_property( *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( + auto sg_dst_prop = cugraph::test::generate::dst_property( *handle_, sg_graph_view, sg_vertex_prop); auto expected_result = transform_reduce_e( diff --git a/cpp/tests/prims/mg_transform_reduce_e_by_src_dst_key.cu b/cpp/tests/prims/mg_transform_reduce_e_by_src_dst_key.cu index 457e6b5ab93..a66c70ff586 100644 --- a/cpp/tests/prims/mg_transform_reduce_e_by_src_dst_key.cu +++ b/cpp/tests/prims/mg_transform_reduce_e_by_src_dst_key.cu @@ -14,8 +14,17 @@ * limitations under the License. */ -#include "property_generator.cuh" +#include "prims/reduce_op.cuh" +#include "prims/transform_reduce_e_by_src_dst_key.cuh" +#include "prims/update_edge_src_dst_property.cuh" #include "result_compare.cuh" +#include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" +#include "utilities/device_comm_wrapper.hpp" +#include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" +#include "utilities/test_graphs.hpp" +#include "utilities/thrust_wrapper.hpp" #include #include @@ -42,15 +51,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include @@ -108,8 +108,8 @@ class Tests_MGTransformReduceEBySrcDstKey std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -119,20 +119,22 @@ class Tests_MGTransformReduceEBySrcDstKey const int initial_value = 4; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); + cugraph::test::generate::initial_value(initial_value); - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_vertex_key = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_key = cugraph::test::generate::src_property( + auto mg_vertex_key = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_key = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_key); - auto mg_dst_key = cugraph::test::generate::dst_property( + auto mg_dst_key = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_key); if (cugraph::test::g_perf) { @@ -246,24 +248,26 @@ class Tests_MGTransformReduceEBySrcDstKey if (handle_->get_comms().get_rank() == 0) { auto sg_graph_view = sg_graph.view(); - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); - auto sg_src_prop = cugraph::test::generate::src_property( + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); + auto sg_src_prop = cugraph::test::generate::src_property( *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( + auto sg_dst_prop = cugraph::test::generate::dst_property( *handle_, sg_graph_view, sg_vertex_prop); - auto sg_vertex_key = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); - auto sg_src_key = cugraph::test::generate::src_property( + auto sg_vertex_key = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); + auto sg_src_key = cugraph::test::generate::src_property( *handle_, sg_graph_view, sg_vertex_key); - auto sg_dst_key = cugraph::test::generate::dst_property( + auto sg_dst_key = cugraph::test::generate::dst_property( *handle_, sg_graph_view, sg_vertex_key); auto [sg_by_src_keys, sg_by_src_values] = transform_reduce_e_by_src_key( diff --git a/cpp/tests/prims/mg_transform_reduce_v.cu b/cpp/tests/prims/mg_transform_reduce_v.cu index c954f31d0f9..c26085a55c4 100644 --- a/cpp/tests/prims/mg_transform_reduce_v.cu +++ b/cpp/tests/prims/mg_transform_reduce_v.cu @@ -15,13 +15,14 @@ */ #include "prims/transform_reduce_v.cuh" -#include "property_generator.cuh" #include "result_compare.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_kernels.cuh" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -114,7 +115,7 @@ class Tests_MGTransformReduceV v_op_t v_op{hash_bin_count}; auto property_initial_value = - cugraph::test::generate::initial_value(initial_value); + cugraph::test::generate::initial_value(initial_value); enum class reduction_type_t { PLUS, MINIMUM, MAXIMUM }; std::array reduction_types = { reduction_type_t::PLUS, reduction_type_t::MINIMUM, reduction_type_t::MAXIMUM}; diff --git a/cpp/tests/prims/mg_transform_reduce_v_frontier_outgoing_e_by_dst.cu b/cpp/tests/prims/mg_transform_reduce_v_frontier_outgoing_e_by_dst.cu index 99161df2cb4..07a0f7e7aab 100644 --- a/cpp/tests/prims/mg_transform_reduce_v_frontier_outgoing_e_by_dst.cu +++ b/cpp/tests/prims/mg_transform_reduce_v_frontier_outgoing_e_by_dst.cu @@ -17,12 +17,12 @@ #include "prims/transform_reduce_v_frontier_outgoing_e_by_dst.cuh" #include "prims/update_edge_src_dst_property.cuh" #include "prims/vertex_frontier.cuh" -#include "property_generator.cuh" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" +#include "utilities/property_generator_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -155,8 +155,8 @@ class Tests_MGTransformReduceVFrontierOutgoingEByDst std::optional> edge_mask{std::nullopt}; if (prims_usecase.edge_masking) { - edge_mask = - cugraph::test::generate::edge_property(*handle_, mg_graph_view, 2); + edge_mask = cugraph::test::generate::edge_property( + *handle_, mg_graph_view, 2); mg_graph_view.attach_edge_mask((*edge_mask).view()); } @@ -164,11 +164,12 @@ class Tests_MGTransformReduceVFrontierOutgoingEByDst const int hash_bin_count = 5; - auto mg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, *mg_renumber_map, hash_bin_count); - auto mg_src_prop = cugraph::test::generate::src_property( + auto mg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, *mg_renumber_map, hash_bin_count); + auto mg_src_prop = cugraph::test::generate::src_property( *handle_, mg_graph_view, mg_vertex_prop); - auto mg_dst_prop = cugraph::test::generate::dst_property( + auto mg_dst_prop = cugraph::test::generate::dst_property( *handle_, mg_graph_view, mg_vertex_prop); auto mg_key_buffer = cugraph::allocate_dataframe_buffer( @@ -314,15 +315,18 @@ class Tests_MGTransformReduceVFrontierOutgoingEByDst auto sg_graph_view = sg_graph.view(); - auto sg_vertex_prop = cugraph::test::generate::vertex_property( - *handle_, - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), - thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), - hash_bin_count); - auto sg_src_prop = cugraph::test::generate::src_property( - *handle_, sg_graph_view, sg_vertex_prop); - auto sg_dst_prop = cugraph::test::generate::dst_property( - *handle_, sg_graph_view, sg_vertex_prop); + auto sg_vertex_prop = + cugraph::test::generate::vertex_property( + *handle_, + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_first()), + thrust::make_counting_iterator(sg_graph_view.local_vertex_partition_range_last()), + hash_bin_count); + auto sg_src_prop = + cugraph::test::generate::src_property( + *handle_, sg_graph_view, sg_vertex_prop); + auto sg_dst_prop = + cugraph::test::generate::dst_property( + *handle_, sg_graph_view, sg_vertex_prop); auto sg_key_buffer = cugraph::allocate_dataframe_buffer( sg_graph_view.local_vertex_partition_range_size(), handle_->get_stream()); diff --git a/cpp/tests/prims/property_generator.cuh b/cpp/tests/prims/property_generator.cuh deleted file mode 100644 index 0ac1f84c79b..00000000000 --- a/cpp/tests/prims/property_generator.cuh +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2021-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. - */ - -#pragma once -#include "prims/transform_e.cuh" -#include "prims/update_edge_src_dst_property.cuh" - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include - -namespace cugraph { -namespace test { - -namespace detail { - -template -__host__ __device__ auto make_type_casted_tuple_from_scalar(T val, std::index_sequence) -{ - return thrust::make_tuple( - static_cast::type>(val)...); -} - -template -__host__ __device__ auto make_property_value(T val) -{ - property_t ret{}; - if constexpr (cugraph::is_thrust_tuple_of_arithmetic::value) { - ret = make_type_casted_tuple_from_scalar( - val, std::make_index_sequence::value>{}); - } else { - ret = static_cast(val); - } - return ret; -} - -template -struct vertex_property_transform { - int32_t mod{}; - - constexpr __device__ property_t operator()(vertex_t v) const - { - static_assert(cugraph::is_thrust_tuple_of_arithmetic::value || - std::is_arithmetic_v); - cuco::detail::MurmurHash3_32 hash_func{}; - return make_property_value(hash_func(v) % mod); - } -}; - -template -struct edge_property_transform { - int32_t mod{}; - - constexpr __device__ property_t operator()( - vertex_t src, vertex_t dst, thrust::nullopt_t, thrust::nullopt_t, thrust::nullopt_t) const - { - static_assert(cugraph::is_thrust_tuple_of_arithmetic::value || - std::is_arithmetic_v); - cuco::detail::MurmurHash3_32 hash_func{}; - return make_property_value(hash_func(src + dst) % mod); - } -}; - -} // namespace detail - -template -struct generate { - private: - using property_buffer_type = - decltype(allocate_dataframe_buffer(size_t{0}, rmm::cuda_stream_view{})); - - public: - static property_t initial_value(int32_t init) - { - return detail::make_property_value(init); - } - - static auto vertex_property(raft::handle_t const& handle, - rmm::device_uvector const& labels, - int32_t hash_bin_count) - { - auto data = cugraph::allocate_dataframe_buffer(labels.size(), handle.get_stream()); - thrust::transform(handle.get_thrust_policy(), - labels.begin(), - labels.end(), - cugraph::get_dataframe_buffer_begin(data), - detail::vertex_property_transform{hash_bin_count}); - return data; - } - - static auto vertex_property(raft::handle_t const& handle, - thrust::counting_iterator begin, - thrust::counting_iterator end, - int32_t hash_bin_count) - { - auto length = thrust::distance(begin, end); - auto data = cugraph::allocate_dataframe_buffer(length, handle.get_stream()); - thrust::transform(handle.get_thrust_policy(), - begin, - end, - cugraph::get_dataframe_buffer_begin(data), - detail::vertex_property_transform{hash_bin_count}); - return data; - } - - template - static auto src_property(raft::handle_t const& handle, - graph_view_type const& graph_view, - property_buffer_type const& property) - { - auto output_property = - cugraph::edge_src_property_t(handle, graph_view); - update_edge_src_property( - handle, graph_view, cugraph::get_dataframe_buffer_begin(property), output_property); - return output_property; - } - - template - static auto dst_property(raft::handle_t const& handle, - graph_view_type const& graph_view, - property_buffer_type const& property) - { - auto output_property = - cugraph::edge_dst_property_t(handle, graph_view); - update_edge_dst_property( - handle, graph_view, cugraph::get_dataframe_buffer_begin(property), output_property); - return output_property; - } - - template - static auto edge_property(raft::handle_t const& handle, - graph_view_type const& graph_view, - int32_t hash_bin_count) - { - auto output_property = cugraph::edge_property_t(handle, graph_view); - cugraph::transform_e(handle, - graph_view, - cugraph::edge_src_dummy_property_t{}.view(), - cugraph::edge_dst_dummy_property_t{}.view(), - cugraph::edge_dummy_property_t{}.view(), - detail::edge_property_transform{hash_bin_count}, - output_property.mutable_view()); - return output_property; - } -}; - -} // namespace test -} // namespace cugraph diff --git a/cpp/tests/sampling/detail/nbr_sampling_utils.cuh b/cpp/tests/sampling/detail/nbr_sampling_utils.cuh index b248723403a..be93990eb9c 100644 --- a/cpp/tests/sampling/detail/nbr_sampling_utils.cuh +++ b/cpp/tests/sampling/detail/nbr_sampling_utils.cuh @@ -21,7 +21,6 @@ #include "utilities/base_fixture.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/sampling/mg_random_walks_test.cpp b/cpp/tests/sampling/mg_random_walks_test.cpp index 046fab141ea..dbafa9ac1f2 100644 --- a/cpp/tests/sampling/mg_random_walks_test.cpp +++ b/cpp/tests/sampling/mg_random_walks_test.cpp @@ -18,7 +18,6 @@ #include "utilities/base_fixture.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/sampling/sg_random_walks_test.cpp b/cpp/tests/sampling/sg_random_walks_test.cpp index b40ac2d66af..6b0ce32fdfe 100644 --- a/cpp/tests/sampling/sg_random_walks_test.cpp +++ b/cpp/tests/sampling/sg_random_walks_test.cpp @@ -17,7 +17,6 @@ #include "sampling/random_walks_check.hpp" #include "utilities/base_fixture.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/coarsen_graph_test.cpp b/cpp/tests/structure/coarsen_graph_test.cpp index e4969334d5a..7c0e22ff24a 100644 --- a/cpp/tests/structure/coarsen_graph_test.cpp +++ b/cpp/tests/structure/coarsen_graph_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/structure/count_self_loops_and_multi_edges_test.cpp b/cpp/tests/structure/count_self_loops_and_multi_edges_test.cpp index 202dcecbc59..0055ee1315e 100644 --- a/cpp/tests/structure/count_self_loops_and_multi_edges_test.cpp +++ b/cpp/tests/structure/count_self_loops_and_multi_edges_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/degree_test.cpp b/cpp/tests/structure/degree_test.cpp index 29bb9df50d5..2a899c49f5e 100644 --- a/cpp/tests/structure/degree_test.cpp +++ b/cpp/tests/structure/degree_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/structure/has_edge_and_compute_multiplicity_test.cpp b/cpp/tests/structure/has_edge_and_compute_multiplicity_test.cpp index 7138cee9579..322d7915504 100644 --- a/cpp/tests/structure/has_edge_and_compute_multiplicity_test.cpp +++ b/cpp/tests/structure/has_edge_and_compute_multiplicity_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/induced_subgraph_test.cpp b/cpp/tests/structure/induced_subgraph_test.cpp index 31b1cd055a3..d8f55b65bda 100644 --- a/cpp/tests/structure/induced_subgraph_test.cpp +++ b/cpp/tests/structure/induced_subgraph_test.cpp @@ -15,6 +15,7 @@ */ #include "structure/induced_subgraph_validate.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" #include @@ -190,8 +191,11 @@ class Tests_InducedSubgraph if (induced_subgraph_usecase.check_correctness) { auto h_subgraph_vertices = cugraph::test::to_host(handle, d_subgraph_vertices); - auto [h_offsets, h_indices, h_weights] = - cugraph::test::graph_to_host_csr(handle, graph_view, edge_weight_view); + auto [h_offsets, h_indices, h_weights] = cugraph::test::graph_to_host_csr( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); auto [h_reference_subgraph_edgelist_majors, h_reference_subgraph_edgelist_minors, diff --git a/cpp/tests/structure/mg_count_self_loops_and_multi_edges_test.cpp b/cpp/tests/structure/mg_count_self_loops_and_multi_edges_test.cpp index 0fe76d93068..45fac884f49 100644 --- a/cpp/tests/structure/mg_count_self_loops_and_multi_edges_test.cpp +++ b/cpp/tests/structure/mg_count_self_loops_and_multi_edges_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/mg_has_edge_and_compute_multiplicity_test.cpp b/cpp/tests/structure/mg_has_edge_and_compute_multiplicity_test.cpp index ad3abbc5d8f..0ee72726294 100644 --- a/cpp/tests/structure/mg_has_edge_and_compute_multiplicity_test.cpp +++ b/cpp/tests/structure/mg_has_edge_and_compute_multiplicity_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/mg_induced_subgraph_test.cu b/cpp/tests/structure/mg_induced_subgraph_test.cu index d1e242b1980..3b32c15bf9f 100644 --- a/cpp/tests/structure/mg_induced_subgraph_test.cu +++ b/cpp/tests/structure/mg_induced_subgraph_test.cu @@ -16,6 +16,7 @@ #include "structure/detail/structure_utils.cuh" #include "structure/induced_subgraph_validate.hpp" #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" diff --git a/cpp/tests/structure/mg_select_random_vertices_test.cpp b/cpp/tests/structure/mg_select_random_vertices_test.cpp index 47440522d32..a33e2ca1813 100644 --- a/cpp/tests/structure/mg_select_random_vertices_test.cpp +++ b/cpp/tests/structure/mg_select_random_vertices_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include diff --git a/cpp/tests/structure/mg_symmetrize_test.cpp b/cpp/tests/structure/mg_symmetrize_test.cpp index 3d1238c5751..7eb387f3915 100644 --- a/cpp/tests/structure/mg_symmetrize_test.cpp +++ b/cpp/tests/structure/mg_symmetrize_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/mg_transpose_storage_test.cpp b/cpp/tests/structure/mg_transpose_storage_test.cpp index f2f735685e6..4cbbe500dd8 100644 --- a/cpp/tests/structure/mg_transpose_storage_test.cpp +++ b/cpp/tests/structure/mg_transpose_storage_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/mg_transpose_test.cpp b/cpp/tests/structure/mg_transpose_test.cpp index 3da44c9159c..80cdcae070a 100644 --- a/cpp/tests/structure/mg_transpose_test.cpp +++ b/cpp/tests/structure/mg_transpose_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/renumbering_test.cpp b/cpp/tests/structure/renumbering_test.cpp index 05b0df4805d..ffb51943660 100644 --- a/cpp/tests/structure/renumbering_test.cpp +++ b/cpp/tests/structure/renumbering_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/structure/symmetrize_test.cpp b/cpp/tests/structure/symmetrize_test.cpp index 5b065272565..383411ccf2b 100644 --- a/cpp/tests/structure/symmetrize_test.cpp +++ b/cpp/tests/structure/symmetrize_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/structure/transpose_storage_test.cpp b/cpp/tests/structure/transpose_storage_test.cpp index 4a4b23f4a63..c4f2523727c 100644 --- a/cpp/tests/structure/transpose_storage_test.cpp +++ b/cpp/tests/structure/transpose_storage_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/structure/transpose_test.cpp b/cpp/tests/structure/transpose_test.cpp index 0bfa6742667..c748926b749 100644 --- a/cpp/tests/structure/transpose_test.cpp +++ b/cpp/tests/structure/transpose_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include diff --git a/cpp/tests/structure/weight_sum_test.cpp b/cpp/tests/structure/weight_sum_test.cpp index 9148f57b8f4..87c31b93734 100644 --- a/cpp/tests/structure/weight_sum_test.cpp +++ b/cpp/tests/structure/weight_sum_test.cpp @@ -15,7 +15,7 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" +#include "utilities/conversion_utilities.hpp" #include #include @@ -134,8 +134,11 @@ class Tests_WeightSum } if (weight_sum_usecase.check_correctness) { - auto [h_offsets, h_indices, h_weights] = - cugraph::test::graph_to_host_csr(handle, graph_view, edge_weight_view); + auto [h_offsets, h_indices, h_weights] = cugraph::test::graph_to_host_csr( + handle, + graph_view, + edge_weight_view, + std::optional>(std::nullopt)); std::vector h_reference_in_weight_sums(graph_view.number_of_vertices()); std::vector h_reference_out_weight_sums(graph_view.number_of_vertices()); diff --git a/cpp/tests/traversal/bfs_test.cpp b/cpp/tests/traversal/bfs_test.cpp index 68aa8dc0cd4..12a6912b581 100644 --- a/cpp/tests/traversal/bfs_test.cpp +++ b/cpp/tests/traversal/bfs_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/extract_bfs_paths_test.cu b/cpp/tests/traversal/extract_bfs_paths_test.cu index e6a5ad6f525..0ff16f2730f 100644 --- a/cpp/tests/traversal/extract_bfs_paths_test.cu +++ b/cpp/tests/traversal/extract_bfs_paths_test.cu @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/k_hop_nbrs_test.cpp b/cpp/tests/traversal/k_hop_nbrs_test.cpp index c2bea204779..4ee00ef4e34 100644 --- a/cpp/tests/traversal/k_hop_nbrs_test.cpp +++ b/cpp/tests/traversal/k_hop_nbrs_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/mg_bfs_test.cpp b/cpp/tests/traversal/mg_bfs_test.cpp index 33fd3319551..bb5d0b317f0 100644 --- a/cpp/tests/traversal/mg_bfs_test.cpp +++ b/cpp/tests/traversal/mg_bfs_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/mg_extract_bfs_paths_test.cu b/cpp/tests/traversal/mg_extract_bfs_paths_test.cu index f51282b639f..6869672d518 100644 --- a/cpp/tests/traversal/mg_extract_bfs_paths_test.cu +++ b/cpp/tests/traversal/mg_extract_bfs_paths_test.cu @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/mg_k_hop_nbrs_test.cpp b/cpp/tests/traversal/mg_k_hop_nbrs_test.cpp index ae4a65cfb53..6c532b68448 100644 --- a/cpp/tests/traversal/mg_k_hop_nbrs_test.cpp +++ b/cpp/tests/traversal/mg_k_hop_nbrs_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/mg_sssp_test.cpp b/cpp/tests/traversal/mg_sssp_test.cpp index 18a36f43da3..467dba384e9 100644 --- a/cpp/tests/traversal/mg_sssp_test.cpp +++ b/cpp/tests/traversal/mg_sssp_test.cpp @@ -15,10 +15,10 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" #include "utilities/mg_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/ms_bfs_test.cu b/cpp/tests/traversal/ms_bfs_test.cu index ffaf1dc18a9..6219b28e6e6 100644 --- a/cpp/tests/traversal/ms_bfs_test.cu +++ b/cpp/tests/traversal/ms_bfs_test.cu @@ -15,7 +15,6 @@ */ #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/traversal/od_shortest_distances_test.cpp b/cpp/tests/traversal/od_shortest_distances_test.cpp index 638124e4ef7..931baff4504 100644 --- a/cpp/tests/traversal/od_shortest_distances_test.cpp +++ b/cpp/tests/traversal/od_shortest_distances_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/traversal/sssp_test.cpp b/cpp/tests/traversal/sssp_test.cpp index 2e5bc09a6a4..2d5f960528e 100644 --- a/cpp/tests/traversal/sssp_test.cpp +++ b/cpp/tests/traversal/sssp_test.cpp @@ -15,8 +15,8 @@ */ #include "utilities/base_fixture.hpp" +#include "utilities/conversion_utilities.hpp" #include "utilities/test_graphs.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/tree/mst_test.cu b/cpp/tests/tree/mst_test.cu index b7b104190cd..e0eb88aac61 100644 --- a/cpp/tests/tree/mst_test.cu +++ b/cpp/tests/tree/mst_test.cu @@ -19,7 +19,6 @@ #include "../src/converters/legacy/COOtoCSR.cuh" #include "utilities/base_fixture.hpp" -#include "utilities/test_utilities.hpp" #include #include diff --git a/cpp/tests/utilities/check_utilities.hpp b/cpp/tests/utilities/check_utilities.hpp new file mode 100644 index 00000000000..68b4ef88dda --- /dev/null +++ b/cpp/tests/utilities/check_utilities.hpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2019-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. + */ +#pragma once + +#include "utilities/conversion_utilities.hpp" + +#include +#include + +#include +#include +#include + +namespace cugraph { +namespace test { + +// check the mapping between v0 & v1 is invertible (one to one and onto) +template +bool check_invertible(raft::host_span v0, raft::host_span v1) +{ + if (v0.size() != v1.size()) return false; + + std::map map{}; + + for (size_t i = 0; i < v0.size(); ++i) { + auto find_it = map.find(v0[i]); + if (find_it == map.end()) { + map[v0[i]] = v1[i]; + } else if (find_it->second != v1[i]) + return false; // one value in v0 is mapped to multiple distinct values in v1, so v0 to v1 is + // not a function + } + + std::map inv_map{}; + for (auto it = map.begin(); it != map.end(); ++it) { + auto find_it = inv_map.find(it->second); + if (find_it == inv_map.end()) { + inv_map[it->second] = it->first; + } else + return false; // multiple distinct values in v0 are mapped to one value in v1 + } + + std::vector inv_v1(v1.size()); + for (size_t i = 0; i < v1.size(); ++i) { + auto find_it = inv_map.find(v1[i]); + if (find_it == inv_map.end()) return false; // elements in v0 are mapped to only a subset of v1 + inv_v1[i] = find_it->second; + } + + return std::equal(v0.begin(), v0.end(), inv_v1.begin()); +} + +template +bool check_invertible(raft::handle_t const& handle, + raft::device_span v0, + raft::device_span v1) +{ + auto v0_copy = to_host(handle, v0); + auto v1_copy = to_host(handle, v1); + + return check_invertible(raft::host_span(v0_copy.data(), v0_copy.size()), + raft::host_span(v1_copy.data(), v1_copy.size())); +} + +template +struct nearly_equal { + const type_t threshold_ratio; + const type_t threshold_magnitude; + + bool operator()(type_t lhs, type_t rhs) const + { + return std::abs(lhs - rhs) < + std::max(std::max(lhs, rhs) * threshold_ratio, threshold_magnitude); + } +}; + +template +struct device_nearly_equal { + const type_t threshold_ratio; + const type_t threshold_magnitude; + + bool __device__ operator()(type_t lhs, type_t rhs) const + { + return std::abs(lhs - rhs) < + thrust::max(thrust::max(lhs, rhs) * threshold_ratio, threshold_magnitude); + } +}; + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/conversion_utilities.hpp b/cpp/tests/utilities/conversion_utilities.hpp new file mode 100644 index 00000000000..cbd08fee806 --- /dev/null +++ b/cpp/tests/utilities/conversion_utilities.hpp @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2019-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. + */ +#pragma once + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace cugraph { +namespace test { + +template +decltype(auto) make_graph(raft::handle_t const& handle, + std::vector const& v_src, + std::vector const& v_dst, + std::optional> const& v_w, + vertex_t num_vertices, + edge_t num_edges) +{ + rmm::device_uvector d_src(num_edges, handle.get_stream()); + rmm::device_uvector d_dst(num_edges, handle.get_stream()); + auto d_w = v_w ? std::make_optional>(num_edges, handle.get_stream()) + : std::nullopt; + + raft::update_device(d_src.data(), v_src.data(), d_src.size(), handle.get_stream()); + raft::update_device(d_dst.data(), v_dst.data(), d_dst.size(), handle.get_stream()); + if (d_w) { + raft::update_device((*d_w).data(), (*v_w).data(), (*d_w).size(), handle.get_stream()); + } + + cugraph::graph_t graph(handle); + std::optional, weight_t>> + edge_weights{std::nullopt}; + std::tie(graph, edge_weights, std::ignore, std::ignore) = + cugraph::create_graph_from_edgelist( + handle, + std::nullopt, + std::move(d_src), + std::move(d_dst), + std::move(d_w), + std::nullopt, + cugraph::graph_properties_t{false, false}, + false); + + return std::make_tuple(std::move(graph), std::move(edge_weights)); +} + +template +std::vector to_host(raft::handle_t const& handle, raft::device_span data) +{ + std::vector h_data(data.size()); + if constexpr (std::is_same_v) { // std::vector stores values in a packed format + auto h_tmp = new bool[data.size()]; + raft::update_host(h_tmp, data.data(), data.size(), handle.get_stream()); + handle.sync_stream(); + std::transform( + h_tmp, h_tmp + data.size(), h_data.begin(), [](uint8_t v) { return static_cast(v); }); + delete[] h_tmp; + } else { + raft::update_host(h_data.data(), data.data(), data.size(), handle.get_stream()); + handle.sync_stream(); + } + return h_data; +} + +template +std::vector to_host(raft::handle_t const& handle, rmm::device_uvector const& data) +{ + return to_host(handle, raft::device_span(data.data(), data.size())); +} + +template +std::optional> to_host(raft::handle_t const& handle, + std::optional> data) +{ + std::optional> h_data{std::nullopt}; + if (data) { h_data = to_host(handle, *data); } + return h_data; +} + +template +std::optional> to_host(raft::handle_t const& handle, + std::optional> const& data) +{ + std::optional> h_data{std::nullopt}; + if (data) { + h_data = to_host(handle, raft::device_span((*data).data(), (*data).size())); + } + return h_data; +} + +template +rmm::device_uvector to_device(raft::handle_t const& handle, raft::host_span data) +{ + rmm::device_uvector d_data(data.size(), handle.get_stream()); + raft::update_device(d_data.data(), data.data(), data.size(), handle.get_stream()); + handle.sync_stream(); + return d_data; +} + +template +rmm::device_uvector to_device(raft::handle_t const& handle, std::vector const& data) +{ + rmm::device_uvector d_data(data.size(), handle.get_stream()); + if constexpr (std::is_same_v) { // std::vector stores values in a packed format + auto h_tmp = new bool[data.size()]; + std::copy(data.begin(), data.end(), h_tmp); + raft::update_device(d_data.data(), h_tmp, h_tmp + data.size(), handle.get_stream()); + handle.sync_stream(); + delete[] h_tmp; + } else { + raft::update_device(d_data.data(), data.data(), data.size(), handle.get_stream()); + handle.sync_stream(); + } + return d_data; +} + +template +std::optional> to_device(raft::handle_t const& handle, + std::optional> data) +{ + std::optional> d_data{std::nullopt}; + if (data) { + d_data = rmm::device_uvector(data->size(), handle.get_stream()); + raft::update_device(d_data->data(), data->data(), data->size(), handle.get_stream()); + handle.sync_stream(); + } + return d_data; +} + +template +std::optional> to_device(raft::handle_t const& handle, + std::optional> const& data) +{ + std::optional> d_data{std::nullopt}; + if (data) { d_data = to_device(handle, *data); } + return d_data; +} + +// If multi-GPU, only the rank 0 GPU holds the valid data +template +std::tuple, std::vector, std::optional>> +graph_to_host_coo( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view, + std::optional> renumber_map); + +// If multi-GPU, only the rank 0 GPU holds the valid data +template +std::tuple, + rmm::device_uvector, + std::optional>> +graph_to_device_coo( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view, + std::optional> renumber_map); + +// If multi-GPU, only the rank 0 GPU holds the valid data +template +std::tuple, std::vector, std::optional>> +graph_to_host_csr( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view, + std::optional> renumber_map); + +// Only the rank 0 GPU holds the valid data +template +std::tuple, + std::optional, + weight_t>>, + std::optional>> +mg_graph_to_sg_graph( + raft::handle_t const& handle, + cugraph::graph_view_t const& graph_view, + std::optional> edge_weight_view, + std::optional> renumber_map, + bool renumber); + +// Only the rank 0 GPU holds the valid data + +template +std::tuple>, rmm::device_uvector> +mg_vertex_property_values_to_sg_vertex_property_values( + raft::handle_t const& handle, + std::optional> + mg_renumber_map, // std::nullopt if the MG graph is not renumbered + std::tuple mg_vertex_partition_range, + std::optional> + sg_renumber_map, // std::nullopt if the SG graph is not renumbered + std::optional> + mg_vertices, // std::nullopt if the entire local vertex partition range is assumed + raft::device_span mg_values); + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/test_utilities_impl.cuh b/cpp/tests/utilities/conversion_utilities_impl.cuh similarity index 96% rename from cpp/tests/utilities/test_utilities_impl.cuh rename to cpp/tests/utilities/conversion_utilities_impl.cuh index a50a1a89663..819bd370541 100644 --- a/cpp/tests/utilities/test_utilities_impl.cuh +++ b/cpp/tests/utilities/conversion_utilities_impl.cuh @@ -16,8 +16,8 @@ #pragma once #include "structure/detail/structure_utils.cuh" +#include "utilities/conversion_utilities.hpp" #include "utilities/device_comm_wrapper.hpp" -#include "utilities/test_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include @@ -46,7 +46,8 @@ std::tuple, std::vector, std::optional const& graph_view, - std::optional> edge_weight_view) + std::optional> edge_weight_view, + std::optional> renumber_map) { rmm::device_uvector d_src(0, handle.get_stream()); rmm::device_uvector d_dst(0, handle.get_stream()); @@ -57,7 +58,7 @@ graph_to_host_coo( graph_view, edge_weight_view, std::optional>{std::nullopt}, - std::optional>{std::nullopt}); + renumber_map); if constexpr (is_multi_gpu) { d_src = cugraph::test::device_gatherv( @@ -105,7 +106,8 @@ std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view) + std::optional> edge_weight_view, + std::optional> renumber_map) { rmm::device_uvector d_src(0, handle.get_stream()); rmm::device_uvector d_dst(0, handle.get_stream()); @@ -116,7 +118,7 @@ graph_to_device_coo( graph_view, edge_weight_view, std::optional>{std::nullopt}, - std::optional>{std::nullopt}); + renumber_map); if constexpr (is_multi_gpu) { d_src = cugraph::test::device_gatherv( @@ -150,7 +152,8 @@ std::tuple, std::vector, std::optional const& graph_view, - std::optional> edge_weight_view) + std::optional> edge_weight_view, + std::optional> renumber_map) { rmm::device_uvector d_src(0, handle.get_stream()); rmm::device_uvector d_dst(0, handle.get_stream()); @@ -161,7 +164,7 @@ graph_to_host_csr( graph_view, edge_weight_view, std::optional>{std::nullopt}, - std::optional>{std::nullopt}); + renumber_map); if constexpr (is_multi_gpu) { d_src = cugraph::test::device_gatherv( @@ -237,7 +240,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber) { rmm::device_uvector d_src(0, handle.get_stream()); @@ -249,7 +252,7 @@ mg_graph_to_sg_graph( graph_view, edge_weight_view, std::optional>{std::nullopt}, - number_map); + renumber_map); d_src = cugraph::test::device_gatherv( handle, raft::device_span{d_src.data(), d_src.size()}); @@ -260,14 +263,14 @@ mg_graph_to_sg_graph( handle, raft::device_span{d_wgt->data(), d_wgt->size()}); rmm::device_uvector vertices(0, handle.get_stream()); - if (number_map) { vertices = cugraph::test::device_gatherv(handle, *number_map); } + if (renumber_map) { vertices = cugraph::test::device_gatherv(handle, *renumber_map); } graph_t sg_graph(handle); std::optional, weight_t>> sg_edge_weights{std::nullopt}; std::optional> sg_number_map; if (handle.get_comms().get_rank() == 0) { - if (!number_map) { + if (!renumber_map) { vertices.resize(graph_view.number_of_vertices(), handle.get_stream()); cugraph::detail::sequence_fill( handle.get_stream(), vertices.data(), vertices.size(), vertex_t{0}); diff --git a/cpp/tests/utilities/test_utilities_mg.cu b/cpp/tests/utilities/conversion_utilities_mg.cu similarity index 84% rename from cpp/tests/utilities/test_utilities_mg.cu rename to cpp/tests/utilities/conversion_utilities_mg.cu index 2d7fb2072e2..04f5bc76046 100644 --- a/cpp/tests/utilities/test_utilities_mg.cu +++ b/cpp/tests/utilities/conversion_utilities_mg.cu @@ -13,7 +13,7 @@ * See the License for the specific language governin_from_mtxg permissions and * limitations under the License. */ -#include "utilities/test_utilities_impl.cuh" +#include "utilities/conversion_utilities_impl.cuh" namespace cugraph { namespace test { @@ -22,73 +22,85 @@ template std::tuple, std::vector, std::optional const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -96,7 +108,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -104,7 +117,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -112,7 +126,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -120,7 +135,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -128,7 +144,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -136,7 +153,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -144,7 +162,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -152,7 +171,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -160,7 +180,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -168,7 +189,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -176,7 +198,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -184,79 +207,92 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple< cugraph::graph_t, @@ -266,7 +302,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -277,7 +313,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -288,7 +324,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -299,7 +335,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -310,7 +346,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -321,7 +357,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -332,7 +368,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -343,7 +379,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -354,7 +390,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -365,7 +401,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -376,7 +412,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple< @@ -387,7 +423,7 @@ mg_graph_to_sg_graph( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, std::optional> edge_weight_view, - std::optional> number_map, + std::optional> renumber_map, bool renumber); template std::tuple>, rmm::device_uvector> diff --git a/cpp/tests/utilities/test_utilities_sg.cu b/cpp/tests/utilities/conversion_utilities_sg.cu similarity index 78% rename from cpp/tests/utilities/test_utilities_sg.cu rename to cpp/tests/utilities/conversion_utilities_sg.cu index 8fa32c7ac63..888b34b7e30 100644 --- a/cpp/tests/utilities/test_utilities_sg.cu +++ b/cpp/tests/utilities/conversion_utilities_sg.cu @@ -13,7 +13,7 @@ * See the License for the specific language governin_from_mtxg permissions and * limitations under the License. */ -#include "utilities/test_utilities_impl.cuh" +#include "utilities/conversion_utilities_impl.cuh" namespace cugraph { namespace test { @@ -22,73 +22,85 @@ template std::tuple, std::vector, std::optional const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -96,7 +108,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -104,7 +117,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -112,7 +126,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -120,7 +135,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -128,7 +144,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -136,7 +153,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -144,7 +162,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -152,7 +171,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -160,7 +180,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -168,7 +189,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -176,7 +198,8 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, rmm::device_uvector, @@ -184,79 +207,92 @@ template std::tuple, graph_to_device_coo( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); template std::tuple, std::vector, std::optional>> graph_to_host_csr( raft::handle_t const& handle, cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); + std::optional> edge_weight_view, + std::optional> renumber_map); } // namespace test } // namespace cugraph diff --git a/cpp/tests/utilities/csv_file_utilities.cu b/cpp/tests/utilities/csv_file_utilities.cu index d801b18cf02..08b1e37af8a 100644 --- a/cpp/tests/utilities/csv_file_utilities.cu +++ b/cpp/tests/utilities/csv_file_utilities.cu @@ -15,7 +15,7 @@ */ #include "detail/graph_partition_utils.cuh" -#include "utilities/test_utilities.hpp" +#include "utilities/csv_file_utilities.hpp" #include #include diff --git a/cpp/tests/utilities/csv_file_utilities.hpp b/cpp/tests/utilities/csv_file_utilities.hpp new file mode 100644 index 00000000000..2e1089dfd97 --- /dev/null +++ b/cpp/tests/utilities/csv_file_utilities.hpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2019-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. + */ +#pragma once + +#include + +#include + +#include + +#include +#include +#include +#include + +namespace cugraph { +namespace test { + +template +std::tuple, + rmm::device_uvector, + std::optional>, + bool> +read_edgelist_from_csv_file(raft::handle_t const& handle, + std::string const& graph_file_full_path, + bool test_weighted, + bool store_transposed, + bool multi_gpu); + +template +std::tuple, + std::optional< + cugraph::edge_property_t, + weight_t>>, + std::optional>> +read_graph_from_csv_file(raft::handle_t const& handle, + std::string const& graph_file_full_path, + bool test_weighted, + bool renumber); + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/matrix_market_file_utilities.cu b/cpp/tests/utilities/matrix_market_file_utilities.cu index b76e9fdf8cf..302533113ee 100644 --- a/cpp/tests/utilities/matrix_market_file_utilities.cu +++ b/cpp/tests/utilities/matrix_market_file_utilities.cu @@ -15,7 +15,7 @@ */ #include "detail/graph_partition_utils.cuh" -#include "utilities/test_utilities.hpp" +#include "utilities/matrix_market_file_utilities.hpp" #include #include diff --git a/cpp/tests/utilities/matrix_market_file_utilities.hpp b/cpp/tests/utilities/matrix_market_file_utilities.hpp new file mode 100644 index 00000000000..f88fee4da62 --- /dev/null +++ b/cpp/tests/utilities/matrix_market_file_utilities.hpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2019-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. + */ +#pragma once + +#include +#include + +#include + +#include + +#include +#include +#include +#include + +extern "C" { +#include "mmio.h" +} + +namespace cugraph { +namespace test { + +/// Read matrix properties from Matrix Market file +/** Matrix Market file is assumed to be a sparse matrix in coordinate + * format. + * + * @param f File stream for Matrix Market file. + * @param tg Boolean indicating whether to convert matrix to general + * format (from symmetric, Hermitian, or skew symmetric format). + * @param t (Output) MM_typecode with matrix properties. + * @param m (Output) Number of matrix rows. + * @param n (Output) Number of matrix columns. + * @param nnz (Output) Number of non-zero matrix entries. + * @return Zero if properties were read successfully. Otherwise + * non-zero. + */ +template +int mm_properties(FILE* f, int tg, MM_typecode* t, IndexType_* m, IndexType_* n, IndexType_* nnz); + +/// Read Matrix Market file and convert to COO format matrix +/** Matrix Market file is assumed to be a sparse matrix in coordinate + * format. + * + * @param f File stream for Matrix Market file. + * @param tg Boolean indicating whether to convert matrix to general + * format (from symmetric, Hermitian, or skew symmetric format). + * @param nnz Number of non-zero matrix entries. + * @param cooRowInd (Output) Row indices for COO matrix. Should have + * at least nnz entries. + * @param cooColInd (Output) Column indices for COO matrix. Should + * have at least nnz entries. + * @param cooRVal (Output) Real component of COO matrix + * entries. Should have at least nnz entries. Ignored if null + * pointer. + * @param cooIVal (Output) Imaginary component of COO matrix + * entries. Should have at least nnz entries. Ignored if null + * pointer. + * @return Zero if matrix was read successfully. Otherwise non-zero. + */ +template +int mm_to_coo(FILE* f, + int tg, + IndexType_ nnz, + IndexType_* cooRowInd, + IndexType_* cooColInd, + ValueType_* cooRVal, + ValueType_* cooIVal); + +// FIXME: A similar function could be useful for CSC format +// There are functions above that operate coo -> csr and coo->csc +/** + * @tparam + */ +template +std::unique_ptr> generate_graph_csr_from_mm( + bool& directed, std::string mm_file); + +// returns a tuple of (rows, columns, weights, vertices, is_symmetric) +template +std::tuple, + rmm::device_uvector, + std::optional>, + rmm::device_uvector, + bool> +read_edgelist_from_matrix_market_file(raft::handle_t const& handle, + std::string const& graph_file_full_path, + bool test_weighted, + bool store_transposed, + bool multi_gpu); + +// renumber must be true if multi_gpu is true +template +std::tuple, + std::optional< + cugraph::edge_property_t, + weight_t>>, + std::optional>> +read_graph_from_matrix_market_file(raft::handle_t const& handle, + std::string const& graph_file_full_path, + bool test_weighted, + bool renumber); + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/mg_utilities.cpp b/cpp/tests/utilities/mg_utilities.cpp index 86ccdccd49a..6f8fb8c6acd 100644 --- a/cpp/tests/utilities/mg_utilities.cpp +++ b/cpp/tests/utilities/mg_utilities.cpp @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "utilities/test_utilities.hpp" +#include "utilities/mg_utilities.hpp" + +#include #include #include diff --git a/cpp/tests/utilities/misc_utilities.cpp b/cpp/tests/utilities/misc_utilities.cpp index 842b2fdd7db..f4f815be9e0 100644 --- a/cpp/tests/utilities/misc_utilities.cpp +++ b/cpp/tests/utilities/misc_utilities.cpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "utilities/test_utilities.hpp" +#include "utilities/misc_utilities.hpp" #include #include diff --git a/cpp/tests/utilities/misc_utilities.hpp b/cpp/tests/utilities/misc_utilities.hpp new file mode 100644 index 00000000000..4200d5112c5 --- /dev/null +++ b/cpp/tests/utilities/misc_utilities.hpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019-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. + */ +#pragma once + +#include + +namespace cugraph { +namespace test { + +std::string getFileName(const std::string& s); + +// Define RAPIDS_DATASET_ROOT_DIR using a preprocessor variable to +// allow for a build to override the default. This is useful for +// having different builds for specific default dataset locations. +#ifndef RAPIDS_DATASET_ROOT_DIR +#define RAPIDS_DATASET_ROOT_DIR "/datasets" +#endif + +static const std::string& get_rapids_dataset_root_dir() +{ + static std::string rdrd(""); + // Env var always overrides the value of RAPIDS_DATASET_ROOT_DIR + if (rdrd == "") { + const char* envVar = std::getenv("RAPIDS_DATASET_ROOT_DIR"); + rdrd = (envVar != NULL) ? envVar : RAPIDS_DATASET_ROOT_DIR; + } + return rdrd; +} + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/property_generator_kernels.cuh b/cpp/tests/utilities/property_generator_kernels.cuh new file mode 100644 index 00000000000..d8d5cc420fd --- /dev/null +++ b/cpp/tests/utilities/property_generator_kernels.cuh @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2021-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. + */ +#pragma once + +#include "prims/transform_e.cuh" +#include "prims/update_edge_src_dst_property.cuh" +#include "utilities/property_generator_utilities.hpp" + +#include +#include + +#include + +#include +#include + +namespace cugraph { +namespace test { + +namespace detail { + +template +__host__ __device__ auto make_type_casted_tuple_from_scalar(T val, std::index_sequence) +{ + return thrust::make_tuple( + static_cast::type>(val)...); +} + +template +__host__ __device__ auto make_property_value(T val) +{ + property_t ret{}; + if constexpr (cugraph::is_thrust_tuple_of_arithmetic::value) { + ret = make_type_casted_tuple_from_scalar( + val, std::make_index_sequence::value>{}); + } else { + ret = static_cast(val); + } + return ret; +} + +template +struct vertex_property_transform { + int32_t mod{}; + + constexpr __device__ property_t operator()(vertex_t v) const + { + static_assert(cugraph::is_thrust_tuple_of_arithmetic::value || + std::is_arithmetic_v); + cuco::detail::MurmurHash3_32 hash_func{}; + return make_property_value(hash_func(v) % mod); + } +}; + +template +struct edge_property_transform { + int32_t mod{}; + + constexpr __device__ property_t operator()( + vertex_t src, vertex_t dst, thrust::nullopt_t, thrust::nullopt_t, thrust::nullopt_t) const + { + static_assert(cugraph::is_thrust_tuple_of_arithmetic::value || + std::is_arithmetic_v); + cuco::detail::MurmurHash3_32 hash_func{}; + return make_property_value(hash_func(src + dst) % mod); + } +}; + +} // namespace detail + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/property_generator_utilities.hpp b/cpp/tests/utilities/property_generator_utilities.hpp new file mode 100644 index 00000000000..6bd22da1f75 --- /dev/null +++ b/cpp/tests/utilities/property_generator_utilities.hpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2021-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. + */ + +#pragma once + +#include +#include +#include + +#include + +#include + +#include +#include + +namespace cugraph { +namespace test { + +template +struct generate { + private: + using vertex_type = typename GraphViewType::vertex_type; + + using property_buffer_type = std::decay_t( + size_t{0}, rmm::cuda_stream_view{}))>; + + public: + static property_t initial_value(int32_t init); + + static property_buffer_type vertex_property(raft::handle_t const& handle, + rmm::device_uvector const& labels, + int32_t hash_bin_count); + + static property_buffer_type vertex_property(raft::handle_t const& handle, + thrust::counting_iterator begin, + thrust::counting_iterator end, + int32_t hash_bin_count); + + static cugraph::edge_src_property_t src_property( + raft::handle_t const& handle, + GraphViewType const& graph_view, + property_buffer_type const& property); + + static cugraph::edge_dst_property_t dst_property( + raft::handle_t const& handle, + GraphViewType const& graph_view, + property_buffer_type const& property); + + static cugraph::edge_property_t edge_property( + raft::handle_t const& handle, GraphViewType const& graph_view, int32_t hash_bin_count); +}; + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/property_generator_utilities_impl.cuh b/cpp/tests/utilities/property_generator_utilities_impl.cuh new file mode 100644 index 00000000000..1a6c87700a9 --- /dev/null +++ b/cpp/tests/utilities/property_generator_utilities_impl.cuh @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2021-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. + */ +#pragma once + +#include "prims/transform_e.cuh" +#include "prims/update_edge_src_dst_property.cuh" +#include "utilities/property_generator_kernels.cuh" +#include "utilities/property_generator_utilities.hpp" + +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +namespace cugraph { +namespace test { + +template +property_t generate::initial_value(int32_t init) +{ + return detail::make_property_value(init); +} + +template +typename generate::property_buffer_type +generate::vertex_property(raft::handle_t const& handle, + rmm::device_uvector const& labels, + int32_t hash_bin_count) +{ + auto data = cugraph::allocate_dataframe_buffer(labels.size(), handle.get_stream()); + thrust::transform(handle.get_thrust_policy(), + labels.begin(), + labels.end(), + cugraph::get_dataframe_buffer_begin(data), + detail::vertex_property_transform{hash_bin_count}); + return data; +} + +template +typename generate::property_buffer_type +generate::vertex_property(raft::handle_t const& handle, + thrust::counting_iterator begin, + thrust::counting_iterator end, + int32_t hash_bin_count) +{ + auto length = thrust::distance(begin, end); + auto data = cugraph::allocate_dataframe_buffer(length, handle.get_stream()); + thrust::transform(handle.get_thrust_policy(), + begin, + end, + cugraph::get_dataframe_buffer_begin(data), + detail::vertex_property_transform{hash_bin_count}); + return data; +} + +template +cugraph::edge_src_property_t +generate::src_property(raft::handle_t const& handle, + GraphViewType const& graph_view, + property_buffer_type const& property) +{ + auto output_property = + cugraph::edge_src_property_t(handle, graph_view); + update_edge_src_property( + handle, graph_view, cugraph::get_dataframe_buffer_begin(property), output_property); + return output_property; +} + +template +cugraph::edge_dst_property_t +generate::dst_property(raft::handle_t const& handle, + GraphViewType const& graph_view, + property_buffer_type const& property) +{ + auto output_property = + cugraph::edge_dst_property_t(handle, graph_view); + update_edge_dst_property( + handle, graph_view, cugraph::get_dataframe_buffer_begin(property), output_property); + return output_property; +} + +template +cugraph::edge_property_t +generate::edge_property(raft::handle_t const& handle, + GraphViewType const& graph_view, + int32_t hash_bin_count) +{ + auto output_property = cugraph::edge_property_t(handle, graph_view); + cugraph::transform_e(handle, + graph_view, + cugraph::edge_src_dummy_property_t{}.view(), + cugraph::edge_dst_dummy_property_t{}.view(), + cugraph::edge_dummy_property_t{}.view(), + detail::edge_property_transform{hash_bin_count}, + output_property.mutable_view()); + return output_property; +} + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/property_generator_utilities_mg.cu b/cpp/tests/utilities/property_generator_utilities_mg.cu new file mode 100644 index 00000000000..f283050dca8 --- /dev/null +++ b/cpp/tests/utilities/property_generator_utilities_mg.cu @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021-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. + */ +#include "utilities/property_generator_utilities_impl.cuh" + +namespace cugraph { +namespace test { + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/property_generator_utilities_sg.cu b/cpp/tests/utilities/property_generator_utilities_sg.cu new file mode 100644 index 00000000000..dd1907a9f1d --- /dev/null +++ b/cpp/tests/utilities/property_generator_utilities_sg.cu @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021-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. + */ +#include "utilities/property_generator_utilities_impl.cuh" + +namespace cugraph { +namespace test { + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +template struct generate, bool>; +template struct generate, int32_t>; +template struct generate, int64_t>; +template struct generate, + thrust::tuple>; + +} // namespace test +} // namespace cugraph diff --git a/cpp/tests/utilities/test_graphs.hpp b/cpp/tests/utilities/test_graphs.hpp index 9b7ffe74e85..0f3224bfc52 100644 --- a/cpp/tests/utilities/test_graphs.hpp +++ b/cpp/tests/utilities/test_graphs.hpp @@ -15,7 +15,9 @@ */ #pragma once -#include "utilities/test_utilities.hpp" +#include "utilities/csv_file_utilities.hpp" +#include "utilities/matrix_market_file_utilities.hpp" +#include "utilities/misc_utilities.hpp" #include "utilities/thrust_wrapper.hpp" #include diff --git a/cpp/tests/utilities/test_utilities.hpp b/cpp/tests/utilities/test_utilities.hpp deleted file mode 100644 index 8bf606e5753..00000000000 --- a/cpp/tests/utilities/test_utilities.hpp +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Copyright (c) 2019-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. - */ -#pragma once - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -extern "C" { -#include "mmio.h" -} - -namespace cugraph { -namespace test { - -std::string getFileName(const std::string& s); - -/// Read matrix properties from Matrix Market file -/** Matrix Market file is assumed to be a sparse matrix in coordinate - * format. - * - * @param f File stream for Matrix Market file. - * @param tg Boolean indicating whether to convert matrix to general - * format (from symmetric, Hermitian, or skew symmetric format). - * @param t (Output) MM_typecode with matrix properties. - * @param m (Output) Number of matrix rows. - * @param n (Output) Number of matrix columns. - * @param nnz (Output) Number of non-zero matrix entries. - * @return Zero if properties were read successfully. Otherwise - * non-zero. - */ -template -int mm_properties(FILE* f, int tg, MM_typecode* t, IndexType_* m, IndexType_* n, IndexType_* nnz); - -/// Read Matrix Market file and convert to COO format matrix -/** Matrix Market file is assumed to be a sparse matrix in coordinate - * format. - * - * @param f File stream for Matrix Market file. - * @param tg Boolean indicating whether to convert matrix to general - * format (from symmetric, Hermitian, or skew symmetric format). - * @param nnz Number of non-zero matrix entries. - * @param cooRowInd (Output) Row indices for COO matrix. Should have - * at least nnz entries. - * @param cooColInd (Output) Column indices for COO matrix. Should - * have at least nnz entries. - * @param cooRVal (Output) Real component of COO matrix - * entries. Should have at least nnz entries. Ignored if null - * pointer. - * @param cooIVal (Output) Imaginary component of COO matrix - * entries. Should have at least nnz entries. Ignored if null - * pointer. - * @return Zero if matrix was read successfully. Otherwise non-zero. - */ -template -int mm_to_coo(FILE* f, - int tg, - IndexType_ nnz, - IndexType_* cooRowInd, - IndexType_* cooColInd, - ValueType_* cooRVal, - ValueType_* cooIVal); - -// FIXME: A similar function could be useful for CSC format -// There are functions above that operate coo -> csr and coo->csc -/** - * @tparam - */ -template -std::unique_ptr> generate_graph_csr_from_mm( - bool& directed, std::string mm_file); - -// Define RAPIDS_DATASET_ROOT_DIR using a preprocessor variable to -// allow for a build to override the default. This is useful for -// having different builds for specific default dataset locations. -#ifndef RAPIDS_DATASET_ROOT_DIR -#define RAPIDS_DATASET_ROOT_DIR "/datasets" -#endif - -static const std::string& get_rapids_dataset_root_dir() -{ - static std::string rdrd(""); - // Env var always overrides the value of RAPIDS_DATASET_ROOT_DIR - if (rdrd == "") { - const char* envVar = std::getenv("RAPIDS_DATASET_ROOT_DIR"); - rdrd = (envVar != NULL) ? envVar : RAPIDS_DATASET_ROOT_DIR; - } - return rdrd; -} - -// returns a tuple of (rows, columns, weights, vertices, is_symmetric) -template -std::tuple, - rmm::device_uvector, - std::optional>, - rmm::device_uvector, - bool> -read_edgelist_from_matrix_market_file(raft::handle_t const& handle, - std::string const& graph_file_full_path, - bool test_weighted, - bool store_transposed, - bool multi_gpu); - -// renumber must be true if multi_gpu is true -template -std::tuple, - std::optional< - cugraph::edge_property_t, - weight_t>>, - std::optional>> -read_graph_from_matrix_market_file(raft::handle_t const& handle, - std::string const& graph_file_full_path, - bool test_weighted, - bool renumber); - -template -std::tuple, - rmm::device_uvector, - std::optional>, - bool> -read_edgelist_from_csv_file(raft::handle_t const& handle, - std::string const& graph_file_full_path, - bool test_weighted, - bool store_transposed, - bool multi_gpu); - -template -std::tuple, - std::optional< - cugraph::edge_property_t, - weight_t>>, - std::optional>> -read_graph_from_csv_file(raft::handle_t const& handle, - std::string const& graph_file_full_path, - bool test_weighted, - bool renumber); - -// alias for easy customization for debug purposes: -// -template -using vector_test_t = rmm::device_uvector; - -template -decltype(auto) make_graph(raft::handle_t const& handle, - std::vector const& v_src, - std::vector const& v_dst, - std::optional> const& v_w, - vertex_t num_vertices, - edge_t num_edges) -{ - vector_test_t d_src(num_edges, handle.get_stream()); - vector_test_t d_dst(num_edges, handle.get_stream()); - auto d_w = v_w ? std::make_optional>(num_edges, handle.get_stream()) - : std::nullopt; - - raft::update_device(d_src.data(), v_src.data(), d_src.size(), handle.get_stream()); - raft::update_device(d_dst.data(), v_dst.data(), d_dst.size(), handle.get_stream()); - if (d_w) { - raft::update_device((*d_w).data(), (*v_w).data(), (*d_w).size(), handle.get_stream()); - } - - cugraph::graph_t graph(handle); - std::optional, weight_t>> - edge_weights{std::nullopt}; - std::tie(graph, edge_weights, std::ignore, std::ignore) = - cugraph::create_graph_from_edgelist( - handle, - std::nullopt, - std::move(d_src), - std::move(d_dst), - std::move(d_w), - std::nullopt, - cugraph::graph_properties_t{false, false}, - false); - - return std::make_tuple(std::move(graph), std::move(edge_weights)); -} - -// compares single GPU CSR graph data: -// (for testing / debugging); -// on first == false, second == brief description of what is different; -// -template -std::pair compare_graphs(raft::handle_t const& handle, - left_graph_t const& lgraph, - right_graph_t const& rgraph) -{ - if constexpr (left_graph_t::is_multi_gpu && right_graph_t::is_multi_gpu) { - // no support for comparing distributed graphs, yet: - // - CUGRAPH_FAIL("Unsupported graph type for comparison."); - return std::make_pair(false, std::string("unsupported")); - } else if constexpr (!std::is_same_v) { - return std::make_pair(false, std::string("type")); - } else { - // both graphs are single GPU: - // - using graph_t = left_graph_t; - - using vertex_t = typename graph_t::vertex_type; - using edge_t = typename graph_t::edge_type; - using weight_t = typename graph_t::weight_type; - - size_t num_vertices = lgraph.number_of_vertices(); - size_t num_edges = lgraph.number_of_edges(); - - { - size_t r_num_vertices = rgraph.number_of_vertices(); - size_t r_num_edges = rgraph.number_of_edges(); - - if (num_vertices != r_num_vertices) return std::make_pair(false, std::string("num_vertices")); - - if (num_edges != r_num_edges) return std::make_pair(false, std::string("num_edges")); - } - - if (lgraph.is_symmetric() != rgraph.is_symmetric()) - return std::make_pair(false, std::string("symmetric")); - - if (lgraph.is_multigraph() != rgraph.is_multigraph()) - return std::make_pair(false, std::string("multigraph")); - - bool is_weighted = lgraph.is_weighted(); - if (is_weighted != rgraph.is_weighted()) return std::make_pair(false, std::string("weighted")); - - auto lgraph_view = lgraph.view(); - auto rgraph_view = rgraph.view(); - - std::vector lv_ro(num_vertices + 1); - std::vector lv_ci(num_edges); - - raft::update_host(lv_ro.data(), - lgraph_view.local_edge_partition_view().offsets().data(), - num_vertices + 1, - handle.get_stream()); - raft::update_host(lv_ci.data(), - lgraph_view.local_edge_partition_view().indices().data(), - num_edges, - handle.get_stream()); - - std::vector rv_ro(num_vertices + 1); - std::vector rv_ci(num_edges); - - raft::update_host(rv_ro.data(), - rgraph_view.local_edge_partition_view().offsets().data(), - num_vertices + 1, - handle.get_stream()); - raft::update_host(rv_ci.data(), - rgraph_view.local_edge_partition_view().indices().data(), - num_edges, - handle.get_stream()); - - auto lv_vs = is_weighted ? std::make_optional>(num_edges) : std::nullopt; - auto rv_vs = is_weighted ? std::make_optional>(num_edges) : std::nullopt; - if (is_weighted) { - raft::update_host((*lv_vs).data(), - (*(lgraph_view.local_edge_partition_view().weights())).data(), - num_edges, - handle.get_stream()); - - raft::update_host((*rv_vs).data(), - (*(rgraph_view.local_edge_partition_view().weights())).data(), - num_edges, - handle.get_stream()); - } - - handle.sync_stream(); - - if (lv_ro != rv_ro) return std::make_pair(false, std::string("offsets")); - - for (size_t i = 0; i < num_vertices; ++i) { - auto first = lv_ro[i]; - auto last = lv_ro[i + 1]; - if (is_weighted) { - std::vector> lv_pairs(last - first); - std::vector> rv_pairs(last - first); - for (edge_t j = first; j < last; ++j) { - lv_pairs[j - first] = std::make_tuple(lv_ci[j], (*lv_vs)[j]); - rv_pairs[j - first] = std::make_tuple(rv_ci[j], (*rv_vs)[j]); - } - std::sort(lv_pairs.begin(), lv_pairs.end()); - std::sort(rv_pairs.begin(), rv_pairs.end()); - if (!std::equal(lv_pairs.begin(), lv_pairs.end(), rv_pairs.begin(), [](auto lhs, auto rhs) { - return std::get<0>(lhs) == std::get<0>(rhs); - })) - return std::make_pair(false, std::string("indices")); - if (!std::equal(lv_pairs.begin(), lv_pairs.end(), rv_pairs.begin(), [](auto lhs, auto rhs) { - return std::get<1>(lhs) == std::get<1>(rhs); - })) - return std::make_pair(false, std::string("values")); - } else { - std::sort(lv_ci.begin() + first, lv_ci.begin() + last); - std::sort(rv_ci.begin() + first, rv_ci.begin() + last); - if (!std::equal(lv_ci.begin() + first, lv_ci.begin() + last, rv_ci.begin() + first)) - return std::make_pair(false, std::string("indices")); - } - } - - if (lgraph_view.local_edge_partition_segment_offsets(0) != - rgraph_view.local_edge_partition_segment_offsets(0)) - return std::make_pair(false, std::string("segment offsets")); - - return std::make_pair(true, std::string{}); - } -} - -// check the mapping between v0 & v1 is invertible (one to one and onto) -template -bool check_invertible(raft::host_span v0, raft::host_span v1) -{ - if (v0.size() != v1.size()) return false; - - std::map map{}; - - for (size_t i = 0; i < v0.size(); ++i) { - auto find_it = map.find(v0[i]); - if (find_it == map.end()) { - map[v0[i]] = v1[i]; - } else if (find_it->second != v1[i]) - return false; // one value in v0 is mapped to multiple distinct values in v1, so v0 to v1 is - // not a function - } - - std::map inv_map{}; - for (auto it = map.begin(); it != map.end(); ++it) { - auto find_it = inv_map.find(it->second); - if (find_it == inv_map.end()) { - inv_map[it->second] = it->first; - } else - return false; // multiple distinct values in v0 are mapped to one value in v1 - } - - std::vector inv_v1(v1.size()); - for (size_t i = 0; i < v1.size(); ++i) { - auto find_it = inv_map.find(v1[i]); - if (find_it == inv_map.end()) return false; // elements in v0 are mapped to only a subset of v1 - inv_v1[i] = find_it->second; - } - - return std::equal(v0.begin(), v0.end(), inv_v1.begin()); -} - -template -std::vector to_host(raft::handle_t const& handle, raft::device_span data) -{ - std::vector h_data(data.size()); - if constexpr (std::is_same_v) { // std::vector stores values in a packed format - auto h_tmp = new bool[data.size()]; - raft::update_host(h_tmp, data.data(), data.size(), handle.get_stream()); - handle.sync_stream(); - std::transform( - h_tmp, h_tmp + data.size(), h_data.begin(), [](uint8_t v) { return static_cast(v); }); - delete[] h_tmp; - } else { - raft::update_host(h_data.data(), data.data(), data.size(), handle.get_stream()); - handle.sync_stream(); - } - return h_data; -} - -template -std::vector to_host(raft::handle_t const& handle, rmm::device_uvector const& data) -{ - return to_host(handle, raft::device_span(data.data(), data.size())); -} - -template -std::optional> to_host(raft::handle_t const& handle, - std::optional> data) -{ - std::optional> h_data{std::nullopt}; - if (data) { h_data = to_host(handle, *data); } - return h_data; -} - -template -std::optional> to_host(raft::handle_t const& handle, - std::optional> const& data) -{ - std::optional> h_data{std::nullopt}; - if (data) { - h_data = to_host(handle, raft::device_span((*data).data(), (*data).size())); - } - return h_data; -} - -template -rmm::device_uvector to_device(raft::handle_t const& handle, raft::host_span data) -{ - rmm::device_uvector d_data(data.size(), handle.get_stream()); - raft::update_device(d_data.data(), data.data(), data.size(), handle.get_stream()); - handle.sync_stream(); - return d_data; -} - -template -rmm::device_uvector to_device(raft::handle_t const& handle, std::vector const& data) -{ - rmm::device_uvector d_data(data.size(), handle.get_stream()); - if constexpr (std::is_same_v) { // std::vector stores values in a packed format - auto h_tmp = new bool[data.size()]; - std::copy(data.begin(), data.end(), h_tmp); - raft::update_device(d_data.data(), h_tmp, h_tmp + data.size(), handle.get_stream()); - handle.sync_stream(); - delete[] h_tmp; - } else { - raft::update_device(d_data.data(), data.data(), data.size(), handle.get_stream()); - handle.sync_stream(); - } - return d_data; -} - -template -std::optional> to_device(raft::handle_t const& handle, - std::optional> data) -{ - std::optional> d_data{std::nullopt}; - if (data) { - d_data = rmm::device_uvector(data->size(), handle.get_stream()); - raft::update_device(d_data->data(), data->data(), data->size(), handle.get_stream()); - handle.sync_stream(); - } - return d_data; -} - -template -std::optional> to_device(raft::handle_t const& handle, - std::optional> const& data) -{ - std::optional> d_data{std::nullopt}; - if (data) { d_data = to_device(handle, *data); } - return d_data; -} - -template -bool check_invertible(raft::handle_t const& handle, - raft::device_span v0, - raft::device_span v1) -{ - auto v0_copy = to_host(handle, v0); - auto v1_copy = to_host(handle, v1); - - return check_invertible(raft::host_span(v0_copy.data(), v0_copy.size()), - raft::host_span(v1_copy.data(), v1_copy.size())); -} - -template -std::vector random_vector(L size, unsigned seed = 0) -{ - std::default_random_engine gen(seed); - std::uniform_real_distribution dist(0.0, 1.0); - std::vector v(size); - std::generate(v.begin(), v.end(), [&] { return dist(gen); }); - return v; -} - -// If multi-GPU, only the rank 0 GPU holds the valid data -template -std::tuple, std::vector, std::optional>> -graph_to_host_coo( - raft::handle_t const& handle, - cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); - -// If multi-GPU, only the rank 0 GPU holds the valid data -template -std::tuple, - rmm::device_uvector, - std::optional>> -graph_to_device_coo( - raft::handle_t const& handle, - cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); - -// If multi-GPU, only the rank 0 GPU holds the valid data -template -std::tuple, std::vector, std::optional>> -graph_to_host_csr( - raft::handle_t const& handle, - cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view); - -// Only the rank 0 GPU holds the valid data -template -std::tuple, - std::optional, - weight_t>>, - std::optional>> -mg_graph_to_sg_graph( - raft::handle_t const& handle, - cugraph::graph_view_t const& graph_view, - std::optional> edge_weight_view, - std::optional> number_map, - bool renumber); - -// Only the rank 0 GPU holds the valid data - -template -std::tuple>, rmm::device_uvector> -mg_vertex_property_values_to_sg_vertex_property_values( - raft::handle_t const& handle, - std::optional> - mg_renumber_map, // std::nullopt if the MG graph is not renumbered - std::tuple mg_vertex_partition_range, - std::optional> - sg_renumber_map, // std::nullopt if the SG graph is not renumbered - std::optional> - mg_vertices, // std::nullopt if the entire local vertex partition range is assumed - raft::device_span mg_values); - -template -struct nearly_equal { - const type_t threshold_ratio; - const type_t threshold_magnitude; - - bool operator()(type_t lhs, type_t rhs) const - { - return std::abs(lhs - rhs) < - std::max(std::max(lhs, rhs) * threshold_ratio, threshold_magnitude); - } -}; - -template -struct device_nearly_equal { - const type_t threshold_ratio; - const type_t threshold_magnitude; - - bool __device__ operator()(type_t lhs, type_t rhs) const - { - return std::abs(lhs - rhs) < - thrust::max(thrust::max(lhs, rhs) * threshold_ratio, threshold_magnitude); - } -}; - -} // namespace test -} // namespace cugraph From 4becbe81ef914fff10ab4e4750d61fe60bde12af Mon Sep 17 00:00:00 2001 From: Tingyu Wang Date: Wed, 20 Mar 2024 16:02:08 -0400 Subject: [PATCH 8/9] Always scatter in FP32 in TPConv (#4260) Always scatter in FP32 in TPConv due to poor performance of torch's native scatter_add in bfloat16. Authors: - Tingyu Wang (https://github.com/tingyu66) Approvers: - Alex Barghi (https://github.com/alexbarghi-nv) URL: https://github.com/rapidsai/cugraph/pull/4260 --- .../cugraph_equivariant/nn/tensor_product_conv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/cugraph-equivariant/cugraph_equivariant/nn/tensor_product_conv.py b/python/cugraph-equivariant/cugraph_equivariant/nn/tensor_product_conv.py index 5120a23180d..af1d0efa76c 100644 --- a/python/cugraph-equivariant/cugraph_equivariant/nn/tensor_product_conv.py +++ b/python/cugraph-equivariant/cugraph_equivariant/nn/tensor_product_conv.py @@ -251,7 +251,10 @@ def forward( if edge_envelope is not None: out = out * edge_envelope.view(-1, 1) - out = scatter_reduce(out, dst, dim=0, dim_size=num_dst_nodes, reduce=reduce) + dtype = out.dtype + out = scatter_reduce( + out.float(), dst, dim=0, dim_size=num_dst_nodes, reduce=reduce + ).to(dtype) if self.batch_norm: out = self.batch_norm(out) From 87061152bfad49f4a5d73288eed399b773218a0a Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Thu, 21 Mar 2024 09:12:22 -0400 Subject: [PATCH 9/9] Update pre-commit-hooks to v0.0.3 (#4264) This fixes an issue with how the `verify-copyright` hook handles multiple merge bases. Authors: - Kyle Edwards (https://github.com/KyleFromNVIDIA) Approvers: - Don Acosta (https://github.com/acostadon) URL: https://github.com/rapidsai/cugraph/pull/4264 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 542e9cacb77..a314b8c7185 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,7 +52,7 @@ repos: - id: rapids-dependency-file-generator args: ["--clean"] - repo: https://github.com/rapidsai/pre-commit-hooks - rev: v0.0.1 + rev: v0.0.3 hooks: - id: verify-copyright files: |