def _load(cls, stencil_id, definition_func): stencil_class_name = cls.get_stencil_class_name(stencil_id) file_name = cls.get_stencil_module_path(stencil_id) stencil_module = gt_utils.make_module_from_file(stencil_class_name, file_name) stencil_class = getattr(stencil_module, stencil_class_name) stencil_class.__module__ = cls.get_stencil_module_name(stencil_id, qualified=True) stencil_class._gt_id_ = stencil_id.version stencil_class.definition_func = staticmethod(definition_func) return stencil_class
def _load(self) -> Type["StencilObject"]: stencil_class_name = self.builder.class_name file_name = str(self.builder.module_path) stencil_module = gt_utils.make_module_from_file(stencil_class_name, file_name) stencil_class = getattr(stencil_module, stencil_class_name) stencil_class.__module__ = self.builder.module_qualname stencil_class._gt_id_ = self.builder.stencil_id.version stencil_class._file_name = file_name stencil_class.definition_func = staticmethod(self.builder.definition) return stencil_class
def compile_reference(): from gt4py.backend.pyext_builder import build_gtcpu_ext current_dir = os.path.dirname(__file__) reference_names = build_gtcpu_ext( "reference_cpp_regression", [os.path.join(current_dir, "reference.cpp")], os.path.join(current_dir, "build"), current_dir, verbose=False, clean=False, ) return gt_utils.make_module_from_file(*reference_names)
def compile_reference(): current_dir = os.path.dirname(__file__) build_opts = pyext_builder.get_gt_pyext_build_opts() build_opts["include_dirs"].append(EXTERNAL_SRC_PATH) reference_names = pyext_builder.build_pybind_ext( "reference_cpp_regression", [os.path.join(current_dir, "reference.cpp")], os.path.join(current_dir, "build"), current_dir, verbose=False, clean=False, **build_opts, ) return gt_utils.make_module_from_file(*reference_names)
def compile_reference(): current_dir = os.path.dirname(__file__) build_opts = pyext_builder.get_gt_pyext_build_opts().copy() gt2_include_path = gt_config.build_settings["gt2_include_path"] build_opts["include_dirs"].extend( [gt2_include_path, os.path.join(gt2_include_path, "..", "tests")]) build_opts.setdefault("extra_compile_args", []) build_opts["extra_compile_args"].append("-Wno-sign-compare") reference_names = pyext_builder.build_pybind_ext( "reference_cpp_regression", [os.path.join(current_dir, "reference.cpp")], os.path.join(current_dir, "build"), current_dir, verbose=False, clean=False, **build_opts, ) return gt_utils.make_module_from_file(*reference_names)