Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
numasysif.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Stanford University, NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18// portability wrapper over NUMA system interfaces
19
20// NOTE: this is nowhere near a full libnuma-style interface - it's just the
21// calls that Realm's NUMA module needs
22
23#ifndef NUMASYSIF_H
24#define NUMASYSIF_H
25
26#include "realm/realm_config.h"
27
28#include <stdlib.h>
29#include <map>
30
31namespace Realm {
32
36 };
37
42
43 // is NUMA support available in the system?
45
46 // return info on the memory and cpu in each NUMA node
47 // default is to restrict to only those nodes enabled in the current affinity mask
48 bool numasysif_get_mem_info(std::map<int, NumaNodeMemInfo> &info,
49 bool only_available = true);
50 bool numasysif_get_cpu_info(std::map<int, NumaNodeCpuInfo> &info,
51 bool only_available = true);
52
53 // return the "distance" between two nodes - try to normalize to Linux's model of
54 // 10 being the same node and the cost for other nodes increasing by roughly 10
55 // per hop
56 int numasysif_get_distance(int node1, int node2);
57
58 // allocate memory on a given NUMA node - pin if requested
59 void *numasysif_alloc_mem(int node, size_t bytes, bool pin);
60
61 // free memory allocated on a given NUMA node
62 bool numasysif_free_mem(int node, void *base, size_t bytes);
63
64 // bind already-allocated memory to a given node - pin if requested
65 // may fail if the memory has already been touched
66 bool numasysif_bind_mem(int node, void *base, size_t bytes, bool pin);
67
68}; // namespace Realm
69
70#endif
Definition activemsg.h:38
bool numasysif_free_mem(int node, void *base, size_t bytes)
bool numasysif_bind_mem(int node, void *base, size_t bytes, bool pin)
bool numasysif_get_mem_info(std::map< int, NumaNodeMemInfo > &info, bool only_available=true)
void * numasysif_alloc_mem(int node, size_t bytes, bool pin)
bool numasysif_numa_available(void)
int numasysif_get_distance(int node1, int node2)
bool numasysif_get_cpu_info(std::map< int, NumaNodeCpuInfo > &info, bool only_available=true)
Definition numasysif.h:38
int cores_available
Definition numasysif.h:40
int node_id
Definition numasysif.h:39
Definition numasysif.h:33
size_t bytes_available
Definition numasysif.h:35
int node_id
Definition numasysif.h:34