root

A Source to Source Translator which converts a simple C program to a parallel C program embedded with OpenMP Directives.

Usage:
The input should be a C file with no other constructs like MPI, Pthreads, etc. This programs generates a new file named "output.c" which is the OpenMP C program.
The indexes inside the arrays should be one of the following pattern:
1. a*i + b
2. a*i - b
3. a*i
4. i + b
5. i - b
6. i

Compiling the output program:
You can compile the output.c file for openMP using the following command:
gcc output.c -fopenmp

Note: Quadratic equations like a*i*i + b are not supported yet.

Data Dependencies in Parallelization:
There are 3 types of data dependencies which may interfere while parallelizing the program, these are:
1. Flow Dependence.
2. Anti Dependence.
3. Output Dependence.
This program only takes the Flow and Anti Dependence into consideration because while parallelizing the code for OpenMP, output dependence doesn't account.

Working:
This program first detects all the for loops in the source code and then finds whether there is any loop carried dependence in any of the for loops. If the loops contain dependence, then the Warning is flased stating "Whether you still want to parellize the code". If Yes, then a new file is generated which consists of the source code embedded with OpenMP Directives.

Future Work:
1. Parallilize Nested Loops.
2. Convert C Code to CUDA Code.