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

Fix a problem about asynchronous execution of parallel::merge and parallel::partition. #3041

Merged

Conversation

taeguk
Copy link
Member

@taeguk taeguk commented Dec 3, 2017

No description provided.

dest + (last1 - first1) + (last2 - first2));
// Not reachable.
HPX_ASSERT(false);
});
Copy link
Member

Choose a reason for hiding this comment

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

Could we prefect forward comp, proj1 and proj2 into the lambda?

Copy link
Member Author

@taeguk taeguk Dec 13, 2017

Choose a reason for hiding this comment

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

@sithhell I did. There was 3 key points.

  1. The lambda must have own variables including comp, proj1, and proj2 because the variables will be used in asynchronous manner.
  2. So, the lambda must construct own variables from original parameters. In this point, the parameters must be perfect forwarded into constructors of the own variables.
  3. Support C++11. (This is why I use std::bind().)

Copy link
Member Author

Choose a reason for hiding this comment

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

@sithhell How do you think about my modification for perfect forwarding?
There are some places that this way can be applied to. (For example,

hpx::future<R> f = execution::async_execute(
policy.executor(),
[=]() mutable -> R
{
return static_scan_partitioner_helper<
R, Result1, Result2, ScanPartTag
>::call(policy, first, count, init,
f1, f2, f3, f4);
});
)

If this way is appropriate enough, I will apply it to some places, too.

@taeguk taeguk force-pushed the tg_fix_parallel_algorithms_async branch from 7304e05 to 89bbf2c Compare December 13, 2017 13:35
Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a lot!

@hkaiser hkaiser merged commit f63f4b9 into STEllAR-GROUP:master Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants