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

Minor fixes on the file permission, host allocation flag, and worker thread initialization #637

Merged
merged 5 commits into from
Feb 21, 2025

Conversation

kingcrimsontianyu
Copy link
Contributor

@kingcrimsontianyu kingcrimsontianyu commented Feb 18, 2025

This PR makes the following minor fixes:

  • Use the correct file permission flags corresponding to the 644 code.
  • Use the correct flag for the cuMemHostAlloc call.
  • For the thread pool, replace the thread_local call-once section (which may negatively affect performance; see Enable tracing of thread pool tasks using NVTX #630 (comment)) with more idiomatic worker thread initialization function.

Copy link

copy-pr-bot bot commented Feb 18, 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 self-assigned this Feb 18, 2025
@kingcrimsontianyu kingcrimsontianyu added bug Something isn't working non-breaking Introduces a non-breaking change c++ Affects the C++ API of KvikIO labels Feb 18, 2025
@kingcrimsontianyu kingcrimsontianyu changed the title Minor fixes Minor fixes on the file permission and host allocation flag Feb 18, 2025
@kingcrimsontianyu kingcrimsontianyu marked this pull request as ready for review February 18, 2025 17:07
@kingcrimsontianyu kingcrimsontianyu requested a review from a team as a code owner February 18, 2025 17:07
@kingcrimsontianyu kingcrimsontianyu changed the title Minor fixes on the file permission and host allocation flag Minor fixes on the file permission, host allocation flag, and worker thread initialization Feb 19, 2025
namespace kvikio {

template <typename pool_type>
class thread_pool_wrapper : public pool_type {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a thread pool wrapper to avoid burdening the defaults class with the detail of worker_thread_init_func.

void reset(unsigned int nthreads) { pool_type::reset(nthreads, worker_thread_init_func); }

private:
inline static std::function<void()> worker_thread_init_func{[] {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

inline here permits in-class definition of the static data member with a brace initializer. Ref https://eel.is/c++draft/class.static#data-4

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.

Nice!

@kingcrimsontianyu
Copy link
Contributor Author

Just fixed a style consistency issue (nvtx_manager should use CamelCase). Will merge once CI passes. Thanks for the review!

@madsbk
Copy link
Member

madsbk commented Feb 21, 2025

/merge

@rapids-bot rapids-bot bot merged commit 08ab53b into rapidsai:branch-25.04 Feb 21, 2025
60 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c++ Affects the C++ API of KvikIO non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants