module grammar.cc.c_compilation#

Inheritance diagram of mlprodict.grammar.cc.c_compilation

Short summary#

module mlprodict.grammar.cc.c_compilation

Helpers to compile C.

source on GitHub

Classes#

class

truncated documentation

CompilationError

Raised when a compilation error was detected.

Functions#

function

truncated documentation

compile_c_function

Compiles a C function with cffi. It takes one features vector.

Documentation#

Helpers to compile C.

source on GitHub

exception mlprodict.grammar.cc.c_compilation.CompilationError#

Bases: Exception

Raised when a compilation error was detected.

source on GitHub

mlprodict.grammar.cc.c_compilation.compile_c_function(code_c, nbout, dtype=<class 'numpy.float32'>, add_header=True, suffix='', additional_paths=None, tmpdir='.', fLOG=None)#

Compiles a C function with cffi. It takes one features vector.

Parameters:
  • nbout – number of expected outputs

  • code_c – code C

  • dtype – numeric type to use

  • add_header – add common function before compiling

  • suffix – avoid avoid the same compiled module name

  • additional_paths – additional paths to add to the module

  • tmpdir – see below

  • fLOG – logging function

Returns:

compiled function

The function assumes the first line is the signature. If you are using Windows with Visual Studio 2017, make sure you are using Python 3.6.3+ (see Issue 30389). Parameter tmpdir is used by function compile.

source on GitHub