-
Notifications
You must be signed in to change notification settings - Fork 44
[WIP] Introducing execution- and launch policies #300
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
Open
fuchsto
wants to merge
6
commits into
development
Choose a base branch
from
feat-policies
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0cb58f5
Introducing execution- and launch policies
fuchsto d432193
Merge branch 'development' into feat-policies
fuchsto b15163c
Merge branch 'development' into feat-policies
fuchsto cb1f05a
Merge branch 'development' into feat-policies
fuchsto 337f03f
Merge branch 'development' into feat-policies
fuchsto 885700c
Merge branch 'development' into feat-policies
fuchsto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
|
||
#include <dash/tools/PatternVisualizer.h> | ||
|
||
|
||
using std::cout; | ||
using std::cerr; | ||
using std::endl; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#ifndef DASH__EXECUTION_H__INCLUDED | ||
#define DASH__EXECUTION_H__INCLUDED | ||
|
||
#include <type_traits> | ||
|
||
|
||
namespace dash { | ||
|
||
/** | ||
* Execution policy type trait. | ||
*/ | ||
template<class T> | ||
struct is_execution_policy | ||
: public std::integral_constant<bool, false> | ||
{ }; | ||
|
||
namespace execution { | ||
|
||
/** | ||
* Sequential execution policy. | ||
*/ | ||
class sequenced_policy { }; | ||
|
||
/** | ||
* Parallel execution policy. | ||
*/ | ||
class parallel_policy { }; | ||
|
||
/** | ||
* Parallel non-sequential execution policy. | ||
*/ | ||
class parallel_unsequenced_policy { }; | ||
|
||
constexpr sequenced_policy seq; | ||
constexpr parallel_policy par; | ||
constexpr parallel_unsequenced_policy par_unseq; | ||
|
||
} // namespace execution | ||
|
||
/** | ||
* Specialization of execution policy type trait for sequential execution | ||
* policy. | ||
*/ | ||
template<> | ||
struct is_execution_policy<dash::execution::sequenced_policy> | ||
: public std::integral_constant<bool, true> | ||
{ }; | ||
|
||
/** | ||
* Specialization of execution policy type trait for parallel execution | ||
* policy. | ||
*/ | ||
template<> | ||
struct is_execution_policy<dash::execution::parallel_policy> | ||
: public std::integral_constant<bool, true> | ||
{ }; | ||
|
||
/** | ||
* Specialization of execution policy type trait for parallel non-sequential | ||
* execution policy. | ||
*/ | ||
template<> | ||
struct is_execution_policy<dash::execution::parallel_unsequenced_policy> | ||
: public std::integral_constant<bool, true> | ||
{ }; | ||
|
||
} // namespace dash | ||
|
||
#endif // DASH__EXECUTION_H__INCLUDED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
#ifndef DASH__LAUNCH__H__INCLUDED | ||
#define DASH__LAUNCH__H__INCLUDED | ||
#ifndef DASH__LAUNCH_POLICY_H__INCLUDED | ||
#define DASH__LAUNCH_POLICY_H__INCLUDED | ||
|
||
#include <cstdint> | ||
|
||
namespace dash { | ||
|
||
enum class launch : uint16_t { | ||
/// synchronous launch policy | ||
sync = 0x1, | ||
/// async launch policy | ||
async = 0x2 | ||
/// synchronous launch policy | ||
sync = 0x1, | ||
/// async launch policy | ||
async = 0x2, | ||
/// deferred launch policy | ||
deferred = 0x4, | ||
/// unspecified launch policy | ||
any = sync | async | deferred | ||
}; | ||
|
||
} | ||
|
||
|
||
#endif // DASH__LAUNCH__H__INCLUDED | ||
#endif // DASH__LAUNCH_POLICY_H__INCLUDED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ namespace dash { | |
* \ingroup DashAlgorithms | ||
*/ | ||
template < | ||
typename ValueType, | ||
class ValueType, | ||
class InputIt, | ||
class OutputIt > | ||
OutputIt copy( | ||
|
@@ -58,23 +58,28 @@ OutputIt copy( | |
OutputIt out_first); | ||
|
||
/** | ||
* Asynchronous variant of \c dash::copy. | ||
* Asynchronous or deferred execution of \c dash::copy. | ||
* Copies the elements in the range, defined by \c [in_first, in_last), to | ||
* another range beginning at \c out_first. | ||
* | ||
* In terms of data distribution, source and destination ranges passed to | ||
* \c dash::copy can be local (\c *ValueType) or global (\c GlobIter<ValueType>). | ||
* \c dash::copy can be | ||
* | ||
* - local (\c *ValueType) | ||
* - or global (\c GlobIter<ValueType>) | ||
* | ||
* For a blocking variant of \c dash::copy_async, see \c dash::copy. | ||
* For a blocking variant, see \c dash::copy without launch policy parameter. | ||
* | ||
* Example: | ||
* | ||
* \code | ||
* // Start asynchronous copying | ||
* dash::Future<T*> fut_dest_end = | ||
* dash::copy_async(array_a.block(0).begin(), | ||
* array_a.block(0).end(), | ||
* local_array); | ||
* dash::copy( | ||
* dash::launch::async, | ||
* array_a.block(0).begin(), | ||
* array_a.block(0).end(), | ||
* local_array); | ||
* // Overlapping computation here | ||
* // ... | ||
* // Wait for completion of asynchronous copying: | ||
|
@@ -88,12 +93,14 @@ OutputIt copy( | |
* \ingroup DashAlgorithms | ||
*/ | ||
template < | ||
typename ValueType, | ||
class ExecutionPolicy, | ||
class ValueType, | ||
class GlobInputIt > | ||
dash::Future<ValueType *> copy_async( | ||
InputIt in_first, | ||
InputIt in_last, | ||
OutputIt out_first); | ||
dash::Future<ValueType *> copy( | ||
ExecutionPolicy && policy, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The execution policy is ignored atm, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I just pinned the branch as PR to simplify discussion. It's work in progress (= |
||
InputIt in_first, | ||
InputIt in_last, | ||
OutputIt out_first); | ||
|
||
#else // DOXYGEN | ||
|
||
|
@@ -1028,15 +1035,14 @@ ValueType * copy( | |
template < | ||
typename ValueType, | ||
class GlobOutputIt > | ||
dash::Future<GlobOutputIt> copy_async( | ||
constexpr dash::Future<GlobOutputIt> copy_async( | ||
ValueType * in_first, | ||
ValueType * in_last, | ||
GlobOutputIt out_first) | ||
{ | ||
auto fut = dash::internal::copy_async_impl(in_first, | ||
in_last, | ||
out_first); | ||
return fut; | ||
return dash::internal::copy_async_impl(in_first, | ||
in_last, | ||
out_first); | ||
} | ||
|
||
/** | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is the difference in semantics between
parallel_policy
andparallel_unsequenced_policy
?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.
This is well described on cppreference.