MOTION
0.01
Framework for mixed-protocol multi-party computation
|
Go to the documentation of this file.
31 #include <unordered_map>
35 struct AlgorithmDescription;
50 Register(std::shared_ptr<Logger> logger);
54 std::shared_ptr<Logger>
GetLogger() {
return logger_; }
69 return gates_.at(gate_id - gate_id_offset_);
105 return gates_setup_done_condition_;
109 return gates_online_done_condition_;
117 std::string path,
const std::shared_ptr<AlgorithmDescription>& algorithm_description);
124 std::shared_ptr<Logger> logger_;
127 std::size_t global_gate_id_ = 0, global_wire_id_ = 0;
128 std::size_t global_arithmetic_gmw_sharing_id_ = 0, global_boolean_gmw_sharing_id_ = 0;
129 std::size_t gate_id_offset_ = 0, wire_id_offset_ = 0;
131 std::atomic<std::size_t> evaluated_gates_online_ = 0;
132 std::atomic<std::size_t> evaluated_gates_setup_ = 0;
135 bool gates_setup_done_flag_ =
false;
136 bool gates_online_done_flag_ =
false;
138 std::shared_ptr<FiberCondition> gates_setup_done_condition_;
139 std::shared_ptr<FiberCondition> gates_online_done_condition_;
141 std::queue<std::size_t> active_gates_;
142 std::mutex active_queue_mutex_;
144 std::vector<GatePointer> input_gates_;
145 std::vector<GatePointer> gates_;
147 std::vector<WirePointer> wires_;
149 std::unordered_map<std::string, std::shared_ptr<AlgorithmDescription>> cached_algos_;
150 std::mutex cached_algos_mutex_;
std::shared_ptr< AlgorithmDescription > GetCachedAlgorithmDescription(const std::string &path)
Gets cached AlgorithmDescription object read from a file and placed into cached_algos_.
Definition: register.cpp:188
std::size_t GetTotalNumberOfGates() const
Definition: register.h:98
void RegisterNextInputGate(GatePointer gate)
Definition: register.cpp:82
std::size_t GetNumberOfEvaluatedGateSetups() const
Definition: register.h:94
void Clear()
Definition: register.cpp:161
std::shared_ptr< Wire > WirePointer
Definition: register.h:40
void UnregisterGate(std::size_t gate_id)
Definition: register.h:76
auto & GetGates() const
Definition: register.h:74
bool AddCachedAlgorithmDescription(std::string path, const std::shared_ptr< AlgorithmDescription > &algorithm_description)
Tries to insert an AlgorithmDescription object read from a file into cached_algos_.
Definition: register.cpp:181
void IncrementEvaluatedGatesOnlineCounter()
Definition: register.cpp:125
std::shared_ptr< Register > RegisterPointer
Definition: backend.h:84
~Register()
Definition: register.cpp:47
void IncrementEvaluatedGatesSetupCounter()
Definition: register.cpp:114
Definition: algorithm_description.cpp:35
std::size_t GetNumberOfEvaluatedGates() const
Definition: register.h:96
std::shared_ptr< Gate > GatePointer
Definition: backend.h:64
void ClearActiveQueue()
Definition: register.cpp:96
void RegisterNextGate(GatePointer gate)
Definition: register.cpp:77
std::shared_ptr< Logger > GetLogger()
Definition: register.h:54
std::shared_ptr< FiberCondition > GetGatesSetupDoneCondition()
Definition: register.h:104
Definition: register.h:48
constexpr bool kVerboseDebug
Definition: constants.h:50
const GatePointer & GetGate(std::size_t gate_id) const
Definition: register.h:68
std::size_t NextBooleanGmwSharingId(std::size_t number_of_parallel_values)
Definition: register.cpp:70
void RegisterNextWire(WirePointer wire)
Definition: register.h:78
std::shared_ptr< FiberCondition > GetGatesOnlineDoneCondition()
Definition: register.h:108
std::size_t NextArithmeticSharingId(std::size_t number_of_parallel_values)
Definition: register.cpp:63
void UnregisterWire(std::size_t wire_id)
Definition: register.h:82
std::int64_t GetNextGateFromActiveQueue()
Definition: register.cpp:102
WirePointer GetWire(std::size_t wire_id) const
Definition: register.h:80
void Reset()
Definition: register.cpp:136
std::size_t NextWireId() noexcept
Definition: register.cpp:58
Register(std::shared_ptr< Logger > logger)
Definition: register.cpp:40
const auto & GetInputGates() const
Definition: register.h:72
std::size_t NextGateId() noexcept
Definition: register.cpp:53
void AddToActiveQueue(std::size_t gate_id)
Definition: register.cpp:88