Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NumaMem.h
Go to the documentation of this file.
1 /*
2  * This file belongs to the Galois project, a C++ library for exploiting
3  * parallelism. The code is being released under the terms of the 3-Clause BSD
4  * License (a copy is located in LICENSE.txt at the top-level directory).
5  *
6  * Copyright (C) 2018, The University of Texas at Austin. All rights reserved.
7  * UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
8  * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY,
9  * FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF
10  * PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF
11  * DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH
12  * RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances
13  * shall University be liable for incidental, special, indirect, direct or
14  * consequential damages or loss of profits, interruption of business, or
15  * related expenses which may arise from use of Software or Documentation,
16  * including but not limited to those resulting from defects in Software and/or
17  * Documentation, or loss or inaccuracy of data of any kind.
18  */
19 
20 #ifndef GALOIS_SUBSTRATE_NUMAMEM
21 #define GALOIS_SUBSTRATE_NUMAMEM
22 
23 #include <cstddef>
24 #include <memory>
25 #include <vector>
26 
27 #include "galois/config.h"
28 
29 namespace galois {
30 namespace substrate {
31 
32 namespace internal {
33 struct largeFreer {
34  size_t bytes;
35  void operator()(void* ptr) const;
36 };
37 } // namespace internal
38 
39 typedef std::unique_ptr<void, internal::largeFreer> LAptr;
40 
41 LAptr largeMallocLocal(size_t bytes); // fault in locally
42 LAptr largeMallocFloating(size_t bytes); // leave numa mapping undefined
43 // fault in interleaved mapping
44 LAptr largeMallocInterleaved(size_t bytes, unsigned numThreads);
45 // fault in block interleaved mapping
46 LAptr largeMallocBlocked(size_t bytes, unsigned numThreads);
47 
48 // fault in specified regions for each thread (threadRanges)
49 template <typename RangeArrayTy>
50 LAptr largeMallocSpecified(size_t bytes, uint32_t numThreads,
51  RangeArrayTy& threadRanges, size_t elementSize);
52 
53 } // namespace substrate
54 } // namespace galois
55 
56 #endif // GALOIS_SUBSTRATE_NUMAMEM
LAptr largeMallocBlocked(size_t bytes, unsigned numThreads)
Definition: NumaMem.cpp:188
LAptr largeMallocFloating(size_t bytes)
Definition: NumaMem.cpp:180
LAptr largeMallocLocal(size_t bytes)
Definition: NumaMem.cpp:172
LAptr largeMallocSpecified(size_t bytes, uint32_t numThreads, RangeArrayTy &threadRanges, size_t elementSize)
Allocates pages for some specified number of bytes, then does NUMA page faulting based on a specified...
Definition: NumaMem.cpp:213
void operator()(void)
Definition: Executor_ParaMeter.h:417
LAptr largeMallocInterleaved(size_t bytes, unsigned numThreads)
Definition: NumaMem.cpp:150
std::unique_ptr< void, internal::largeFreer > LAptr
Definition: NumaMem.h:39