Giter Site home page Giter Site logo

libocca / occa.py Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 6.0 247 KB

OCCA Python API: JIT Compilation for Multiple Architectures

Home Page: https://libocca.org

License: MIT License

Python 66.19% C++ 27.70% Jupyter Notebook 6.12%
cuda gpgpu gpu hpc jit occa opencl openmp python threading

occa.py's People

Contributors

awehrfritz avatar dmed256 avatar rtilk89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

occa.py's Issues

Redirect std::cout and std::cerr

Jupyter doesn't redirect IO messages coming directly from the C++ API. We need to somehow wrap std::cout and std::err usage in occa to allow for redirects.

We would take wanted outputs and wrap them in some C API methods

Pretty print errors given an ast node

Use the node's col_offset and lineno attributes to print a nice error message for the user

myfile.py:10:30:Error Expected a 1 and not a 0
1234567890123456789012345678901234567890
                             ^

or if in Jupyter, get the cell number and print

In [31]:10:30:Error Expected a 1 and not a 0
1234567890123456789012345678901234567890
                             ^

We might be able to get the cell number with inspect

import inspect
inspect.getfile(foo)
> '<ipython-input-31-5643a48472c0>'

@okl.kernel

Python OKL

Create ast parser to convert a restricted Python function to an OKL kernel

@okl.kernel
def add_vectors(a: [float],
                b: [float],
                ab: [float]):
    for i in okl.range(len(a)).tile(16):
      ab[i] = a[i] + b[i]

shorthand for

@okl.kernel
def add_vectors(a: [float],
                b: [float],
                ab: [float]):
    for block in okl.range(0, len(a), 16).outer:
        for i in okl.range(block, block + 16).inner:
            ab[i] = a[i] + b[i]

API

Have props be a restricted kwarg

add_vectors[device](a, b, ab, props={})
# or
add_vectors(a, b, ab, props={})

Docstrings

  • Add docstrings to everything!
  • Add to README that XCode needs to be installed

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.