12 #include "seal/seal.h"
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<seal::Plaintext> encodeVector(
const std::vector<std::vector<std::int64_t>> &vec);
100 std::vector<seal::Plaintext> encodeVector(
const std::vector<gsl::span<const std::int64_t>> &vec);
101 std::vector<seal::Ciphertext> encryptVector(
const std::vector<seal::Plaintext> &encoded_vec);
102 std::vector<seal::Ciphertext> eltwiseadd(
const std::vector<seal::Plaintext> &A,
103 const std::vector<seal::Ciphertext> &B);
104 std::vector<seal::Plaintext> decryptResult(
const std::vector<seal::Ciphertext> &encrypted_result);
105 std::vector<std::vector<int64_t>> decodeResult(
const std::vector<seal::Plaintext> &encoded_result);
111 SealBFVContext(
int poly_modulus_degree);
113 seal::BatchEncoder &encoder() {
return *m_p_batch_encoder; }
114 seal::Evaluator &evaluator() {
return *m_p_evaluator; }
115 seal::Decryptor &decryptor() {
return *m_p_decryptor; }
116 const seal::Encryptor &encryptor()
const {
return *m_p_encryptor; }
117 const seal::PublicKey &public_key()
const {
return m_public_key; }
118 const seal::SecretKey &secret_key()
const {
return m_secret_key; }
119 seal::SEALContext &context() {
return *m_p_seal_context; }
122 std::shared_ptr<seal::SEALContext> m_p_seal_context;
123 std::unique_ptr<seal::KeyGenerator> m_p_keygen;
124 seal::PublicKey m_public_key;
125 seal::SecretKey m_secret_key;
126 std::unique_ptr<seal::Encryptor> m_p_encryptor;
127 std::unique_ptr<seal::Evaluator> m_p_evaluator;
128 std::unique_ptr<seal::Decryptor> m_p_decryptor;
129 std::unique_ptr<seal::BatchEncoder> m_p_batch_encoder;
132 std::size_t m_vector_size;
133 std::shared_ptr<SealBFVContext> m_p_context;
135 SealBFVContext &context() {
return *m_p_context; }
139 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)
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.