from copapy import value from copapy.backend import Write, compile_to_dag, stencil_db_from_package from copapy._binwrite import Command import copapy as cp def compile_example(arch: str = 'native') -> None: """Test compilation of a simple program for x86_64.""" c1 = value(9.0) #ret = [c1 / 4, c1 / -4, c1 // 4, c1 // -4, (c1 * -1) // 4] ret = [c1 // 3.3 + 5] #ret = [cp.sqrt(c1)] #c2 = cp._math.get_42() #ret = [c2] out = [Write(r) for r in ret] sdb = stencil_db_from_package(arch) dw, _ = compile_to_dag(out, sdb) dw.write_com(Command.DUMP_CODE) #print('* Data to runner:') #dw.print() dw.to_file('build/runner/test.copapy') if __name__ == "__main__": compile_example()