quantlab.factor.kunquant_compile.compile_graphs#

quantlab.factor.kunquant_compile.compile_graphs(graphs, libname, compiler=None)[source]#

Return the compiled library of graphs, compiling only when no cache has it.

Takes the arguments of KunQuant.jit.cfake.compileit, whose library it returns: one (module name, graph, KunCompilerConfig) per module, the library’s name and the C++ compiler config (KunQuant’s default when None). The library is looked up in this process, then in cache_dir(), and compiled when neither has it.

Parameters:
graphslist[tuple[str, KunQuant.Stage.Function, KunCompilerConfig]]

The modules of the library.

libnamestr

The library’s name.

compilercfake.CppCompilerConfig, optional

The C++ compiler config.

Returns:
KunRunner.Library

The loaded library; getModule(name) returns each module.

Examples

>>> b = Builder()
>>> with b:
...     Output(Input("x") * 2.0, "y")
>>> config = KunCompilerConfig(input_layout="TS", output_layout="TS")
>>> lib = compile_graphs([("Double", Function(b.ops), config)], "Double")
>>> compile_graphs([("Double", Function(b.ops), config)], "Double") is lib
True