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

In case of a "raw thread" is needed per core for implementing parallel algorithm, what is good practice in HPX? #2757

Closed
taeguk opened this issue Jul 12, 2017 · 2 comments

Comments

@taeguk
Copy link
Member

taeguk commented Jul 12, 2017

I'm implementing parallel::partition using F&A algorithms illustrated in the paper.(http://www.lsi.upc.edu/~lfrias/research/parpar/parpar.pdf)
Existed implementation of F&A algorithms : http://parallelstl.codeplex.com/SourceControl/latest#include/experimental/impl/partition.h

What I do for that algorithms is that creating a fixed number of threads and each thread gets the chunk from 'chuck manager' when each thread need more chunks.

In current, there is hpx::parallel::static_partitioner for partitioning the data into several chunks and spawning one chunk of iterations for each available core. (https://github.com/STEllAR-GROUP/hpx/blob/6e078e0/hpx/parallel/util/partitioner.hpp#L43-L46)
But, static_partitioner is not adjusted to what I do.

In the algorithm which I'm implementing, the thread have to get more chunks dynamically.
Also, when the thread get a chunk, it should be able to select the position which the chunk is got from between the left end and the right end in the sequence of chunks.

With raw thread, this algorithm can be implemented easily.
But, it seems not the HPX-friendly way.
I want to know what is good way to implement this algorithm in HPX.

@hkaiser
Copy link
Member

hkaiser commented Jul 12, 2017

I'd suggest to simply use async_execute(policy.executor(), ...) whenever you need to execute work on a chunk and not to worry about having an 'underlying' thread to explicitly schedule things on. HPX will do that for you.

@hkaiser
Copy link
Member

hkaiser commented Jul 19, 2017

Can we close this now?

@taeguk taeguk closed this as completed Jul 19, 2017
@hkaiser hkaiser added this to Merged to master in Standard Algorithms Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Standard Algorithms
  
Merged to master
Development

No branches or pull requests

2 participants