Skip to content

Demo_Step1

Daniel Rubio Bonilla edited this page Dec 22, 2016 · 8 revisions

Annotating the Code

POGADE allows developers to easily annotate code to become POLCA compliant. With this tool, the developer can examine the behavior of the code in terms of dependencies (data flow) and assess its performance with respect to the expected number of (assembly) operations using the SmartDriver ASMC (see below) – whilst this only gives a rough estimation, the analysis of the annotations can also determine the complexity of the code. This way the developer can get a rough feeling for bottlenecks, whether a chosen set of transformations is sensible for the intended parallelization, respectively destination platform.

After installing POGADE (check installation script) it has to be setup to find other POLCA tools if these are not in the path of the system. This can be done in the menu View -> Settings. To start working with POGADE create a new project (or load a previous one). A POGADE project is basically a folder that contains copies of the different version of the source code file as well as metadata files. The "file" menu has actions to easily export and import projects between different computers and create new projects:

POGADE filemenu

Creating a new POGADE project:

POGADE newproyect

The next step is to use the "Project Viewer" to add or create source files. The left button creates a new blank source file, the middle one adds an existing source file and the left one is used to delete project files (this does not delete the original ones that are stored outside the POLCA project directory). The next picture shows a project with a single C file code:

POGADE filesinproject

A double click on the source code file will open it in the POGADE Source Code Editor.

POGADE editor

The Versioning box can be used to create new revisions of the same file, that will be added to the combo box. The changes on the editor will only affect the revision currently selected.

Once the code has been annotated with POLCA directives click on the Process button, which will call different POLCA tools and enable the visualization and code transformation features. For example the pragmas and their scopes are visualized and the possible transformation marked with a red arrow:

POGADE newproyect

The Graph button will visualize the structure of the information. The different nodes can be expanded by double clicking on them:

POGADE newproyect

The Scopes Tree button will show the tree of annotations and annotated function calls, showing the static analysis values of the ASMCount SmartDriver component together with its dependencies on the code variables. This analysis gives us the algorithmic complexity and the variables on which it depends:

POGADE newproyect

The Transformation button will open the window that lists the different transformations that are possible to be applied by the C-Source2Source tool at the current moment. Clicking on each will visualize the code before and after the transformation. As will be demonstrated later, the C-Source2Source transformer can thereby exploit machine learning to make platform-specific suggestions. The transformations can be applied directly from this window:

POGADE newproyect

To follow the reasoning on how to introduce annotations visit the Code Examples documentation. The code example used can be downloaded from here: Annotated N-Body code.