-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgda_dpointer.h
More file actions
83 lines (63 loc) · 2.11 KB
/
Copy pathgda_dpointer.h
File metadata and controls
83 lines (63 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2023 ETH Zurich.
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// main author: Robert Gerstenberger
#ifndef __GDA_DPOINTER_H
#define __GDA_DPOINTER_H
#include <inttypes.h>
#include <stdbool.h>
/**
This header provides functions for so called DPointers. A DPointer is
a data structure that indicates a remote memory location. The remote
memory location is identified by a (target) rank and an offset.
A DPointer consists of two fields: rank and offset, where each field
occupies a certain amount of bits.
- The rank can be found in the higher order bits of a dpointer.
- The offset can be found in the lower order bits of a dpointer.
--------------------------------
| rank | offset |
--------------------------------
*/
/**
constant definitions
*/
// TODO: move this constant definition somewhere else, since it might actually
// be a user-defined constant?
/**
This constant controls the number of bits used for the offset field of the
DPointer. In doing so, it controls also the maximum amount of memory per rank,
that can be used for the graph database.
rank field uses 64 - GDA_DPOINTER_OFFSETBITS bits, so more memory per rank also
means a smaller number of ranks in total and vice versa.
*/
#define GDA_DPOINTER_OFFSETBITS 32
#define GDA_DPOINTER_NULL 0xFFFFFFFFFFFFFFFF
/**
data type definitions
*/
typedef uint64_t GDA_DPointer;
/**
function prototypes
*/
/**
Sets the DPointer to a new value.
*/
void GDA_SetDPointer(uint64_t offset, uint64_t rank, GDA_DPointer* dpointer);
/**
Retrieves the rank and the offset of a DPointer.
Doesn't check whether the DPointer is NULL.
*/
void GDA_GetDPointer(uint64_t* offset, uint64_t* rank, GDA_DPointer dpointer);
/**
Checks whether a DPointer is invalid.
*/
bool GDA_DPointerIsNull(GDA_DPointer dpointer);
/**
Prints the content of a DPointer. Intended for debugging.
Will also work for a DPointer that is NULL.
*/
void GDA_PrintDPointer(GDA_DPointer dpointer);
#endif // #ifndef __GDA_DPOINTER_H