https://github.com/adharshkamath/mathy-compiler
A compiler to generate OpenMP programs for equations involving constructs like Forall, Summation, etc., frequently used in the scientific domain
https://github.com/adharshkamath/mathy-compiler
bison c compiler compiler-construction cpp equation flex lex mathematical-equation mathematical-notations omp-parallel openmp openmp-programs parallelization transpiler yacc
Last synced: 3 months ago
JSON representation
A compiler to generate OpenMP programs for equations involving constructs like Forall, Summation, etc., frequently used in the scientific domain
- Host: GitHub
- URL: https://github.com/adharshkamath/mathy-compiler
- Owner: adharshkamath
- License: gpl-3.0
- Created: 2020-06-13T05:26:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-14T20:10:31.000Z (over 4 years ago)
- Last Synced: 2023-03-06T01:18:56.563Z (over 2 years ago)
- Topics: bison, c, compiler, compiler-construction, cpp, equation, flex, lex, mathematical-equation, mathematical-notations, omp-parallel, openmp, openmp-programs, parallelization, transpiler, yacc
- Language: C
- Homepage: https://adharshkamath.github.io/posts/mathy-compiler-demo/
- Size: 1.26 MB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mathy Compiler
This is a compiler to generate OpenMP programs for equations involving constructs like _Forall_, _Summation_ etc., frequently used in the scientific domain.
This project is written in C++ using Bison and Flex.
Feel free to make a PR or raise an issue if you find any bugs, or if you're interested in making improvements.
## How to use
Compile this project:
```
cd source
make install
```Open a file and write an equation like this:
```
mean = sigma(a[i]/100) where 0<=i<=100
```Or if you like Unicode characters,
```
mean = Σ(a[i]/100) | 0<=i<=100
```
The above equation, when compiled using the above mentioned compiler, will output an OpenMP program that will- Declare an array `a` of 101 floats
- Calculate the mean of those 101 elements and store it in the variable `mean`
- Calculate the time taken to do the above work, including the time for function callTo generate OpenMP program for the equation:
```
./test filename [-o output_filename] [-t data type for variables]
```The equations in [benchmark/source](./benchmark/source) are implementations of programs from [PolyBench/C](https://web.cse.ohio-state.edu/~pouchet.2/software/polybench/).
The OpenMP outputs for these equations can be found in [benchmark/output](benchmark/output).
To compile all the source files in [benchmark](./benchmark/), from the root directory, run
```
python3 benchmark.py
```Please refer to the [wiki](https://github.com/adharshkamath/Mathy-Compiler/wiki) for the Grammar, Syntax and currently supported features of the project.
This project was done under the guidance of [Dr. Rupesh Nasre](https://www.cse.iitm.ac.in/~rupesh)