Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'party->Run( repetitions )' problem #33

Open
scg258 opened this issue Nov 4, 2022 · 2 comments
Open

'party->Run( repetitions )' problem #33

scg258 opened this issue Nov 4, 2022 · 2 comments

Comments

@scg258
Copy link

scg258 commented Nov 4, 2022

The following circuit will have an error of exceeding the boundary, but if the parameter is removed, the circuit can operate successfully.

suint v1=party->In<mo::MpcProtocol::kBooleanGmw>(mo::ToInput(value),0);
suint v2=party->In<mo::MpcProtocol::kBooleanGmw>(mo::ToInput(value),1);
suint c=v1+v2;

party->Run(2);

The error is:
terminate called after throwing an instance of 'std::out_of_range'
what(): Accessing positions 159 to 477 of 159

@Oleksandr-Tkachenko
Copy link
Member

Party::Run currently doesn't work well with repetitions > 1. If you're trying to benchmark multiple runs, one option would be to do something like this:

encrypto::motion::AccumulatedRunTimeStatistics accumulated_statistics;
encrypto::motion::AccumulatedCommunicationStatistics accumulated_communication_statistics;
for (std::size_t i = 0; i < number_of_repetitions; ++i) {
encrypto::motion::PartyPointer party{CreateParty(user_options)};
// establish communication channels with other parties
if (protocol_string == "BMR") {
auto statistics =
EvaluateProtocol(party, number_of_simd, encrypto::motion::MpcProtocol::kBmr, check);
accumulated_statistics.Add(statistics);
} else if (protocol_string == "GMW" || protocol_string == "BooleanGMW") {
auto statistics = EvaluateProtocol(party, number_of_simd,
encrypto::motion::MpcProtocol::kBooleanGmw, check);
accumulated_statistics.Add(statistics);
} else {
throw std::invalid_argument("Only GMW or BMR is allowed");
}
auto communication_statistics =
party->GetBackend()->GetCommunicationLayer().GetTransportStatistics();
accumulated_communication_statistics.Add(communication_statistics);
}
std::cout << encrypto::motion::PrintStatistics(
fmt::format("AES128 with {} SIMD values in {}", number_of_simd, protocol_string),
accumulated_statistics, accumulated_communication_statistics);
.

@scg258
Copy link
Author

scg258 commented Nov 7, 2022

Thank you!

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

No branches or pull requests

2 participants