Overview

Parallel raytracer / renderer that demonstrates the use of parallel_for.

This example includes software developed by John E. Stone. See here for copyright information.

This example is a 2-D raytracer/renderer that visually shows different parallel scheduling methods and their resulting speedup. The code was parallelized by speculating that each pixel could be rendered in parallel. The resulting parallel code was then checked for correctness by using Intel® Thread Checker, which pointed out where synchronization was needed. Minimal synchronization was then inserted into the parallel code. The resulting parallel code exhibits good speedup.

The following versions of the example are provided:

serial
Original sequential version.
tbb1d
Parallel version that uses Threading Building Blocks and blocked_range to parallelize over tasks that are groups of scan-lines.
tbb
Parallel version that uses Threading Building Blocks and blocked_range2d to parallelize over tasks that are rectangular sub-areas.

Files

src/video.cpp
Source code for main program and GUI interfaces.
src/trace.serial.cpp
Source code for original sequential version of example.
src/trace.tbb1d.cpp
Source code for Threading Building Blocks blocked_range (scan-line) version of example.
src/trace.tbb.cpp
Source code for Threading Building Blocks blocked_range2d (rectangular sub-area) version of example.
(src/*.cpp)
Remainder of source code for example.
(src/*.h)
Remainder of include files for example.
Makefile
Makefile for building example.

Directories

src
Contains source code and include files for the example.
dat
Contains data sets for running the example.
vc7.1
Contains Microsoft* Visual Studio* .NET 2003 workspace for building and running the example.
vc8
Contains Microsoft* Visual Studio* 2005 workspace for building and running the example.
vc9
Contains Microsoft* Visual Studio* 2008 workspace for building and running the example.
xcode
Contains Xcode* IDE workspace for building and running the example.

To Build

General build directions can be found here.

For Windows* systems, Microsoft* Visual Studio* projects are provided for each of the above versions.

The Makefile supports the following build targets (in addition to the general ones). Here, <version> is one of the above versions of the example, i.e., {serial, tbb1d, tbb}.

make <version>[_debug]
Build and run a single version (release or debug). Equivalent to 'make build_<version>[_debug] run_<version>'.
make build_<version>[_debug]
Compile and link a single version (release or debug). The resulting executable is left in the directory for the example.
make run_<version>
Run a single version previously produced by one of the above commands.
make [(above options or targets)] DATASET={820spheres, balls, balls3, lattice, model2, teapot, trypsin4pti}
Build and run as above, but run with the specified data set.
make [(above options or targets)] ARGS=-D
Build and run as above, but run with disabled run-time display updating for use in making performance measurements (strongly recommended when measuring performance or scalability; see note below).
make [(above options or targets)] UI={con, gdi, dd, x, mac}
Build and run as usual, but build with the specified GUI driver: console, GDI+*, Direct Draw*, X11, or OpenGL* (see the description of the common GUI code for more information on available graphics support). For Linux* and Mac OS* X systems, the best available driver is detected automatically by the Makefile. For Windows* systems, UI=gdi is the default GUI driver; compiling with UI=dd may offer superior performance, but can only be used if the Microsoft* Direct Draw* SDK is installed on your system and if overlay is supported by your graphics card. Use UI=con to build without the GUI for use in making performance measurements (strongly recommended when measuring performance or scalability; see note below).
make [(above options or targets)] XARCH=x64
Build and run as above, but also specify XARCH=x64 (or XARCH=AMD64 for older compilers) when building the example on Windows* as a 64-bit binary.
make [(above options or targets)] DDLIB_DIR=<specify path to library directory of Direct Draw* SDK here>
If you experience ddraw.lib linking problems, specify the correct library directory via this option.

Usage

Building via the above make commands, or via Visual Studio projects on Windows* systems, produces executable files named tacheon.<version>.exe. To run these executables directly, use one or more of the following commands.
tacheon.<version>.exe <dataset>
Run this version (release or debug), where <dataset> is the path/name of one of the *.dat files in the dat directory for the example.
tacheon.<version>.exe -D <dataset>
Run this version (release or debug), but run with disabled run-time display updating for use in making performance measurements (strongly recommended when measuring performance or scalability; see note below).
To run a short version of this example, e.g., for use with Intel® Threading Tools:
Build a debug version of the tbb example with the GUI turned off (e.g., make UI=con tbb_debug; see also the build directions above).
Run it with a small dataset, e.g., tacheon.tbb.exe -D dat/820spheres.dat.

Notes


Up to parent directory

Copyright © 2005-2008 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.

The original source for this example is
Copyright (c) 1994, 1995, 1996, 1997 John E. Stone All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by John E. Stone
  4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.