libocca / occa.py Goto Github PK
View Code? Open in Web Editor NEWOCCA Python API: JIT Compilation for Multiple Architectures
Home Page: https://libocca.org
License: MIT License
OCCA Python API: JIT Compilation for Multiple Architectures
Home Page: https://libocca.org
License: MIT License
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
std::cout
would use PySys_WriteStdout
occa::warn
and occa::error
could use PyErr_WarnEx for that Jupyter pretty print
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>'
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]
Have props
be a restricted kwarg
add_vectors[device](a, b, ab, props={})
# or
add_vectors(a, b, ab, props={})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.