libstdc++
types.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 // Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3, or (at your option) any later
9 // version.
10 
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
24 
25 /** @file parallel/types.h
26  * @brief Basic types and typedefs.
27  * This file is a GNU parallel extension to the Standard C++ Library.
28  */
29 
30 // Written by Johannes Singler and Felix Putze.
31 
32 #ifndef _GLIBCXX_PARALLEL_TYPES_H
33 #define _GLIBCXX_PARALLEL_TYPES_H 1
34 
35 #include <cstdlib>
36 
37 namespace __gnu_parallel
38 {
39  // Enumerated types.
40 
41  /// Run-time equivalents for the compile-time tags.
43  {
44  /// Not parallel.
46 
47  /// Parallel unbalanced (equal-sized chunks).
49 
50  /// Parallel balanced (work-stealing).
52 
53  /// Parallel with OpenMP dynamic load-balancing.
55 
56  /// Parallel with OpenMP static load-balancing.
58 
59  /// Parallel with OpenMP taskqueue construct.
61  };
62 
63  /// Strategies for run-time algorithm selection:
64  // force_sequential, force_parallel, heuristic.
66  {
67  heuristic,
68  force_sequential,
69  force_parallel
70  };
71 
72  /// Sorting algorithms:
73  // multi-way mergesort, quicksort, load-balanced quicksort.
75  {
76  MWMS,
77  QS,
78  QS_BALANCED
79  };
80 
81  /// Merging algorithms:
82  // bubblesort-alike, loser-tree variants, enum sentinel.
84  {
85  LOSER_TREE
86  };
87 
88  /// Partial sum algorithms: recursive, linear.
90  {
91  RECURSIVE,
92  LINEAR
93  };
94 
95  /// Sorting/merging algorithms: sampling, exact.
97  {
98  SAMPLING,
99  EXACT
100  };
101 
102  /// Find algorithms:
103  // growing blocks, equal-sized blocks, equal splitting.
105  {
106  GROWING_BLOCKS,
107  CONSTANT_SIZE_BLOCKS,
108  EQUAL_SPLIT
109  };
110 
111  /// Integer Types.
112  // XXX need to use <cstdint>
113  /** @brief 16-bit signed integer. */
114  typedef short int16;
115 
116  /** @brief 16-bit unsigned integer. */
117  typedef unsigned short uint16;
118 
119  /** @brief 32-bit signed integer. */
120  typedef int int32;
121 
122  /** @brief 32-bit unsigned integer. */
123  typedef unsigned int uint32;
124 
125  /** @brief 64-bit signed integer. */
126  typedef long long int64;
127 
128  /** @brief 64-bit unsigned integer. */
129  typedef unsigned long long uint64;
130 
131  /**
132  * @brief Unsigned integer to index elements.
133  * The total number of elements for each algorithm must fit into this type.
134  */
136 
137  /**
138  * @brief Unsigned integer to index a thread number.
139  * The maximum thread number (for each processor) must fit into this type.
140  */
142 
143  // XXX atomics interface?
144  /// Longest compare-and-swappable integer type on this platform.
145  typedef int64 lcas_t;
146 
147  // XXX numeric_limits::digits?
148  /// Number of bits of ::lcas_t.
149  static const int lcas_t_bits = sizeof(lcas_t) * 8;
150 
151  /// ::lcas_t with the right half of bits set to 1.
152  static const lcas_t lcas_t_mask = ((lcas_t(1) << (lcas_t_bits / 2)) - 1);
153 }
154 
155 #endif /* _GLIBCXX_PARALLEL_TYPES_H */
Parallel with OpenMP taskqueue construct.
Definition: types.h:60
unsigned int uint32
32-bit unsigned integer.
Definition: types.h:123
int int32
32-bit signed integer.
Definition: types.h:120
static const lcas_t lcas_t_mask
lcas_t with the right half of bits set to 1.
Definition: types.h:152
unsigned long long uint64
64-bit unsigned integer.
Definition: types.h:129
Parallel unbalanced (equal-sized chunks).
Definition: types.h:48
Parallel with OpenMP static load-balancing.
Definition: types.h:57
_Parallelism
Run-time equivalents for the compile-time tags.
Definition: types.h:42
uint16 thread_index_t
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
Definition: types.h:141
unsigned short uint16
16-bit unsigned integer.
Definition: types.h:117
Parallel balanced (work-stealing).
Definition: types.h:51
short int16
Integer Types.
Definition: types.h:114
_MultiwayMergeAlgorithm
Merging algorithms:
Definition: types.h:83
static const int lcas_t_bits
Number of bits of lcas_t.
Definition: types.h:149
_AlgorithmStrategy
Strategies for run-time algorithm selection:
Definition: types.h:65
_SplittingAlgorithm
Sorting/merging algorithms: sampling, exact.
Definition: types.h:96
uint64 sequence_index_t
Unsigned integer to index elements. The total number of elements for each algorithm must fit into thi...
Definition: types.h:135
_SortAlgorithm
Sorting algorithms:
Definition: types.h:74
long long int64
64-bit signed integer.
Definition: types.h:126
Not parallel.
Definition: types.h:45
_FindAlgorithm
Find algorithms:
Definition: types.h:104
int64 lcas_t
Longest compare-and-swappable integer type on this platform.
Definition: types.h:145
Parallel with OpenMP dynamic load-balancing.
Definition: types.h:54
_PartialSumAlgorithm
Partial sum algorithms: recursive, linear.
Definition: types.h:89