def build_transform(self): definition = self.build() return TransformData( definition_ir=definition, implementation_ir=init_implementation_from_definition(definition), options=BuildOptions(name=self.name, module=__name__), )
def stencil_def_to_oir(stencil_def, externals): build_options = BuildOptions( name=stencil_def.__name__, module=__name__, rebuild=True, backend_opts={}, build_info=None ) definition_ir = GTScriptFrontend.generate( stencil_def, externals=externals, options=build_options ) gtir = GtirPipeline(DefIRToGTIR.apply(definition_ir)).full() return GTIRToOIR().visit(gtir)
def make_transform_data( *, name: str, domain: Domain, fields: List[str], body: BodyType, iteration_order: IterationOrder, ) -> TransformData: definition = make_definition(name, fields, domain, body, iteration_order) return TransformData( definition_ir=definition, implementation_ir=init_implementation_from_definition(definition), options=BuildOptions(name=name, module=__name__), )
def __init__( self, definition_func: Union[StencilFunc, AnnotatedStencilFunc], *, backend: Optional[Type["BackendType"]] = None, options: Optional[BuildOptions] = None, frontend: Optional["FrontendType"] = None, ): self._definition = definition_func # type ignore explanation: Attribclass generated init not recognized by mypy self.options = options or BuildOptions( # type: ignore **self.default_options_dict(definition_func)) self.backend: "BackendType" = (backend(self) if backend else gt4py.backend.from_name("debug")(self)) self.frontend: "FrontendType" = frontend or gt4py.frontend.from_name( "gtscript") self.caching = gt4py.caching.strategy_factory("jit", self) self._build_data: Dict[str, Any] = {} self._externals: Dict[str, Any] = {}
def with_options(self: "StencilBuilder", *, name: str, module: str, **kwargs: Any) -> "StencilBuilder": """ Fluidly set the build options. Parameters ---------- name: Name of the stencil module: qualified module name of the stencil's module kwargs: passed through to the options instance """ self._build_data = {} # mypy attribkwclass bug self.options = BuildOptions(name=name, module=module, **kwargs) # type: ignore return self