Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libkvikio conda packages are built with INTERFACE_COMPILE_DEFINITIONS that require CUDA 12.2 for cuFile Stream APIs #341

Closed
bdice opened this issue Feb 13, 2024 · 0 comments · Fixed by #342

Comments

@bdice
Copy link
Contributor

bdice commented Feb 13, 2024

This issue describes a build failure seen in cudf's devcontainers with CUDA 12.0 when using the libkvikio conda packages that are now built with CUDA 12.2, as of #328. The build failures look like this:

  In file included from /home/coder/.conda/envs/rapids/include/kvikio/defaults.hpp:26,
                   from /home/coder/.conda/envs/rapids/include/kvikio/buffer.hpp:23,
                   from /home/coder/.conda/envs/rapids/include/kvikio/file_handle.hpp:31,
                   from /home/coder/cudf/cpp/src/io/utilities/datasource.cpp:26:
  /home/coder/.conda/envs/rapids/include/kvikio/shim/cufile.hpp:59:12: error: 'cuFileReadAsync' was not declared in this scope; did you mean 'cuFileRead'?
     59 |   decltype(cuFileReadAsync)* ReadAsync{nullptr};
        |            ^~~~~~~~~~~~~~~
        |            cuFileRead

The libkvikio conda packages contain this in lib/cmake/kvikio/kvikio-targets.cmake:

set_target_properties(kvikio::kvikio PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "KVIKIO_CUFILE_FOUND;KVIKIO_CUFILE_BATCH_API_FOUND;KVIKIO_CUFILE_STREAM_API_FOUND"
  INTERFACE_COMPILE_FEATURES "cxx_std_17"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "Threads::Threads;CUDA::toolkit;cufile::cuFile_interface;dl"
)

In other words, the INTERFACE_COMPILE_DEFINITIONS are being set based on the packages available during the libkvikio conda build, which might not be the same packages/versions as when libkvikio is actually being used. Because we built libkvikio with CUDA 12.2 and then tried to use it with CUDA 12.0 devcontainers, the build failed to find the cuFile Stream APIs that were introduced in CUDA 12.2.

I am opening a PR that proposes to defer these definitions until the call to find_package, which will use the exact cuFile features present (if cuFile is available at all) when building a package like cudf that depends on kvikio.

@rapids-bot rapids-bot bot closed this as completed in #342 Feb 14, 2024
rapids-bot bot pushed a commit that referenced this issue Feb 14, 2024
This PR closes #341.

The kvikio `INTERFACE_COMPILE_DEFINITIONS` were being set based on the packages available during the libkvikio conda build (e.g. CUDA 12.2 since #328), which might not be the same packages/versions as when libkvikio is actually being used (e.g. to build libcudf with CUDA 12.0). Because we built libkvikio with CUDA 12.2 and then tried to use it with CUDA 12.0 devcontainers, the build failed to find the cuFile Stream APIs that were introduced in CUDA 12.2.

This PR defers these definitions until the call to `find_package`, which will then use the exact cuFile features present (if cuFile is available at all) when building a package like cudf that depends on kvikio. The libkvikio example/test binary is built with the cuFile features available at build time, for use in the `libkvikio-tests` conda package. However, this test binary will still be compatible with a runtime where cuFile is unavailable or is version 12.0, as it is dlopen-ing the library and has runtime checks for the batch/stream features it tries to use.

I did local testing of this PR with cudf devcontainers. I tested both 12.0 and 12.2 to reproduce (and fix) the failure, and also tested clean builds of libcudf after removing `libcufile` (to test when cuFile is not found). All seems to work as intended.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant