Skip to content

Commit e45d01c

Browse files
authored
Merge pull request #184 from openfheorg/dev
Update to v0.8.10
2 parents 2447d37 + 4269e99 commit e45d01c

File tree

8 files changed

+241
-206
lines changed

8 files changed

+241
-206
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project (OpenFHE-Python)
44

55
set(OPENFHE_PYTHON_VERSION_MAJOR 0)
66
set(OPENFHE_PYTHON_VERSION_MINOR 8)
7-
set(OPENFHE_PYTHON_VERSION_PATCH 9)
7+
set(OPENFHE_PYTHON_VERSION_PATCH 10)
88
set(OPENFHE_PYTHON_VERSION ${OPENFHE_PYTHON_VERSION_MAJOR}.${OPENFHE_PYTHON_VERSION_MINOR}.${OPENFHE_PYTHON_VERSION_PATCH})
99

1010
set(CMAKE_CXX_STANDARD 17)
@@ -14,10 +14,13 @@ if(APPLE)
1414
set(CMAKE_CXX_VISIBILITY_PRESET default)
1515
endif()
1616

17-
find_package(OpenFHE 1.2.1 REQUIRED)
17+
find_package(OpenFHE 1.2.2 REQUIRED)
1818
find_package(pybind11 REQUIRED)
1919

20-
set( CMAKE_CXX_FLAGS ${OpenFHE_CXX_FLAGS} )
20+
# "CMAKE_INTERPROCEDURAL_OPTIMIZATION ON" (ON is the default value) causes link failure. see
21+
# https://github.com/openfheorg/openfhe-python/actions/runs/11492843373/job/31987579944
22+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
23+
2124
set( OpenFHE_Py_SOURCES src/lib)
2225
set( OpenFHE_Py_INCLUDES src/include)
2326

docker/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ RUN git clone https://github.com/openfheorg/openfhe-python.git \
4444
&& make -j$(nproc) \
4545
&& make install
4646

47+
# Install openfhe as a pip package
48+
WORKDIR /openfhe-python
49+
RUN python3 setup.py sdist bdist_wheel && pip install dist/openfhe-*.whl
50+
4751
# Expose the port JupyterLab will listen on
4852
EXPOSE 8888
4953

examples/pke/simple-ckks-bootstrapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def simple_bootstrap_example():
6666

6767
ciphertext_after = cryptocontext.EvalBootstrap(ciph)
6868

69-
print(f"Number of levels remaining after bootstrapping: {depth - ciphertext_after.GetLevel()}")
69+
print(f"Number of levels remaining after bootstrapping: {depth - ciphertext_after.GetLevel() - (ciphertext_after.GetNoiseScaleDeg() - 1)}")
7070

7171
result = cryptocontext.Decrypt(ciphertext_after,key_pair.secretKey)
7272
result.SetLength(encoded_length)

setup.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import glob
99
import shutil
1010

11-
__version__ = '0.8.4'
11+
__version__ = '0.9.0'
12+
OPENFHE_PATH = 'openfhe/'
13+
OPENFHE_LIB = 'openfhe.so'
1214

1315
class CMakeExtension(Extension):
1416
def __init__(self, name, sourcedir=''):
@@ -22,7 +24,7 @@ def run(self):
2224
self.build_cmake(ext)
2325

2426
def build_cmake(self, ext):
25-
if os.path.exists('openfhe/openfhe.so'):
27+
if os.path.exists(OPENFHE_PATH + OPENFHE_LIB):
2628
return
2729
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
2830
print(extdir)
@@ -46,14 +48,14 @@ def build_cmake(self, ext):
4648
raise RuntimeError("Cannot find any built .so file in " + extdir)
4749

4850
src_file = so_files[0]
49-
dst_file = os.path.join('openfhe', 'openfhe.so')
51+
dst_file = os.path.join('openfhe', OPENFHE_LIB)
5052
shutil.move(src_file, dst_file)
5153

5254
# Run build_ext before sdist
5355
class SDist(_sdist):
5456
def run(self):
55-
if os.path.exists('openfhe/openfhe.so'):
56-
os.remove('openfhe/openfhe.so')
57+
if os.path.exists(OPENFHE_PATH + OPENFHE_LIB):
58+
os.remove(OPENFHE_PATH + OPENFHE_LIB)
5759
self.run_command('build_ext')
5860
super().run()
5961

src/include/docstrings/binfhecontext_docs.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,18 @@ const char* binfhe_EvalSign_docs = R"pbdoc(
185185
:return: the resulting ciphertext
186186
:rtype: LWECiphertext
187187
)pbdoc";
188+
189+
const char* binfhe_SerializedVersion_docs = R"pbdoc(
190+
Return the serialized version number in use.
191+
192+
:return: the version number
193+
:rtype: uint32_t
194+
)pbdoc";
195+
196+
const char* binfhe_SerializedObjectName_docs = R"pbdoc(
197+
Return the serialized object name
198+
199+
:return: object name
200+
:rtype: std::string
201+
)pbdoc";
188202
#endif // BINFHECONTEXT_DOCSTRINGS_H

src/lib/bindings.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,9 @@ void bind_ciphertext(py::module &m)
11141114
// .def("GetScalingFactor", &CiphertextImpl<DCRTPoly>::GetScalingFactor)
11151115
// .def("SetScalingFactor", &CiphertextImpl<DCRTPoly>::SetScalingFactor)
11161116
.def("GetSlots", &CiphertextImpl<DCRTPoly>::GetSlots)
1117-
.def("SetSlots", &CiphertextImpl<DCRTPoly>::SetSlots);
1117+
.def("SetSlots", &CiphertextImpl<DCRTPoly>::SetSlots)
1118+
.def("GetNoiseScaleDeg", &CiphertextImpl<DCRTPoly>::GetNoiseScaleDeg)
1119+
.def("SetNoiseScaleDeg", &CiphertextImpl<DCRTPoly>::SetNoiseScaleDeg);
11181120
}
11191121

11201122
void bind_schemes(py::module &m){

0 commit comments

Comments
 (0)