-
Notifications
You must be signed in to change notification settings - Fork 224
feature: switch threader_for to int64 indices #3471
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
a4c06de
4ba268e
3a569e7
c0f983e
2a313dc
6ace7c3
aaf4c6a
ea5cbfe
e9048ac
31b9cf0
7676940
0ec337a
bffdf4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,10 +87,9 @@ extern "C" | |
| { | ||
| DAAL_EXPORT int _daal_threader_get_max_threads(); | ||
| DAAL_EXPORT int _daal_threader_get_current_thread_index(); | ||
| DAAL_EXPORT void _daal_threader_for(int n, int threads_request, const void * a, daal::functype func); | ||
| DAAL_EXPORT void _daal_threader_for(int64_t n, int64_t threads_request, const void * a, daal::functype func); | ||
| DAAL_EXPORT void _daal_threader_reduce(const size_t n, const size_t grainSize, daal::Reducer & reducer); | ||
| DAAL_EXPORT void _daal_static_threader_reduce(const size_t n, const size_t grainSize, daal::Reducer & reducer); | ||
| DAAL_EXPORT void _daal_threader_for_int64(int64_t n, const void * a, daal::functype_int64 func); | ||
| DAAL_EXPORT void _daal_threader_for_simple(int n, int threads_request, const void * a, daal::functype func); | ||
| DAAL_EXPORT void _daal_threader_for_int32ptr(const int * begin, const int * end, const void * a, daal::functype_int32ptr func); | ||
| DAAL_EXPORT void _daal_static_threader_for(size_t n, const void * a, daal::functype_static func); | ||
|
|
@@ -266,34 +265,13 @@ inline void threader_func_break(int i, bool & needBreak, const void * a) | |
| /// @param[in] reserved Parameter reserved for the future. Currently unused. | ||
| /// @param[in] func Callable object that defines the loop body. | ||
| template <typename F> | ||
| inline void threader_for(int n, int reserved, const F & func) | ||
| inline void threader_for(int64_t n, int64_t reserved, const F & func) | ||
| { | ||
| const void * a = static_cast<const void *>(&func); | ||
|
|
||
| _daal_threader_for(n, reserved, a, threader_func<F>); | ||
| } | ||
|
|
||
| /// Pass a function to be executed in a for loop to the threading layer. | ||
| /// The maximal number of iterations in the loop is `2^63 - 1 (INT64_MAX)`. | ||
| /// The default scheduling of the threading layer is used to assign | ||
| /// the iterations of the loop to threads. | ||
| /// The iterations of the loop should be logically independent. | ||
| /// Data dependencies between the iterations are allowed, but may requre the use | ||
| /// of synchronization primitives. | ||
| /// | ||
| /// @tparam F Callable object of type `[/* captures */](int64_t i) -> void`, | ||
| /// where `i` is the loop's iteration index, `0 <= i < n`. | ||
| /// | ||
| /// @param[in] n Number of iterations in the for loop. | ||
| /// @param[in] func Callable object that defines the loop body. | ||
| template <typename F> | ||
| inline void threader_for_int64(int64_t n, const F & func) | ||
| { | ||
| const void * a = static_cast<const void *>(&func); | ||
|
|
||
| _daal_threader_for_int64(n, a, threader_func<F>); | ||
| } | ||
|
|
||
| /// Pass a function to be executed in a for loop to the threading layer. | ||
| /// The maximal number of iterations in the loop is 2^31 - 1. | ||
|
||
| /// | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -167,7 +167,7 @@ void copy_convert(const detail::host_policy& policy, | |||||||||
| const std::int64_t row_count = shape.first; | ||||||||||
| const std::int64_t col_count = shape.second; | ||||||||||
|
|
||||||||||
| detail::threader_for_int64(row_count, [&](std::int64_t i) -> void { | ||||||||||
| detail::threader_for(row_count, row_count, [&](std::int64_t i) -> void { | ||||||||||
|
||||||||||
| detail::threader_for(row_count, row_count, [&](std::int64_t i) -> void { | |
| const std::int64_t threads_request = detail::threader_get_max_threads(); | |
| detail::threader_for(row_count, threads_request, [&](std::int64_t i) -> void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter name 'reserved' in the documentation no longer accurately describes the second parameter, which is now 'threads_request' with a specific purpose. The documentation should be updated to reflect that this parameter controls the number of threads requested for parallel execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a mismatch between the headers and the C++ files regarding the names of the parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it's a common issue for all threader functions. WIll be update all of the functions