Giter Site home page Giter Site logo

athena's Introduction

Athena Python: A Tiramisu Compiler Python Frontend For Loading Tiramisu Programs and Building and Executing Schedules

Introduction

Athena Python is a Python frontend for the Tiramisu compiler. It allows users to build schedules for Tiramisu programs and execute them. It also allows users to generate C++ code for their Tiramisu schedules and execute it.

Installation

To install Athena Python, you need to install the Tiramisu compiler first. Please follow the instructions here.

Then, you can install Athena Python by cloning this repository and running the following command:

git clone [email protected]:skourta/athena_python.git
cd athena_python
poetry install

Usage and Features

To use Athena Python, you need to activate the virtual environment created by Poetry:

poetry shell

Loading a Tiramisu Program

To load a Tiramisu program, you need to create a TiramisuProgram object and pass the path to the Tiramisu program to its from_file constructor:

from athena.tiramisu import TiramisuProgram

tiramisu_program = TiramisuProgram.from_file("path/to/tiramisu/program.cpp")

Building a Schedule

To build a schedule for a Tiramisu program, you need to create a Schedule object and pass the TiramisuProgram object to its constructor:

from athena.tiramisu import Schedule

schedule = Schedule(tiramisu_program)

Scheduling

Athena Python provides a set of code transformations that can be used to build schedules for Tiramisu programs. These transformations are implemented as TiramisuAction objects.

To add a transformation to a schedule, you need to call the add_optimizations method of the Schedule object and pass the TiramisuAction object to it:

from athena.tiramisu import Schedule, tiramisu_actions

schedule = Schedule(tiramisu_program)

tiramisu_action = tiramisu_actions.Parallelization([("comp00",1)])

schedule.add_optimizations([tiramisu_action])

You can find the list of all the transformations implemented in Athena Python here

Legality Checking

To check the legality of a schedule, you need to call the is_legal method of the Schedule object:

from athena.tiramisu import Schedule, tiramisu_actions

schedule = Schedule(tiramisu_program)

tiramisu_action = tiramisu_actions.Parallelization([("comp00",1)])

schedule.add_optimizations([tiramisu_action])

if schedule.is_legal():
    print("The schedule is legal")
else:
    print("The schedule is illegal")

Execution

To execute a schedule, you need to call the apply_schedule method of the Schedule object:

from athena.tiramisu import Schedule, tiramisu_actions

schedule = Schedule(tiramisu_program)

tiramisu_action = tiramisu_actions.Parallelization([("comp00",1)])

schedule.add_optimizations([tiramisu_action])

schedule.apply_schedule()

Development

Testing

To run the tests, you need to activate the virtual environment created by Poetry:

poetry shell

Then, you can run the tests using the following command:

pytest

Coverage

To run the tests and generate the coverage report, you need to activate the virtual environment created by Poetry:

poetry shell

Then, you can run the tests using the following command:

coverage run -m pytest

Finally, you can generate the coverage report using the following command:

coverage report

For HTML coverage report, you can use the following command:

coverage html --include="athena/**/*"

Code Formatting

The library uses the black code formatter. To format the code, you need to activate the virtual environment created by Poetry:

poetry shell

Then, you can format the code using the following command:

black .

You can also preferably install the black formatter extension for your code editor to format the code automatically.

athena's People

Contributors

skourta avatar

Watchers

 avatar

Forkers

rayanea7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.