def load_from_file(sdfg, binary_filename): if not os.path.isfile(binary_filename): raise FileNotFoundError('File not found: ' + binary_filename) # Load the generated library lib = csd.ReloadableDLL(binary_filename, sdfg.name) # Load and return the compiled function return csd.CompiledSDFG(sdfg, lib)
def load_precompiled_sdfg(folder: str): """ Loads a pre-compiled SDFG from an output folder (e.g. ".dacecache/program"). Folder must contain a file called "program.sdfg" and a subfolder called "build" with the shared object. :param folder: Path to SDFG output folder. :return: A callable CompiledSDFG object. """ from dace.codegen import compiled_sdfg as csdfg sdfg = SDFG.from_file(os.path.join(folder, 'program.sdfg')) suffix = config.Config.get('compiler', 'library_extension') return csdfg.CompiledSDFG( sdfg, csdfg.ReloadableDLL( os.path.join(folder, 'build', f'lib{sdfg.name}.{suffix}'), sdfg.name))
def get_program_handle(library_path, sdfg): lib = csd.ReloadableDLL(library_path, sdfg.name) # Load and return the compiled function return csd.CompiledSDFG(sdfg, lib, sdfg.arg_names)