import pickle from cozy import syntax from cozy import parse from cozy import codegen from cozy import common from cozy import typecheck from cozy import desugar from cozy import syntax_tools from cozy import handle_tools from cozy import invariant_preservation from cozy import synthesis from cozy import opts save_failed_codegen_inputs = opts.Option("save-failed-codegen-inputs", str, "/tmp/failed_codegen.py", metavar="PATH") checkpoint_prefix = opts.Option("checkpoint-prefix", str, "") do_cse = opts.Option( "cse", bool, False, description="Perform common subexpression elimination just before codegen") def run(): """Entry point for Cozy executable. This procedure reads sys.argv and executes the requested tasks. """
from cozy import parse from cozy import codegen from cozy import common from cozy import typecheck from cozy import desugar from cozy import syntax_tools from cozy import invariant_preservation from cozy import synthesis from cozy import library from cozy import autotuning from cozy import sharing from cozy import opts save_failed_codegen_inputs = opts.Option("save-failed-codegen-inputs", str, "/tmp/failed_codegen.py", metavar="PATH") enable_autotuning = opts.Option("enable-autotuning", bool, False) checkpoint_prefix = opts.Option("checkpoint-prefix", str, "") def run(): parser = argparse.ArgumentParser(description='Data structure synthesizer.') parser.add_argument("-S", "--save", metavar="FILE", type=str, default=None, help="Save synthesis output") parser.add_argument("-R", "--resume",
from cozy.syntax import ( Query, Visibility, Type, INT, LONG, BOOL, FLOAT, TNative, TTuple, THandle, TRecord, TEnum, TBag, TSet, TList, Exp, ENum, ONE, ZERO, EVar, EBinOp, EEmptyList, ENull, ETuple, EMakeRecord, EEq, ENot, EAll, ECond, SNoOp, SAssign, SForEach, seq, SDecl, ELt) from cozy.target_syntax import TMap, EMapGet, SWhile, SReturn from cozy.syntax_tools import free_vars, subst, all_exps from cozy.typecheck import is_scalar, is_collection from .cxx import CxxPrinter from .misc import INDENT, indent_lines, EEscape, SEscape from .optimization import simplify_and_optimize guava = opts.Option("guava", bool, False, description="Import Google's Guava library in generated Java class") JAVA_PRIMITIVE_TYPES = { "boolean", "byte", "char", "short", "int", "long", "float", "double"} class JavaPrinter(CxxPrinter): def __init__(self, out, boxed : bool = True): super().__init__(out=out) self.boxed = boxed def visit_Spec(self, spec, state_exps, sharing, abstract_state=()): self.state_exps = state_exps self.funcs = { f.name: f for f in spec.extern_funcs } self.queries = { q.name: q for q in spec.methods if isinstance(q, Query) } self.vars = set(e.id for e in all_exps(spec) if isinstance(e, EVar))
- The synchronization primitives (i.e. locks) in the `threading` module do not affect Jobs; you must use the synchronization primitives in the `multiprocessing` module. """ import os import multiprocessing from queue import Queue as PlainQueue, Empty, Full import threading import signal from cozy.common import partition import cozy.opts as opts do_profiling = opts.Option("profile", bool, False, description="Profile Cozy itself") _interrupted = False def _set_interrupt_flag(signal_number, stack_frame): global _interrupted # print("GOT INTERRUPTED") # import traceback # traceback.print_stack(stack_frame) _interrupted = True def install_graceful_sigint_handler(): """Install a graceful handler for SIGINT.