23 static constexpr std::uint64_t NumWorkloadParams = 1;
26 static constexpr std::uint64_t ParametersCount = 2;
27 static constexpr std::uint64_t ResultComponentsCount = 1;
30 static constexpr std::size_t PolyModulusDegree = 8192;
31 static constexpr std::size_t NumCoefficientModuli = 1;
33 TutorialEltwiseAddBenchmarkDescription();
34 ~TutorialEltwiseAddBenchmarkDescription()
override;
50 static constexpr std::int64_t tag = 0x1;
55 ~TutorialEltwiseAddBenchmark()
override;
73 struct InternalParamInfo
76 static constexpr std::int64_t tagPlaintext = 0x10;
77 static constexpr std::int64_t tagCiphertext = 0x20;
79 std::uint64_t param_position;
84 struct InternalParam :
public InternalParamInfo
87 std::vector<T> samples;
99 std::vector<lbcrypto::Plaintext> encodeVector(
const std::vector<std::vector<std::int64_t>> &vec);
100 std::vector<lbcrypto::Ciphertext<lbcrypto::DCRTPoly>> encryptVector(
const std::vector<lbcrypto::Plaintext> &encoded_vec);
101 std::vector<lbcrypto::Ciphertext<lbcrypto::DCRTPoly>> eltwiseadd(
const std::vector<lbcrypto::Plaintext> &A,
102 const std::vector<lbcrypto::Ciphertext<lbcrypto::DCRTPoly>> &B);
103 std::vector<lbcrypto::Plaintext> decryptResult(
const std::vector<lbcrypto::Ciphertext<lbcrypto::DCRTPoly>> &encrypted_result);
104 std::vector<std::vector<int64_t>> decodeResult(
const std::vector<lbcrypto::Plaintext> &encoded_result);
107 class PalisadeBFVContext
110 PalisadeBFVContext(
int poly_modulus_degree);
112 auto publicKey()
const {
return m_keys->publicKey; }
113 std::size_t getSlotCount()
const {
return m_slot_count; }
114 lbcrypto::CryptoContext<lbcrypto::DCRTPoly> &context() {
return *m_p_palisade_context; }
115 void decrypt(
const lbcrypto::Ciphertext<lbcrypto::DCRTPoly> &cipher, lbcrypto::Plaintext &plain)
117 context()->Decrypt(m_keys->secretKey, cipher, &plain);
120 lbcrypto::Plaintext
decrypt(
const lbcrypto::Ciphertext<lbcrypto::DCRTPoly> &cipher)
122 lbcrypto::Plaintext retval;
128 std::shared_ptr<lbcrypto::CryptoContext<lbcrypto::DCRTPoly>> m_p_palisade_context;
129 std::unique_ptr<lbcrypto::LPKeyPair<lbcrypto::DCRTPoly>> m_keys;
130 std::size_t m_slot_count;
133 std::size_t m_vector_size;
134 std::shared_ptr<PalisadeBFVContext> m_p_context;
136 PalisadeBFVContext &context() {
return *m_p_context; }
140 std::shared_ptr<Workload> m_p_workload;
Top level opaque benchmark class.
virtual hebench::APIBridge::Handle load(const hebench::APIBridge::Handle *p_local_data, std::uint64_t count)=0
virtual hebench::APIBridge::Handle decrypt(hebench::APIBridge::Handle encrypted_data)=0
virtual void store(hebench::APIBridge::Handle remote_data, hebench::APIBridge::Handle *p_local_data, std::uint64_t count)=0
virtual hebench::APIBridge::Handle encode(const hebench::APIBridge::DataPackCollection *p_parameters)=0
std::int64_t classTag() const override
Retrieves the tag of the class to which this object belongs.
virtual hebench::APIBridge::Handle encrypt(hebench::APIBridge::Handle encoded_data)=0
virtual void decode(hebench::APIBridge::Handle encoded_data, hebench::APIBridge::DataPackCollection *p_native)=0
virtual hebench::APIBridge::Handle operate(hebench::APIBridge::Handle h_remote_packed, const hebench::APIBridge::ParameterIndexer *p_param_indexers, std::uint64_t indexers_count)=0
Base class that encapsulates common behavior of backend engines.
Base class for objects representing a specific benchmark based on an HEBench benchmark descriptor.
virtual void destroyBenchmark(BaseBenchmark *p_bench)=0
Destroys and frees resources held by a BaseBenchmark (or derived) object previously created by create...
virtual BaseBenchmark * createBenchmark(BaseEngine &engine, const hebench::APIBridge::WorkloadParams *p_params)=0
Instantiates the represented benchmark.
virtual std::string getBenchmarkDescription(const hebench::APIBridge::WorkloadParams *p_w_params) const
Retrieves human-readable description specific to the represented benchmark.
#define HEBERROR_DECLARE_CLASS_NAME(class_name)
ErrorCode decrypt(Handle h_benchmark, Handle h_ciphertext, Handle *h_plaintext)
Decrypts a cipher text into corresponding plain text.
Workload
Defines all possible workloads.
Defines a benchmark test.
Defines a collection of data packs.
Specifies the parameters for a workload.
Structure to contain flexible data.