is_cuda

Ciphertext.is_cuda
Is True if the ciphertext is stored on the GPU, False otherwise.
  • Output
    • boolean
from desilofhe import Engine

message = [1, 2, 3]

gpu_engine = Engine(mode="gpu")
gpu_secret_key = gpu_engine.create_secret_key()
gpu_public_key = gpu_engine.create_public_key(gpu_secret_key)

gpu_ciphertext = gpu_engine.encrypt(message, gpu_public_key)

assert gpu_ciphertext.is_cuda

cpu_engine = Engine(mode="cpu")
cpu_secret_key = cpu_engine.create_secret_key()
cpu_public_key = cpu_engine.create_public_key(cpu_secret_key)

cpu_ciphertext = cpu_engine.encrypt(message, cpu_public_key)

assert not cpu_ciphertext.is_cuda