From 0d9459d18b0313b71c8daee3cd0f68d3e31a662f Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 15 Jul 2024 00:19:50 +0000 Subject: [PATCH 1/4] First pass of a working rattler-build build --- ci/build_cpp.sh | 2 + .../recipes/libcugraph/install_libcugraph.sh | 1 + conda/recipes/libcugraph/meta.yaml | 402 +++++++++++------- 3 files changed, 246 insertions(+), 159 deletions(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 859977d76d5..58450a1e410 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -15,6 +15,8 @@ rapids-print-env rapids-logger "Begin cpp build" +mamba install rattler-build -c conda-forge + RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) rapids-conda-retry mambabuild conda/recipes/libcugraph rapids-upload-conda-to-s3 cpp diff --git a/conda/recipes/libcugraph/install_libcugraph.sh b/conda/recipes/libcugraph/install_libcugraph.sh index 5be47e41f2e..00a8f529acb 100644 --- a/conda/recipes/libcugraph/install_libcugraph.sh +++ b/conda/recipes/libcugraph/install_libcugraph.sh @@ -1,4 +1,5 @@ #!/bin/bash # Copyright (c) 2022, NVIDIA CORPORATION. +./build.sh libcugraph libcugraph_etl cpp-mgtests -n -v --allgpuarch cmake --install cpp/build diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index 8b1fadbba25..8b516332d62 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -1,197 +1,281 @@ # Copyright (c) 2018-2024, NVIDIA CORPORATION. +# Notes: +# - nccl package on rapidsai-nightly causes problems because rattler-build uses strict channel priority - rattler-build uses strict channel priority and it does not appear to be configurable, see https://github.com/prefix-dev/rattler-build/issues/343, so we need to make it work. +# - Various bits of string interpolation in the top variables don't seem to work yet. Still need to figure out how to achieve the same effect +# - Need to include git in the build env because the host git doesn't appear to be visible. +# - I'm not yet sure how you handle multiple outputs where one of them does all the building for reuse by other jobs downstream +# - Try using secrets instead of env -{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %} -{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} -{% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} -{% set cuda_major = cuda_version.split('.')[0] %} -{% set date_string = environ['RAPIDS_DATE_STRING'] %} +context: + version: ${{ env.get("RAPIDS_PACKAGE_VERSION") }} + minor_version: ${{ (version | split('.'))[:2] | join(".") }} + cuda_version: ${{ (env.get('RAPIDS_CUDA_VERSION') | split('.'))[:2] | join(".") }} + cuda_major: ${{ (env.get('RAPIDS_CUDA_VERSION') | split('.'))[0] }} + date_string: ${{ env.get("RAPIDS_DATE_STRING") }} -package: - name: libcugraph-split +recipe: + version: ${{ version }} source: path: ../../.. build: - script_env: - - AWS_ACCESS_KEY_ID - - AWS_SECRET_ACCESS_KEY - - AWS_SESSION_TOKEN - - CMAKE_C_COMPILER_LAUNCHER - - CMAKE_CUDA_COMPILER_LAUNCHER - - CMAKE_CXX_COMPILER_LAUNCHER - - CMAKE_GENERATOR - - PARALLEL_LEVEL - - SCCACHE_BUCKET - - SCCACHE_IDLE_TIMEOUT - - SCCACHE_REGION - - SCCACHE_S3_KEY_PREFIX=libcugraph-aarch64 # [aarch64] - - SCCACHE_S3_KEY_PREFIX=libcugraph-linux64 # [linux64] - - SCCACHE_S3_USE_SSL - - SCCACHE_S3_NO_CREDENTIALS - -requirements: - build: - - {{ compiler('c') }} - {% if cuda_major == "11" %} - - {{ compiler('cuda11') }} {{ cuda_version }} - {% else %} - - {{ compiler('cuda') }} - {% endif %} - - cuda-version ={{ cuda_version }} - - {{ compiler('cxx') }} - - cmake {{ cmake_version }} - - ninja - - openmpi<5.0.3 # Required for building cpp-mgtests (multi-GPU tests) - - {{ stdlib("c") }} - host: - {% if cuda_major == "11" %} - - cudatoolkit - - cuda-nvtx ={{ cuda_version }} - - cuda-profiler-api {{ cuda11_cuda_profiler_api_host_version }} - - libcublas {{ cuda11_libcublas_host_version }} - - libcublas-dev {{ cuda11_libcublas_host_version }} - - libcurand {{ cuda11_libcurand_host_version }} - - libcurand-dev {{ cuda11_libcurand_host_version }} - - libcusolver {{ cuda11_libcusolver_host_version }} - - libcusolver-dev {{ cuda11_libcusolver_host_version }} - - libcusparse {{ cuda11_libcusparse_host_version }} - - libcusparse-dev {{ cuda11_libcusparse_host_version }} - {% else %} - - cuda-nvtx-dev - - cuda-profiler-api - - cuda-cudart-dev - - libcublas-dev - - libcurand-dev - - libcusolver-dev - - libcusparse-dev - {% endif %} - - cuda-version ={{ cuda_version }} - - doxygen {{ doxygen_version }} - - libcudf ={{ minor_version }} - - libcugraphops ={{ minor_version }} - - libraft ={{ minor_version }} - - libraft-headers ={{ minor_version }} - - librmm ={{ minor_version }} - - nccl {{ nccl_version }} - - ucx-proc=*=gpu - - rapids-build-backend>=0.3.1,<0.4.0.dev0 + script: + env: + AWS_ACCESS_KEY_ID: ${{ env.get("AWS_ACCESS_KEY_ID") }} + AWS_SECRET_ACCESS_KEY: ${{ env.get("AWS_SECRET_ACCESS_KEY") }} + AWS_SESSION_TOKEN: ${{ env.get("AWS_SESSION_TOKEN") }} + CMAKE_C_COMPILER_LAUNCHER: ${{ env.get("CMAKE_C_COMPILER_LAUNCHER") }} + CMAKE_CUDA_COMPILER_LAUNCHER: ${{ env.get("CMAKE_CUDA_COMPILER_LAUNCHER") }} + CMAKE_CXX_COMPILER_LAUNCHER: ${{ env.get("CMAKE_CXX_COMPILER_LAUNCHER") }} + CMAKE_GENERATOR: ${{ env.get("CMAKE_GENERATOR") }} + PARALLEL_LEVEL: ${{ env.get("PARALLEL_LEVEL") }} + SCCACHE_BUCKET: ${{ env.get("SCCACHE_BUCKET") }} + SCCACHE_IDLE_TIMEOUT: ${{ env.get("SCCACHE_IDLE_TIMEOUT") }} + SCCACHE_REGION: ${{ env.get("SCCACHE_REGION") }} + SCCACHE_S3_KEY_PREFIX: ${{ "libcugraph-linux64" if linux64 else "libcugraph-aarch64" if aarch64 }} + SCCACHE_S3_USE_SSL: ${{ env.get("SCCACHE_S3_USE_SSL") }} + SCCACHE_S3_NO_CREDENTIALS: ${{ env.get("SCCACHE_S3_NO_CREDENTIALS") }} outputs: - - name: libcugraph - version: {{ version }} - script: install_libcugraph.sh + - package: + name: libcugraph build: - number: {{ GIT_DESCRIBE_NUMBER }} - string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} - ignore_run_exports_from: - {% if cuda_major == "11" %} - - {{ compiler('cuda11') }} - {% else %} - - {{ compiler('cuda') }} - - cuda-cudart-dev - {% endif %} + script: install_libcugraph.sh + number: ${{ GIT_DESCRIBE_NUMBER }} + string: cuda${{ cuda_major }}_${{ date_string }}_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }} requirements: + ignore_run_exports: + from_package: + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} + else: + - ${{ compiler('cuda') }} + - cuda-cudart-dev build: - - cmake {{ cmake_version }} + - ${{ compiler('c') }} + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} ${{ cuda_version }} + else: + - ${{ compiler('cuda') }} + - cuda-version =${{ cuda_version }} + - ${{ compiler('cxx') }} + - cmake ${{ cmake_version }} + - ninja + - git + - openmpi<5.0.3 # Required for building cpp-mgtests (multi-GPU tests) + - ${{ stdlib("c") }} host: - - cuda-version ={{ cuda_version }} - - cuda-cudart-dev + - if: cuda_major == "11" + then: + - cudatoolkit + - cuda-nvtx =${{ cuda_version }} + - cuda-profiler-api ${{ cuda11_cuda_profiler_api_host_version }} + - libcublas ${{ cuda11_libcublas_host_version }} + - libcublas-dev ${{ cuda11_libcublas_host_version }} + - libcurand ${{ cuda11_libcurand_host_version }} + - libcurand-dev ${{ cuda11_libcurand_host_version }} + - libcusolver ${{ cuda11_libcusolver_host_version }} + - libcusolver-dev ${{ cuda11_libcusolver_host_version }} + - libcusparse ${{ cuda11_libcusparse_host_version }} + - libcusparse-dev ${{ cuda11_libcusparse_host_version }} + else: + - cuda-nvtx-dev + - cuda-profiler-api + - cuda-cudart-dev + - libcublas-dev + - libcurand-dev + - libcusolver-dev + - libcusparse-dev + - cuda-version =${{ cuda_version }} + - doxygen ${{ doxygen_version }} + - libcudf =${{ minor_version }} + - libcugraphops =${{ minor_version }} + - libraft =${{ minor_version }} + - libraft-headers =${{ minor_version }} + - librmm =${{ minor_version }} + - conda-forge::nccl ${{ nccl_version }} + - ucx-proc=*=gpu + - rapids-build-backend>=0.3.1,<0.4.0.dev0 run: - - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} - {% if cuda_major == "11" %} - - cuda-profiler-api {{ cuda11_cuda_profiler_api_run_version }} - - cudatoolkit - - libcublas {{ cuda11_libcublas_run_version }} - - libcurand {{ cuda11_libcurand_run_version }} - - libcusolver {{ cuda11_libcusolver_run_version }} - - libcusparse {{ cuda11_libcusparse_run_version }} - {% else %} - - cuda-profiler-api - - cuda-cudart - - libcublas - - libcurand - - libcusolver - - libcusparse - {% endif %} - - libcugraphops ={{ minor_version }} - - libraft ={{ minor_version }} - - libraft-headers ={{ minor_version }} - - librmm ={{ minor_version }} - - nccl {{ nccl_version }} + - ${{ pin_compatible('cuda-version', upper_bound='x', lower_bound='x') }} + - if: cuda_major == "11" + then: + - cuda-profiler-api ${{ cuda11_cuda_profiler_api_run_version }} + - cudatoolkit + - libcublas ${{ cuda11_libcublas_run_version }} + - libcurand ${{ cuda11_libcurand_run_version }} + - libcusolver ${{ cuda11_libcusolver_run_version }} + - libcusparse ${{ cuda11_libcusparse_run_version }} + else: + - cuda-profiler-api + - cuda-cudart + - libcublas + - libcurand + - libcusolver + - libcusparse + - libcugraphops =${{ minor_version }} + - libraft =${{ minor_version }} + - libraft-headers =${{ minor_version }} + - librmm =${{ minor_version }} + - conda-forge::nccl ${{ nccl_version }} - ucx-proc=*=gpu about: - home: https://rapids.ai/ - dev_url: https://github.com/rapidsai/cugraph + homepage: https://rapids.ai/ + repository: https://github.com/rapidsai/cugraph license: Apache-2.0 license_file: ../../../LICENSE summary: libcugraph library - - name: libcugraph_etl - version: {{ version }} - script: install_libcugraph_etl.sh + - package: + name: libcugraph_etl build: - number: {{ GIT_DESCRIBE_NUMBER }} - string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} - ignore_run_exports_from: - {% if cuda_major == "11" %} - - {{ compiler('cuda11') }} - {% else %} - - {{ compiler('cuda') }} - - cuda-cudart-dev - {% endif %} + script: install_libcugraph_etl.sh + number: ${{ GIT_DESCRIBE_NUMBER }} + string: cuda${{ cuda_major }}_${{ date_string }}_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }} requirements: + ignore_run_exports: + from_package: + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} + else: + - ${{ compiler('cuda') }} + - cuda-cudart-dev build: - - cmake {{ cmake_version }} + - ${{ compiler('c') }} + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} ${{ cuda_version }} + else: + - ${{ compiler('cuda') }} + - cuda-version =${{ cuda_version }} + - ${{ compiler('cxx') }} + - cmake ${{ cmake_version }} + - ninja + - openmpi<5.0.3 # Required for building cpp-mgtests (multi-GPU tests) + - ${{ stdlib("c") }} host: - - cuda-version ={{ cuda_version }} - - cuda-cudart-dev + - if: cuda_major == "11" + then: + - cudatoolkit + - cuda-nvtx =${{ cuda_version }} + - cuda-profiler-api ${{ cuda11_cuda_profiler_api_host_version }} + - libcublas ${{ cuda11_libcublas_host_version }} + - libcublas-dev ${{ cuda11_libcublas_host_version }} + - libcurand ${{ cuda11_libcurand_host_version }} + - libcurand-dev ${{ cuda11_libcurand_host_version }} + - libcusolver ${{ cuda11_libcusolver_host_version }} + - libcusolver-dev ${{ cuda11_libcusolver_host_version }} + - libcusparse ${{ cuda11_libcusparse_host_version }} + - libcusparse-dev ${{ cuda11_libcusparse_host_version }} + else: + - cuda-nvtx-dev + - cuda-profiler-api + - cuda-cudart-dev + - libcublas-dev + - libcurand-dev + - libcusolver-dev + - libcusparse-dev + - cuda-version =${{ cuda_version }} + - doxygen ${{ doxygen_version }} + - libcudf =${{ minor_version }} + - libcugraphops =${{ minor_version }} + - libraft =${{ minor_version }} + - libraft-headers =${{ minor_version }} + - librmm =${{ minor_version }} + - conda-forge::nccl ${{ nccl_version }} + - ucx-proc=*=gpu + - rapids-build-backend>=0.3.1,<0.4.0.dev0 run: - - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} - - {{ pin_subpackage('libcugraph', exact=True) }} - {% if cuda_major == "11" %} - - cudatoolkit - {% else %} - - cuda-cudart - {% endif %} - - libcudf ={{ minor_version }} - - librmm ={{ minor_version }} + - ${{ pin_compatible('cuda-version', upper_bound='x', lower_bound='x') }} + - ${{ pin_subpackage('libcugraph', exact=True) }} + - if: cuda_major == "11" + then: + - cudatoolkit + else: + - cuda-cudart + - libcudf =${{ minor_version }} + - librmm =${{ minor_version }} about: - home: https://rapids.ai/ - dev_url: https://github.com/rapidsai/cugraph + homepage: https://rapids.ai/ + repository: https://github.com/rapidsai/cugraph license: Apache-2.0 license_file: ../../../LICENSE summary: libcugraph_etl library - - name: libcugraph-tests - version: {{ version }} - script: install_libcugraph_tests.sh + - package: + name: libcugraph-tests build: - number: {{ GIT_DESCRIBE_NUMBER }} - string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} - ignore_run_exports_from: - {% if cuda_major == "11" %} - - {{ compiler('cuda11') }} - {% else %} - - {{ compiler('cuda') }} - - cuda-cudart-dev - {% endif %} + script: install_libcugraph_tests.sh + number: ${{ GIT_DESCRIBE_NUMBER }} + string: cuda${{ cuda_major }}_${{ date_string }}_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }} requirements: + ignore_run_exports: + from_package: + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} + else: + - ${{ compiler('cuda') }} + - cuda-cudart-dev build: - - cmake {{ cmake_version }} + - ${{ compiler('c') }} + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} ${{ cuda_version }} + else: + - ${{ compiler('cuda') }} + - cuda-version =${{ cuda_version }} + - ${{ compiler('cxx') }} + - cmake ${{ cmake_version }} + - ninja + - openmpi<5.0.3 # Required for building cpp-mgtests (multi-GPU tests) + - ${{ stdlib("c") }} host: - - cuda-version ={{ cuda_version }} - - cuda-cudart-dev + - if: cuda_major == "11" + then: + - cudatoolkit + - cuda-nvtx =${{ cuda_version }} + - cuda-profiler-api ${{ cuda11_cuda_profiler_api_host_version }} + - libcublas ${{ cuda11_libcublas_host_version }} + - libcublas-dev ${{ cuda11_libcublas_host_version }} + - libcurand ${{ cuda11_libcurand_host_version }} + - libcurand-dev ${{ cuda11_libcurand_host_version }} + - libcusolver ${{ cuda11_libcusolver_host_version }} + - libcusolver-dev ${{ cuda11_libcusolver_host_version }} + - libcusparse ${{ cuda11_libcusparse_host_version }} + - libcusparse-dev ${{ cuda11_libcusparse_host_version }} + else: + - cuda-nvtx-dev + - cuda-profiler-api + - cuda-cudart-dev + - libcublas-dev + - libcurand-dev + - libcusolver-dev + - libcusparse-dev + - cuda-version =${{ cuda_version }} + - doxygen ${{ doxygen_version }} + - libcudf =${{ minor_version }} + - libcugraphops =${{ minor_version }} + - libraft =${{ minor_version }} + - libraft-headers =${{ minor_version }} + - librmm =${{ minor_version }} + - conda-forge::nccl ${{ nccl_version }} + - ucx-proc=*=gpu + - rapids-build-backend>=0.3.1,<0.4.0.dev0 run: - - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} - - {{ pin_subpackage('libcugraph_etl', exact=True) }} - - {{ pin_subpackage('libcugraph', exact=True) }} - {% if cuda_major == "11" %} - - cudatoolkit - {% else %} - - cuda-cudart - {% endif %} + - ${{ pin_compatible('cuda-version', upper_bound='x', lower_bound='x') }} + - ${{ pin_subpackage('libcugraph_etl', exact=True) }} + - ${{ pin_subpackage('libcugraph', exact=True) }} + - if: cuda_major == "11" + then: + - cudatoolkit + else: + - cuda-cudart about: - home: https://rapids.ai/ - dev_url: https://github.com/rapidsai/cugraph + homepage: https://rapids.ai/ + repository: https://github.com/rapidsai/cugraph license: Apache-2.0 license_file: ../../../LICENSE summary: libcugraph test & benchmark executables From ac37105d83899d13830ffe0497296e473893e5d1 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 19 Jul 2024 02:58:17 +0000 Subject: [PATCH 2/4] All updates that should be needed for cached build --- ci/build_cpp.sh | 19 ++- conda/recipes/libcugraph/build.sh | 11 ++ .../recipes/libcugraph/install_libcugraph.sh | 3 +- .../libcugraph/install_libcugraph_etl.sh | 2 +- .../libcugraph/install_libcugraph_tests.sh | 8 +- conda/recipes/libcugraph/meta.yaml | 145 +++++++++++++++--- 6 files changed, 156 insertions(+), 32 deletions(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 58450a1e410..e40cf291428 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -15,8 +15,25 @@ rapids-print-env rapids-logger "Begin cpp build" +# TODO: Upstream this to the image. mamba install rattler-build -c conda-forge -RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) rapids-conda-retry mambabuild conda/recipes/libcugraph +RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) rattler-build build \ + # rattler-build uses recipe.yaml, not meta.yaml + --recipe conda/recipes/libcugraph/meta.yaml \ + # rattler-build uses variants.yaml, not conda_build_config.yaml + --variant-config conda/recipes/libcugraph/conda_build_config.yaml \ + # rattler-build does not respect .condarc, so channels and the output dir + # must be explicitly specified + -c rapidsai-nightly -c conda-forge \ + --output-dir ${RAPIDS_CONDA_BLD_OUTPUT_DIR} + # The multi-output cache is currently an experimental feature. + # (https://prefix-dev.github.io/rattler-build/dev/multiple_output_cache/) + --experimental + # By default rattler-build adds a timestamp that defeats sccache caching. + --no-build-id + +echo "sccache stats:" +sccache -s rapids-upload-conda-to-s3 cpp diff --git a/conda/recipes/libcugraph/build.sh b/conda/recipes/libcugraph/build.sh index 3119853df2a..f003cb3627d 100644 --- a/conda/recipes/libcugraph/build.sh +++ b/conda/recipes/libcugraph/build.sh @@ -8,4 +8,15 @@ # openmpi build dependencies). The conda package does NOT include these test # binaries or extra dependencies, but these are built here for use in CI runs. +export LIBCUGRAPH_BUILD_DIR="${PREFIX}/tmp/cugraph_build" +export LIBCUGRAPH_ETL_BUILD_DIR="${PREFIX}/tmp/cugraph_etl_build" ./build.sh libcugraph libcugraph_etl cpp-mgtests -n -v --allgpuarch + +cmake --install ${LIBCUGRAPH_BUILD_DIR} --prefix ${PREFIX}/tmp/install/libcugraph/ +cmake --install ${LIBCUGRAPH_ETL_BUILD_DIR} --prefix ${PREFIX}/tmp/install/libcugraph_etl/ + +for component in testing testing_c testing_mg; do + cmake --install ${LIBCUGRAPH_BUILD_DIR} --component ${component} --prefix ${PREFIX}/tmp/install/libcugraph_components/${component}/ +done + +cmake --install ${LIBCUGRAPH_ETL_BUILD_DIR} --component testing --prefix ${PREFIX}/tmp/install/libcugraph_etl_components/testing/ diff --git a/conda/recipes/libcugraph/install_libcugraph.sh b/conda/recipes/libcugraph/install_libcugraph.sh index 00a8f529acb..defdf7368e5 100644 --- a/conda/recipes/libcugraph/install_libcugraph.sh +++ b/conda/recipes/libcugraph/install_libcugraph.sh @@ -1,5 +1,4 @@ #!/bin/bash # Copyright (c) 2022, NVIDIA CORPORATION. -./build.sh libcugraph libcugraph_etl cpp-mgtests -n -v --allgpuarch -cmake --install cpp/build +cp -r ${PREFIX}/tmp/install/libcugraph/* ${PREFIX}/ diff --git a/conda/recipes/libcugraph/install_libcugraph_etl.sh b/conda/recipes/libcugraph/install_libcugraph_etl.sh index 724cd641ffa..8c8f21b55a8 100644 --- a/conda/recipes/libcugraph/install_libcugraph_etl.sh +++ b/conda/recipes/libcugraph/install_libcugraph_etl.sh @@ -1,4 +1,4 @@ #!/bin/bash # Copyright (c) 2022, NVIDIA CORPORATION. -cmake --install cpp/libcugraph_etl/build +cp -r ${PREFIX}/tmp/install/libcugraph_etl/* ${PREFIX}/ diff --git a/conda/recipes/libcugraph/install_libcugraph_tests.sh b/conda/recipes/libcugraph/install_libcugraph_tests.sh index cbddfe4bf78..dce56d9e702 100644 --- a/conda/recipes/libcugraph/install_libcugraph_tests.sh +++ b/conda/recipes/libcugraph/install_libcugraph_tests.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright (c) 2022-2023, NVIDIA CORPORATION. -cmake --install cpp/build --component testing -cmake --install cpp/build --component testing_c -cmake --install cpp/build --component testing_mg -cmake --install cpp/libcugraph_etl/build --component testing +for component in testing testing_c testing_mg; do + cp -r ${PREFIX}/tmp/install/libcugraph_components/* ${PREFIX}/ +done +cp -r ${PREFIX}/tmp/install/libcugraph_etl_components/testing//* ${PREFIX}/ diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index 8b516332d62..5ca86f37455 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -1,9 +1,5 @@ # Copyright (c) 2018-2024, NVIDIA CORPORATION. # Notes: -# - nccl package on rapidsai-nightly causes problems because rattler-build uses strict channel priority - rattler-build uses strict channel priority and it does not appear to be configurable, see https://github.com/prefix-dev/rattler-build/issues/343, so we need to make it work. -# - Various bits of string interpolation in the top variables don't seem to work yet. Still need to figure out how to achieve the same effect -# - Need to include git in the build env because the host git doesn't appear to be visible. -# - I'm not yet sure how you handle multiple outputs where one of them does all the building for reuse by other jobs downstream # - Try using secrets instead of env context: @@ -19,23 +15,114 @@ recipe: source: path: ../../.. -build: - script: - env: - AWS_ACCESS_KEY_ID: ${{ env.get("AWS_ACCESS_KEY_ID") }} - AWS_SECRET_ACCESS_KEY: ${{ env.get("AWS_SECRET_ACCESS_KEY") }} - AWS_SESSION_TOKEN: ${{ env.get("AWS_SESSION_TOKEN") }} - CMAKE_C_COMPILER_LAUNCHER: ${{ env.get("CMAKE_C_COMPILER_LAUNCHER") }} - CMAKE_CUDA_COMPILER_LAUNCHER: ${{ env.get("CMAKE_CUDA_COMPILER_LAUNCHER") }} - CMAKE_CXX_COMPILER_LAUNCHER: ${{ env.get("CMAKE_CXX_COMPILER_LAUNCHER") }} - CMAKE_GENERATOR: ${{ env.get("CMAKE_GENERATOR") }} - PARALLEL_LEVEL: ${{ env.get("PARALLEL_LEVEL") }} - SCCACHE_BUCKET: ${{ env.get("SCCACHE_BUCKET") }} - SCCACHE_IDLE_TIMEOUT: ${{ env.get("SCCACHE_IDLE_TIMEOUT") }} - SCCACHE_REGION: ${{ env.get("SCCACHE_REGION") }} - SCCACHE_S3_KEY_PREFIX: ${{ "libcugraph-linux64" if linux64 else "libcugraph-aarch64" if aarch64 }} - SCCACHE_S3_USE_SSL: ${{ env.get("SCCACHE_S3_USE_SSL") }} - SCCACHE_S3_NO_CREDENTIALS: ${{ env.get("SCCACHE_S3_NO_CREDENTIALS") }} +# The cache section is hidden behind the `--experimental` CLI flag. It allows doing some common work into a directory that is copied back into each output. We can leverage that functionality to do the equivalent of a single top-level build followed by just installing components into each subpackage. +cache: + build: + script: + file: build.sh + env: + AWS_ACCESS_KEY_ID: ${{ env.get("AWS_ACCESS_KEY_ID") }} + AWS_SECRET_ACCESS_KEY: ${{ env.get("AWS_SECRET_ACCESS_KEY") }} + AWS_SESSION_TOKEN: ${{ env.get("AWS_SESSION_TOKEN") }} + CMAKE_C_COMPILER_LAUNCHER: ${{ env.get("CMAKE_C_COMPILER_LAUNCHER") }} + CMAKE_CUDA_COMPILER_LAUNCHER: ${{ env.get("CMAKE_CUDA_COMPILER_LAUNCHER") }} + CMAKE_CXX_COMPILER_LAUNCHER: ${{ env.get("CMAKE_CXX_COMPILER_LAUNCHER") }} + CMAKE_GENERATOR: ${{ env.get("CMAKE_GENERATOR") }} + PARALLEL_LEVEL: ${{ env.get("PARALLEL_LEVEL") }} + SCCACHE_BUCKET: ${{ env.get("SCCACHE_BUCKET") }} + SCCACHE_IDLE_TIMEOUT: ${{ env.get("SCCACHE_IDLE_TIMEOUT") }} + SCCACHE_REGION: ${{ env.get("SCCACHE_REGION") }} + SCCACHE_S3_KEY_PREFIX: ${{ "libcugraph-linux64" if linux64 else "libcugraph-aarch64" if aarch64 }} + SCCACHE_S3_USE_SSL: ${{ env.get("SCCACHE_S3_USE_SSL") }} + SCCACHE_S3_NO_CREDENTIALS: ${{ env.get("SCCACHE_S3_NO_CREDENTIALS") }} + number: ${{ GIT_DESCRIBE_NUMBER }} + string: cuda${{ cuda_major }}_${{ date_string }}_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }} + requirements: + ignore_run_exports: + from_package: + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} + else: + - ${{ compiler('cuda') }} + - cuda-cudart-dev + build: + - ${{ compiler('c') }} + - if: cuda_major == "11" + then: + - ${{ compiler('cuda11') }} ${{ cuda_version }} + else: + - ${{ compiler('cuda') }} + - cuda-version =${{ cuda_version }} + - ${{ compiler('cxx') }} + - cmake ${{ cmake_version }} + - ninja + - git + - openmpi<5.0.3 # Required for building cpp-mgtests (multi-GPU tests) + - ${{ stdlib("c") }} + host: + - if: cuda_major == "11" + then: + - cudatoolkit + - cuda-nvtx =${{ cuda_version }} + - cuda-profiler-api ${{ cuda11_cuda_profiler_api_host_version }} + - libcublas ${{ cuda11_libcublas_host_version }} + - libcublas-dev ${{ cuda11_libcublas_host_version }} + - libcurand ${{ cuda11_libcurand_host_version }} + - libcurand-dev ${{ cuda11_libcurand_host_version }} + - libcusolver ${{ cuda11_libcusolver_host_version }} + - libcusolver-dev ${{ cuda11_libcusolver_host_version }} + - libcusparse ${{ cuda11_libcusparse_host_version }} + - libcusparse-dev ${{ cuda11_libcusparse_host_version }} + else: + - cuda-nvtx-dev + - cuda-profiler-api + - cuda-cudart-dev + - libcublas-dev + - libcurand-dev + - libcusolver-dev + - libcusparse-dev + - cuda-version =${{ cuda_version }} + - doxygen ${{ doxygen_version }} + - libcudf =${{ minor_version }} + - libcugraphops =${{ minor_version }} + - libraft =${{ minor_version }} + - libraft-headers =${{ minor_version }} + - librmm =${{ minor_version }} + # rattler-build uses strict channel priority and it is not yet + # configurable (https://github.com/prefix-dev/rattler-build/issues/343). + # However, it does support specifying that a package should come from a + # specific channel. We can therefore specify that we want nccl from + # conda-forge and then have rapidsai be the higher priority channel. We + # could equivalently swap the order of the channels and force librmm to + # come from the rapidsai/rapidsai-nightly channel, but that seems a bit + # trickier. + - conda-forge::nccl ${{ nccl_version }} + - ucx-proc=*=gpu + - rapids-build-backend>=0.3.1,<0.4.0.dev0 + run: + - ${{ pin_compatible('cuda-version', upper_bound='x', lower_bound='x') }} + - if: cuda_major == "11" + then: + - cuda-profiler-api ${{ cuda11_cuda_profiler_api_run_version }} + - cudatoolkit + - libcublas ${{ cuda11_libcublas_run_version }} + - libcurand ${{ cuda11_libcurand_run_version }} + - libcusolver ${{ cuda11_libcusolver_run_version }} + - libcusparse ${{ cuda11_libcusparse_run_version }} + else: + - cuda-profiler-api + - cuda-cudart + - libcublas + - libcurand + - libcusolver + - libcusparse + - libcugraphops =${{ minor_version }} + - libraft =${{ minor_version }} + - libraft-headers =${{ minor_version }} + - librmm =${{ minor_version }} + - conda-forge::nccl ${{ nccl_version }} + - ucx-proc=*=gpu outputs: - package: @@ -44,6 +131,9 @@ outputs: script: install_libcugraph.sh number: ${{ GIT_DESCRIBE_NUMBER }} string: cuda${{ cuda_major }}_${{ date_string }}_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }} + files: + exclude: + - tmp/* requirements: ignore_run_exports: from_package: @@ -64,6 +154,7 @@ outputs: - ${{ compiler('cxx') }} - cmake ${{ cmake_version }} - ninja + # - Need to include git in the build env because the host git doesn't appear to be visible. - git - openmpi<5.0.3 # Required for building cpp-mgtests (multi-GPU tests) - ${{ stdlib("c") }} @@ -126,7 +217,7 @@ outputs: homepage: https://rapids.ai/ repository: https://github.com/rapidsai/cugraph license: Apache-2.0 - license_file: ../../../LICENSE + license_file: LICENSE summary: libcugraph library - package: name: libcugraph_etl @@ -134,6 +225,9 @@ outputs: script: install_libcugraph_etl.sh number: ${{ GIT_DESCRIBE_NUMBER }} string: cuda${{ cuda_major }}_${{ date_string }}_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }} + files: + exclude: + - tmp/* requirements: ignore_run_exports: from_package: @@ -202,7 +296,7 @@ outputs: homepage: https://rapids.ai/ repository: https://github.com/rapidsai/cugraph license: Apache-2.0 - license_file: ../../../LICENSE + license_file: LICENSE summary: libcugraph_etl library - package: name: libcugraph-tests @@ -210,6 +304,9 @@ outputs: script: install_libcugraph_tests.sh number: ${{ GIT_DESCRIBE_NUMBER }} string: cuda${{ cuda_major }}_${{ date_string }}_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }} + files: + exclude: + - tmp/* requirements: ignore_run_exports: from_package: @@ -277,5 +374,5 @@ outputs: homepage: https://rapids.ai/ repository: https://github.com/rapidsai/cugraph license: Apache-2.0 - license_file: ../../../LICENSE + license_file: LICENSE summary: libcugraph test & benchmark executables From 9462063b2b2309dce189651604808a0b8170cbe2 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 22 Jul 2024 18:45:27 +0000 Subject: [PATCH 3/4] Fix various issues --- ci/build_cpp.sh | 21 +++++++++++-------- conda/recipes/libcugraph/build.sh | 12 ++++++++++- .../libcugraph/install_libcugraph_etl.sh | 5 +++++ .../libcugraph/install_libcugraph_tests.sh | 3 ++- conda/recipes/libcugraph/meta.yaml | 3 +++ 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index e40cf291428..795eb551e46 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -18,19 +18,22 @@ rapids-logger "Begin cpp build" # TODO: Upstream this to the image. mamba install rattler-build -c conda-forge +# Notes on the comments in the command below (some things like file renamings +# should be done before merging): +# - rattler-build uses recipe.yaml by default, not meta.yaml. +# - rattler-build uses variants.yaml by default, not conda_build_config.yaml +# - rattler-build does not respect .condarc, so channels and the output dir +# must be explicitly specified +# - The multi-output cache is currently an experimental feature. +# (https://prefix-dev.github.io/rattler-build/dev/multiple_output_cache/) +# - By default rattler-build adds a timestamp that defeats sccache caching, +# which --no-build-id turns off RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) rattler-build build \ - # rattler-build uses recipe.yaml, not meta.yaml --recipe conda/recipes/libcugraph/meta.yaml \ - # rattler-build uses variants.yaml, not conda_build_config.yaml --variant-config conda/recipes/libcugraph/conda_build_config.yaml \ - # rattler-build does not respect .condarc, so channels and the output dir - # must be explicitly specified -c rapidsai-nightly -c conda-forge \ - --output-dir ${RAPIDS_CONDA_BLD_OUTPUT_DIR} - # The multi-output cache is currently an experimental feature. - # (https://prefix-dev.github.io/rattler-build/dev/multiple_output_cache/) - --experimental - # By default rattler-build adds a timestamp that defeats sccache caching. + --output-dir ${RAPIDS_CONDA_BLD_OUTPUT_DIR} \ + --experimental \ --no-build-id echo "sccache stats:" diff --git a/conda/recipes/libcugraph/build.sh b/conda/recipes/libcugraph/build.sh index f003cb3627d..84352b4f73d 100644 --- a/conda/recipes/libcugraph/build.sh +++ b/conda/recipes/libcugraph/build.sh @@ -12,6 +12,15 @@ export LIBCUGRAPH_BUILD_DIR="${PREFIX}/tmp/cugraph_build" export LIBCUGRAPH_ETL_BUILD_DIR="${PREFIX}/tmp/cugraph_etl_build" ./build.sh libcugraph libcugraph_etl cpp-mgtests -n -v --allgpuarch +# The cccl libcudacxx dir contains some broken symlinks and that causes +# rattler-build to fail out when trying to follow them to copy the files. +find ${LIBCUGRAPH_BUILD_DIR}/ -xtype l -delete + +# The libarrow package contains a file that is somehow being installed accidentally, see +# https://github.com/prefix-dev/rattler-build/issues/979 +# https://github.com/conda-forge/arrow-cpp-feedstock/issues/1478 +rm -rf "${PREFIX}/share" + cmake --install ${LIBCUGRAPH_BUILD_DIR} --prefix ${PREFIX}/tmp/install/libcugraph/ cmake --install ${LIBCUGRAPH_ETL_BUILD_DIR} --prefix ${PREFIX}/tmp/install/libcugraph_etl/ @@ -19,4 +28,5 @@ for component in testing testing_c testing_mg; do cmake --install ${LIBCUGRAPH_BUILD_DIR} --component ${component} --prefix ${PREFIX}/tmp/install/libcugraph_components/${component}/ done -cmake --install ${LIBCUGRAPH_ETL_BUILD_DIR} --component testing --prefix ${PREFIX}/tmp/install/libcugraph_etl_components/testing/ +# This is a nonexistent component that we've been installing for no reason... +#cmake --install ${LIBCUGRAPH_ETL_BUILD_DIR} --component testing --prefix ${PREFIX}/tmp/install/libcugraph_etl_components/testing/ diff --git a/conda/recipes/libcugraph/install_libcugraph_etl.sh b/conda/recipes/libcugraph/install_libcugraph_etl.sh index 8c8f21b55a8..e608135d661 100644 --- a/conda/recipes/libcugraph/install_libcugraph_etl.sh +++ b/conda/recipes/libcugraph/install_libcugraph_etl.sh @@ -2,3 +2,8 @@ # Copyright (c) 2022, NVIDIA CORPORATION. cp -r ${PREFIX}/tmp/install/libcugraph_etl/* ${PREFIX}/ + +# The libarrow package contains a file that is somehow being installed accidentally, see +# https://github.com/prefix-dev/rattler-build/issues/979 +# https://github.com/conda-forge/arrow-cpp-feedstock/issues/1478 +rm -rf "${PREFIX}/share" diff --git a/conda/recipes/libcugraph/install_libcugraph_tests.sh b/conda/recipes/libcugraph/install_libcugraph_tests.sh index dce56d9e702..a0e50f34362 100644 --- a/conda/recipes/libcugraph/install_libcugraph_tests.sh +++ b/conda/recipes/libcugraph/install_libcugraph_tests.sh @@ -4,4 +4,5 @@ for component in testing testing_c testing_mg; do cp -r ${PREFIX}/tmp/install/libcugraph_components/* ${PREFIX}/ done -cp -r ${PREFIX}/tmp/install/libcugraph_etl_components/testing//* ${PREFIX}/ +# This is a nonexistent component that we've been installing for no reason... +#cp -r ${PREFIX}/tmp/install/libcugraph_etl_components/testing/* ${PREFIX}/ diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index 5ca86f37455..721ee54a00c 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -251,6 +251,9 @@ outputs: - openmpi<5.0.3 # Required for building cpp-mgtests (multi-GPU tests) - ${{ stdlib("c") }} host: + # Until https://github.com/prefix-dev/rattler-build/issues/977 is + # resolved we'll have to ignore a lot of these run exports on every + # output. - if: cuda_major == "11" then: - cudatoolkit From 723a949424b153a70b5bee1848ac2093e689014b Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 22 Jul 2024 20:14:52 +0000 Subject: [PATCH 4/4] Style --- conda/recipes/libcugraph/build.sh | 2 +- conda/recipes/libcugraph/install_libcugraph.sh | 2 +- conda/recipes/libcugraph/install_libcugraph_etl.sh | 2 +- conda/recipes/libcugraph/install_libcugraph_tests.sh | 2 +- conda/recipes/libcugraph/meta.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conda/recipes/libcugraph/build.sh b/conda/recipes/libcugraph/build.sh index 84352b4f73d..845117cc67e 100644 --- a/conda/recipes/libcugraph/build.sh +++ b/conda/recipes/libcugraph/build.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright (c) 2019-2022, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # This assumes the script is executed from the root of the repo directory diff --git a/conda/recipes/libcugraph/install_libcugraph.sh b/conda/recipes/libcugraph/install_libcugraph.sh index defdf7368e5..7c7a27b1b5e 100644 --- a/conda/recipes/libcugraph/install_libcugraph.sh +++ b/conda/recipes/libcugraph/install_libcugraph.sh @@ -1,4 +1,4 @@ #!/bin/bash -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. cp -r ${PREFIX}/tmp/install/libcugraph/* ${PREFIX}/ diff --git a/conda/recipes/libcugraph/install_libcugraph_etl.sh b/conda/recipes/libcugraph/install_libcugraph_etl.sh index e608135d661..1ced340cf5e 100644 --- a/conda/recipes/libcugraph/install_libcugraph_etl.sh +++ b/conda/recipes/libcugraph/install_libcugraph_etl.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. cp -r ${PREFIX}/tmp/install/libcugraph_etl/* ${PREFIX}/ diff --git a/conda/recipes/libcugraph/install_libcugraph_tests.sh b/conda/recipes/libcugraph/install_libcugraph_tests.sh index a0e50f34362..9ea5baf0749 100644 --- a/conda/recipes/libcugraph/install_libcugraph_tests.sh +++ b/conda/recipes/libcugraph/install_libcugraph_tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. for component in testing testing_c testing_mg; do cp -r ${PREFIX}/tmp/install/libcugraph_components/* ${PREFIX}/ diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index 721ee54a00c..ca3aa3754ef 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -18,7 +18,7 @@ source: # The cache section is hidden behind the `--experimental` CLI flag. It allows doing some common work into a directory that is copied back into each output. We can leverage that functionality to do the equivalent of a single top-level build followed by just installing components into each subpackage. cache: build: - script: + script: file: build.sh env: AWS_ACCESS_KEY_ID: ${{ env.get("AWS_ACCESS_KEY_ID") }}