-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathuts.h
More file actions
127 lines (101 loc) · 3.58 KB
/
uts.h
File metadata and controls
127 lines (101 loc) · 3.58 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* ---- The Unbalanced Tree Search (UTS) Benchmark ----
*
* Copyright (c) 2010 See AUTHORS file for copyright holders
*
* This file is part of the unbalanced tree search benchmark. This
* project is licensed under the MIT Open Source license. See the LICENSE
* file for copyright and licensing information.
*
* UTS is a collaborative project between researchers at the University of
* Maryland, the University of North Carolina at Chapel Hill, and the Ohio
* State University. See AUTHORS file for more information.
*
*/
#ifndef _UTS_H
#define _UTS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "rng/rng.h"
#define UTS_VERSION "2.1"
/***********************************************************
* Tree node descriptor and statistics *
***********************************************************/
#define MAXNUMCHILDREN 100 // cap on children (BIN root is exempt)
struct node_t {
int type; // distribution governing number of children
int height; // depth of this node in the tree
int numChildren; // number of children, -1 => not yet determined
/* for statistics (if configured via UTS_STAT) */
#ifdef UTS_STAT
struct node_t *pp; // parent pointer
int sizeChildren; // sum of children sizes
int maxSizeChildren; // max of children sizes
int ind;
int size[MAXNUMCHILDREN]; // children sizes
double unb[MAXNUMCHILDREN]; // imbalance of each child 0 <= unb_i <= 1
#endif
/* for RNG state associated with this node */
struct state_t state;
};
typedef struct node_t Node;
/* Tree type
* Trees are generated using a Galton-Watson process, in
* which the branching factor of each node is a random
* variable.
*
* The random variable can follow a binomial distribution
* or a geometric distribution. Hybrid tree are
* generated with geometric distributions near the
* root and binomial distributions towards the leaves.
*/
enum uts_trees_e { BIN = 0, GEO, HYBRID, BALANCED };
enum uts_geoshape_e { LINEAR = 0, EXPDEC, CYCLIC, FIXED };
typedef enum uts_trees_e tree_t;
typedef enum uts_geoshape_e geoshape_t;
/* Strings for the above enums */
extern char * uts_trees_str[];
extern char * uts_geoshapes_str[];
/* Tree parameters */
extern tree_t type;
extern double b_0;
extern int rootId;
extern int nonLeafBF;
extern double nonLeafProb;
extern int gen_mx;
extern geoshape_t shape_fn;
extern double shiftDepth;
/* Benchmark parameters */
extern int computeGranularity;
extern int debug;
extern int verbose;
/* For stats generation: */
typedef unsigned long long counter_t;
/* Utility Functions */
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
void uts_error(char *str);
void uts_parseParams(int argc, char **argv);
int uts_paramsToStr(char *strBuf, int ind);
void uts_printParams();
void uts_helpMessage();
void uts_showStats(int nPes, int chunkSize, double walltime, counter_t nNodes, counter_t nLeaves, counter_t maxDepth);
double uts_wctime();
double rng_toProb(int n);
/* Common tree routines */
void uts_initRoot(Node * root, int type);
int uts_numChildren(Node *parent);
int uts_numChildren_bin(Node * parent);
int uts_numChildren_geo(Node * parent);
int uts_childType(Node *parent);
/* Implementation Specific Functions */
char * impl_getName();
int impl_paramsToStr(char *strBuf, int ind);
int impl_parseParam(char *param, char *value);
void impl_helpMessage();
void impl_abort(int err);
#ifdef __cplusplus
}
#endif
#endif /* _UTS_H */