HEBench
api.h
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef _HEBench_API_Bridge_H_7e5fa8c2415240ea93eff148ed73539b
6 #define _HEBench_API_Bridge_H_7e5fa8c2415240ea93eff148ed73539b
7 
8 #include "types.h"
9 
10 namespace hebench {
11 namespace APIBridge {
12 
26 
42 extern "C" ErrorCode initEngine(Handle *h_engine, const int8_t *p_buffer, uint64_t size);
43 
53 extern "C" ErrorCode subscribeBenchmarksCount(Handle h_engine, std::uint64_t *p_count);
72 extern "C" ErrorCode subscribeBenchmarks(Handle h_engine, Handle *p_h_bench_descs, std::uint64_t count);
87  Handle h_bench_desc,
88  std::uint64_t *p_param_count,
89  std::uint64_t *p_default_count);
111 extern "C" ErrorCode describeBenchmark(Handle h_engine,
112  Handle h_bench_desc,
113  BenchmarkDescriptor *p_bench_desc,
114  WorkloadParams *p_default_params,
115  std::uint64_t default_count);
141 extern "C" ErrorCode createBenchmark(Handle h_engine,
142  Handle h_bench_desc,
143  const WorkloadParams *p_params,
144  Handle *h_benchmark);
145 
166 extern "C" ErrorCode initBenchmark(Handle h_benchmark,
167  const BenchmarkDescriptor *p_concrete_desc);
168 
195 extern "C" ErrorCode encode(Handle h_benchmark,
196  const DataPackCollection *p_parameters,
197  Handle *h_plaintext);
198 
223 extern "C" ErrorCode decode(Handle h_benchmark,
224  Handle h_plaintext,
225  DataPackCollection *p_native);
226 
241 extern "C" ErrorCode encrypt(Handle h_benchmark,
242  Handle h_plaintext,
243  Handle *h_ciphertext);
244 
259 extern "C" ErrorCode decrypt(Handle h_benchmark,
260  Handle h_ciphertext,
261  Handle *h_plaintext);
262 
305 extern "C" ErrorCode load(Handle h_benchmark,
306  const Handle *h_local_packed_params,
307  std::uint64_t local_count,
308  Handle *h_remote);
309 
336 extern "C" ErrorCode store(Handle h_benchmark,
337  Handle h_remote,
338  Handle *h_local_packed_params,
339  std::uint64_t local_count);
340 
513 extern "C" ErrorCode operate(Handle h_benchmark,
514  Handle h_remote_packed_params,
515  const ParameterIndexer *p_param_indexers,
516  uint64_t indexers_count,
517  Handle *h_remote_output);
518 
537 extern "C" std::uint64_t getSchemeName(Handle h_engine, Scheme s, char *p_name, std::uint64_t size);
557 extern "C" std::uint64_t getSchemeSecurityName(Handle h_engine, Scheme s, Security sec,
558  char *p_name, std::uint64_t size);
559 
585 extern "C" std::uint64_t getBenchmarkDescriptionEx(Handle h_engine,
586  Handle h_bench_desc,
587  const hebench::APIBridge::WorkloadParams *p_w_params,
588  char *p_description, std::uint64_t size);
589 
607 extern "C" std::uint64_t getErrorDescription(Handle h_engine, ErrorCode code, char *p_description, std::uint64_t size);
608 
629 extern "C" std::uint64_t getLastErrorDescription(Handle h_engine, char *p_description, std::uint64_t size);
630 
631 } // namespace APIBridge
632 } // namespace hebench
633 
634 #endif // defined _HEBench_API_Bridge_H_7e5fa8c2415240ea93eff148ed73539b
ErrorCode encrypt(Handle h_benchmark, Handle h_plaintext, Handle *h_ciphertext)
Encrypts a plain text into a cipher text.
std::uint64_t getSchemeName(Handle h_engine, Scheme s, char *p_name, std::uint64_t size)
Retrieves the name of a specified scheme ID from the backend.
std::uint64_t getSchemeSecurityName(Handle h_engine, Scheme s, Security sec, char *p_name, std::uint64_t size)
Retrieves the name of the specified security for the scheme ID from the backend.
std::uint64_t getErrorDescription(Handle h_engine, ErrorCode code, char *p_description, std::uint64_t size)
Retrieves the general error description of an error code.
ErrorCode destroyHandle(Handle h)
Releases resources held by the specified handle.
ErrorCode operate(Handle h_benchmark, Handle h_remote_packed_params, const ParameterIndexer *p_param_indexers, uint64_t indexers_count, Handle *h_remote_output)
Performs the workload operation of the benchmark.
ErrorCode encode(Handle h_benchmark, const DataPackCollection *p_parameters, Handle *h_plaintext)
Given a pack of parameters in raw, native data format, encodes them into plain text suitable for back...
ErrorCode decrypt(Handle h_benchmark, Handle h_ciphertext, Handle *h_plaintext)
Decrypts a cipher text into corresponding plain text.
ErrorCode store(Handle h_benchmark, Handle h_remote, Handle *h_local_packed_params, std::uint64_t local_count)
Retrieves the specified data from the backend.
std::int32_t Scheme
Open-ended homomorphic encryption scheme ID.
Definition: types.h:406
ErrorCode describeBenchmark(Handle h_engine, Handle h_bench_desc, BenchmarkDescriptor *p_bench_desc, WorkloadParams *p_default_params, std::uint64_t default_count)
Retrieves the concrete description for a benchmark registered by backend.
ErrorCode initBenchmark(Handle h_benchmark, const BenchmarkDescriptor *p_concrete_desc)
Allows the benchmark to perform initialization steps based on the finalized, concrete description.
std::int32_t Security
Open-ended homomorphic encryption scheme security ID.
Definition: types.h:412
ErrorCode createBenchmark(Handle h_engine, Handle h_bench_desc, const WorkloadParams *p_params, Handle *h_benchmark)
Instantiates a benchmark on the backend.
ErrorCode getWorkloadParamsDetails(Handle h_engine, Handle h_bench_desc, std::uint64_t *p_param_count, std::uint64_t *p_default_count)
Retrieves details about the flexible parameters supported by this workload.
ErrorCode load(Handle h_benchmark, const Handle *h_local_packed_params, std::uint64_t local_count, Handle *h_remote)
Loads the specified data from the local host into the remote backend to use as parameter during a cal...
std::int32_t ErrorCode
Return value for API bridge functions.
Definition: types.h:34
ErrorCode initEngine(Handle *h_engine, const int8_t *p_buffer, uint64_t size)
Initializes the backend engine.
ErrorCode decode(Handle h_benchmark, Handle h_plaintext, DataPackCollection *p_native)
Decodes plaintext data into the appropriate raw, native format.
std::uint64_t getLastErrorDescription(Handle h_engine, char *p_description, std::uint64_t size)
Retrieves the detailed description of the last error that occurred during an operation on the engine.
std::uint64_t getBenchmarkDescriptionEx(Handle h_engine, Handle h_bench_desc, const hebench::APIBridge::WorkloadParams *p_w_params, char *p_description, std::uint64_t size)
Retrieves backend specific text description for a benchmark descriptor.
ErrorCode subscribeBenchmarksCount(Handle h_engine, std::uint64_t *p_count)
Retrieves the number of benchmarks for which the backend is registering to perform.
ErrorCode subscribeBenchmarks(Handle h_engine, Handle *p_h_bench_descs, std::uint64_t count)
Retrieves handles to the benchmark descriptions for which the backend is registering to perform.
Defines a benchmark test.
Definition: types.h:527
Defines a collection of data packs.
Definition: types.h:624
Specifies the parameters for a workload.
Definition: types.h:363
Structure to contain flexible data.
Definition: types.h:552