Skip to content

ESROCOS/ilk-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the readme file of the ILK-Compiler tool.

Usage

Prerequisites

A valid Lua interpreter (Lua5.2 -- suggested, Lua5.3 or Luajit), and the luarocks tool are required. Please install them from your package manager (or from sources). For example, you could follow this procedure (tested on Ubuntu 16.04 - requires wget, unzip, tar, make, git):

  1. Install Lua 5.2 and liblua5.2-dev (NOTE: getting luarocks using apt-get install results in an incompatible installation on Ubuntu 16.04 as of 14 Jun 2018)

    sudo apt-get install lua5.2 liblua5.2-dev

  2. Download and install luarocks

    • download from https://luarocks.org/ or using wget

    • unpack the source archive

    • compile and install

      wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.4.tar.gz
      tar zxvf luarocks-2.4.4.tar.gz
      cd luarocks-2.4.4/
      ./configure --lua-version=5.2
      make build
      sudo make install
      cd ..
      
  3. Install Lua dependencies using luarocks:

    cd etc/
    luarocks install --local --only-deps ilkcompiler-0.4.0-1.rockspec
    

Running the tool

First issue this command in your shell:

eval `luarocks path`

Then you can run the actual compiler; no arguments or the --help switch will show some usage information:

./ilk-compiler.lua --help

Generated code

The output directory will contain the code generated by the compiler, in the language selected with the --backend switch. Currently, three backends (i.e. target languages) are supported:

  • C++/Eigen (--backend=eigen)
  • Python/Numpy (--backend=numpy)
  • Julia (--backend=julia)

C++ / Eigen backend

Building

You will need the Eigen3 C++ library installed in your system, including the corresponding pkg-config configuration file (which is usually /usr/local/share/pkgconfig/eigen3.pc). This file will be installed if you follow the standard make procedure for Eigen.

You also need our Eigen backend library, which is shipped within this repository. It is a minimal collection of support functions referenced by the generated code. Please build and install it in your system, using the standard CMake procedure:

cd backend/eigen
mkdir build
cd build
cmake ..
make
sudo make install

Afterwards, you can build the generated code also with cmake; in the output directory where the code was generated:

mkdir build
cd build/
cmake ..
make

Type make edit_cache to change some options, like enabling the building of the tests.

Python/Numpy backend

Please add to your PYTHONPATH the location of our Python backend package, which is backend/ilknumpy -- the full path of backend/ must appear in PYTHONPATH, as ilknumpy is the actual package.

Julia backend

Please set the JULIA_LOAD_PATH environment variable with the path of our Julia backend module (under backend/julia) and the path with the generated code. For example:

export JULIA_LOAD_PATH=.../ilk-compiler/backend/julia/:/tmp/ilkgen/julia:

Do not forget the trailing :.