1 : |
jhr |
390 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2 : |
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3 : |
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4 : |
jhr |
366 |
<head>
|
5 : |
jhr |
390 |
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6 : |
|
|
<title>Diderot project</title>
|
7 : |
|
|
<meta name="generator" content="BBEdit 9.5">
|
8 : |
|
|
<style type="text/css" title="text/css">
|
9 : |
|
|
/* <![CDATA[ */
|
10 : |
|
|
.code-display {
|
11 : |
|
|
font-family: "Courier", monospace;
|
12 : |
|
|
white-space: pre;
|
13 : |
|
|
border: 1px solid #CBCBCB;
|
14 : |
|
|
background-color: #FFF8ED;
|
15 : |
|
|
color: mediumblue;
|
16 : |
|
|
width: 800px;
|
17 : |
|
|
padding: 1em;
|
18 : |
|
|
}
|
19 : |
|
|
.code-type {
|
20 : |
|
|
color: darkblue;
|
21 : |
|
|
font-weight: bold;
|
22 : |
|
|
}
|
23 : |
|
|
.code-kw {
|
24 : |
|
|
color: darkblue;
|
25 : |
|
|
font-weight: bold;
|
26 : |
|
|
}
|
27 : |
|
|
.code-comment {
|
28 : |
|
|
color: darkred;
|
29 : |
|
|
font-style: italic;
|
30 : |
|
|
}
|
31 : |
|
|
.warning {
|
32 : |
|
|
background-color: #FFFF66;
|
33 : |
|
|
color: red;
|
34 : |
|
|
font-style: italic;
|
35 : |
|
|
padding: 1em;
|
36 : |
|
|
}
|
37 : |
|
|
/* ]]> */
|
38 : |
|
|
</style>
|
39 : |
jhr |
366 |
</head>
|
40 : |
|
|
<body>
|
41 : |
|
|
|
42 : |
|
|
<hr />
|
43 : |
|
|
<h2 align="center">The Diderot Project</h2>
|
44 : |
|
|
<hr />
|
45 : |
|
|
|
46 : |
|
|
<h3>About</h3>
|
47 : |
|
|
<p>
|
48 : |
|
|
The Diderot project is an effort to design and implement a <i>Parallel
|
49 : |
|
|
Domain-specific Language</i> (PDSL) for image analysis and visualization.
|
50 : |
|
|
We are particularly interested in a class of algorithms that are programmed
|
51 : |
|
|
in terms of <em>continuous</em> scalar, vector, and tensor fields that
|
52 : |
jhr |
375 |
are reconstructed from the image data.
|
53 : |
|
|
Our goals are to provide a high-level mathematical programming model for
|
54 : |
|
|
these algorithms, while also providing high-performance implementations
|
55 : |
|
|
on a variety of parallel hardware platforms.
|
56 : |
jhr |
366 |
</p>
|
57 : |
|
|
|
58 : |
jhr |
376 |
<h3>People</h3>
|
59 : |
|
|
<ul>
|
60 : |
|
|
<li><a href="http://cs.uchicago.edu/~glk/">Gordon Kindlmann</a></li>
|
61 : |
|
|
<li><a href="http://cs.uchicago.edu/~jhr/">John Reppy</a></li>
|
62 : |
|
|
<li><a href="http://www.cs.uchicago.edu/people/lamonts">Lamont Samuels</a></li>
|
63 : |
jhr |
389 |
<li><a href="http://www.cs.uchicago.edu/people/nseltzer">Nicholas Seltzer</a></li>
|
64 : |
jhr |
376 |
</ul>
|
65 : |
|
|
|
66 : |
jhr |
375 |
<h3>Language overview</h3>
|
67 : |
|
|
<p>
|
68 : |
|
|
The following is an overview of our current preliminary design for Diderot.
|
69 : |
|
|
We are building a compiler for this design and expect that the design will
|
70 : |
|
|
evolve as we get experience with the implementation.
|
71 : |
|
|
Also, the design is conservative, in that it does not provide all of the features that
|
72 : |
|
|
we plan to provide (<i>e.g.</i>, actor-actor interactions).
|
73 : |
|
|
</p>
|
74 : |
|
|
|
75 : |
|
|
<h4>Types</h4>
|
76 : |
|
|
<p>
|
77 : |
|
|
The main type of computational value in Diderot is a <em>tensor</em>, which includes
|
78 : |
|
|
reals (0-order tensors), vectors, and matrices.
|
79 : |
|
|
In addition, Diderot provides booleans, integers, and strings.
|
80 : |
|
|
Diderot also has three <em>abstract</em> types:
|
81 : |
|
|
</p>
|
82 : |
|
|
<dl>
|
83 : |
|
|
<dt>images</dt>
|
84 : |
|
|
<dd>are used to represent the data being analyzed, as well as other array data, such as transfer
|
85 : |
|
|
functions.
|
86 : |
|
|
</dd>
|
87 : |
|
|
<dt>kernels</dt>
|
88 : |
|
|
<dd>are separable convolution kernels</dd>
|
89 : |
|
|
<dt>fields</dt>
|
90 : |
|
|
<dd>are an abstraction of functions from 1D, 2D, or 3D space to some tensor type.
|
91 : |
|
|
A field is defined by convolving an image with a kernel.
|
92 : |
|
|
</dd>
|
93 : |
|
|
</dl>
|
94 : |
|
|
|
95 : |
|
|
<h4>Program structure</h4>
|
96 : |
|
|
<p>A Diderot program is organized into three logical sections:</p>
|
97 : |
|
|
<ol>
|
98 : |
|
|
<li>Global declarations define global values, such as fields, as well as the inputs to the program.</li>
|
99 : |
|
|
<li>Actor definitions define the computational agents that implement the program</li>
|
100 : |
|
|
<li>Initialization defines the initial set of actors and their structure</li>
|
101 : |
|
|
</ol>
|
102 : |
|
|
|
103 : |
|
|
<h4>Actors</h4>
|
104 : |
|
|
<p>
|
105 : |
|
|
An <em>actor</em> represents a mostly autonomous computation with local state, which includes
|
106 : |
|
|
their <em>position</em> in world space.
|
107 : |
|
|
An actor definition consists of declared state variables and methods.
|
108 : |
|
|
All actors must have an <em>update</em> method and may optionally have a <em>stabilize</em>
|
109 : |
|
|
method.
|
110 : |
|
|
</p>
|
111 : |
|
|
|
112 : |
|
|
<h4>Execution model</h4>
|
113 : |
|
|
<p>The Diderot execution model is <em>bulk synchronous</em>.
|
114 : |
|
|
At each iteration, the update methods of all active actors are invoked, resulting in a new
|
115 : |
|
|
configuration.
|
116 : |
|
|
</p>
|
117 : |
|
|
|
118 : |
jhr |
390 |
<h4>An example: A simple volume renderer in Diderot</h4>
|
119 : |
|
|
<p>
|
120 : |
|
|
The following code is a simple diffuse-only volume rendering with head-light
|
121 : |
|
|
written in Diderot.
|
122 : |
|
|
It uses an opacity function that varies linearly between two values.
|
123 : |
|
|
This example illustrates the use of probing both a field and its gradient.
|
124 : |
|
|
</p>
|
125 : |
|
|
<p class="warning">
|
126 : |
|
|
This example uses Unicode characters for convolution (code point <tt>\u229B</tt>)
|
127 : |
|
|
and differentiation (code point <tt>\u2207</tt>).
|
128 : |
|
|
If your browser has trouble with displaying these characters, an
|
129 : |
|
|
ASCII-only version can be found <a href="vr-lite-ascii.html">here</a>.
|
130 : |
|
|
</p>
|
131 : |
|
|
|
132 : |
|
|
<div align="center">
|
133 : |
|
|
<div align="left" class="code-display"><span class="code-type">input</span> <span class="code-type">string</span> dataFile; <span class="code-comment">// name of dataset</span>
|
134 : |
|
|
<span class="code-type">input</span> <span class="code-type">real</span> stepSz = 0.1; <span class="code-comment">// size of steps</span>
|
135 : |
|
|
<span class="code-type">input</span> <span class="code-type">vec3</span> eye; <span class="code-comment">// location of eye point</span>
|
136 : |
|
|
<span class="code-type">input</span> <span class="code-type">vec3</span> orig; <span class="code-comment">// location of pixel (0,0)</span>
|
137 : |
|
|
<span class="code-type">input</span> <span class="code-type">vec3</span> cVec; <span class="code-comment">// vector between pixels horizontally</span>
|
138 : |
|
|
<span class="code-type">input</span> <span class="code-type">vec3</span> rVec; <span class="code-comment">// vector between pixels vertically</span>
|
139 : |
|
|
<span class="code-type">input</span> <span class="code-type">real</span> valOpacMin; <span class="code-comment">// highest value with opacity 0.0</span>
|
140 : |
|
|
<span class="code-type">input</span> <span class="code-type">real</span> valOpacMax; <span class="code-comment">// lowest value with opacity 1.0 </span>
|
141 : |
|
|
|
142 : |
|
|
<span class="code-type">image(3)[]</span> img = load (dataFile);
|
143 : |
|
|
<span class="code-type">field#1(3)[]</span> F = img ⊛ bspln3;
|
144 : |
|
|
|
145 : |
|
|
<span class="code-kw">actor</span> RayCast (<span class="code-type">int</span> row, <span class="code-type">int</span> col)
|
146 : |
|
|
{
|
147 : |
|
|
<span class="code-type">vec3</span> pos = orig + <span class="code-type">real</span>(row)*rVec + <span class="code-type">real</span>(col)*cVec;
|
148 : |
|
|
<span class="code-type">vec3</span> dir = (pos - eye)/|pos - eye|;
|
149 : |
|
|
<span class="code-type">real</span> t = 0.0;
|
150 : |
|
|
<span class="code-type">real</span> transp = 1.0;
|
151 : |
|
|
<span class="code-type">real</span> gray = 0.0;
|
152 : |
|
|
<span class="code-type">output</span> <span class="code-type">vec4</span> rgba = [0.0, 0.0, 0.0, 0.0];
|
153 : |
|
|
|
154 : |
|
|
<span class="code-kw">update</span> {
|
155 : |
|
|
pos = pos + stepSz*dir;
|
156 : |
|
|
<span class="code-kw">if</span> (inside (pos,F)) {
|
157 : |
|
|
<span class="code-type">real</span> val = F@pos;
|
158 : |
|
|
<span class="code-type">vec3</span> grad = ∇F@pos;
|
159 : |
|
|
<span class="code-type">vec3</span> norm = -grad / |grad|;
|
160 : |
|
|
<span class="code-kw">if</span> (val > valOpacMin) { <span class="code-comment">// we have some opacity </span>
|
161 : |
|
|
<span class="code-type">real</span> opac =
|
162 : |
|
|
1.0 <span class="code-kw">if</span> (val > valOpacMax)
|
163 : |
|
|
<span class="code-kw">else</span> (val - valOpacMin)/(valOpacMax - valOpacMin);
|
164 : |
|
|
gray = gray + transp*opac*max(0.0, dot(-dir,norm));
|
165 : |
|
|
transp = transp*(1.0 - opac);
|
166 : |
|
|
}
|
167 : |
|
|
}
|
168 : |
|
|
<span class="code-kw">if</span> (transp < 0.01) { <span class="code-comment">// early ray termination</span>
|
169 : |
|
|
transp = 0.0;
|
170 : |
|
|
<span class="code-kw">stabilize</span>;
|
171 : |
|
|
}
|
172 : |
|
|
<span class="code-kw">if</span> (t > 40.0) {
|
173 : |
|
|
<span class="code-kw">stabilize</span>;
|
174 : |
|
|
}
|
175 : |
|
|
t = t + stepSz;
|
176 : |
|
|
}
|
177 : |
|
|
|
178 : |
|
|
<span class="code-kw">stabilize</span> {
|
179 : |
|
|
rgba = [gray, gray, gray, 1.0-transp];
|
180 : |
|
|
}
|
181 : |
|
|
|
182 : |
|
|
}
|
183 : |
|
|
|
184 : |
|
|
<span class="code-kw">initially</span> [ RayCast(r, c) | r in 0..199, c in 0..199 ];
|
185 : |
|
|
</div>
|
186 : |
|
|
</div>
|
187 : |
|
|
|
188 : |
jhr |
366 |
<h3>Status</h3>
|
189 : |
|
|
<p>
|
190 : |
|
|
We have a prototype language design that can handle simple examples, such as volume
|
191 : |
|
|
rendering, and we are working on a baseline compiler for the design.
|
192 : |
|
|
This compiler will generate CUDA or OpenCL code for running on GPUs.
|
193 : |
|
|
</p>
|
194 : |
|
|
|
195 : |
jhr |
376 |
<h3>Further information</h3>
|
196 : |
|
|
<p>
|
197 : |
|
|
We have not published any papers on Diderot yet, but here are some unpublished documents that provide
|
198 : |
|
|
additional details about the project.
|
199 : |
|
|
</p>
|
200 : |
|
|
<ul>
|
201 : |
|
|
<li><a href="papers/msrc-talk-20100906.pdf"><em>Diderot: A parallel domain-specific language for image analysis</em></a>, talk
|
202 : |
|
|
given at Microsoft Research --- Cambridge, September 6, 2010.
|
203 : |
|
|
</li>
|
204 : |
|
|
</ul>
|
205 : |
|
|
|
206 : |
jhr |
366 |
<hr />
|
207 : |
jhr |
390 |
Last modified: October 13, 2010.
|
208 : |
jhr |
366 |
<hr />
|
209 : |
|
|
|
210 : |
|
|
</body>
|
211 : |
|
|
</html>
|