Skip to content

Commit 924e3f5

Browse files
committed
Committing Parallel STL 20190522 open source release
1 parent 06ab5fc commit 924e3f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5828
-2119
lines changed

.clang-format

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ BreakBeforeBraces: Allman
1515
# Disable formatting options which may break tests.
1616
SortIncludes: false
1717
ReflowComments: false
18+
19+
# Indent preprocessor directives
20+
IndentPPDirectives: AfterHash

CHANGES

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
------------------------------------------------------------------------
22
The list of most significant changes made over time in Parallel STL.
33

4+
Parallel STL 20190522 release
5+
PSTL_VERSION == 207
6+
7+
Features / APIs:
8+
9+
- Added for_loop algorithm family from the Parallelism TS v2
10+
(working draft N4808) with support for sequenced_policy
11+
and parallel_policy.
12+
- The following algorithms support parallel_policy with forward
13+
iterators: transform, for_each.
14+
15+
------------------------------------------------------------------------
416
Parallel STL release within Intel(R) Parallel Studio XE 2019 Update 4
517
PSTL_VERSION == 206
618

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Parallel STL
2-
[![Stable release](https://img.shields.io/badge/version-20190429-green.svg)](https://github.com/intel/parallelstl/releases/tag/20190429)
2+
[![Stable release](https://img.shields.io/badge/version-20190522-green.svg)](https://github.com/intel/parallelstl/releases/tag/20190522)
33

44
Parallel STL is an implementation of the C++ standard library algorithms with support for execution policies,
55
as specified in ISO/IEC 14882:2017 standard, commonly called C++17.

Release_Notes.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ Known Issues or limitations
8989
support '#pragma omp simd' or '#pragma simd'.
9090
Parallel and vector execution is only supported for the algorithms
9191
if random access iterators are provided, while for other iterator
92-
types the execution will remain serial.
92+
types the execution will remain serial, excepting for_each and
93+
transform which support parallel execution with forward iterators
94+
as well. In case of forward iterators an execution of the invoked
95+
function should have enough work for the parallel execution to be
96+
effective.
9397
Semantics of the following algorithms does not allow unsequenced execution:
9498
includes, inplace_merge, merge, set_difference, set_intersection,
9599
set_symmetric_difference, set_union, stable_partition, unique.

examples/convex_hull/convex_hull.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void quickhull(const pointVec_t &points, pointVec_t &hull) {
104104
return;
105105
}
106106
//Find left and right most points, they will be in the convex hull
107-
#if __INTEL_COMPILER == 1900 && PSTL_VERSION >= 200 && PSTL_VERSION <= 204
107+
#if (__INTEL_COMPILER >= 1900 && __INTEL_COMPILER <= 1910) && (PSTL_VERSION >= 200 && PSTL_VERSION <= 204)
108108
// A workaround for incorrectly working minmax_element
109109
point_t p1 = *std::min_element(pstl::execution::par_unseq, points.cbegin(), points.cend());
110110
point_t p2 = *std::max_element(pstl::execution::par_unseq, points.cbegin(), points.cend());

include/pstl/algorithm

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020

2121
#if __PSTL_EXECUTION_POLICIES_DEFINED
2222
// If <execution> has already been included, pull in implementations
23-
#include "internal/glue_algorithm_impl.h"
23+
# include "internal/glue_algorithm_impl.h"
2424
#else
2525
// Otherwise just pull in forward declarations
26-
#include "internal/glue_algorithm_defs.h"
27-
#define __PSTL_ALGORITHM_FORWARD_DECLARED 1
26+
# include "internal/glue_algorithm_defs.h"
27+
# define __PSTL_ALGORITHM_FORWARD_DECLARED 1
2828
#endif
2929

3030
#endif /* __PSTL_algorithm */

include/pstl/execution

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,24 @@
2222
#define __PSTL_EXECUTION_POLICIES_DEFINED 1
2323

2424
#if __PSTL_ALGORITHM_FORWARD_DECLARED
25-
#include "internal/glue_algorithm_impl.h"
25+
# include "internal/glue_algorithm_impl.h"
2626
#endif
2727

2828
#if __PSTL_MEMORY_FORWARD_DECLARED
29-
#include "internal/glue_memory_impl.h"
29+
# include "internal/glue_memory_impl.h"
3030
#endif
3131

3232
#if __PSTL_NUMERIC_FORWARD_DECLARED
33-
#include "internal/glue_numeric_impl.h"
33+
# include "internal/glue_numeric_impl.h"
3434
#endif
3535

3636
#if __PSTL_CPP17_EXECUTION_POLICIES_PRESENT
3737
__PSTL_PRAGMA_MESSAGE_POLICIES("The <Parallel STL> execution policies are defined in the namespace __pstl::execution")
38+
# include "internal/algorithm_impl.h"
39+
# include "internal/numeric_impl.h"
40+
# include "internal/parallel_backend.h"
3841
#else
39-
#include "internal/glue_execution_defs.h"
42+
# include "internal/glue_execution_defs.h"
4043
__PSTL_PRAGMA_MESSAGE_POLICIES(
4144
"The <Parallel STL> execution policies are injected into the standard namespace std::execution")
4245
#endif

include/pstl/experimental/algorithm

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// -*- C++ -*-
2+
//===-- algorithm ---------------------------------------------------------===//
3+
//
4+
// Copyright (C) 2019 Intel Corporation
5+
//
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
// This file incorporates work covered by the following copyright and permission
9+
// notice:
10+
//
11+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
12+
// See https://llvm.org/LICENSE.txt for license information.
13+
//
14+
//===----------------------------------------------------------------------===//
15+
16+
#ifndef __PSTL_experimental_algorithm
17+
#define __PSTL_experimental_algorithm
18+
19+
#define __cpp_lib_experimental_parallel_for_loop 201711
20+
21+
#include "internal/reduction.h"
22+
#include "internal/induction.h"
23+
#include "internal/for_loop.h"
24+
25+
#endif /* __PSTL_experimental_algorithm */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// -*- C++ -*-
2+
//===-- for_loop.h --------------------------------------------------------===//
3+
//
4+
// Copyright (C) 2019 Intel Corporation
5+
//
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
// This file incorporates work covered by the following copyright and permission
9+
// notice:
10+
//
11+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
12+
// See https://llvm.org/LICENSE.txt for license information.
13+
//
14+
//===----------------------------------------------------------------------===//
15+
16+
#ifndef __PSTL_experimental_for_loop_H
17+
#define __PSTL_experimental_for_loop_H
18+
19+
#include <tuple>
20+
21+
#include "../../internal/pstl_config.h"
22+
#include "../../internal/execution_impl.h"
23+
#include "../../internal/utils.h"
24+
#include "for_loop_impl.h"
25+
26+
namespace std
27+
{
28+
namespace experimental
29+
{
30+
inline namespace parallelism_v2
31+
{
32+
33+
// TODO: type_identity should be available in type_traits starting from C++20
34+
// Perhaps we need to add an internal structure if PSTL is used with older versions
35+
template <typename _Tp>
36+
struct type_identity
37+
{
38+
using type = _Tp;
39+
};
40+
template <typename _Tp>
41+
using type_identity_t = typename type_identity<_Tp>::type;
42+
43+
// TODO: add static asserts for parameters according to the requirements
44+
template <typename _ExecutionPolicy, typename _Ip, typename... _Rest>
45+
void
46+
for_loop(_ExecutionPolicy&& __exec, type_identity_t<_Ip> __start, _Ip __finish, _Rest&&... __rest)
47+
{
48+
__pstl::__internal::__for_loop_repack(std::forward<_ExecutionPolicy>(__exec), __start, __finish,
49+
__pstl::__internal::__single_stride_type{},
50+
std::forward_as_tuple(std::forward<_Rest>(__rest)...));
51+
}
52+
53+
template <typename _ExecutionPolicy, typename _Ip, typename _Sp, typename... _Rest>
54+
void
55+
for_loop_strided(_ExecutionPolicy&& __exec, type_identity_t<_Ip> __start, _Ip __finish, _Sp __stride, _Rest&&... __rest)
56+
{
57+
__pstl::__internal::__for_loop_repack(std::forward<_ExecutionPolicy>(__exec), __start, __finish, __stride,
58+
std::forward_as_tuple(std::forward<_Rest>(__rest)...));
59+
}
60+
61+
template <typename _ExecutionPolicy, typename _Ip, typename _Size, typename... _Rest>
62+
void
63+
for_loop_n(_ExecutionPolicy&& __exec, _Ip __start, _Size __n, _Rest&&... __rest)
64+
{
65+
__pstl::__internal::__for_loop_repack_n(std::forward<_ExecutionPolicy>(__exec), __start, __n,
66+
__pstl::__internal::__single_stride_type{},
67+
std::forward_as_tuple(std::forward<_Rest>(__rest)...));
68+
}
69+
70+
template <typename _ExecutionPolicy, typename _Ip, typename _Size, typename _Sp, typename... _Rest>
71+
void
72+
for_loop_n_strided(_ExecutionPolicy&& __exec, _Ip __start, _Size __n, _Sp __stride, _Rest&&... __rest)
73+
{
74+
__pstl::__internal::__for_loop_repack_n(std::forward<_ExecutionPolicy>(__exec), __start, __n, __stride,
75+
std::forward_as_tuple(std::forward<_Rest>(__rest)...));
76+
}
77+
78+
// Serial implementations
79+
template <typename _Ip, typename... _Rest>
80+
void
81+
for_loop(type_identity_t<_Ip> __start, _Ip __finish, _Rest&&... __rest)
82+
{
83+
std::experimental::parallelism_v2::for_loop(__pstl::execution::v1::seq, __start, __finish,
84+
std::forward<_Rest>(__rest)...);
85+
}
86+
87+
template <typename _Ip, typename _Sp, typename... _Rest>
88+
void
89+
for_loop_strided(type_identity_t<_Ip> __start, _Ip __finish, _Sp __stride, _Rest&&... __rest)
90+
{
91+
std::experimental::parallelism_v2::for_loop_strided(__pstl::execution::v1::seq, __start, __finish, __stride,
92+
std::forward<_Rest>(__rest)...);
93+
}
94+
95+
template <typename _Ip, typename _Size, typename... _Rest>
96+
void
97+
for_loop_n(_Ip __start, _Size __n, _Rest&&... __rest)
98+
{
99+
std::experimental::parallelism_v2::for_loop_n(__pstl::execution::v1::seq, __start, __n,
100+
std::forward<_Rest>(__rest)...);
101+
}
102+
103+
template <typename _Ip, typename _Size, typename _Sp, typename... _Rest>
104+
void
105+
for_loop_n_strided(_Ip __start, _Size __n, _Sp __stride, _Rest&&... __rest)
106+
{
107+
std::experimental::parallelism_v2::for_loop_n_strided(__pstl::execution::v1::seq, __start, __n, __stride,
108+
std::forward<_Rest>(__rest)...);
109+
}
110+
111+
} // namespace parallelism_v2
112+
} // namespace experimental
113+
} // namespace std
114+
115+
#endif /* __PSTL_experimental_for_loop_H */

0 commit comments

Comments
 (0)