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

feat: make the # of CPU threads configurable and document cpu/memory patterns #2773

Merged
merged 6 commits into from
Aug 26, 2024

Conversation

westonpace
Copy link
Contributor

This gets rid of all usage of num_cpus (except in one spot to determine the default # of CPU threads) and instead uses ObjectStore::io_parallelism or get_num_compute_intensive_cpus. Admittedly, many of our operations do not split out I/O and compute. For example:

async move {
  let batch = read_batch(...).await?;
  let transformed = transform_batch(batch);
}

However, we can just pick one and clean these up as we go. For now, I made a best effort guess (most places where we were applying a multiplier to num_cpus I use the I/O count. Other places I use the compute count.

@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 94.25287% with 5 lines in your changes missing coverage. Please review.

Project coverage is 79.30%. Comparing base (eb87bfa) to head (57d076d).
Report is 1 commits behind head on main.

Files Patch % Lines
rust/lance-core/src/utils/tokio.rs 50.00% 1 Missing and 1 partial ⚠️
rust/lance-io/src/object_store.rs 71.42% 1 Missing and 1 partial ⚠️
rust/lance/src/index/vector/ivf/v2.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2773      +/-   ##
==========================================
+ Coverage   79.26%   79.30%   +0.03%     
==========================================
  Files         227      227              
  Lines       68245    68283      +38     
  Branches    68245    68283      +38     
==========================================
+ Hits        54096    54153      +57     
+ Misses      11023    11002      -21     
- Partials     3126     3128       +2     
Flag Coverage Δ
unittests 79.30% <94.25%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -322,7 +326,7 @@ impl FileReader {
.await
}
})
.buffered(num_cpus::get() * 4)
.buffered(self.io_parallelism() as usize)
Copy link
Contributor

Choose a reason for hiding this comment

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

can io_parallalism return usize so dont need cast all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Done.

@westonpace westonpace force-pushed the feat/configurable-cpu-threads branch from 52a50c1 to 0516bd8 Compare August 25, 2024 15:11
@westonpace westonpace merged commit 1e6ee60 into lancedb:main Aug 26, 2024
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants