Thrill  0.1
async_schedule.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * foxxll/mng/async_schedule.hpp
3  *
4  * Part of FOXXLL. See http://foxxll.org
5  *
6  * Copyright (C) 2002 Roman Dementiev <[email protected]>
7  * Copyright (C) 2009 Andreas Beckmann <[email protected]>
8  *
9  * Distributed under the Boost Software License, Version 1.0.
10  * (See accompanying file LICENSE_1_0.txt or copy at
11  * http://www.boost.org/LICENSE_1_0.txt)
12  **************************************************************************/
13 
14 #ifndef FOXXLL_MNG_ASYNC_SCHEDULE_HEADER
15 #define FOXXLL_MNG_ASYNC_SCHEDULE_HEADER
16 
17 // Implements the "prudent prefetching" as described in
18 // D. Hutchinson, P. Sanders, J. S. Vitter: Duality between prefetching
19 // and queued writing on parallel disks, 2005
20 // DOI: 10.1137/S0097539703431573
21 
22 #include <foxxll/common/types.hpp>
23 #include <tlx/simple_vector.hpp>
24 
25 namespace foxxll {
26 
28  const size_t* first,
29  const size_t* last,
30  size_t* out_first,
31  size_t m,
32  size_t D);
33 
35  size_t* first,
36  size_t* last,
37  size_t* out_first,
38  size_t m,
39  size_t D)
40 {
41  compute_prefetch_schedule(static_cast<const size_t*>(first), static_cast<const size_t*>(last), out_first, m, D);
42 }
43 
44 template <typename RunType>
46  const RunType& input,
47  size_t* out_first,
48  size_t m,
49  size_t D)
50 {
51  const size_t L = input.size();
53  for (size_t i = 0; i < L; ++i)
54  disks[i] = input[i].bid.storage->get_device_id();
55  compute_prefetch_schedule(disks.begin(), disks.end(), out_first, m, D);
56 }
57 
58 template <typename BidIteratorType>
60  BidIteratorType input_begin,
61  BidIteratorType input_end,
62  size_t* out_first,
63  size_t m,
64  size_t D)
65 {
66  const size_t L = input_end - input_begin;
68  size_t i = 0;
69  for (BidIteratorType it = input_begin; it != input_end; ++it, ++i)
70  disks[i] = it->storage->get_device_id();
71  compute_prefetch_schedule(disks.begin(), disks.end(), out_first, m, D);
72 }
73 
74 } // namespace foxxll
75 
76 #endif // !FOXXLL_MNG_ASYNC_SCHEDULE_HEADER
77 
78 /**************************************************************************/
iterator end() noexcept
return mutable iterator beyond last element
Simpler non-growing vector without initialization.
void compute_prefetch_schedule(const size_t *first, const size_t *last, size_t *out_first, size_t m, size_t D)
iterator begin() noexcept
return mutable iterator to first element
FOXXLL library namespace
int D
Definition: gen_data.py:14