Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Parallel sort via tbb #844

Conversation

AlexanderKalistratov
Copy link
Collaborator

No description provided.

@pep8speaks
Copy link

pep8speaks commented May 18, 2020

Hello @AlexanderKalistratov! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-06-01 20:07:41 UTC

@AlexanderKalistratov
Copy link
Collaborator Author

Still need to update setup, requirements, conda recipe, whatever to add dependency for tbb-devel

break;
default:
// fallback to c qsort?
if (size < 4) run_sort(_void_range<4>)
Copy link
Contributor

Choose a reason for hiding this comment

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

<=

template<class T>
inline void merge_sorted_main_loop(buffer_queue<T>& left, buffer_queue<T>& right, buffer_queue<T>& out, void* compare = nullptr)
{
if (compare)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can write this shorter, like
auto less = compare ? reinterpret_cast<compare_func>(compare) : [](T* r, T* l){ return *r < *l; }

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

calling comapre instead of using simple < causes 20-30% of performance degradation

void set_threads_num(uint64_t threads)
{
get_arena().initialize(threads);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it is going to work as intended. IMO Better to just save value to global variable here and than pass this var into arena ctor.
static tbb::task_arena arena(num_threads);

@AlexanderKalistratov AlexanderKalistratov merged commit df516cb into IntelPython:master Jun 1, 2020
Copy link
Contributor

@PokhodenkoSA PokhodenkoSA left a comment

Choose a reason for hiding this comment

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

Watched.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants