copapy/tools/make_example.py

16 lines
407 B
Python
Raw Permalink Normal View History

2025-12-06 17:09:25 +00:00
from copapy import value
from copapy.backend import Write, compile_to_dag, stencil_db_from_package
from copapy._binwrite import Command
input = value(9.0)
result = input ** 2 / 3.3 + 5
2025-10-12 20:22:30 +00:00
arch = 'native'
sdb = stencil_db_from_package(arch)
dw, _ = compile_to_dag([Write(result)], sdb)
2025-10-12 20:22:30 +00:00
# Instruct runner to dump patched code to a file:
dw.write_com(Command.DUMP_CODE)
2025-10-12 20:22:30 +00:00
dw.to_file('build/runner/test.copapy')