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

Continue to make KvikIO a shared library by moving code from hpp to cpp #581

Merged

Conversation

kingcrimsontianyu
Copy link
Contributor

@kingcrimsontianyu kingcrimsontianyu commented Jan 7, 2025

In light of the initiative to make KvikiIO a shared library, this PR further separates the implementation from the interface as thoroughly as possible.

This PR is marked "breaking" because:

  • The function getenv_or initially in the detail namespace has been moved outside to become part of the public API. cuDF uses this function and needs a timely code update.
  • Other classes and functions initially in the detail namespace for internal use only have been relocated to the .cpp files, so downstream applications that happen to use those entities will now see compile errors.

Notes:

  • Functions initially prefixed with the attribute [[nodiscard]] in the header now have them in the declaration (.hpp) only, not in the definition (.cpp).
  • Classes or functions initially in the detail namespace from X.hpp are now moved to the unnamed namespace in the X.cpp files, unless they are used elsewhere (e.g. Y.cpp).

@kingcrimsontianyu kingcrimsontianyu added non-breaking Introduces a non-breaking change c++ Affects the C++ API of KvikIO labels Jan 7, 2025
@kingcrimsontianyu kingcrimsontianyu self-assigned this Jan 7, 2025
Copy link

copy-pr-bot bot commented Jan 7, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@kingcrimsontianyu kingcrimsontianyu added the improvement Improves an existing functionality label Jan 7, 2025
@kingcrimsontianyu
Copy link
Contributor Author

/ok to test

@kingcrimsontianyu
Copy link
Contributor Author

/ok to test

@kingcrimsontianyu
Copy link
Contributor Author

/ok to test

@kingcrimsontianyu kingcrimsontianyu added breaking Introduces a breaking change and removed non-breaking Introduces a non-breaking change labels Jan 8, 2025
@kingcrimsontianyu
Copy link
Contributor Author

/ok to test

@kingcrimsontianyu kingcrimsontianyu marked this pull request as ready for review January 9, 2025 15:24
@kingcrimsontianyu kingcrimsontianyu requested review from a team as code owners January 9, 2025 15:24
Copy link
Contributor

@KyleFromNVIDIA KyleFromNVIDIA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved trivial CMake changes

cpp/include/kvikio/cufile/driver.hpp Outdated Show resolved Hide resolved
cpp/include/kvikio/defaults.hpp Show resolved Hide resolved
cpp/include/kvikio/utils.hpp Outdated Show resolved Hide resolved
cpp/src/cufile/config.cpp Outdated Show resolved Hide resolved
cpp/src/cufile/driver.cpp Outdated Show resolved Hide resolved
cpp/src/cufile/driver.cpp Outdated Show resolved Hide resolved
cpp/src/error.cpp Show resolved Hide resolved
Copy link
Member

@madsbk madsbk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @kingcrimsontianyu

@kingcrimsontianyu
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 66508db into rapidsai:branch-25.02 Jan 14, 2025
59 checks passed
"src/posix_io.cpp"
"src/shim/cuda.cpp"
"src/shim/cufile.cpp"
"src/shim/libcurl.cpp"
Copy link
Contributor

@bdice bdice Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think libcurl.cpp should only be built if we have an option like CUDF_KVIKIO_REMOTE_IO=ON to enable it. Perhaps it should be named KVIKIO_REMOTE_IO? See NVIDIA/spark-rapids-jni#2766. No curl dependency should be required if that CMake option is off.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option I am looking for may already exist: KvikIO_REMOTE_SUPPORT

rapids-bot bot pushed a commit to rapidsai/cudf that referenced this pull request Jan 14, 2025
KvikIO has just introduced slightly breaking code changes (rapidsai/kvikio#581) where the utility function `getenv_or` is moved out of the `detail` namespace and becomes part of the public API. This PR adapts cuDF for this change.

This PR has been tested locally using the abovementioned KvikIO branch.

Authors:
  - Tianyu Liu (https://github.com/kingcrimsontianyu)
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Devavret Makkar (https://github.com/devavret)
  - Bradley Dice (https://github.com/bdice)
  - Muhammad Haseeb (https://github.com/mhaseeb123)

URL: #17733
rapids-bot bot pushed a commit that referenced this pull request Jan 14, 2025
This PR fixes a CMake bug introduced in #581 where `libcurl` is unconditionally compiled.

Authors:
  - Tianyu Liu (https://github.com/kingcrimsontianyu)

Approvers:
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)
  - Bradley Dice (https://github.com/bdice)
  - Alessandro Bellina (https://github.com/abellina)

URL: #587
rapids-bot bot pushed a commit that referenced this pull request Jan 22, 2025
…Mark noexcept to compat mode-related functions (#588)

This PR performs makes the following three improvements:
- Separates interface and definition for `file_handle.hpp` that was missed in the previous PR #581.
- To help avoid UB (e.g. program crash) for downstream applications, adds the following qualifying remark to the returned future object of `pread/pwrite`:
  >The `std::future` object's `wait()` or `get()` should not be called after the lifetime of the FileHandle object ends. Otherwise, the behavior is undefined.
- Add `noexcept` specifier to compatibility mode-related functions.

Authors:
  - Tianyu Liu (https://github.com/kingcrimsontianyu)

Approvers:
  - Mads R. B. Kristensen (https://github.com/madsbk)
  - Lawrence Mitchell (https://github.com/wence-)

URL: #588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Introduces a breaking change c++ Affects the C++ API of KvikIO improvement Improves an existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants