Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /web/htdocs/index.html
ViewVC logotype

View of /web/htdocs/index.html

Parent Directory Parent Directory | Revision Log Revision Log

Revision 390 - (download) (as text) (annotate)
Wed Oct 13 19:56:41 2010 UTC (11 years, 3 months ago) by jhr
File size: 8457 byte(s)
  Add VR lite example in both ASCII and Unicode versions
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Diderot project</title>
  <meta name="generator" content="BBEdit 9.5">
  <style type="text/css" title="text/css">
    /* <![CDATA[ */
	.code-display {
		font-family: "Courier", monospace;
		white-space: pre;
		border: 1px solid #CBCBCB;
		background-color: #FFF8ED;
		color: mediumblue;
		width: 800px;
		padding: 1em;
	.code-type {
		color: darkblue;
		font-weight: bold;
	.code-kw {
		color: darkblue;
		font-weight: bold;
	.code-comment {
		color: darkred;
		font-style: italic;
	.warning {
		background-color: #FFFF66;
		color: red;
		font-style: italic;
		padding: 1em;
    /* ]]> */

<hr />
<h2 align="center">The Diderot Project</h2>
<hr />

The Diderot project is an effort to design and implement a <i>Parallel
Domain-specific Language</i> (PDSL) for image analysis and visualization.
We are particularly interested in a class of algorithms that are programmed
in terms of <em>continuous</em> scalar, vector, and tensor fields that
are reconstructed from the image data.
Our goals are to provide a high-level mathematical programming model for
these algorithms, while also providing high-performance implementations
on a variety of parallel hardware platforms.

  <li><a href="http://cs.uchicago.edu/~glk/">Gordon Kindlmann</a></li>
  <li><a href="http://cs.uchicago.edu/~jhr/">John Reppy</a></li>
  <li><a href="http://www.cs.uchicago.edu/people/lamonts">Lamont Samuels</a></li>
  <li><a href="http://www.cs.uchicago.edu/people/nseltzer">Nicholas Seltzer</a></li>

<h3>Language overview</h3>
The following is an overview of our current preliminary design for Diderot.
We are building a compiler for this design and expect that the design will
evolve as we get experience with the implementation.
Also, the design is conservative, in that it does not provide all of the features that
we plan to provide (<i>e.g.</i>, actor-actor interactions).

The main type of computational value in Diderot is a <em>tensor</em>, which includes
reals (0-order tensors), vectors, and matrices.
In addition, Diderot provides booleans, integers, and strings.
Diderot also has three <em>abstract</em> types:
    <dd>are used to represent the data being analyzed, as well as other array data, such as transfer
    <dd>are separable convolution kernels</dd>
    <dd>are an abstraction of functions from 1D, 2D, or 3D space to some tensor type.
    A field is defined by convolving an image with a kernel.

<h4>Program structure</h4>
<p>A Diderot program is organized into three logical sections:</p>
  <li>Global declarations define global values, such as fields, as well as the inputs to the program.</li>
  <li>Actor definitions define the computational agents that implement the program</li>
  <li>Initialization defines the initial set of actors and their structure</li>

An <em>actor</em> represents a mostly autonomous computation with local state, which includes
their <em>position</em> in world space.
An actor definition consists of declared state variables and methods.
All actors must have an <em>update</em> method and may optionally have a <em>stabilize</em>

<h4>Execution model</h4>
<p>The Diderot execution model is <em>bulk synchronous</em>.
At each iteration, the update methods of all active actors are invoked, resulting in a new

<h4>An example: A simple volume renderer in Diderot</h4>
The following code is a simple diffuse-only volume rendering with head-light
written in Diderot.
It uses an opacity function that varies linearly between two values.
This example illustrates the use of probing both a field and its gradient.
<p class="warning">
This example uses Unicode characters for convolution (code point <tt>\u229B</tt>)
and differentiation (code point <tt>\u2207</tt>).
If your browser has trouble with displaying these characters, an
ASCII-only version can be found <a href="vr-lite-ascii.html">here</a>.

<div align="center">
<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>
<span class="code-type">input</span> <span class="code-type">real</span> stepSz = 0.1;  <span class="code-comment">// size of steps</span>
<span class="code-type">input</span> <span class="code-type">vec3</span> eye;           <span class="code-comment">// location of eye point</span>
<span class="code-type">input</span> <span class="code-type">vec3</span> orig;          <span class="code-comment">// location of pixel (0,0)</span>
<span class="code-type">input</span> <span class="code-type">vec3</span> cVec;          <span class="code-comment">// vector between pixels horizontally</span>
<span class="code-type">input</span> <span class="code-type">vec3</span> rVec;          <span class="code-comment">// vector between pixels vertically</span>
<span class="code-type">input</span> <span class="code-type">real</span> valOpacMin;    <span class="code-comment">// highest value with opacity 0.0</span>
<span class="code-type">input</span> <span class="code-type">real</span> valOpacMax;    <span class="code-comment">// lowest value with opacity 1.0 </span>

<span class="code-type">image(3)[]</span> img = load (dataFile);
<span class="code-type">field#1(3)[]</span> F = img ⊛ bspln3;

<span class="code-kw">actor</span> RayCast (<span class="code-type">int</span> row, <span class="code-type">int</span> col)
    <span class="code-type">vec3</span> pos = orig + <span class="code-type">real</span>(row)*rVec + <span class="code-type">real</span>(col)*cVec;
    <span class="code-type">vec3</span> dir = (pos - eye)/|pos - eye|;
    <span class="code-type">real</span> t = 0.0;
    <span class="code-type">real</span> transp = 1.0;
    <span class="code-type">real</span> gray = 0.0;
    <span class="code-type">output</span> <span class="code-type">vec4</span>	rgba = [0.0, 0.0, 0.0, 0.0];

    <span class="code-kw">update</span> {
        pos = pos + stepSz*dir;
        <span class="code-kw">if</span> (inside (pos,F)) {
            <span class="code-type">real</span> val = F@pos;
            <span class="code-type">vec3</span> grad = ∇F@pos;
            <span class="code-type">vec3</span> norm = -grad / |grad|;
            <span class="code-kw">if</span> (val > valOpacMin) {  <span class="code-comment">// we have some opacity </span>
                <span class="code-type">real</span> opac =
			1.0 <span class="code-kw">if</span> (val > valOpacMax)
			<span class="code-kw">else</span> (val - valOpacMin)/(valOpacMax - valOpacMin);
                gray = gray + transp*opac*max(0.0, dot(-dir,norm));
                transp = transp*(1.0 - opac);
        <span class="code-kw">if</span> (transp < 0.01) {  <span class="code-comment">// early ray termination</span>
            transp = 0.0;
            <span class="code-kw">stabilize</span>;
        <span class="code-kw">if</span> (t > 40.0) {
            <span class="code-kw">stabilize</span>;
        t = t + stepSz;

     <span class="code-kw">stabilize</span> {
        rgba = [gray, gray, gray, 1.0-transp];


<span class="code-kw">initially</span> [ RayCast(r, c) | r in 0..199, c in 0..199 ];

We have a prototype language design that can handle simple examples, such as volume
rendering, and we are working on a baseline compiler for the design.
This compiler will generate CUDA or OpenCL code for running on GPUs.

<h3>Further information</h3>
We have not published any papers on Diderot yet, but here are some unpublished documents that provide
additional details about the project.
  <li><a href="papers/msrc-talk-20100906.pdf"><em>Diderot: A parallel domain-specific language for image analysis</em></a>, talk
  given at Microsoft Research --- Cambridge, September 6, 2010.

<hr />
Last modified: October 13, 2010.
<hr />


ViewVC Help
Powered by ViewVC 1.0.0