treelite
Functions
Compiler

Functions

int TreeliteCompilerCreate (const char *name, CompilerHandle *out)
 create a compiler with a given name More...
 
int TreeliteCompilerSetParam (CompilerHandle handle, const char *name, const char *value)
 set a parameter for a compiler More...
 
int TreeliteCompilerGenerateCode (CompilerHandle compiler, ModelHandle model, int verbose, const char *dirpath)
 generate prediction code from a tree ensemble model. The code will be C99 compliant. One header file (.h) will be generated, along with one or more source files (.c). More...
 
int TreeliteCompilerFree (CompilerHandle handle)
 delete compiler from memory More...
 

Detailed Description

Compiler interface

Function Documentation

int TreeliteCompilerCreate ( const char *  name,
CompilerHandle out 
)

create a compiler with a given name

Parameters
namename of compiler
outcreated compiler
Returns
0 for success, -1 for failure

Definition at line 232 of file c_api.cc.

int TreeliteCompilerFree ( CompilerHandle  handle)

delete compiler from memory

Parameters
handlecompiler to remove
Returns
0 for success, -1 for failure

Definition at line 300 of file c_api.cc.

int TreeliteCompilerGenerateCode ( CompilerHandle  compiler,
ModelHandle  model,
int  verbose,
const char *  dirpath 
)

generate prediction code from a tree ensemble model. The code will be C99 compliant. One header file (.h) will be generated, along with one or more source files (.c).

Usage example:

1 TreeliteCompilerGenerateCode(compiler, model, 1, "./my/model");
2 // files to generate: ./my/model/header.h, ./my/model/main.c
3 // if parallel compilation is enabled:
4 // ./my/model/header.h, ./my/model/main.c, ./my/model/tu0.c,
5 // ./my/model/tu1.c, and so forth
Parameters
compilerhandle for compiler
modelhandle for tree ensemble model
verbosewhether to produce extra messages
dirpathdirectory to store header and source files
Returns
0 for success, -1 for failure

Definition at line 260 of file c_api.cc.

int TreeliteCompilerSetParam ( CompilerHandle  handle,
const char *  name,
const char *  value 
)

set a parameter for a compiler

Parameters
handlecompiler
namename of parameter
valuevalue of parameter
Returns
0 for success, -1 for failure

Definition at line 239 of file c_api.cc.