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

For loop doesn't parallelize #2281

Closed
mcopik opened this issue Aug 4, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@mcopik
Copy link
Contributor

commented Aug 4, 2016

The example shown at the website:
http://stellar-group.org/2016/03/hpx-and-index-based-cpp-parallel-loops/
Suggests that the input to for_loop may be a pair of integers giving the range of computations.

However, in the implementation the iterator type is passed to traits:
https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/parallel/algorithms/for_loop.hpp#L235
Which always gives false; int is not an iterator type, hence an integer can't be a forward iterator:

struct belongs_to_category<Iter, Cat,

The is_seq integral constants is true which prevents from using a parallel execution policy even when it's explicitly specified. I've encountered this problem when working with Safura on her code and trying to find a reason why the code parallelize so poorly, when it doesn't parallelize at all.

@hkaiser hkaiser added this to the 1.0.0 milestone Aug 5, 2016

@hkaiser

This comment has been minimized.

Copy link
Member

commented Aug 5, 2016

Could you create a small reproducing test case to demonstrate the problem, please?

@mcopik

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2016

In Safura's code we had a problem with sequential execution, but I can't reproduce this problem in a smaller example because for_loop ends with throwing an exception: HPX(invalid_status) (maybe it's similar with the issue #2282). It executes correctly with the sequential executor:
https://gist.github.com/mcopik/1c0426d15189a777376f83e5f4ec7406

Am I doing something wrong here?

@hkaiser

This comment has been minimized.

Copy link
Member

commented Aug 5, 2016

@mcopik Could you please describe:

  • how you built HPX
  • what tests (code) to build and how to run it in order to reproduce the issue

I'm not sure from you description of what code you ran (you mention at least two different scenarios, both not well described) and what errors you have seen when running any of those.

What is 'Safura's code', etc.?

In other words, please create a minimal reproducing test case I can cut&paste, compile, and run in order to see what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.