Default engine
Engine(mode: str = 'cpu', *, slot_count: int | None = None, use_bootstrap: bool = False, use_multiparty: bool = False, use_bootstrap_to_14_levels: bool = False, compact: bool = False, thread_count: int = 0, cuda_grid_size_multiplier: int = 4, device_id: int = 0)- Creates an engine to execute operations.
- Input:
- mode:
cpu,parallel, orgpu. parallel refers to parallel processing using the CPU. - slot_count: Specifies the engine slot count.
- use_bootstrap: Whether to use the bootstrap operation.
- use_bootstrap_to_14_levels: Whether to use the bootstrap operation to 14 levels.
- use_multiparty: Whether to use multiparty computation.
- compact: Whether to use compact representation.
- Not supported for multiparty computation.
- thread_count: Specifies the number of threads to use when the mode is
parallelorgpu. - cuda_grid_size_multiplier: Specifies the CUDA kernel call grid size multiplier when the mode is
gpu. - device_id: Specifies which GPU to use when the mode is
gpu.
- mode:
- Output:
- Engine
Only one of use_bootstrap, use_bootstrap_to_14_levels, and use_multiparty can be enabled in a single engine.
from desilofhe import Engine
engine1 = Engine()
engine2 = Engine(mode="parallel", use_multiparty=True, thread_count=256)
engine3 = Engine(mode="gpu", use_bootstrap=True, thread_count=512, device_id=1)
Create with Max Level
Engine(max_level: int, mode: str = 'cpu', *, use_multiparty: bool = False, compact: bool = False, thread_count: int = 0, cuda_grid_size_multiplier: int = 4, device_id: int = 0)
- Input:
- max_level: Specifies the maximum number of multiplications allowed.
- mode:
cpu,parallel, orgpu. parallel refers to parallel processing using the CPU. - use_multiparty: Whether to use the multiparty computation.
- compact: Whether to use the compact representation.
- Not supported for multiparty computation.
- thread_count: Specifies the number of threads to use when the mode is
parallelorgpu. - cuda_grid_size_multiplier: Specifies the CUDA kernel call grid size multiplier when the mode is
gpu. - device_id: Specifies which GPU to use when the mode is
gpu.
- Output
- Engine
from desilofhe import Engine
engine1 = Engine(max_level=10)
engine2 = Engine(max_level=12, mode="parallel", thread_count=128)
engine3 = Engine(
max_level=15, mode="gpu", use_multiparty=True, thread_count=512, device_id=1
)
Create with Slot Count
Engine(*, slot_count: int, max_level: int, mode: str = 'cpu', *, use_multiparty: bool = False, compact: bool = False, thread_count: int = 0, cuda_grid_size_multiplier: int = 4, device_id: int = 0)
- Input:
- max_level: Specifies the maximum number of multiplications allowed.
- mode:
cpu,parallel, orgpu. parallel refers to parallel processing using the CPU. - slot_count: Specifies the engine slot count.
- use_multiparty: Whether to use the multiparty computation.
- compact: Whether to use the compact representation.
- Not supported for multiparty computation.
- thread_count: Specifies the number of threads to use when the mode is
parallelorgpu. - cuda_grid_size_multiplier: Specifies the CUDA kernel call grid size multiplier when the mode is
gpu. - device_id: Specifies which GPU to use when the mode is
gpu.
- Output
- Engine
from desilofhe import Engine
engine1 = Engine(slot_count=1024, max_level=10)
engine2 = Engine(
slot_count=1024, max_level=12, mode="parallel", thread_count=16
)
engine3 = Engine(
slot_count=1024,
max_level=15,
mode="gpu",
use_multiparty=True,
thread_count=512,
device_id=1,
)
Create with Custom Parameters
Engine(log_coeff_count: int, special_prime_count: int, mode: str = 'cpu', *, log_slot_count: int | None = None, use_multiparty: bool = False, compact: bool = False, thread_count: int = 0, cuda_grid_size_multiplier: int = 4, device_id: int = 0)
- Input:
- log_coeff_count: The logarithm of the ciphertext coefficient count. Can range from 13 to 17.
- special_prime_count: The size of a single partition for key-switching.
- mode:
cpu,parallel, orgpu. parallel refers to parallel processing using the CPU. - log_slot_count: The logarithm of the engine slot count. Can range from 1 to log_coeff_count - 1.
- use_multiparty: Whether to use the multiparty computation.
- compact: Whether to use the compact representation.
- Not supported for multiparty computation.
- Only supports the following
(log_slot_count, special_prime_count)pairs:(13, 1),(14, 1),(15, 2), and(16, 4)
- thread_count: Specifies the number of threads to use when the mode is
parallelorgpu. - cuda_grid_size_multiplier: Specifies the CUDA kernel call grid size multiplier when the mode is
gpu - device_id: Specifies which GPU to use when the mode is
gpu.
- Output
- Engine
from desilofhe import Engine
engine1 = Engine(log_coeff_count=14, special_prime_count=1)
engine2 = Engine(log_coeff_count=14, special_prime_count=1, log_slot_count=10)
engine3 = Engine(
log_coeff_count=15, special_prime_count=2, mode="parallel", thread_count=16
)
engine4 = Engine(
log_coeff_count=16,
special_prime_count=4,
mode="gpu",
use_multiparty=True,
thread_count=512,
device_id=1,
)