da4ml.codegen.cpp package
Submodules
da4ml.codegen.cpp.cpp_codegen module
- da4ml.codegen.cpp.cpp_codegen.cpp_logic_and_bridge_gen(sol: Solution, fn_name: str, flavor: str, pragmas: list[str] | None = None, n_indent: int = 4, n_base_indent: int = 0, print_latency: bool = False)
- da4ml.codegen.cpp.cpp_codegen.get_typestr_fn(flavor: str)
- da4ml.codegen.cpp.cpp_codegen.kif_to_hlslib_type(k: bool | int = 1, i: int = 0, f: int = 0)
- da4ml.codegen.cpp.cpp_codegen.kif_to_vitis_type(k: bool | int = 1, i: int = 0, f: int = 0)
da4ml.codegen.cpp.hls_model module
- class da4ml.codegen.cpp.hls_model.HLSModel(solution: Solution, prj_name: str, path: str | Path, flavor: str = 'vitis', print_latency: bool = True, part_name: str = 'xcvu13p-flga2577-2-e', pragma: Sequence[str] | None = None, clock_period: int = 5, clock_uncertainty: float = 0.1, io_delay_minmax: tuple[float, float] = (0.2, 0.4))
Bases:
object
- compile(verbose=False, openmp=True, o3: bool = False, clean=True)
Compile the model to a shared object file
- Parameters:
verbose (bool, optional) – Verbose output, by default False
openmp (bool, optional) – Enable openmp, by default True
o3 (bool | None, optional) – Turn on -O3 flag, by default False
clean (bool, optional) – Remove obsolete shared object files, by default True
- Raises:
RuntimeError – If compilation fails
- predict(data: ndarray[tuple[int, ...], dtype[T]]) ndarray[tuple[int, ...], dtype[T]]
Run the model on the input data.
- Parameters:
data (NDArray[np.floating]) – Input data to the model. The shape is ignored, and the number of samples is determined by the size of the data.
- Returns:
Output of the model in shape (n_samples, output_size).
- Return type:
NDArray[np.floating]
- write()
Module contents
- class da4ml.codegen.cpp.HLSModel(solution: Solution, prj_name: str, path: str | Path, flavor: str = 'vitis', print_latency: bool = True, part_name: str = 'xcvu13p-flga2577-2-e', pragma: Sequence[str] | None = None, clock_period: int = 5, clock_uncertainty: float = 0.1, io_delay_minmax: tuple[float, float] = (0.2, 0.4))
Bases:
object
- compile(verbose=False, openmp=True, o3: bool = False, clean=True)
Compile the model to a shared object file
- Parameters:
verbose (bool, optional) – Verbose output, by default False
openmp (bool, optional) – Enable openmp, by default True
o3 (bool | None, optional) – Turn on -O3 flag, by default False
clean (bool, optional) – Remove obsolete shared object files, by default True
- Raises:
RuntimeError – If compilation fails
- predict(data: ndarray[tuple[int, ...], dtype[T]]) ndarray[tuple[int, ...], dtype[T]]
Run the model on the input data.
- Parameters:
data (NDArray[np.floating]) – Input data to the model. The shape is ignored, and the number of samples is determined by the size of the data.
- Returns:
Output of the model in shape (n_samples, output_size).
- Return type:
NDArray[np.floating]
- write()