Getting Started

Requirements

Package Version Note
gcc >=4.9.x If you want to build llvm with gcc too, please follow llvm’s requirement for gcc
clang >=3.8.x Only tested with v3.8
llvm >=3.8.x Only tested with v3.8 and v4.0, other versions might work
cmake >=3.1.x  
Python v2.7.x  
Gurobi Optimizer v7.0.2 or v6.5.2 Only free with academic license, but there is free trial

Installation

  1. Download the source code package from download page
  2. Create a directory with your prefered name <PROJ_DIR>
  3. Extract the source code package in <PROJ_DIR> directory
  4. Extract Gurobi library package in <PROJ_DIR>
  5. Go to Gurobi website to register and request a license, also download the Gurobi library
  6. In bin subdirectory of Gurobi directory run $ ./grbgetkey <key-you-obtained> to activate your Gurobi

Note

  • If you are using Debian/Ubuntu and installed llvm from apt-get, make sure you have the llvm-<version number>-dev package.
  • If you are building llvm from source, make sure you put the build or install directory in your $PATH environment variable.
  1. $ cd into <PROJ_DIR>\cgra-me-uoft and $ make

See also

Reference the CMake Build guide if you want to use the complete feature, this is only a Makefile wrapper to CMake.

See Troubleshoot if you encountered any problem in installatiton process.

Generate Benchmark DFGs

Now, you can generate some DFGs (Data Flow Graph) from some of the benchmarks we provided. DFGs are the representation of the datapath side of a computation kernel.

  1. $ cd <PROJ_DIR>/cgra-me-uoft/benchmarks/microbench
  2. $ make

This will generate all of the micro-benchmarks we provided, which can be used for mapping later on

Mapping

This is the process of taking a DFG and a CGRA architecture and mapping the computation kernel onto the CGRA. For simplicity, we have some basic CGRA architecture delivered with the source code. Now we try to map a DFG that we just generated from C source code to a architechture.

  1. $ cd <PROJ_DIR>/cgra-me-uoft/build/bin
  2. $ ./cgrame_ilp_map -g ../../benchmarks/microbench/accumulate/graph_loop.dot -i 2

Now if everything is setup correctly, you should see the mapper running. Wait for while, as it can take some time to complete. We are running a benchmark that does accumulation, with a four by four homogeneous orthogonal configuration. We are allowing two contexts for contexts switching.

Notice that we have more then one excutable in bin directory. The cgrame_anneal_map uses Simulated Annealing mapping method, and the cgrame_ilp_map uses ILP method. The cgrame_map can take custom architecture but it uses Simulated Annealing method. ILP method is prefered.

Conclusion

This is only a getting started guide to CGRA-ME, there are many other features, you can read the User Guide if you want to know more about them.

Troubleshoot

  • I have cmake error about cannot find llvm package
    • Using apt-get: the package manmager could mess up stuff sometimes, please check if you have any of the following directory in you $PATH: /usr/ or /usr/bin/ or /usr/sbin/
      • If you don’t see any of the above add /usr/ to your $PATH, then try build again
    • Build from llvm source: try to add <LLVM_DIR>/build/ to your $PATH, then try build again

Note

If the above did not help you, it might be that you have a existing llvm installed and it is tricking the package searcher from cmake. Reference the user guide and run cmake with the argument -DCMAKE_PREFIX_PATH=<path/to/your/llvm> to override the default llvm cmake file.

Send us an e-mail if you have any other problem!