This repository has been archived by the owner on Apr 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
macros.tex
183 lines (161 loc) · 6.98 KB
/
macros.tex
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
% Semantic markup
\newcommand{\pubauthor}[1]{#1\xspace}
\newcommand{\pubtitle}[1]{#1\xspace}
\newcommand{\pubhow}[2]{{\em #1}\xspace#2\xspace}
% Proper names.
\newcommand{\mapfoldl}{\code{map\_foldl}\xspace}
\newcommand{\mapfoldlpar}{\code{map\-\_\-fold\-l\-\_\-par}\xspace}
\newcommand{\quicksortacc}{\code{quicksort/3}\xspace}
\newcommand{\partition}{\code{partition/4}\xspace}
\newcommand{\listfoldlthree}{\code{list.foldl3/8}\xspace}
\newcommand{\foldlthree}{\code{foldl3/8}\xspace}
\newcommand{\M}{\code{M/2}\xspace}
\newcommand{\F}{\code{F/3}\xspace}
\newcommand{\LC}{\code{LC}\xspace}
\newcommand{\LCS}{\code{LCslot}\xspace}
\newcommand{\lcfinish}{\code{lc\_finish}\xspace}
\newcommand{\lcwaitfreeslot}{\code{lc\_wait\_free\_slot}\xspace}
\newcommand{\lcjoinandterminate}{\code{lc\_\-join\_\-and\_\-term\-in\-ate}\xspace}
\newcommand{\lcspawnoff}{\code{lc\_spawn\_off}\xspace}
\newcommand{\lccreateloopcontrol}{\code{lc\_\-cre\-ate\_\-loop\_\-con\-trol}\xspace}
\newcommand{\createloopgoal}{\code{create\-\_loop\_goal}\xspace}
\newcommand{\putbarriers}{\code{put\-\_bar\-rier\-s\-\_in\-\_base\_case\-s}\xspace}
\newcommand{\io}{\code{io}\xspace}
\newcommand{\di}{\code{di}\xspace}
\newcommand{\uo}{\code{uo}\xspace}
\newcommand{\NULL}{\code{NULL}\xspace}
\newcommand{\n}{{\textbackslash}n\xspace}
% These three don't get the MR prefix because they're mercury predicates
% rather than runtime procedures.
\newcommand{\signal}{\code{future\-\_\-signal\-/\-2}\xspace}
\newcommand{\wait}{\code{future\-\_\-wait\-/\-2}\xspace}
\newcommand{\get}{\code{future\-\_\-get\-/\-2}\xspace}
\newcommand{\joinandcontinue}{\code{MR\_join\_and\_continue}\xspace}
%\newcommand{\getglobalwork}{\code{MR\_get\_global\_work}\xspace}
\newcommand{\idle}{\code{MR\_idle}\xspace}
\newcommand{\idleorigcontext}{\code{MR\_idle\_orig\_context}\xspace}
\newcommand{\sleep}{\code{MR\_sleep}\xspace}
\newcommand{\trystealspark}{\code{MR\_try\_steal\_spark()}\xspace}
\newcommand{\prepareengineforspark}{\code{MR\_prepare\_engine\_for\_spark()}\xspace}
\newcommand{\prepareengineforcontext}{\code{MR\_prepare\_engine\_for\_context()}\xspace}
\newcommand{\enginesleepsync}{\code{MR\_engine\_sleep\_sync}\xspace}
\newcommand{\wakeengine}{\code{MR\_wake\_engine}\xspace}
\newcommand{\push}[0]{\code{MR\_push\_spark()}\xspace}
\newcommand{\pop}[0]{\code{MR\_pop\_spark()}\xspace}
\newcommand{\steal}[0]{\code{MR\_steal\_spark()}\xspace}
\newcommand{\esactiondata}{\code{MR\_\-es\_\-action\_\-data}\xspace}
\newcommand{\findpartime}[0]{\code{find\_par\_time}\xspace}
\newcommand{\findbestpartition}[0]{\code{find\_best\_partition}\xspace}
% the name 'det' is already taken. So I've prefixed all the detisms with 'd'
\newcommand{\ddet}{\code{det}\xspace}
\newcommand{\dsemidet}{\code{semidet}\xspace}
\newcommand{\dmulti}{\code{multi}\xspace}
\newcommand{\dnondet}{\code{nondet}\xspace}
\newcommand{\dfailure}{\code{failure}\xspace}
\newcommand{\derroneous}{\code{erroneous}\xspace}
\newcommand{\dccmulti}{\code{cc\_multi}\xspace}
\newcommand{\dccnondet}{\code{cc\_nondet}\xspace}
\newcommand{\seqfn}[0]{\texttt{seq}\xspace}
\newcommand{\parfn}[0]{\texttt{par}\xspace}
\newcommand{\tscope}{ThreadScope\xspace}
\newcommand{\pvc}{parallelism via concurrency\xspace}
\newcommand{\PS}[0]{\code{ProcStatic}\xspace}
\newcommand{\PD}[0]{\code{ProcDynamic}\xspace}
\newcommand{\CSS}[0]{\code{CallSiteStatic}\xspace}
\newcommand{\CSD}[0]{\code{CallSiteDynamic}\xspace}
\newcommand{\Clique}[0]{\code{Clique}\xspace}
\newcommand{\reorder}{\code{reorder()}\xspace}
\newcommand{\trypushconjlater}{\code{try\_push\_conj\_later()}\xspace}
\newcommand{\tramp}[1]{\code{TRAMPOLINE(}#1\code{)}\xspace}
\newcommand{\fibs}[0]{\code{fibs/1+1}\xspace}
\newcommand{\fibsseq}[0]{\code{fibs\_seq/1+1}\xspace}
\newcommand{\fibsgc}[0]{\code{fibs\_gc/2+1}\xspace}
\newcommand{\Depth}[0]{\code{Depth}\xspace}
% These get used in math.
\newcommand{\prodtime}{\operatorname{prodtime}\,}
\newcommand{\prodtimep}{\operatorname{prodtime'}\,}
\newcommand{\callprodtime}{\operatorname{call\_prodtime}\,}
\newcommand{\constime}{\operatorname{constime}\,}
\newcommand{\constimep}{\operatorname{constime'}\,}
\newcommand{\callconstime}{\operatorname{call\_constime}\,}
\newcommand{\iteconstime}{\operatorname{iteconstime}\,}
\newcommand{\timef}{\operatorname{time}\,}
\DeclareMathOperator*{\Avg}{Avg}
\newcommand{\undef}{\operatorname{undefined}\xspace}
\newcommand{\canthappen}{\operatorname{cannot\,happen}\xspace}
\newcommand{\pat}[1]{\llbracket#1\rrbracket}
\newcommand{\timeofcall}{\operatorname{time\_of\_call}\xspace}
% I use this in tables to create a cell whose contents are centered.
\newcommand{\C}[1]{\multicolumn{1}{c}{#1}}
\newcommand{\Ctwo}[1]{\multicolumn{2}{c}{#1}}
% Centre with a boarder on the right.
\newcommand{\Cbr}[1]{\multicolumn{1}{c|}{#1}}
% Left over N cells with boarder.
\newcommand{\Lbr}[2]{\multicolumn{#1}{l|}{#2}}
% Decimal alignment type (dcolumn package)
\newcolumntype{d}[1]{D{.}{.}{#1}}
% Author notes.
\newcommand{\authornote}[3]{
% Comment out next line to remove author notes
% {\fbox{\sc #1}:$\triangleright$\textcolor{#2}{\textbf{#3}}$\triangleleft$}%
}
\newcommand{\paul}[1]{\authornote{Paul}{blue}{#1}}
\newcommand{\peter}[1]{\authornote{Peter}{green}{#1}}
\newcommand{\zoltan}[1]{\authornote{Zoltan}{red}{#1}}
\newcommand{\status}[1]{\authornote{Status of this section}{red}{#1}}
\newcommand{\plan}[1]{\authornote{Plan}{red}{#1}}
\newcommand{\todoitem}[3]{\parbox{4in}{#1} &
\parbox{1in}{#2} & \parbox{1in}{#3} }
% Optional prose.
\newcommand{\iclp}[1]{{}}
\newcommand{\conf}[1]{{}}
\newcommand{\tr}[1]{{#1}}
% Semantic markup.
\newcommand{\code}[1]{{\tt#1}}
\newcommand{\samp}[1]{`{\tt#1}'}
\newcommand{\param}[1]{\mbox{\it{#1}}}
\newcommand{\dfn}[1]{{\em#1}}
\newcommand{\stress}[1]{{\em#1}\/}
\newcommand{\calls}[0]{\rightarrow}
\newcommand{\instr}[1]{{\red{\code{#1}}}}
\newcommand{\instruction}[1]{\code{#1}}
\newcommand{\var}[1]{\code{#1}}
\newcommand{\nil}[0]{\code{[]}}
\newcommand{\cons}[2]{\code{[}$#1$ \code{$|$} $#2$\code{]}}
\newcommand{\single}[1]{\code{[}$#1$\code{]}}
% Layout, floats etc.
\newlength{\figboxwidth}
\setlength{\figboxwidth}{\textwidth}
\addtolength{\subfigcapskip}{1em}
\newcommand{\picfigurenofloat}[1]{
\newcommand{\spf}{\footnotesize} % Sets font size for the picture
\input{pics/#1} % defines macro called \graph
\centerline{\raise 1em\box\graph} % Prints the picture.
\vspace{1mm}
}
% 2 arguments:
% - the figure filename
% - the caption
% note that the filename will be used to form the label "fig:filename"
\newcommand{\picfigure}[2]{
\picfigurelabel{#1}{fig:#1}{#2}
}
% 3 arguments
% - the figure filename
% - the figure label
% - the caption
\newcommand{\picfigurelabel}[3]{
\begin{figure}[t]
\picfigurenofloat{#1}
\caption{#3}
\label{#2}
\end{figure}
}
% Macros for algorithm values
\newcommand{\reccallres}[3]{(\text{rec call num:~}#1,
\text{prob:~}#2,
\text{cost:~}#3)}
\newcommand{\cost}[1]{\operatorname{cost}(#1)}
% Custom float.
\floatstyle{plain}
\newfloat{float}{tbp}{lofloats}