quantlab.factor.kunquant_compile#
Compiled KunQuant libraries, kept in the process and on disk: compile_graphs.
KunQuant turns a graph into C++ and compiles it, which takes a second or
more each time. Every compilation in quantlab goes through compile_graphs, which
compiles a graph once and then reuses the library: the same process gets the
library it already loaded, and another process (a ChunkedBuilder worker,
the next daily run) loads it from the cache directory.
A library is keyed by everything that changes the binary: each graph’s text
(str(Function), deterministic across processes, unlike the generated
C++), its KunCompilerConfig, the source of every quantlab module that
defines one of its operators (a custom operator’s C++ is written by its
Python class), the CppCompilerConfig and the compiler’s version, the host
CPU (KunQuant compiles with -march=native) and the KunQuant installation.
The cache directory is $QUANTLAB_KUNQUANT_CACHE, else
$XDG_CACHE_HOME/quantlab/kunquant, else ~/.cache/quantlab/kunquant; an
empty QUANTLAB_KUNQUANT_CACHE keeps libraries in the process only. Each
entry is a directory named by the key holding the library and a complete
marker with the library’s digest; an entry without the marker, or whose
library does not match it, is compiled again. Deleting the directory clears
the cache.
Functions
Return the directory compiled libraries are cached in, or |
|
Return the compiled library of |
|
Return the hex digest a library of |