Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions benchmark/src/IntegerMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static void BM_BigInt_DividedByEq(benchmark::State& state) {
}

template <typename I>
static void exp_BigInt(const I& a, const usint& b) {
static void exp_BigInt(const I& a, uint32_t b) {
__attribute__((unused)) I c1 = a.Exp(b);
}

Expand All @@ -199,7 +199,7 @@ static void BM_BigInt_Exp(benchmark::State& state) {
}

template <typename I>
static void expeq_BigInt(I a, const usint& b) {
static void expeq_BigInt(I a, uint32_t b) {
a.ExpEq(b);
}

Expand Down Expand Up @@ -239,7 +239,7 @@ static void BM_BigInt_MultiplyAndRoundEq(benchmark::State& state) {
}

template <typename I>
static void lshift_BigInt(const I& a, const usshort& b) {
static void lshift_BigInt(const I& a, uint16_t b) {
__attribute__((unused)) I c1 = a.LShift(b);
}

Expand All @@ -251,7 +251,7 @@ static void BM_BigInt_LShift(benchmark::State& state) {
}

template <typename I>
static void lshifteq_BigInt(I a, const usshort& b) {
static void lshifteq_BigInt(I a, uint16_t b) {
a.LShiftEq(b);
}

Expand All @@ -263,7 +263,7 @@ static void BM_BigInt_LShiftEq(benchmark::State& state) {
}

template <typename I>
static void rshift_BigInt(const I& a, const usshort& b) {
static void rshift_BigInt(const I& a, uint16_t b) {
__attribute__((unused)) I c1 = a.RShift(b);
}

Expand All @@ -275,7 +275,7 @@ static void BM_BigInt_RShift(benchmark::State& state) {
}

template <typename I>
static void rshifteq_BigInt(I a, const usshort& b) {
static void rshifteq_BigInt(I a, uint16_t b) {
a.RShiftEq(b);
}

Expand Down
24 changes: 12 additions & 12 deletions benchmark/src/NbTheory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ BENCHMARK(BM_FACT1); // register benchmark
// Prime Modulus tests
//
static BigInteger PM_foundPrimeModulus(void) {
const usint m = 2048;
const usint nBits = 30;
const uint32_t m = 2048;
const uint32_t nBits = 30;

return lbcrypto::FirstPrime<BigInteger>(nBits, m);
}
Expand All @@ -215,8 +215,8 @@ BENCHMARK(BM_PM1); // register benchmark

// note this returns a refrence to BBI
static BigInteger& PM_returns_higher_bit_length(void) {
usint m = 4096;
usint nBits = 49;
uint32_t m = 4096;
uint32_t nBits = 49;

BigInteger primeModulus = lbcrypto::FirstPrime<BigInteger>(nBits, m);
return primeModulus;
Expand All @@ -240,8 +240,8 @@ BENCHMARK(BM_PM2); // register benchmark
// Note this benchmark returns two BBIs so we return a string and suffer
// some overhead
static std::string PROU_equals_m_not_equals_mbytwo(void) {
usint m = 4096;
usint nBits = 33;
uint32_t m = 4096;
uint32_t nBits = 33;

BigInteger primeModulus = lbcrypto::FirstPrime<BigInteger>(nBits, m);
BigInteger primitiveRootOfUnity = lbcrypto::RootOfUnity<BigInteger>(m, primeModulus);
Expand All @@ -268,9 +268,9 @@ BENCHMARK(BM_PROU1); // register benchmark
#if 0 // this takes a long time to run so comment out for quick check
// similarly this outputs 3 values with a string
static std::string PROU_equals_m_not_equals_mbytwo_mbyfour_single_input(void) {
const usint n = 2048;
const usint m = 2*n;
const usint nBits = 43;
const uint32_t n = 2048;
const uint32_t m = 2*n;
const uint32_t nBits = 43;
const int ITERATIONS = m*2;

BigInteger M(std::to_string(m)),
Expand Down Expand Up @@ -312,7 +312,7 @@ BENCHMARK(BM_PROU2);

// similarly this outputs 3 values with a string
static std::string PROU_equals_m_not_equals_mbytwo_mbyfour_multiple_inputs(void) {
usint nqBitsArray[] = {
uint32_t nqBitsArray[] = {
1,
1,
2,
Expand All @@ -329,7 +329,7 @@ static std::string PROU_equals_m_not_equals_mbytwo_mbyfour_multiple_inputs(void)
40,
2048,
41
// const usint BIT_LENGTH = 200 and const usint FRAGMENTATION_FACTOR = 27
// const uint32_t BIT_LENGTH = 200 and const uint32_t FRAGMENTATION_FACTOR = 27
// ,2048, 51
,
4096,
Expand Down Expand Up @@ -358,7 +358,7 @@ static std::string PROU_equals_m_not_equals_mbytwo_mbyfour_multiple_inputs(void)
};
int length = sizeof(nqBitsArray) / sizeof(nqBitsArray[0]);

usint n, qBits, m;
uint32_t n, qBits, m;
BigInteger wpowerm("0");
BigInteger wpowermbytwo("0");
BigInteger wpowermbyfour("0");
Expand Down
8 changes: 4 additions & 4 deletions benchmark/src/bfv-mult-method-benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@

using namespace lbcrypto;

constexpr usint RING_DIM = 16384;
constexpr usint MULT_DEPTH = 7;
constexpr usint PTM = 2;
constexpr usint DCRT_BITS = 60;
constexpr uint32_t RING_DIM = 16384;
constexpr uint32_t MULT_DEPTH = 7;
constexpr uint32_t PTM = 2;
constexpr uint32_t DCRT_BITS = 60;
constexpr KeySwitchTechnique KS_TECH = BV;

static std::vector<MultiplicationTechnique> MULT_METHOD_ARGS = {BEHZ, HPS, HPSPOVERQ, HPSPOVERQLEVELED};
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/ckks-functional-bootstrapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ struct fbt_config {

auto exact(x);
std::transform(x.begin(), x.end(), exact.begin(),
[&](const int64_t& elem) { return (elem >= t.PInput.ConvertToDouble() / 2.); });
[&](int64_t elem) { return (elem >= t.PInput.ConvertToDouble() / 2.); });

std::vector<int64_t> coeffintMod;
std::vector<std::complex<double>> coeffcompMod;
Expand Down
26 changes: 13 additions & 13 deletions benchmark/src/compare-bfv-hps-leveled-vs-behz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@

using namespace lbcrypto;

usint mult_depth = 3;
static std::vector<usint> ptm_args{2, 65537};
static std::vector<usint> dcrtbit_args{30, 60};
static std::vector<usint> logn_args{12, 14};
uint32_t mult_depth = 3;
static std::vector<uint32_t> ptm_args{2, 65537};
static std::vector<uint32_t> dcrtbit_args{30, 60};
static std::vector<uint32_t> logn_args{12, 14};

static void MultBFVArguments(benchmark::internal::Benchmark* b) {
for (usint ptm : ptm_args) {
for (usint dcrtbit : dcrtbit_args) {
for (uint32_t ptm : ptm_args) {
for (uint32_t dcrtbit : dcrtbit_args) {
b->ArgNames({"ptm", "dcrtbit"})->Args({ptm, dcrtbit})->MinTime(10.0);
}
}
}

static void DecBFVArguments(benchmark::internal::Benchmark* b) {
for (usint ptm : ptm_args) {
for (usint dcrtbit : dcrtbit_args) {
for (usint logn : logn_args) {
for (uint32_t ptm : ptm_args) {
for (uint32_t dcrtbit : dcrtbit_args) {
for (uint32_t logn : logn_args) {
b->ArgNames({"ptm", "dcrtbit", "logn"})->Args({ptm, dcrtbit, logn});
}
}
Expand All @@ -77,7 +77,7 @@ static void DecBFVArguments(benchmark::internal::Benchmark* b) {
* Context setup utility methods
*/

CryptoContext<DCRTPoly> GenerateBFVrnsContext(usint ptm, usint dcrtBits) {
CryptoContext<DCRTPoly> GenerateBFVrnsContext(uint32_t ptm, uint32_t dcrtBits) {
CCParams<CryptoContextBFVRNS> parameters;
parameters.SetPlaintextModulus(ptm);
parameters.SetMultiplicativeDepth(mult_depth);
Expand All @@ -93,7 +93,7 @@ CryptoContext<DCRTPoly> GenerateBFVrnsContext(usint ptm, usint dcrtBits) {
return cc;
}

CryptoContext<DCRTPoly> GenerateBEHZContext(usint ptm, usint dcrtBits) {
CryptoContext<DCRTPoly> GenerateBEHZContext(uint32_t ptm, uint32_t dcrtBits) {
CCParams<CryptoContextBFVRNS> parameters;
parameters.SetPlaintextModulus(ptm);
parameters.SetMultiplicativeDepth(mult_depth);
Expand All @@ -109,7 +109,7 @@ CryptoContext<DCRTPoly> GenerateBEHZContext(usint ptm, usint dcrtBits) {
return cc;
}

CryptoContext<DCRTPoly> GenerateFlatBFVrnsContext(usint ptm, usint dcrtBits, usint n) {
CryptoContext<DCRTPoly> GenerateFlatBFVrnsContext(uint32_t ptm, uint32_t dcrtBits, uint32_t n) {
CCParams<CryptoContextBFVRNS> parameters;
parameters.SetPlaintextModulus(ptm);
parameters.SetMaxRelinSkDeg(0);
Expand All @@ -124,7 +124,7 @@ CryptoContext<DCRTPoly> GenerateFlatBFVrnsContext(usint ptm, usint dcrtBits, usi
return cc;
}

CryptoContext<DCRTPoly> GenerateFlatBEHZContext(usint ptm, usint dcrtBits, usint n) {
CryptoContext<DCRTPoly> GenerateFlatBEHZContext(uint32_t ptm, uint32_t dcrtBits, uint32_t n) {
CCParams<CryptoContextBFVRNS> parameters;
parameters.SetPlaintextModulus(ptm);
parameters.SetMaxRelinSkDeg(0);
Expand Down
14 changes: 7 additions & 7 deletions benchmark/src/compare-bfvrns-vs-bgvrns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@

using namespace lbcrypto;

usint mult_depth = 3;
uint32_t mult_depth = 3;

/*
* Context setup utility methods
*/
CryptoContext<DCRTPoly> GenerateBFVrnsContext(usint ptm) {
CryptoContext<DCRTPoly> GenerateBFVrnsContext(uint32_t ptm) {
CCParams<CryptoContextBFVRNS> parameters;
parameters.SetPlaintextModulus(ptm);
parameters.SetMultiplicativeDepth(mult_depth);
Expand All @@ -73,7 +73,7 @@ CryptoContext<DCRTPoly> GenerateBFVrnsContext(usint ptm) {
return cc;
}

CryptoContext<DCRTPoly> GenerateBGVrnsContext(usint ptm) {
CryptoContext<DCRTPoly> GenerateBGVrnsContext(uint32_t ptm) {
CCParams<CryptoContextBGVRNS> parameters;
parameters.SetMultiplicativeDepth(mult_depth);
parameters.SetPlaintextModulus(ptm);
Expand All @@ -93,7 +93,7 @@ CryptoContext<DCRTPoly> GenerateBGVrnsContext(usint ptm) {
* BFVrns benchmarks
*/
void BFVrns_EvalMultManyP2(benchmark::State& state) {
usint ptm = 2;
uint32_t ptm = 2;

CryptoContext<DCRTPoly> cc = GenerateBFVrnsContext(ptm);

Expand Down Expand Up @@ -126,7 +126,7 @@ void BFVrns_EvalMultManyP2(benchmark::State& state) {
BENCHMARK(BFVrns_EvalMultManyP2)->Unit(benchmark::kMicrosecond)->MinTime(10.0);

void BGVrns_EvalMultManyP2(benchmark::State& state) {
usint ptm = 2;
uint32_t ptm = 2;

CryptoContext<DCRTPoly> cc = GenerateBGVrnsContext(ptm);

Expand Down Expand Up @@ -163,7 +163,7 @@ BENCHMARK(BGVrns_EvalMultManyP2)->Unit(benchmark::kMicrosecond)->MinTime(10.0);
*/

void BFVrns_EvalMultManyP65537(benchmark::State& state) {
usint ptm = 65537;
uint32_t ptm = 65537;

CryptoContext<DCRTPoly> cc = GenerateBFVrnsContext(ptm);

Expand Down Expand Up @@ -196,7 +196,7 @@ void BFVrns_EvalMultManyP65537(benchmark::State& state) {
BENCHMARK(BFVrns_EvalMultManyP65537)->Unit(benchmark::kMicrosecond)->MinTime(10.0);

void BGVrns_EvalMultManyP65537(benchmark::State& state) {
usint ptm = 65537;
uint32_t ptm = 65537;

CryptoContext<DCRTPoly> cc = GenerateBGVrnsContext(ptm);

Expand Down
Loading
Loading