Getting Started

The following instructions are for the Unix and OSX platforms. Windows support is coming soon. We recommend using Sublime or similar for development. Full IDE support is still experimental.

From Source

Delite requires Java 1.7 or later, Python 2.7, git and SBT 0.13. Instructions for installing these can be found at their respective websites. Be sure to increase the default heap size for sbt (we recommend at least 4GB).

To get started, you first need to download the source for virtualization-lms-core, Delite and Forge. These three libraries provide 1) staging support to embed DSLs in Scala, 2) a parallel and heterogeneous compiler, and 3) the meta DSL that Delite DSLs are implemented in, respectively.

These three repositories have been packaged into a singe repository called hyperdsl using git submodules. First, make a copy of the hyperdsl repository and its submodules on your machine:

git clone https://github.com/stanford-ppl/hyperdsl.git
cd hyperdsl 
git checkout tutorial
git submodule update --init

Now we need the JAVA_HOME environment variable to be set. If it is not already, you will need to set it:

export JAVA_HOME=[absolute path of JDK installation] 

Next, we need to compile each project and make them available to our DSLs as a dependency. Compiling requires a few environment variables to be set, the proper defaults for which can be found in init-env.sh. From the hyperdsl directory type

source init-env.sh
sbt compile

We're almost done. The remainder of these instructions are covered in detail in the tutorial. However, if you want to get a jump start, keep going!

Now we need to run Forge to generate each DSL. Start with a simple example:

forge/bin/update ppl.dsl.forge.examples.SimpleVectorDSLRunner SimpleVector

The generated DSL is now located in the directory published/SimpleVector. We can run applications from there. Forge generates two versions of the DSL: an interpreter, which is a pure Scala library implementation, and the compiler, which is the Delite implementation. All Delite applications have three phases: compiling (Scala), staging (DSL compilation), and executing (runtime). The first step, running the scala compiler, checks your application for syntactic and type correctness. Staging is where the main compilation happens: the DSL builds an IR of the program, optimizes it, and generates an execution graph along with code for multiple targets (e.g. Scala and CUDA). Finally, the Delite runtime reads in the execution graph and generated kernels and executes the application.

Since Delite compilation can take a while (but produces high performance code), the recommended strategy is to use the interpreter while developing and prototyping, and then run the Delite version to scale out to larger datasets or heterogeneous hardware.

So without further ado, let's get to it. Starting from the published/SimpleVector directory, first compile the example application (in apps/src) and then run the interpreter version:

cd published/SimpleVector
sbt compile
bin/delitec HelloSimpleInterpreter 10

If all went well, you should see hello world (and a bunch of other stuff) printed to the console!

Now we can run the compiler version simply by changing the argument to the Delite:

bin/delitec HelloSimpleCompiler
bin/delite HelloSimpleCompiler 10

In this case delitec generates new code for the application rather than interpreting the application directly, and delite runs the generated code.

Congratulations! You just ran your first Delite application. You can find the generated code within published/SimpleVector/generated/