STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sort_base.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/algo/sort_base.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2009 Andreas Beckmann <[email protected]>
7  *
8  * Distributed under the Boost Software License, Version 1.0.
9  * (See accompanying file LICENSE_1_0.txt or copy at
10  * http://www.boost.org/LICENSE_1_0.txt)
11  **************************************************************************/
12 
13 #ifndef STXXL_ALGO_SORT_BASE_HEADER
14 #define STXXL_ALGO_SORT_BASE_HEADER
15 
16 #include <cmath>
18 
19 #ifndef STXXL_NO_WARN_RECURSIVE_SORT
20 #define STXXL_WARNMSG_RECURSIVE_SORT STXXL_ERRMSG
21 #else
22 #define STXXL_WARNMSG_RECURSIVE_SORT STXXL_VERBOSE
23 #endif
24 
25 #ifndef STXXL_SORT_OPTIMAL_PREFETCHING
26 #define STXXL_SORT_OPTIMAL_PREFETCHING 1
27 #endif
28 
29 #ifndef STXXL_CHECK_ORDER_IN_SORTS
30 #define STXXL_CHECK_ORDER_IN_SORTS 0
31 #endif
32 
33 #ifndef STXXL_L2_SIZE
34 #define STXXL_L2_SIZE (512 * 1024)
35 #endif
36 
38 
39 // Optimal merging: merge r = pow(nruns,1/ceil(log(nruns)/log(m))) runs at once
40 inline unsigned_type optimal_merge_factor(unsigned_type num_runs, unsigned_type max_concurrent_runs)
41 {
42  return unsigned_type(ceil(pow(double(num_runs), 1. / ceil(log(double(num_runs)) / log(double(max_concurrent_runs))))));
43 }
44 
46 
47 #endif // !STXXL_ALGO_SORT_BASE_HEADER
48 // vim: et:ts=4:sw=4
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
choose_int_types< my_pointer_size >::unsigned_type unsigned_type
Definition: types.h:64
unsigned_type optimal_merge_factor(unsigned_type num_runs, unsigned_type max_concurrent_runs)
Definition: sort_base.h:40
#define STXXL_END_NAMESPACE
Definition: namespace.h:17