GithubHelp home page GithubHelp logo

hellcwang / chill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ctopcsutahedu/chill

0.0 0.0 0.0 4.77 MB

License: Other

Shell 0.55% C++ 94.75% Python 0.06% C 1.27% Makefile 0.30% CMake 0.60% LLVM 0.38% Yacc 1.92% M4 0.17% CWeb 0.01%

chill's Introduction

CHiLL - The Composable High-Level Loop Source-to-Source Translator

CHiLL is a source-to-source translator for composing high level loop transformations to improve the performance of nested loop calculations written in C. CHiLL’s operations are driven by a script which is generated or supplied by the user that specifies the location of the original source file, the function and loops to modify and the transformations to apply.

Quick Start

Install Prerequisites

  1. Install a boost version for Rose.
  2. Install Rose.
  3. Install isl from repository. [optional but recomended]
  4. Install IEGenLib

Build CHiLL

CHill can be built from two build systems, CMake or automake. (CMake is recomended for use with CLion)

CMake

  1. clone repository, for example: git clone https://github.com/CtopCsUtahEdu/chill.git
  2. change directory into the cloned repository & make build directory: mkdir build; cd build
  3. build with dependencies cmake .. -DROSEHOME=<...> -DBOOSTHOME=<...> -DIEGENHOME=<...> or cmake .. -DCHILLENV=<...>
  4. build make

Note: you can also create the build directory somewhere else and substitute .. with where your source is located.

Automake

  1. clone repository, for example: git clone https://echo12.cs.utah.edu/dhuth/chill-dev.git
  2. make a build directory somewhere outside of the cloned repository.
  3. cd into the newly created build directory and run .bootstrap
  4. run ./configure --with-rose=<...> --with-boost=<...> --with-iegen=<...> (optionally specify --enable-cuda=yes to build cuda-chill intsead)
  5. run make

Note that for both CMake and automake builds, all these extra variables may be specified in the environment so that they don't need to be specified each time. If something is wrong please following the error message, they usually provides a detailed report of what is missing or possibly misplaces.

Running CHiLL (example)

CHiLL takes a single python script file as an argument, and the script file will reference a C source file.

For example, here is the script file fuse_distribute.script.py

# Basic illustration of loop fusion and distribution.

from chill import *

source('fuse_distribute.c')
destination('fuse_distributemodified.c')
procedure('foo')
loop(0)

# initially fused as much as possible
original()
print_code()

# distribute the first two statements
distribute([0,1], 2)
print_code()

# prepare the third statement for fusion
shift([2], 2, 1)
print_code()

# fuse the last two statements
fuse([1,2],2)
print_code()

And the source file fuse_distribute.c

void foo(double A[100], double B[100]) {
    int i, j;
    for(i = 0; i < 100; i++) {
        for(j = 0; j < 100; j++) {
            A[j] = 1.0;
        }
        for(j = 0; j < 100; j++) {
            B[j] = 1.0;
        }
        for(j = 0; j < 99; j++) {
            B[j] = B[j+1]*A[j];
        }
    }
}

chill fuse_distribute.script.py will generate the destination source file fuse_distributemodified.c

void foo(double A[100], double B[100]) {
  int t4;
  int t2;
  for (t2 = 0; t2 <= 99; t2 += 1) {
    for (t4 = 0; t4 <= 99; t4 += 1) 
      A[t4] = 1;
    B[0] = 1;
    for (t4 = 1; t4 <= 99; t4 += 1) {
      B[t4] = 1;
      B[t4 - 1] = B[t4 - 1 + 1] * A[t4 - 1];
    }
  }
}

Examples and Testcases for CHiLL

Additional examples and testcases for CHiLL can be found under examples/chill/testcases. Testcases and exemples for CUDA-CHiLL can be found under exaples/cuda-chill/testcases.

Using Clang as frontend (experimental)

CHiLL and CUDA-CHiLL can operate with either Rose or Clang as its parser implementation. We recommend building with Rose first and try Clang if that doesn't work.

Rose will give more verbose parsing output that includes most information from the preprocessors whereas Clang will expand all includes and macros. Although we don't test result from Clang in our CI due to these minor differences, we expect it to run fine. However, Clang tends to be able to build on more platforms and is included in the official repositories of most mainstream distros, making it a good backup choice.

  1. Install dependencies from repository: clang(-dev), cmake, isl, boost
  2. Install IEGenLib

Building with Clang is currently only supported by the CMake build system. Pass "-DFRONTEND=Clang" to CMake when you are configuring, and build as above.

chill's People

Contributors

dhuth avatar ztuowen avatar king-mahdi avatar hellcwang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.