returnn.util.py_ext_mod_compiler
¶
Python extension module compiler
- class returnn.util.py_ext_mod_compiler.PyExtModCompiler(include_paths=(), **kwargs)[source]¶
Python extension module compiler
- Parameters:
base_name (str) – base name for the module, e.g. “zero_out”
code_version (int|tuple[int]) – check for the cache whether to reuse
code (str) – the source code itself
is_cpp (bool) – if False, C is assumed
c_macro_defines (dict[str,str|int|None]|None) – e.g. {“TENSORFLOW”: 1}
ld_flags (list[str]|None) – e.g. [“-lblas”]
include_paths (list[str]|tuple[str])
include_deps (list[str]|None) – if provided and an existing lib file, we will check if any dependency is newer and we need to recompile. we could also do it automatically via -MD but that seems overkill and too slow.
static_version_name (str|None) – normally, we use …/base_name/hash as the dir but this would use …/base_name/static_version_name.
should_cleanup_old_all (bool) – whether we should look in the cache dir and check all ops if we can delete some old ones which are older than some limit (self._cleanup_time_limit_days)
should_cleanup_old_mydir (bool) – whether we should delete our op dir before we compile there.
log_stream (TextIO|None) – file stream for print statements
verbose (bool) – be slightly more verbose