Open rupertford opened 5 years ago
Hi @rupertford
did you provided an HIR file to that example? The example is probably not protected, but it is expecting a hir file in google protobuf byte format. The example shows how to traverse the HIR specification and do something with it. In this simple case, only to pretty print the equations that were coded in HIR form. It is aim at tools that want to explore the HIR and do something with it. What you probably want to do is the opposite, i.e. generate an HIR file using the python API from a given frontend, isnt?
I will provide a simple example on how to do that. I will let you know
Ah, my mistake. I assumed that the text of the example was actually an HIR file, so I fed that in. So, in that case, yes an example of how to generate HIR via the Python API and/or a pointer to the API definition would be great. Thanks @cosunae
The main API is defined in the python file (autogenerated by protobuffers)
gen/src/proto/HIR_pb2.py
but that will be hard to look at. The API will give you access to create nodes of the HIR, insert children, etc. Where the nodes should be more formally defined in the document (notice though that the current .proto implementation and the specification document differ slightly).
However best would be If I give you an example, where I can document the steps to create it. Just need a couple of days to do it
@rupertford you can find the examples in this
https://github.com/cosunae/dawn/tree/python_examples/examples/python
some explanation about it:
git clone --branch python_examples git@github.com:cosunae/dawn.git
cd dawn/bundle
mkdir build && cd build && cmake .. && make -j8 install
Then you can execute the examples like
export PYTHONPATH=<wdir>/dawn/bundle/install/python
python3 <wdir>/dawn/bundle//install/examples/python/hori_diff.py
Let me know if that helps
Thanks @cosunae. I am getting errors when I build with cmake and get nothing in the install directory. I'll email the details.
It would be useful if there were an examples directory with working HIR examples. I tried pulling out the one in the documentation but this fails with ...