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

Paralellize the filling on the std::vector in DMatrix #41

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

d-consoli
Copy link

Currently the DMatrix creation is a bottleneck in the library because is not performed in parallel. This small modification can solve the issue and I am sure that it can be done also in more clean and performing way (e.g. playing with omp chunking).

data_ = std::vector<ElementType>{data_ptr, data_ptr + num_elem};
data_.reserve(num_elem);
#pragma omp parallel for
for (std::uint64_t i = 0; i < num_elem; ++i) {
Copy link

Choose a reason for hiding this comment

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

Do we have benchmarks showing the impact of this change at various scales? How often is this code likely to get called inside a block that is already parallelized? You mentioned this was a bottleneck; can you give an example of a workload where it is a bottleneck?

@@ -17,6 +17,8 @@ def py_str(string):
"""Convert C string back to Python string"""
return string.decode("utf-8")

def check_if_fast():
return True
Copy link

Choose a reason for hiding this comment

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

Not sure if there's missing code here or if this was supposed to be removed before the PR was made.

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 this pull request may close these issues.

2 participants