Setting up the compilation environment

The following commands should give you a working compilation environment:

mkdir hwrt
cd hwrt
svn co svn://lenny.eng.utah.edu/research/ece/caddis/hwrt/svn/HWRT/SimHWRT/trunk sim
svn co svn://lenny.eng.utah.edu/research/ece/caddis/hwrt/svn/HWRT/LLVM_Trax
cd LLVM_Trax
./setup.sh
cd ../sim
make
The ./setup.sh should take a very long time to run and print a bunch of messages about the build of LLVM. When you run make to build the trax simulator it should also take a while, but not quite as long. If you prefer to set up things using a different directory structure, then you will have to change the paths in the LLVM_Trax/examples/Makefile so that it will compile. The base directory (hwrt) could be any name and placed anywhere you would like in your filesystem.

Example and Makefile

The examples directory in LLVM_Trax is an example of filling the screen with a gradient and should give you a basic idea of how to use atomicinc in the outer loop to divide the work among threads. The Makefile assumes the directory structure from above, so if you change the location then you'll need to modify the paths in the Makefile. The example code should generate the following image:
gradient example output

If you are building on the CADE machines the executable path for llvm-gcc should be correct in the Makefile. If you are building on a mac, uncomment the line

TRAXC=llvm-gcc
and comment out the line
TRAXC=/usr/local/stow/llvm-gcc/llvm-gcc4.2-2.6/bin/g++
.

Recommended Method

I recommend for starting a new trax code project to copy at least the Makefile from the examples directory into a new directory in LLVM_Trax. This Makefile will make sure the trax.hpp include file is available in the paths when you compile and make sure you can compile both to a standard executable as well as to a trax assembly .s file. Be sure to put whatever filename you chose for your file in the Makefile source list and make should work.

Setting up your own project

I recommend for starting a new trax code project to copy at least the Makefile from the examples directory into a new directory in LLVM_Trax. This Makefile will make sure the trax.hpp include file is available in the paths when you compile and make sure you can compile both to a standard executable as well as to a trax assembly .s file. In addition, the makefile will compile all .cc files in the directory to the executable as well as .bc files in the obj directory. You should end up with an x86 executable called run_rt and a TRaX assembly file called rt-llvm.s. run_rt is the CPU version of your code, and rt-llvm.s is the code to pass to the TRaX simulator to run it as a TRaX program.