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

Some code improvements for scheme switching #638

Merged
merged 4 commits into from
Jan 5, 2024
Merged

Conversation

dsuponitskiy
Copy link
Collaborator

No description provided.

@dsuponitskiy dsuponitskiy added the cleanup Code cleanup label Jan 4, 2024
@dsuponitskiy dsuponitskiy added this to the Release 1.1.3 milestone Jan 4, 2024
@dsuponitskiy dsuponitskiy self-assigned this Jan 4, 2024
@dsuponitskiy dsuponitskiy linked an issue Jan 4, 2024 that may be closed by this pull request
@dsuponitskiy dsuponitskiy added the optimization Improves performance label Jan 4, 2024
@pascoec pascoec merged commit 619ee46 into dev Jan 5, 2024
54 checks passed
@pascoec pascoec deleted the 631-some-code-imprv branch January 5, 2024 01:38
dsuponitskiy added a commit that referenced this pull request Mar 4, 2024
* 569 fix fast rotations in leveled bfv (#625)

* fix for fast rotation bfv leveled

* use the already computed digits to drop levels in EvalFastRotation

* Basic tests for BFV EvalFastRotation

* updated tests

* cleanup and clarification

* added more tests + comment

---------

Co-authored-by: Andreea Alexandru <aalexandru@dualitytech.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* fixed FLEXIBLEAUTOEXT for large ring dimensions (#627)

* fixed FLEXIBLEAUTOEXT for large ring dimensions

* fixed the new bug introduced by the prior fix

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Fixed GetBootstrapDepth (#626)

* updated GetBootstrapDepth

* Update simple-ckks-bootstrapping.cpp

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Scheme switching improvements (#630)

* pass BinFHEContext as shared ptr

* pre-rebase

* pass BinFHEContext as shared ptr

* improved linear transform

* unittests are passing + cleanup

* changed API to separate setup from key gen

* data struct for scheme switching parameters

* reverted parameters; serialization not fully working

* fixed serializing keys, issue with serializing inner cc

* changed API for binfhecc access, remaining issue with (de)serialization cc and ctxt compatibility

* serialization works

* cleanup

* prep for cc serialization

* incomplete fix for cc serialization

* before another rebase

* get/set to fix serialization

* Added a mechanism to serialize/deserialize all schemeswitching data

* Reduced the number parameters passed to the constructor (serialize/deserialize schemeswitching data)

* rebased for automorphism keygen revert

* Refactored class SchemeSwitchingDataSerializer

* cleaned some comments

* reverted some old memory changes

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Allow only 2-elem ciphertexts for EvalRotation() (#628)

* Allow only 2-elem ciphertexts for EvalRotation()

* Addressed comments

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Added <cmath> and std:: to some C++ standard lib function calls (#637)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Some code improvements for scheme switching (#638)

* Added a class to hold all parameters for scheme switching setup functions

* Added operator<<() and fixed some bugs in unittests

* Moved some functions to the private section and optimized some operations with vectors

* Fixed an error in scheme-switching-timing.cpp

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Powerpc s390 support (#641)

* Powerpc support.

(cherry picked from commit 7c40ab3)

* Added support to IBM/S390(x) to intnat::MultD

(cherry picked from commit 7a7df9e)

* Fix the big-endian issue with memcpy in S390/x

(cherry picked from commit 7568887)

* intnat/ubintnat.h cleanup

* eliminate mempy usage

* fix for NTL::ConvertToInt<uint128_t>()

---------

Co-authored-by: Yuri Victorovich <yuri@FreeBSD.org>
Co-authored-by: Marcone Almeida <marcone.almeida@gmail.com>

* Moved EvalSum and Automorphism keys to the same map (#639)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Removed ./pke/examples/memory_test.cpp as obsolete (#654)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Fixed a type: replaced __GNUG__ with __GNUC__ (#655)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* 652 fix unittest errors on mingw (#653)

* Fixed unittest errors related to the static key maps in CryptoContextImpl on MinGW

* Fixed a compiler error

* Fixed a compiler error (2)

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Fix for slowdown at a large number of threads (#646)

* partial fix for slowdown at a large number of threads

* fix for slowdown at a large number of threads; fix for lazy reduction issues in DCRTPoly

* fix for 128 bit compilation issue

* Use of std::vector::reserve() (#665)

* additional use of std::vector::reserve()

* fix for clang compilation

* additional use of std::vector::reserve()

* std::is_integral has compiler/platform-dependent behavior for __int128_t (#671)

* fix for -std=c++17; additional checks for int128_t/uit128_t

* BE2 ConvertToInt()

* Update lwe-pke.cpp (#663)

* Update lwe-pke.h

Correct the parameters in the comments of the function

(cherry picked from commit a41d32b)

* Update lwe-pke.cpp

The variance of dgg here is the default value of 1.0, but the variance of the lwe private key should be the same as the variance of member m_dgg in lwe-cryptoparameters.

(cherry picked from commit 5a0b09e)

* Cleaup lwe-pke.cpp

* use dgg from CryptoParams

---------

Co-authored-by: Wangkaixing <50945983+Wangkaixing@users.noreply.github.com>

* 629 correct the use of compress in the scheme switching code (#672)

* corrected Compress for FLEXIBLE modes + corrected final scaling factor for all modes

* fully corrected scaling factors in scheme switch

* moved the specification of the correct scaling factor internally

* some cleanup

* Fixed unittest failures when the library is linked with clang++ in th… (#659)

* Fixed unittest failures when the library is linked with clang++ in the Debug mode and a number of sanitize flags (reported by Google)

* Additional unittest fixes

* Correction to a unittest

* Changes according to the feedback from the review

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* 668 refactor openfhe exception class (#679)

* Added a new class OpenFHEException, changed OPENFHE_THROW and updated all files that use OPENFHE_THROW

* Overloaded OPENFHE_THROW to ensure compatibility with previous versions

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Moved function's implementation from header to source file (#685)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* fix for compilation on MacOS (#687)

* fixed a compilation error affecting python wrapper (#689)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Removed #include <malloc.h> (#693)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* updates the version to v1.1.3

* fixed github vulnerabilities

* added the readthedocs.yaml file (#696)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

---------

Co-authored-by: dsuponitskiy <dmitriy.suponitskiy@gmail.com>
Co-authored-by: Andreea Alexandru <aalexandru@dualitytech.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>
Co-authored-by: andreea-alexandru <31080521+andreea-alexandru@users.noreply.github.com>
Co-authored-by: pascoec <123595534+pascoec@users.noreply.github.com>
Co-authored-by: Yuri Victorovich <yuri@FreeBSD.org>
Co-authored-by: Marcone Almeida <marcone.almeida@gmail.com>
Co-authored-by: Wangkaixing <50945983+Wangkaixing@users.noreply.github.com>
gong-cr pushed a commit to gong-cr/openfhe-development that referenced this pull request Mar 6, 2024
* Added a class to hold all parameters for scheme switching setup functions

* Added operator<<() and fixed some bugs in unittests

* Moved some functions to the private section and optimized some operations with vectors

* Fixed an error in scheme-switching-timing.cpp

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
gong-cr pushed a commit to gong-cr/openfhe-development that referenced this pull request Mar 6, 2024
* 569 fix fast rotations in leveled bfv (openfheorg#625)

* fix for fast rotation bfv leveled

* use the already computed digits to drop levels in EvalFastRotation

* Basic tests for BFV EvalFastRotation

* updated tests

* cleanup and clarification

* added more tests + comment

---------

Co-authored-by: Andreea Alexandru <aalexandru@dualitytech.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* fixed FLEXIBLEAUTOEXT for large ring dimensions (openfheorg#627)

* fixed FLEXIBLEAUTOEXT for large ring dimensions

* fixed the new bug introduced by the prior fix

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Fixed GetBootstrapDepth (openfheorg#626)

* updated GetBootstrapDepth

* Update simple-ckks-bootstrapping.cpp

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Scheme switching improvements (openfheorg#630)

* pass BinFHEContext as shared ptr

* pre-rebase

* pass BinFHEContext as shared ptr

* improved linear transform

* unittests are passing + cleanup

* changed API to separate setup from key gen

* data struct for scheme switching parameters

* reverted parameters; serialization not fully working

* fixed serializing keys, issue with serializing inner cc

* changed API for binfhecc access, remaining issue with (de)serialization cc and ctxt compatibility

* serialization works

* cleanup

* prep for cc serialization

* incomplete fix for cc serialization

* before another rebase

* get/set to fix serialization

* Added a mechanism to serialize/deserialize all schemeswitching data

* Reduced the number parameters passed to the constructor (serialize/deserialize schemeswitching data)

* rebased for automorphism keygen revert

* Refactored class SchemeSwitchingDataSerializer

* cleaned some comments

* reverted some old memory changes

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Allow only 2-elem ciphertexts for EvalRotation() (openfheorg#628)

* Allow only 2-elem ciphertexts for EvalRotation()

* Addressed comments

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Added <cmath> and std:: to some C++ standard lib function calls (openfheorg#637)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Some code improvements for scheme switching (openfheorg#638)

* Added a class to hold all parameters for scheme switching setup functions

* Added operator<<() and fixed some bugs in unittests

* Moved some functions to the private section and optimized some operations with vectors

* Fixed an error in scheme-switching-timing.cpp

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Powerpc s390 support (openfheorg#641)

* Powerpc support.

(cherry picked from commit 7c40ab3)

* Added support to IBM/S390(x) to intnat::MultD

(cherry picked from commit 7a7df9e)

* Fix the big-endian issue with memcpy in S390/x

(cherry picked from commit 7568887)

* intnat/ubintnat.h cleanup

* eliminate mempy usage

* fix for NTL::ConvertToInt<uint128_t>()

---------

Co-authored-by: Yuri Victorovich <yuri@FreeBSD.org>
Co-authored-by: Marcone Almeida <marcone.almeida@gmail.com>

* Moved EvalSum and Automorphism keys to the same map (openfheorg#639)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Removed ./pke/examples/memory_test.cpp as obsolete (openfheorg#654)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Fixed a type: replaced __GNUG__ with __GNUC__ (openfheorg#655)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* 652 fix unittest errors on mingw (openfheorg#653)

* Fixed unittest errors related to the static key maps in CryptoContextImpl on MinGW

* Fixed a compiler error

* Fixed a compiler error (2)

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Fix for slowdown at a large number of threads (openfheorg#646)

* partial fix for slowdown at a large number of threads

* fix for slowdown at a large number of threads; fix for lazy reduction issues in DCRTPoly

* fix for 128 bit compilation issue

* Use of std::vector::reserve() (openfheorg#665)

* additional use of std::vector::reserve()

* fix for clang compilation

* additional use of std::vector::reserve()

* std::is_integral has compiler/platform-dependent behavior for __int128_t (openfheorg#671)

* fix for -std=c++17; additional checks for int128_t/uit128_t

* BE2 ConvertToInt()

* Update lwe-pke.cpp (openfheorg#663)

* Update lwe-pke.h

Correct the parameters in the comments of the function

(cherry picked from commit a41d32b)

* Update lwe-pke.cpp

The variance of dgg here is the default value of 1.0, but the variance of the lwe private key should be the same as the variance of member m_dgg in lwe-cryptoparameters.

(cherry picked from commit 5a0b09e)

* Cleaup lwe-pke.cpp

* use dgg from CryptoParams

---------

Co-authored-by: Wangkaixing <50945983+Wangkaixing@users.noreply.github.com>

* 629 correct the use of compress in the scheme switching code (openfheorg#672)

* corrected Compress for FLEXIBLE modes + corrected final scaling factor for all modes

* fully corrected scaling factors in scheme switch

* moved the specification of the correct scaling factor internally

* some cleanup

* Fixed unittest failures when the library is linked with clang++ in th… (openfheorg#659)

* Fixed unittest failures when the library is linked with clang++ in the Debug mode and a number of sanitize flags (reported by Google)

* Additional unittest fixes

* Correction to a unittest

* Changes according to the feedback from the review

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* 668 refactor openfhe exception class (openfheorg#679)

* Added a new class OpenFHEException, changed OPENFHE_THROW and updated all files that use OPENFHE_THROW

* Overloaded OPENFHE_THROW to ensure compatibility with previous versions

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Moved function's implementation from header to source file (openfheorg#685)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* fix for compilation on MacOS (openfheorg#687)

* fixed a compilation error affecting python wrapper (openfheorg#689)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Removed #include <malloc.h> (openfheorg#693)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* updates the version to v1.1.3

* fixed github vulnerabilities

* added the readthedocs.yaml file (openfheorg#696)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

---------

Co-authored-by: dsuponitskiy <dmitriy.suponitskiy@gmail.com>
Co-authored-by: Andreea Alexandru <aalexandru@dualitytech.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>
Co-authored-by: andreea-alexandru <31080521+andreea-alexandru@users.noreply.github.com>
Co-authored-by: pascoec <123595534+pascoec@users.noreply.github.com>
Co-authored-by: Yuri Victorovich <yuri@FreeBSD.org>
Co-authored-by: Marcone Almeida <marcone.almeida@gmail.com>
Co-authored-by: Wangkaixing <50945983+Wangkaixing@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code cleanup optimization Improves performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scheme switching improvements
3 participants