gcc/libstdc++-v3/include/parallel/omp_loop.h
Benjamin Kosnik 2a60a9f652 re PR libstdc++/42460 (man page errors for generated libstdc++ man pages)
2010-02-04  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/42460
	* doc/doxygen/user.cfg.in: Update file list.
	* include/debug/safe_sequence.h: Doxygen markup fixes for '' and "".
	* include/debug/safe_base.h: Same.
	* include/debug/macros.h: Same.
	* include/tr1_impl/regex: Same.
	* include/std/iostream: Same.
	* include/std/streambuf: Same.
	* include/std/bitset: Same.
	* include/std/iosfwd: Same.
	* include/std/limits: Same.
	* include/std/fstream: Same.
	* include/std/istream: Same.
	* include/std/ostream: Same.
	* include/std/sstream: Same.
	* include/parallel/multiway_merge.h: Same.
	* include/parallel/for_each.h: Same.
	* include/parallel/workstealing.h: Same.
	* include/parallel/omp_loop_static.h: Same.
	* include/parallel/omp_loop.h: Same.
	* include/c_std/csignal: Same.
	* include/c_std/cstdlib: Same.
	* include/c_std/cstdio: Same.
	* include/c_std/cstdarg: Same.
	* include/c_std/cctype: Same.
	* include/c_std/cerrno: Same.
	* include/c_std/cmath: Same.
	* include/c_std/ciso646: Same.
	* include/c_std/ctime: Same.
	* include/c_std/clocale: Same.
	* include/c_std/climits: Same.
	* include/c_std/cassert: Same.
	* include/c_std/csetjmp: Same.
	* include/c_std/cwchar: Same.
	* include/c_std/cfloat: Same.
	* include/c_std/cstring: Same.
	* include/c_std/cstddef: Same.
	* include/c_std/cwctype: Same.
	* include/profile/iterator_tracker.h: Same.
	* include/profile/impl/profiler_trace.h: Same.
	* include/ext/vstring.h: Same.
	* include/ext/algorithm: Same.
	* include/ext/pb_ds/detail/pat_trie_/pat_trie_.h.pp: Same.
	* include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.h.pp: Same.
	* include/ext/pb_ds/detail/type_utils.hpp: Same.
	* include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp: Same
	* include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp: Same.
	* include/ext/rc_string_base.h: Same.
	* include/ext/stdio_sync_filebuf.h: Same.
	* include/ext/functional: Same.
	* include/ext/mt_allocator.h: Same.
	* include/bits/basic_ios.h: Same.
	* include/bits/stl_map.h: Same.
	* include/bits/stl_algobase.h: Same.
	* include/bits/stl_queue.h: Same.
	* include/bits/locale_classes.h: Same.
	* include/bits/stl_set.h: Same.
	* include/bits/locale_facets.h: Same.
	* include/bits/stl_stack.h: Same.
	* include/bits/stl_iterator_base_types.h: Same.
	* include/bits/basic_string.h: Same.
	* include/bits/stl_multimap.h: Same.
	* include/bits/ios_base.h: Same.
	* include/bits/stl_deque.h: Same.
	* include/bits/stl_multiset.h: Same.
	* include/bits/stl_iterator_base_funcs.h: Same.
	* include/bits/char_traits.h: Same.
	* include/bits/stl_algo.h: Same.
	* include/bits/stl_iterator.h: Same.
	* include/bits/stl_tempbuf.h: Same.
	* include/bits/random.tcc: Same.
	* include/bits/stl_function.h: Same.
	* include/bits/cpp_type_traits.h: Same.
	* include/bits/random.h: Same.
	* include/bits/allocator.h: Same.
	* include/bits/locale_facets_nonio.h: Same.
	* include/c_global/csignal: Same.
	* include/c_global/cstdlib: Same.
	* include/c_global/cstdio: Same.
	* include/c_global/cstdarg: Same.
	* include/c_global/cctype: Same.
	* include/c_global/cerrno: Same.
	* include/c_global/cmath: Same.
	* include/c_global/ciso646: Same.
	* include/c_global/ctime: Same.
	* include/c_global/clocale: Same.
	* include/c_global/climits: Same.
	* include/c_global/cassert: Same.
	* include/c_global/csetjmp: Same.
	* include/c_global/cwchar: Same.
	* include/c_global/cfloat: Same.
	* include/c_global/cstring: Same.
	* include/c_global/cstddef: Same.
	* include/c_global/cwctype: Same.
	* include/tr1/hypergeometric.tcc: Same.
	* include/tr1/random.tcc: Same.
	* include/tr1/functional: Same.
	* include/tr1/random.h: Same.
	* include/backward/auto_ptr.h: Same.
	* include/backward/binders.h: Same.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
	Adjust line numbers.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
	* testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
	Same.
	* testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
	Same.

From-SVN: r156502
2010-02-04 18:20:34 +00:00

116 lines
3.9 KiB
C++

// -*- C++ -*-
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file parallel/omp_loop.h
* @brief Parallelization of embarrassingly parallel execution by
* means of an OpenMP for loop.
* This file is a GNU parallel extension to the Standard C++ Library.
*/
// Written by Felix Putze.
#ifndef _GLIBCXX_PARALLEL_OMP_LOOP_H
#define _GLIBCXX_PARALLEL_OMP_LOOP_H 1
#include <omp.h>
#include <parallel/settings.h>
#include <parallel/basic_iterator.h>
#include <parallel/base.h>
namespace __gnu_parallel
{
/** @brief Embarrassingly parallel algorithm for random access
* iterators, using an OpenMP for loop.
*
* @param __begin Begin iterator of element sequence.
* @param __end End iterator of element sequence.
* @param __o User-supplied functor (comparator, predicate, adding
* functor, etc.).
* @param __f Functor to @a process an element with __op (depends on
* desired functionality, e. g. for std::for_each(), ...).
* @param __r Functor to @a add a single __result to the already
* processed elements (depends on functionality).
* @param __base Base value for reduction.
* @param __output Pointer to position where final result is written to
* @param __bound Maximum number of elements processed (e. g. for
* std::count_n()).
* @return User-supplied functor (that may contain a part of the result).
*/
template<typename _RAIter,
typename _Op,
typename _Fu,
typename _Red,
typename _Result>
_Op
__for_each_template_random_access_omp_loop(_RAIter __begin, _RAIter __end,
_Op __o, _Fu& __f, _Red __r,
_Result __base,
_Result& __output,
typename std::iterator_traits<_RAIter>::difference_type __bound)
{
typedef typename std::iterator_traits<_RAIter>::difference_type
_DifferenceType;
_DifferenceType __length = __end - __begin;
_ThreadIndex __num_threads = __gnu_parallel::min<_DifferenceType>
(__get_max_threads(), __length);
_Result *__thread_results;
# pragma omp parallel num_threads(__num_threads)
{
# pragma omp single
{
__num_threads = omp_get_num_threads();
__thread_results = new _Result[__num_threads];
for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
__thread_results[__i] = _Result();
}
_ThreadIndex __iam = omp_get_thread_num();
#pragma omp for schedule(dynamic, _Settings::get().workstealing_chunk_size)
for (_DifferenceType __pos = 0; __pos < __length; ++__pos)
__thread_results[__iam] = __r(__thread_results[__iam],
__f(__o, __begin+__pos));
} //parallel
for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
__output = __r(__output, __thread_results[__i]);
delete [] __thread_results;
// Points to last element processed (needed as return value for
// some algorithms like transform).
__f._M_finish_iterator = __begin + __length;
return __o;
}
} // end namespace
#endif /* _GLIBCXX_PARALLEL_OMP_LOOP_H */