Skip to content
/ dusk Public
forked from dawn-ico/dusk

A minimal and lightweight front-end for dawn.

License

Notifications You must be signed in to change notification settings

muellch/dusk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dusk

A minimal and lightweight front-end for dawn.

Dusk translates a subset of Python code (a Python embedded domain specific language - eDSL) to SIR. Its purpose is to allow quick prototyping of dawn's unstructured features for internal experiments.

Dusk is currently in an experimental state. Examples are available here: tests/examples/

Requirements

Installation

It is highly recommended to use a virtual env for development:

python -m venv virtual_env # create virtual env
source virtual_env/bin/activate # activate virtual env

Then dusk can be directly installed from github via pip (this will also install dawn4py):

pip install dusk@git+https://github.com/dawn-ico/dusk.git

Usage

The package will install a dusk command-line tool which can be used to compile dusk stencils:

dusk --help

and a pipeable dusk-front tool:

dusk-front --help

The output of dusk-front is Dawn's SIR (in JSON format), which is intended to be piped to the tools in the Dawn's toolchain in order to obtain generated code, e.g.

dusk-front ./tests/examples/laplacian_fvm.py | dawn-opt | dawn-codegen -b naive-ico

This allows to pass arguments to dawn-opt and dawn-codegen (for example to enable/configure optimizations). If one doesn't need such customization, a simpler way to obtain generated code is by using the dusk tool, which also allows backend selection (-b option). Example:

dusk -b ico-cuda -o ./laplacian_fd_cuda.cpp ./tests/examples/laplacian_fd.py

Overview

  • tests/examples/ - Examples of the dusk eDSL
  • dusk/script/__init__.py - Contains definitions & mocks for dusk
  • dusk/cli.py - Implements a basic command line interface to compile dusk stencils to generated code
  • dusk/front.py - Implements a basic command line interface to compile dusk stencils to SIR
  • dusk/transpile.py - Provides a programmatic interface to compile dusk stencils
  • dusk/grammar.py - Implements most of the transformations for Python AST to SIR utilizing the matching framework
  • dusk/semantics.py - Provides infrastructure to support dusk's semantics (used by the grammar)
  • dusk/match.py - Implements a simple matching framework for ASTs

About

A minimal and lightweight front-end for dawn.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%