Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

speed of gate bootstrapping #33

Open
zj-rayan opened this issue Feb 6, 2022 · 0 comments
Open

speed of gate bootstrapping #33

zj-rayan opened this issue Feb 6, 2022 · 0 comments

Comments

@zj-rayan
Copy link

zj-rayan commented Feb 6, 2022

I tried to test the speed of nufhe gate bootstrapping by the following way but found it much slower than the result shown in nufhe's main page(0.13ms),how can I get appropriate test result?My GPU is GTX 1660Ti.

import random
import nufhe
import time

size = 32
bits1 = [random.choice([False, True]) for i in range(size)]
bits2 = [random.choice([False, True]) for i in range(size)]
reference = [not (b1 and b2) for b1, b2 in zip(bits1, bits2)]

ctx = nufhe.Context()
secret_key, cloud_key = ctx.make_key_pair()

ciphertext1 = ctx.encrypt(secret_key, bits1)
ciphertext2 = ctx.encrypt(secret_key, bits2)

vm = ctx.make_virtual_machine(cloud_key)
t1 = time.time()
result = vm.gate_nand(ciphertext1, ciphertext2)
t2 = time.time()
print(t2-t1) # around 3.0s
result_bits = ctx.decrypt(secret_key, result)

assert all(result_bits == reference)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant