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

Dynamic scheduling for parallel_for and parallel_reduce #106

Closed
mrtupek opened this issue Oct 8, 2015 · 13 comments
Closed

Dynamic scheduling for parallel_for and parallel_reduce #106

mrtupek opened this issue Oct 8, 2015 · 13 comments
Assignees
Labels
Feature Request Create new capability; will potentially require voting

Comments

@mrtupek
Copy link

mrtupek commented Oct 8, 2015

We've found that some of our loops are faster using dynamic scheduling in openmp.

@mhoemmen
Copy link
Contributor

mhoemmen commented Oct 9, 2015

See issue 100:

#100

I'm not sure how to mark issues as duplicates of another issue, or I would do that now :-)

@crtrott crtrott added duplicate Feature Request Create new capability; will potentially require voting labels Oct 29, 2015
@hcedwar hcedwar removed the duplicate label Nov 23, 2015
@hcedwar
Copy link
Contributor

hcedwar commented Nov 23, 2015

Dynamic scheduling options for both RangePolicy and TeamPolicy

@hcedwar
Copy link
Contributor

hcedwar commented Nov 23, 2015

Adding optional template parameter to policies to specify dynamic scheduling. Policy templates should be switched to variadic arguments.

@crtrott
Copy link
Member

crtrott commented Nov 23, 2015

How about Kokkos::ScheduleDynamic or Kokkos::Schedule < Kokkos::Dynamic >

@hcedwar hcedwar added this to the Pre Christmas Push milestone Nov 23, 2015
@nmhamster
Copy link
Contributor

Prefer Kokkos::Schedule < Kokkos::Dynamic >

@crtrott
Copy link
Member

crtrott commented Dec 16, 2015

Ok this is the syntax I am implementing right now (starting with the RangePolicy):

ExecutionPolicy< class ... Traits >

where Traits can be any or none of the following

ExecutionSpace (some Kokkos execution space)
WorkTag (some user defined class)
Kokkos::ScheduleKokkos::Dynamic , Kokkos::ScheduleKokkos::Static
Kokkos::ChunkSize
Kokkos::IterationType<INT_TYPE>

deprecated: INT_TYPE (i.e. some raw integer type as a direct template argument)

So someone could really customize an execution policy like this:

RangePolicy<InitialIntegrate, OpenMP, Schedule, ChunkSize<32>, IterationType >

Right now order of arguments doesn't matter, but only one of each type is accepted (it static asserts with a helpful message if you for example try RangePolicy<OpenMP,Serial>).

I am pretty much done with RangePolicy accepting these arguments, but Schedule doesn't do anything yet. The other ones doe the same thing as the equivalent before.
This lives on the experimental branch.

@crtrott
Copy link
Member

crtrott commented Dec 16, 2015

One more comment: I will strongly advocate for Schedule, and ChunkSize to have only hint character. Otherwise people can do all kinds of crazy things. For example if you are guaranteed a ChunkSize I think it is possible to write a legal Kokkos::parallel_for which is not vectorizable (effectively you know that successive Chunk items will not collide). While that has its advantages, I think the loss in freedom to map iterations to hardware is far worse. So I rather would say those things are hints, and force people to write portable code. Static for example has an issue because on GPUs there is no true static execution since the hardware has a dynamic scheduler build in.

@hcedwar
Copy link
Contributor

hcedwar commented Dec 16, 2015

Use the term "properties" for this kind of template parameters:
RangePolicy< class ... Properties >
The term "traits" is already in the C++11 meta-programming vernacular.

@crtrott
Copy link
Member

crtrott commented Dec 20, 2015

Just noticed I had done that already in the actual implementation on experimental.
I also changed ChunkSize to become a runtime argument, so that one could adapt the chunk size to the input deck. I.e.:

Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic> >(0,N, Kokkos::ChunkSize(32) )
// This uses all options including TagType in order to call operator(MyCustomTag, int)
Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>, 
                                   Kokkos::IterationType<int>,
                                   Kokkos::OpenMP,
                                   MyCustomTag >(0,N, Kokkos::ChunkSize(32) )

@crtrott
Copy link
Member

crtrott commented Dec 20, 2015

Would a better word for IterationType maybe be IndexType. It is the integer type the policy will internally use to provide indicies to the functor. This includes stuff like team_rank, league_rank, league_size team_size etc. when we extend the PolicyTraits to be used for the TeamPolicy.

@nmhamster
Copy link
Contributor

I prefer IndexType, seems to me to be more logical.

@crtrott
Copy link
Member

crtrott commented Dec 20, 2015

I actually think the same.

@crtrott
Copy link
Member

crtrott commented Jan 14, 2016

This is now in master using setter functions for runtime parameters.

@crtrott crtrott closed this as completed Jan 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Create new capability; will potentially require voting
Projects
None yet
Development

No branches or pull requests

5 participants