From 2d714cbfda6de5a29858b423e4c8b37a75675014 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Thu, 7 Mar 2024 08:20:30 -0600 Subject: [PATCH] Only install necessary components in conda packages. (#2209) Closes #2175. **This PR cuts the binary size of `libraft` by about 50%.** In total, this PR shrinks the binary size of the entire C++ conda channel (the sum of all conda packages produced by `conda/recipes/libraft/meta.yaml`) by around 20%, from 1.5 GB to 1.2 GB. The main difference is dropping the extraneous copy of `libraft.a` (~300 MB) that was shipped in the `libraft` package. Authors: - Bradley Dice (https://github.com/bdice) - Robert Maynard (https://github.com/robertmaynard) Approvers: - Robert Maynard (https://github.com/robertmaynard) - Corey J. Nolet (https://github.com/cjnolet) - https://github.com/damontecres - Ray Douglass (https://github.com/raydouglass) URL: https://github.com/rapidsai/raft/pull/2209 --- conda/recipes/libraft/build_libraft.sh | 5 +++-- conda/recipes/libraft/build_libraft_headers.sh | 5 ++++- conda/recipes/libraft/build_libraft_tests.sh | 2 +- conda/recipes/libraft/conda_build_config.yaml | 3 +++ conda/recipes/libraft/meta.yaml | 6 ++++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/conda/recipes/libraft/build_libraft.sh b/conda/recipes/libraft/build_libraft.sh index 7d4173e8bb..be072844c2 100644 --- a/conda/recipes/libraft/build_libraft.sh +++ b/conda/recipes/libraft/build_libraft.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. -./build.sh libraft --allgpuarch --compile-lib --build-metrics=compile_lib --incl-cache-stats --no-nvtx +./build.sh libraft --allgpuarch --compile-lib --build-metrics=compile_lib --incl-cache-stats --no-nvtx -n +cmake --install cpp/build --component compiled diff --git a/conda/recipes/libraft/build_libraft_headers.sh b/conda/recipes/libraft/build_libraft_headers.sh index cc3b840e43..84dd66411a 100644 --- a/conda/recipes/libraft/build_libraft_headers.sh +++ b/conda/recipes/libraft/build_libraft_headers.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. +# We must install everything (not just the "raft" component) because some +# dependencies like cuCollections and cutlass place their install rules in the +# "all" component. ./build.sh libraft --allgpuarch --no-nvtx diff --git a/conda/recipes/libraft/build_libraft_tests.sh b/conda/recipes/libraft/build_libraft_tests.sh index 05a2b59eb0..799d16ed75 100644 --- a/conda/recipes/libraft/build_libraft_tests.sh +++ b/conda/recipes/libraft/build_libraft_tests.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. ./build.sh tests bench-prims --allgpuarch --no-nvtx --build-metrics=tests_bench_prims --incl-cache-stats cmake --install cpp/build --component testing diff --git a/conda/recipes/libraft/conda_build_config.yaml b/conda/recipes/libraft/conda_build_config.yaml index f1229281bb..9c39da4507 100644 --- a/conda/recipes/libraft/conda_build_config.yaml +++ b/conda/recipes/libraft/conda_build_config.yaml @@ -19,6 +19,9 @@ cmake_version: nccl_version: - ">=2.9.9" +gbench_version: + - "==1.8.0" + gtest_version: - ">=1.13.0" diff --git a/conda/recipes/libraft/meta.yaml b/conda/recipes/libraft/meta.yaml index 7fd1705b7b..55f326dc53 100644 --- a/conda/recipes/libraft/meta.yaml +++ b/conda/recipes/libraft/meta.yaml @@ -280,7 +280,11 @@ outputs: - ninja - sysroot_{{ target_platform }} {{ sysroot_version }} host: + # We must include both libraft and libraft-static to prevent the test + # builds from packaging those libraries. However, tests only depend on + # the shared library in libraft. - {{ pin_subpackage('libraft', exact=True) }} + - {{ pin_subpackage('libraft-static', exact=True) }} - cuda-version ={{ cuda_version }} {% if cuda_major == "11" %} - cuda-profiler-api {{ cuda11_cuda_profiler_api_run_version }} @@ -300,6 +304,7 @@ outputs: - libcusolver-dev - libcusparse-dev {% endif %} + - benchmark {{ gbench_version }} - gmock {{ gtest_version }} - gtest {{ gtest_version }} run: @@ -314,6 +319,7 @@ outputs: - libcusparse {% endif %} - {{ pin_subpackage('libraft', exact=True) }} + - benchmark {{ gbench_version }} - gmock {{ gtest_version }} - gtest {{ gtest_version }} about: