# module `concrete.compiler.library_support` LibrarySupport. Library support provides a way to compile an MLIR program into a library that can be later loaded to execute the compiled code. **Global Variables** --------------- - **DEFAULT_OUTPUT_PATH** --- ## class `LibrarySupport` Support class for library compilation and execution. ### method `__init__` ```python __init__(library_support: LibrarySupport) ``` Wrap the native Cpp object. **Args:** - `library_support` (_LibrarySupport): object to wrap **Raises:** - `TypeError`: if library_support is not of type _LibrarySupport --- #### property output_dir_path Path where to store compilation artifacts. --- ### method `compile` ```python compile( mlir_program: Union[str, Module], options: CompilationOptions = , compilation_context: Optional[CompilationContext] = None ) → LibraryCompilationResult ``` Compile an MLIR program using Concrete dialects into a library. **Args:** - `mlir_program` (Union[str, MlirModule]): mlir program to compile (textual or in-memory) - `options` (CompilationOptions): compilation options **Raises:** - `TypeError`: if mlir_program is not of type str or MlirModule - `TypeError`: if options is not of type CompilationOptions **Returns:** - `LibraryCompilationResult`: the result of the library compilation --- ### method `get_program_info_path` ```python get_program_info_path() → str ``` Get the path where the program info file is expected to be. **Returns:** - `str`: path to the program info file --- ### method `get_shared_lib_path` ```python get_shared_lib_path() → str ``` Get the path where the shared library is expected to be. **Returns:** - `str`: path to the shared library --- ### method `load_client_parameters` ```python load_client_parameters( library_compilation_result: LibraryCompilationResult ) → ClientParameters ``` Load the client parameters from the library compilation result. **Args:** - `library_compilation_result` (LibraryCompilationResult): compilation result of the library **Raises:** - `TypeError`: if library_compilation_result is not of type LibraryCompilationResult **Returns:** - `ClientParameters`: appropriate client parameters for the compiled library --- ### method `load_compilation_feedback` ```python load_compilation_feedback( compilation_result: LibraryCompilationResult ) → ProgramCompilationFeedback ``` Load the compilation feedback from the compilation result. **Args:** - `compilation_result` (LibraryCompilationResult): result of the compilation **Raises:** - `TypeError`: if compilation_result is not of type LibraryCompilationResult **Returns:** - `ProgramCompilationFeedback`: the compilation feedback for the compiled program --- ### method `load_server_lambda` ```python load_server_lambda( library_compilation_result: LibraryCompilationResult, simulation: bool, circuit_name: str = 'main' ) → LibraryLambda ``` Load the server lambda for a given circuit from the library compilation result. **Args:** - `library_compilation_result` (LibraryCompilationResult): compilation result of the library - `simulation` (bool): use simulation for execution - `circuit_name` (str): name of the circuit to be loaded **Raises:** - `TypeError`: if library_compilation_result is not of type LibraryCompilationResult, if circuit_name is not of type str or **Returns:** - `LibraryLambda`: executable reference to the library --- ### method `new` ```python new( output_path: str = '/Users/benoitchevalliermames/Documents/Zama/Git/concrete/tempdirectoryforapidocs/concrete-compiler_compilation_artifacts', runtime_library_path: Optional[str] = None, generateSharedLib: bool = True, generateStaticLib: bool = False, generateClientParameters: bool = True, generateCompilationFeedback: bool = True, generateCppHeader: bool = False ) → LibrarySupport ``` Build a LibrarySupport. **Args:** - `output_path` (str, optional): path where to store compilation artifacts. Defaults to DEFAULT_OUTPUT_PATH. - `runtime_library_path` (Optional[str], optional): path to the runtime library. Defaults to None. - `generateSharedLib` (bool): whether to emit shared library or not. Default to True. - `generateStaticLib` (bool): whether to emit static library or not. Default to False. - `generateClientParameters` (bool): whether to emit client parameters or not. Default to True. - `generateCppHeader` (bool): whether to emit cpp header or not. Default to False. **Raises:** - `TypeError`: if output_path is not of type str - `TypeError`: if runtime_library_path is not of type str - `TypeError`: if one of the generation flags is not of type bool **Returns:** LibrarySupport --- ### method `reload` ```python reload() → LibraryCompilationResult ``` Reload the library compilation result from the output_dir_path. **Returns:** - `LibraryCompilationResult`: loaded library --- ### method `server_call` ```python server_call( library_lambda: LibraryLambda, public_arguments: PublicArguments, evaluation_keys: EvaluationKeys ) → PublicResult ``` Call the library with public_arguments. **Args:** - `library_lambda` (LibraryLambda): reference to the compiled library - `public_arguments` (PublicArguments): arguments to use for execution - `evaluation_keys` (EvaluationKeys): evaluation keys to use for execution **Raises:** - `TypeError`: if library_lambda is not of type LibraryLambda - `TypeError`: if public_arguments is not of type PublicArguments - `TypeError`: if evaluation_keys is not of type EvaluationKeys **Returns:** - `PublicResult`: result of the execution --- ### method `simulate` ```python simulate( library_lambda: LibraryLambda, public_arguments: PublicArguments ) → PublicResult ``` Call the library with public_arguments in simulation mode. **Args:** - `library_lambda` (LibraryLambda): reference to the compiled library - `public_arguments` (PublicArguments): arguments to use for execution **Raises:** - `TypeError`: if library_lambda is not of type LibraryLambda - `TypeError`: if public_arguments is not of type PublicArguments **Returns:** - `PublicResult`: result of the execution