Add conda build option and CUDA target includes#6316
Conversation
|
| Filename | Overview |
|---|---|
| CMakeLists.txt | Adds BUILD_FOR_CONDA option, find_package(CUDAToolkit REQUIRED), per-config nvimgcodec rpath, and propagate_option(BUILD_FOR_CONDA); logic is correct and default behavior is unchanged. |
| cmake/Dependencies.common.cmake | Guards FFTS and cocoapi builds with NOT PREBUILD_DALI_LIBS; switches libtar search order for conda builds. Changes are scoped correctly. |
| dali/core/CMakeLists.txt | cuda.h and cufile.h stubs switched to CUDAToolkit_TARGET_DIR/include; target_include_directories updated similarly. The existing CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES_DIRECTIVE block is still needed here for the nvcomp stub. |
| dali/kernels/signal/fft/CMakeLists.txt | cufft stub migrated to CUDAToolkit_TARGET_DIR/include; the CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES_DIRECTIVE computation block (lines 28-37) is now dead code and should be removed. |
| dali/nvimgcodec/nvimgcodec_wrap.cc | Adds NVIMGCODEC_DEFAULT_LIBRARY_DIR macro and conda-specific dlopen error message; conda branch omits the attempts path list from the error, reducing debuggability. |
| dali/operators/operators.cc | Adds conda upgrade guidance with a properly single-quoted version spec in the error message; non-conda path updated to inline CUDA_VERSION / 1000. |
| dali/util/nvml_wrap.cc | Fixes pre-existing typo 'dirver' -> 'driver' in the dlopen failure message. |
| conda/dali_native_libs/recipe/build.sh | Adds -DBUILD_FOR_CONDA=ON to the native-libs CMake invocation. |
| conda/dali_python_bindings/recipe/build.sh | Adds -DBUILD_FOR_CONDA=ON to the python-bindings CMake invocation (paired with PREBUILD_DALI_LIBS=ON). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CMake configure] --> B{BUILD_FOR_CONDA?}
B -- OFF --> C[Standard wheel/source build]
B -- ON --> D{PREBUILD_DALI_LIBS?}
C --> E[FFTS & cocoapi built from source]
C --> F[libtar.a preferred]
C --> G[nvimgcodec rpath: lib64/]
C --> H[pip install guidance in errors]
D -- OFF --> I[native-libs recipe: FFTS & cocoapi built]
D -- ON --> J[python-bindings recipe: FFTS & cocoapi skipped]
I --> K[libtar shared preferred]
J --> K
K --> L[nvimgcodec rpath: lib/]
L --> M[conda install guidance in errors]
M --> N[CUDAToolkit_TARGET_DIR/include for all stub generators]
E --> O[CUDAToolkit_TARGET_DIR/include for all stub generators]
Reviews (4): Last reviewed commit: "Review fix" | Re-trigger Greptile
5666d1a to
c985677
Compare
|
@greptile review |
c985677 to
71390d0
Compare
|
CI MESSAGE: [49621159]: BUILD STARTED |
|
CI MESSAGE: [49621159]: BUILD FAILED |
|
CI MESSAGE: [49621159]: BUILD PASSED |
71390d0 to
832f595
Compare
|
CI MESSAGE: [49643983]: BUILD STARTED |
|
CI MESSAGE: [49643983]: BUILD FAILED |
832f595 to
2b83881
Compare
|
CI MESSAGE: [49679151]: BUILD STARTED |
|
CI MESSAGE: [49679151]: BUILD FAILED |
|
CI MESSAGE: [49679151]: BUILD PASSED |
2b83881 to
8a6a7ef
Compare
|
CI MESSAGE: [53088284]: BUILD STARTED |
|
CI MESSAGE: [53088284]: BUILD FAILED |
|
CI MESSAGE: [53103732]: BUILD STARTED |
|
CI MESSAGE: [53103732]: BUILD PASSED |
Add BUILD_FOR_CONDA and pass it from the conda recipes so conda-forge packaging can opt into its own dependency layout without changing default builds. When enabled, prefer shared libtar, use conda's nvImageCodec lib directory in runtime lookup and RPATH, and emit conda install guidance for dynamically loaded CUDA toolkit libraries. Require CUDAToolkit package discovery and use CUDAToolkit_TARGET_DIR/include directly for generated CUDA-family stubs and CUDA include directories. This avoids relying on the trimmed CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES value while still honoring explicit CUDA target directories. Also skip bundled FFTS and cocoapi static targets when prebuilt DALI libs are used, and fix a typo in the NVML loader diagnostic. Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
8a6a7ef to
e2a4ea1
Compare
|
|
||
| # more recent CMake puts both cuda/targets/x86_64-linux/include and cuda/targets/x86_64-linux/include/cccl into the path | ||
| # while we usually need only the former | ||
| string(FIND "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" ";" SEMICOLON_POS) |
There was a problem hiding this comment.
[Minor] SEMICOLON_POS is set here but is no longer consumed — the if/else/endif block that used it to derive CUDA_TOOLKIT_INCLUDE_MAJOR_DIRECTORY was removed by this PR. The string(FIND ...) call is now dead code and can be deleted together with the two-line comment above it.
(The sub-CMakeLists.txt files still have their own copies of this pattern for the nvcomp stub, so they are unaffected.)
| #if FOR_CONDA_ENABLED | ||
| #define NVIMGCODEC_DEFAULT_LIBRARY_DIR "lib" | ||
| #else | ||
| #define NVIMGCODEC_DEFAULT_LIBRARY_DIR "lib64" | ||
| #endif | ||
|
|
There was a problem hiding this comment.
just wondering: don't we link directly with the shared-object in Conda (without the dynlink wrapper I mean)?
There was a problem hiding this comment.
I think it is possible but more substantial change to do. Now it is either the wrapper or bundling together.
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
|
CI MESSAGE: [54069946]: BUILD STARTED |
|
CI MESSAGE: [54069946]: BUILD STARTED |
|
CI MESSAGE: [54067531]: BUILD FAILED |
|
CI MESSAGE: [54067531]: BUILD STARTED |
|
CI MESSAGE: [54199753]: BUILD STARTED |
|
CI MESSAGE: [54199753]: BUILD FAILED |
|
CI MESSAGE: [54225421]: BUILD STARTED |
|
CI MESSAGE: [54225421]: BUILD FAILED |
|
CI MESSAGE: [54225421]: BUILD PASSED |
Adds a conda packaging build option and switches CUDA-header consumers to
the CMake CUDAToolkit target directory.
It absorbs https://github.com/conda-forge/nvidia-dali-python-feedstock/tree/main/recipe/patches.
Category:
Other (Build / Configuration)
Description:
This change adds
BUILD_FOR_CONDA, enables it from the conda native-libs andPython-bindings recipes, and keeps the default source and wheel build behavior
unchanged when the option is disabled.
When
BUILD_FOR_CONDA=ON, the build:liblayout for nvImageCodec runtime lookup and RPATH;libtarlibrary instead of forcinglibtar.a;The change also requires CMake's
CUDAToolkitpackage and usesCUDAToolkit_TARGET_DIR/includedirectly for CUDA-family generated stubs andinclude directories. This covers the CUDA, cuFile, cuFFT, NPP, nvImageCodec,
NVML, and nvCUVID stub generation paths without depending on the trimmed
CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIESvalue.For the split conda package build, bundled FFTS and cocoapi static targets are
not rebuilt when
PREBUILD_DALI_LIBS=ON.Additional information:
Affected modules and functionalities:
CMakeLists.txtcmake/Dependencies.common.cmakeconda/dali_native_libs/recipe/build.shconda/dali_python_bindings/recipe/build.shdali/core/CMakeLists.txtdali/kernels/signal/fft/CMakeLists.txtdali/npp/CMakeLists.txtdali/nvimgcodec/CMakeLists.txtdali/operators/video/dynlink_nvcuvid/CMakeLists.txtdali/util/CMakeLists.txtdali/core/dynlink_cufile.ccdali/core/dynlink_nvcomp.ccdali/kernels/signal/fft/cufft_wrap.ccdali/npp/npp_wrap.ccdali/nvimgcodec/nvimgcodec_wrap.ccdali/operators/operators.ccdali/util/nvml_wrap.ccKey points relevant for the review:
BUILD_FOR_CONDAdefaults toOFF; default builds should retain existingbehavior.
propagate_option(BUILD_FOR_CONDA), whichproduces
FOR_CONDA_ENABLEDfor the C++ loader diagnostics.find_package(CUDAToolkit REQUIRED)is now used so the build can consistentlyreference
CUDAToolkit_TARGET_DIR/include.Tests:
Previously configured successfully with:
BUILD_FOR_CONDA=ONBUILD_FOR_CONDA=ONwith explicitCUDAToolkit_TARGET_DIRFor this metadata refresh,
git diff --check upstream/main...HEADpasses.Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-4681