Install gcc-4.4.0-tdm-1-core-2.tar.gz
[msysgit.git] / mingw / lib / gcc / mingw32 / 4.3.3 / include / c++ / parallel / types.h
blob1b646b02084e82d7bdcd1b769b74cb44bbb1856a
1 // -*- C++ -*-
3 // Copyright (C) 2007, 2008 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 2, or (at your option) any later
9 // version.
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.
16 // You should have received a copy of the GNU General Public License
17 // along with this library; see the file COPYING. If not, write to
18 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19 // MA 02111-1307, USA.
21 // As a special exception, you may use this file as part of a free
22 // software library without restriction. Specifically, if other files
23 // instantiate templates or use macros or inline functions from this
24 // file, or you compile this file and link it with other files to
25 // produce an executable, this file does not by itself cause the
26 // resulting executable to be covered by the GNU General Public
27 // License. This exception does not however invalidate any other
28 // reasons why the executable file might be covered by the GNU General
29 // Public License.
31 /** @file parallel/types.h
32 * @brief Basic types and typedefs.
33 * This file is a GNU parallel extension to the Standard C++ Library.
36 // Written by Johannes Singler and Felix Putze.
38 #ifndef _GLIBCXX_PARALLEL_TYPES_H
39 #define _GLIBCXX_PARALLEL_TYPES_H 1
41 #include <cstdlib>
43 namespace __gnu_parallel
45 // Enumerated types.
47 /// Run-time equivalents for the compile-time tags.
48 enum _Parallelism
50 /// Not parallel.
51 sequential,
53 /// Parallel unbalanced (equal-sized chunks).
54 parallel_unbalanced,
56 /// Parallel balanced (work-stealing).
57 parallel_balanced,
59 /// Parallel with OpenMP dynamic load-balancing.
60 parallel_omp_loop,
62 /// Parallel with OpenMP static load-balancing.
63 parallel_omp_loop_static,
65 /// Parallel with OpenMP taskqueue construct.
66 parallel_taskqueue
69 /// Strategies for run-time algorithm selection:
70 // force_sequential, force_parallel, heuristic.
71 enum _AlgorithmStrategy
73 heuristic,
74 force_sequential,
75 force_parallel
78 /// Sorting algorithms:
79 // multi-way mergesort, quicksort, load-balanced quicksort.
80 enum _SortAlgorithm
82 MWMS,
83 QS,
84 QS_BALANCED
87 /// Merging algorithms:
88 // bubblesort-alike, loser-tree variants, enum sentinel.
89 enum _MultiwayMergeAlgorithm
91 LOSER_TREE
94 /// Partial sum algorithms: recursive, linear.
95 enum _PartialSumAlgorithm
97 RECURSIVE,
98 LINEAR
101 /// Sorting/merging algorithms: sampling, exact.
102 enum _SplittingAlgorithm
104 SAMPLING,
105 EXACT
108 /// Find algorithms:
109 // growing blocks, equal-sized blocks, equal splitting.
110 enum _FindAlgorithm
112 GROWING_BLOCKS,
113 CONSTANT_SIZE_BLOCKS,
114 EQUAL_SPLIT
117 /// Integer Types.
118 // XXX need to use <cstdint>
119 /** @brief 16-bit signed integer. */
120 typedef short int16;
122 /** @brief 16-bit unsigned integer. */
123 typedef unsigned short uint16;
125 /** @brief 32-bit signed integer. */
126 typedef int int32;
128 /** @brief 32-bit unsigned integer. */
129 typedef unsigned int uint32;
131 /** @brief 64-bit signed integer. */
132 typedef long long int64;
134 /** @brief 64-bit unsigned integer. */
135 typedef unsigned long long uint64;
138 * @brief Unsigned integer to index elements.
139 * The total number of elements for each algorithm must fit into this type.
141 typedef uint64 sequence_index_t;
144 * @brief Unsigned integer to index a thread number.
145 * The maximum thread number (for each processor) must fit into this type.
147 typedef uint16 thread_index_t;
149 // XXX atomics interface?
150 /// Longest compare-and-swappable integer type on this platform.
151 typedef int64 lcas_t;
153 // XXX numeric_limits::digits?
154 /// Number of bits of ::lcas_t.
155 static const int lcas_t_bits = sizeof(lcas_t) * 8;
157 /// ::lcas_t with the right half of bits set to 1.
158 static const lcas_t lcas_t_mask = ((lcas_t(1) << (lcas_t_bits / 2)) - 1);
161 #endif /* _GLIBCXX_TYPES_H */