furiosa.common package

Submodules

furiosa.common.error module

exception furiosa.common.error.FuriosaError(message: str)

Bases: Exception

General exception caused by Furiosa Runtime

furiosa.common.error.is_err(err: Union[ctypes.c_int, int]) bool
furiosa.common.error.is_ok(err: Union[ctypes.c_int, int]) bool

furiosa.common.native module

class furiosa.common.native.LogLevel(value)

Bases: enum.IntEnum

Python object correspondnig to nux_log_level_t in Nux C API

ERROR = 1
INFO = 3
OFF = 0
WARN = 2
furiosa.common.native.find_global_lib_path(libname: str)
furiosa.common.native.find_native_lib_path(libname: str) Optional[str]

Finding a native library path according to the following priority 1. If the environment variable ‘LD_LIBRARY_PATH’ is set, this function tries to find native library found from LD_LIBRARY_PATH. 2. Otherwise, it tries find the native library from global library paths, such as /usr/lib, /usr/local/lib. 3. If the library still cannot be founded, it returns None.

furiosa.common.native.find_native_libs(libname: str, register_hook: typing.Callable = <function __register_common_capis>)

Finding a native library c interface according to the following priority 1. If the environment variable ‘LD_LIBRARY_PATH’ is set, this function tries to find native library found from LD_LIBRARY_PATH. 2. Otherwise, it tries to find the native library embedded in the python package. 3. If the embedded native library cannot be found, it tries find the native library from global library paths, such as /usr/lib, /usr/local/lib.

After loading C Library, it will call register_hook(ciface).

furiosa.common.native.find_user_lib_path(libname: str)

furiosa.common.thread module

furiosa.common.thread.asynchronous(f: Callable) Callable

Replace sync function to async using aysncio thread pool

furiosa.common.thread.synchronous(f: Callable) Callable

Run async function in place and return the result

furiosa.common.utils module

class furiosa.common.utils.FuriosaVersionInfo(version: packaging.version.Version)

Bases: object

furiosa.common.utils.eprint(*args, **kwargs)
furiosa.common.utils.get_sdk_version(module) Optional[furiosa.common.utils.FuriosaVersionInfo]

Returns the git commit hash representing the current version of the application.

Module contents

Furiosa SDK common utilities

furiosa.common.get_sdk_version(module) Optional[furiosa.common.utils.FuriosaVersionInfo]

Returns the git commit hash representing the current version of the application.