User Tools

Site Tools



This section provides links to a few tutorials, targeted from beginners to advanced users. Before performing one or more of theses tutorials, be sure that you have installed GeCoS. At the beginning of each tutorial, a section named Feature requirement show which features you need to have installed before running each tutorial.

*Disclaimer* As GeCoS is a rapidly changing software, some tutorials may contains bugs or have inconsistencies. You may also find the tutorial unclear or just simply wrong. In that case please report the problems that you encountered either on the gecos-user mailing lists or report a bug on the bug tracking page


First step with GeCoS

Source-to-Source transformations

Testing transformations

The GeCoS module “ModuleTester” provides a simple and quick way to test transformations used inside a GeCoS script. In short, given a list of GecosProjects, it can performs the following steps, depending on the specified options:

  • Generate C code version for each of the projects.
  • Compile the generated C codes for all versions.
  • Link each version to generate an executable (the project must have a “main” Procedure!).
  • Execute all versions.
  • Compare their outputs.


The “ModuleTester” is part of GeCoS testing framework. Thus, in order to use it you should get the following plugin from the GeCoS svn repository:

  • /trunk/gecos/test-utils/fr.irisa.cairn.gecos.tests.framework

This module currently issues bash commands. The following commands are required:

  • bash
  • gcc
  • timeout


The “ModuleTester” can be invoked in a GeCoS scirpt as following:

TesterModule(projects, String testMode, String compareMode, Boolean compareCode, String codegenDir) with:

  • projects: List of GecosProjects to be tested.
  • testMode: String specifying the Test mode. It can be one of the following:
    • “CODEGEN”: generate code only for all projects.
    • “COMPILE”: “CODEGEN” + compile all projects.
    • “EXECUTE”: “COMPILE” + link and execute all projects. (NOTE: this require the projects to have a “main” procedure!)
    • [“AUTO”] : “EXECUTE” if a “main” procedure is available in both versions, otherwise “COMPILE”.
  • compareMode: String specifying the Comparison mode when “EXECUTE”. Supported values are:
    • [“EXIT”] : Check the exit code of the “EXECUTE” commands: if non-zero the test is considered a failure.
    • “STDOUT” : “EXIT” + compare outputs on stdout.
  • compareCode: if true the source code files of both versions are compared.
  • codegenDir: the path of directory to used for placing the generated files.

Here is an example of how the “ModuleTester” can be used to test the loop unrolling transformation:

# Create a GecosProject and Parse it
project = CreateGecosProject("Unroll Project");
# save project before applying the transformation
SaveGecosProject(project, "project_orig.gecosproject");
# Perform loop unrolling
### Testing the transformation:
# - origProj: is the GeCosProject before applying loop unrolling
# - project: is the project after loop unrolling
origProj = LoadGecosProject"project_orig.gecosproject");
modProj = project;
# This will do the following:
# - generate c code for both projects in "./test"
# - compile, link and execute code from both projects
# - Assert that the exit code is zero for both executables and finally 
# compares the output on the 
TesterModule({origProj, modProj}, "EXECUTE", "STDOUT", false, "./test");


Use the GeCoS IR

Extend the GeCoS IR

Static Single Assignment

Polyhedral Framework

Hierarchical Tasks Graph

IGraph framework


tutos/home.txt · Last modified: 2017/03/03 15:40 by aelmouss