Commit 46f872d2 authored by Gerard Ryan's avatar Gerard Ryan

Merge branch 'v1.3.0' into 'master'

V1.3.0 See merge request !4
parents 9a17acf0 53edb02e
......@@ -23,7 +23,6 @@
#POSSIBILITY OF SUCH DAMAGE.
#
################
# Makefile contains core definitions and then includes build instructions
# for making all the palisade components
......@@ -59,12 +58,6 @@ ifdef BACKEND
CPPFLAGS += -DMATHBACKEND=$(BACKEND)
endif
## turn on openmp loop parallelization in the library code
## currently turns on loop parallelization only for the Matrix class
ifdef OMP
CPPFLAGS += -DOMP=$(OMP)
endif
#CPPFLAGS += -Wall -O3 -w -fopenmp -m64 -DNDEBUG ##undefine for parallel best performance operation with no debug
#THE OPTIONS BELOW SHOULD BE USED WITH CARE AS THEY USE A LOT OF AGGRESSIVE OPTIMIZATION OPTIONS
......@@ -73,7 +66,11 @@ endif
#CPPFLAGS += -Wall -Werror -m64 -Ofast -flto -march=native -funroll-loops -fopenmp -DNDEBUG ##undefine for multithread really best performance operation
#CPPFLAGS += -Wall -Werror -m64 -Ofast -flto -march=native -funroll-loops -fopenmp ##undefine for multithread really best performance operation
# base directory of project
ROOTDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
PROJECT := palisade
VERSION := 1.3.0
#build directory
BUILDDIR := build
......@@ -92,16 +89,30 @@ HDREXT := h
$(objects) : %.o : %.cpp
THIRDPARTYINCLUDE := -I third-party/include -I third-party/include/rapidjson
# sub makefiles: each src subdirectory needs to be here
SUBMAKEFILES := core pke
# third party directories
THIRDPARTYDIR := third-party
THIRDPARTYLIBDIR := $(THIRDPARTYDIR)/lib
THIRDPARTYINCLUDE := -I $(THIRDPARTYDIR)/include -I $(THIRDPARTYDIR)/include/rapidjson
# dynamic lib directories on system
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
LIB_DEST := $(PREFIX)/lib/$(PROJECT)/$(VERSION)
EXTLIB := -L$(EXTLIBDIR) $(TEST_LIB) #no profiling
INC := -I src -I src/core/lib -I src/pke/lib -I test $(OMPINCLUDE) $(THIRDPARTYINCLUDE)
INC := -I src $(patsubst %,-Isrc/%/lib,$(SUBMAKEFILES)) -I test $(OMPINCLUDE) $(THIRDPARTYINCLUDE)
#the name of the shared object library for palisade objects.
PALISADECORELIB := libPALISADEcore$(LIBSUFFIX)
PALISADEPKELIB := libPALISADEpke$(LIBSUFFIX)
PALISADEPYLIB := pycrypto$(LIBSUFFIX)
# run make for all components. you can run any individual component separately
# by invoking "make allxxx" for example, make allcore makes everything in core only
......@@ -112,22 +123,37 @@ all:
docs: apidocs
alljava: allcore allpke jwrapper
allpython: allcore allpke pywrapper
alldemos: allcoredemos allpkedemos
testall: $(CORE_TEST_TARGET) $(PKE_TEST_TARGET) utall
$(BINDIR)/unittest/tests$(EXESUFFIX) -t
testall: $(CORE_TEST_TARGET) $(PKE_TEST_TARGET) $(TRAPDOOR_TEST_TARGET) $(WIP_TEST_TARGET) $(CIRCUIT_TEST_TARGET) $(ABE_TEST_TARGET) $(SIGNATURE_TEST_TARGET) utall
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(ROOTDIR)/$(THIRDPARTYLIBDIR):$(ROOTDIR)/$(EXTLIBDIR) $(BINDIR)/unittest/tests$(EXESUFFIX) -t
# clean up all components. you can clean any individual compoenent separately
# by invoking "make cleantargets" for example
# each corresponding makefile will make the cleanxxxx target
.PHONY: clean clobber
clean: cleancore cleanpke cleandocs cleanbenchmark
.PHONY: clean
clean: cleancore cleanpke cleandocs cleanbenchmark
@echo 'Cleaning top level autogenerated directories'
$(RM) -rf $(BINDIR)
$(RM) -rf src/*/bin
.PHONY: clobber
clobber: clean clean_gmp clean_ntl
.PHONY: libdir
libdir:
install --directory $(LIB_DEST)
.PHONY: install
install: installcore installpke
.PHONY: uninstall
uninstall: uninstallcore uninstallpke
UNITTESTMAINOBJ := $(BINDIR)/unittest/Main_TestAll.o
$(UNITTESTMAINOBJ): test/include/gtest/Main_TestAll.cpp src/core/lib/math/backend.h
......
......@@ -48,8 +48,8 @@ CORE_TEST_TARGET := $(EXTTESTDIR)/core/tests$(EXESUFFIX)
-include $(COREUNITOBJECTS:.o=.d)
-include $(COREDEMOOBJECTS:.o=.d)
.PHONY:allcore
allcore: $(EXTLIBDIR)/$(PALISADECORELIB) $(CORE_TEST_TARGET) allcoredemos
.PHONY: allcore
allcore: ntl_all $(EXTLIBDIR)/$(PALISADECORELIB) $(CORE_TEST_TARGET) allcoredemos
allcoredemos: $(EXTLIBDIR)/$(PALISADECORELIB) $(patsubst $(COREBINDIR)/demo/%,$(BINDIR)/demo/core/%,$(patsubst %.o,%$(EXESUFFIX),$(COREDEMOOBJECTS)))
......@@ -95,7 +95,15 @@ $(CORE_TEST_TARGET): $(UNITTESTMAINOBJ) $(COREUNITOBJECTS) $(EXTLIBDIR)/$(PALISA
#used to run tests from make
.PHONY: testcore
testcore: $(CORE_TEST_TARGET)
$(CORE_TEST_TARGET)
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(ROOTDIR)/$(THIRDPARTYLIBDIR):$(ROOTDIR)/$(EXTLIBDIR) $(CORE_TEST_TARGET)
.PHONY: installcore
installcore: libdir
install -t $(LIB_DEST) $(EXTLIBDIR)/$(PALISADECORELIB)
.PHONY: uninstallcore
uninstallcore:
rm $(LIB_DEST)/$(PALISADECORELIB)
corestrings:
@echo $(CORESOURCES)
......
......@@ -25,7 +25,7 @@
INDEXFILE := doc/apidocs/html/index.html
.PHONEY: apidocs
.PHONY: apidocs
apidocs: $(INDEXFILE)
$(INDEXFILE):
......@@ -34,7 +34,7 @@ $(INDEXFILE):
doxygen lbcrypto-doxy-config
@echo
.PHONEY: cleandocs
.PHONY: cleandocs
cleandocs:
@echo " Cleaning docs..."
rm -rf doc/apidocs
......
......@@ -18,7 +18,8 @@ else
endif
CPPSTD := -std=gnu++11 -fPIC
##CPPSTD := -std=gnu++11 -fPIC
CPPSTD := -std=gnu++11 -fPIC ##-mcmodel=large ## static allocator requires this memory model
CC := g++ $(CPPSTD)
LIBSUFFIX := .so
......@@ -35,3 +36,4 @@ LIBPYTHON := -lpython2.7
COMPTHREADFLAG := -pthread
LOADTHREADFLAG := -pthread
......@@ -96,5 +96,12 @@ $(PKE_TEST_TARGET): $(UNITTESTMAINOBJ) $(PKEUNITOBJECTS) $(EXTLIBDIR)/$(PALISADE
#used to run tests from make
.PHONY: testpke
testpke: $(PKE_TEST_TARGET)
$(PKE_TEST_TARGET)
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(ROOTDIR)/$(THIRDPARTYLIBDIR):$(ROOTDIR)/$(EXTLIBDIR) $(PKE_TEST_TARGET)
.PHONY: installpke
installpke: libdir
install -t $(LIB_DEST) $(EXTLIBDIR)/$(PALISADEPKELIB)
.PHONY: uninstallpke
uninstallpke:
rm $(LIB_DEST)/$(PALISADEPKELIB)
PUG.png

52.6 KB

10/17/2018: PALISADE v1.3.0 is released
* Added support for the security levels/tables specified by the HomorphicEncryption.org security standard to all variants of the BFV scheme
* Optimized the packed encoding (batching)
* Simplified the signatures of classes and methods at multiple layers
* Fixed bugs that were brought to our attention
6/15/2018: PALISADE v1.2 is released
PALISADE v1.2 provides several important advancements and improvements to the library. Most notably, we provide:
......
......@@ -44,25 +44,4 @@
using namespace std;
using namespace lbcrypto;
using BE2Integer = cpu_int::BigInteger<integral_dtype,BigIntegerBitLength>;
using BE2ILParams = ILParamsImpl<BE2Integer>;
using BE2ILDCRTParams = ILDCRTParams<BE2Integer>;
using BE2Vector = cpu_int::BigVectorImpl<BE2Integer>;
using BE2Poly = PolyImpl<BE2Integer, BE2Integer, BE2Vector, BE2ILParams>;
using BE2DCRTPoly = DCRTPolyImpl<BE2Integer, BE2Integer, BE2Vector, BE2ILDCRTParams>;
using BE4Integer = exp_int::xubint;
using BE4ILParams = ILParamsImpl<BE4Integer>;
using BE4ILDCRTParams = ILDCRTParams<BE4Integer>;
using BE4Vector = exp_int::xmubintvec;
using BE4Poly = PolyImpl<BE4Integer, BE4Integer, BE4Vector, BE4ILParams>;
using BE4DCRTPoly = DCRTPolyImpl<BE4Integer, BE4Integer, BE4Vector, BE4ILDCRTParams>;
using BE6Integer = NTL::myZZ;
using BE6ILParams = ILParamsImpl<BE6Integer>;
using BE6ILDCRTParams = ILDCRTParams<BE6Integer>;
using BE6Vector = NTL::myVecP<NTL::myZZ>;
using BE6Poly = PolyImpl<BE6Integer, BE6Integer, BE6Vector, BE6ILParams>;
using BE6DCRTPoly = DCRTPolyImpl<BE6Integer, BE6Integer, BE6Vector, BE6ILDCRTParams>;
#endif /* BENCHMARK_SRC_ALLBACKENDS_H_ */
......@@ -72,7 +72,7 @@ void BM_keygen(benchmark::State& state) { // benchmark
}
try {
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(cc->GetRootOfUnity(),
ChineseRemainderTransformFTT<BigVector>::PreCompute(cc->GetRootOfUnity(),
cc->GetCyclotomicOrder(),
cc->GetModulus());
} catch( ... ) {}
......@@ -108,7 +108,7 @@ void BM_encrypt(benchmark::State& state) { // benchmark
}
try {
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(cc->GetRootOfUnity(),
ChineseRemainderTransformFTT<BigVector>::PreCompute(cc->GetRootOfUnity(),
cc->GetCyclotomicOrder(),
cc->GetModulus());
} catch( ... ) {}
......@@ -147,7 +147,7 @@ void BM_decrypt(benchmark::State& state) { // benchmark
}
try {
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(cc->GetRootOfUnity(),
ChineseRemainderTransformFTT<BigVector>::PreCompute(cc->GetRootOfUnity(),
cc->GetCyclotomicOrder(),
cc->GetModulus());
} catch( ... ) {}
......@@ -185,7 +185,7 @@ void BM_rekeygen(benchmark::State& state) { // benchmark
}
try {
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(cc->GetRootOfUnity(),
ChineseRemainderTransformFTT<BigVector>::PreCompute(cc->GetRootOfUnity(),
cc->GetCyclotomicOrder(),
cc->GetModulus());
} catch( ... ) {
......@@ -229,7 +229,7 @@ void BM_reencrypt(benchmark::State& state) { // benchmark
}
try {
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(cc->GetRootOfUnity(),
ChineseRemainderTransformFTT<BigVector>::PreCompute(cc->GetRootOfUnity(),
cc->GetCyclotomicOrder(),
cc->GetModulus());
} catch( ... ) {}
......
......@@ -110,8 +110,8 @@ void BM_encoding_PackedIntPlaintext(benchmark::State& state) {
BigInteger bigmodulus("80899135611688102162227204937217");
BigInteger bigroot("77936753846653065954043047918387");
auto cycloPoly = GetCyclotomicPolynomial<BigVector, BigInteger>(m, modulusQ);
ChineseRemainderTransformArb<BigInteger, BigVector>::SetCylotomicPolynomial(cycloPoly, modulusQ);
auto cycloPoly = GetCyclotomicPolynomial<BigVector>(m, modulusQ);
ChineseRemainderTransformArb<BigVector>::SetCylotomicPolynomial(cycloPoly, modulusQ);
lp.reset(new ILParams(m, modulusQ, squareRootOfRoot, bigmodulus, bigroot));
ep.reset(new EncodingParamsImpl(p,8));
......@@ -142,8 +142,8 @@ void BM_encoding_PackedIntPlaintext_SetParams(benchmark::State& state) {
BigInteger bigmodulus("80899135611688102162227204937217");
BigInteger bigroot("77936753846653065954043047918387");
auto cycloPoly = GetCyclotomicPolynomial<BigVector, BigInteger>(m, modulusQ);
ChineseRemainderTransformArb<BigInteger, BigVector>::SetCylotomicPolynomial(cycloPoly, modulusQ);
auto cycloPoly = GetCyclotomicPolynomial<BigVector>(m, modulusQ);
ChineseRemainderTransformArb<BigVector>::SetCylotomicPolynomial(cycloPoly, modulusQ);
lp.reset(new ILParams(m, modulusQ, squareRootOfRoot, bigmodulus, bigroot));
......
......@@ -57,9 +57,9 @@ void BM_BigInt_constants(benchmark::State& state) { // benchmark
}
}
DO_BENCHMARK_TEMPLATE(BM_BigInt_constants,BE2Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_constants,BE4Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_constants,BE6Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_constants,M2Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_constants,M4Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_constants,M6Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_constants,NativeInteger)
template<typename I>
......@@ -75,9 +75,9 @@ void BM_BigInt_small_variables(benchmark::State& state) { // benchmark
}
}
DO_BENCHMARK_TEMPLATE(BM_BigInt_small_variables,BE2Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_small_variables,BE4Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_small_variables,BE6Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_small_variables,M2Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_small_variables,M4Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_small_variables,M6Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_small_variables,NativeInteger)
template<typename I>
......@@ -92,9 +92,9 @@ void BM_BigInt_large_variables(benchmark::State& state) { // benchmark
}
}
DO_BENCHMARK_TEMPLATE(BM_BigInt_large_variables,BE2Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_large_variables,BE4Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_large_variables,BE6Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_large_variables,M2Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_large_variables,M4Integer)
DO_BENCHMARK_TEMPLATE(BM_BigInt_large_variables,M6Integer)
static string smalla("10403"), smallb("103");
static string largea("18446744073709551616"), largeb("18446744073709551617");
......@@ -116,12 +116,12 @@ static void BM_BigInt_Add(benchmark::State& state) { // benchmark
}
}
BENCHMARK_TEMPLATE(BM_BigInt_Add,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Add,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Add,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Add,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Add,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Add,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Add,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Add,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Add,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Add,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Add,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Add,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Add,NativeInteger)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
// +=
......@@ -140,12 +140,12 @@ static void BM_BigInt_Addeq(benchmark::State& state) { // benchmark
}
}
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Addeq,NativeInteger)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
// mult
......@@ -164,12 +164,12 @@ static void BM_BigInt_Mult(benchmark::State& state) { // benchmark
}
}
BENCHMARK_TEMPLATE(BM_BigInt_Mult,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Mult,NativeInteger)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
// *=
......@@ -188,12 +188,12 @@ static void BM_BigInt_Multeq(benchmark::State& state) { // benchmark
}
}
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,BE2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,BE4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,BE6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,M2Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,M4Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,M6Integer)->Unit(benchmark::kMicrosecond)->ArgName("Large")->Arg(1);
BENCHMARK_TEMPLATE(BM_BigInt_Multeq,NativeInteger)->Unit(benchmark::kMicrosecond)->ArgName("Small")->Arg(0);
//execute the benchmarks
......
This diff is collapsed.
......@@ -81,9 +81,9 @@ static void BM_BigVec_Add(benchmark::State& state) { // benchmark
}
DO_NATIVEVECTOR_BENCHMARK(BM_BigVec_Add)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Add, BE2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Add, BE4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Add, BE6Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Add, M2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Add, M4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Add, M6Vector)
// +=
template <typename V>
......@@ -105,9 +105,9 @@ static void BM_BigVec_Addeq(benchmark::State& state) { // benchmark
}
DO_NATIVEVECTOR_BENCHMARK(BM_BigVec_Addeq)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Addeq, BE2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Addeq, BE4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Addeq, BE6Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Addeq, M2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Addeq, M4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Addeq, M6Vector)
// mult
template <typename V>
......@@ -129,9 +129,9 @@ static void BM_BigVec_Mult(benchmark::State& state) { // benchmark
}
DO_NATIVEVECTOR_BENCHMARK(BM_BigVec_Mult)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Mult, BE2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Mult, BE4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Mult, BE6Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Mult, M2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Mult, M4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Mult, M6Vector)
// mult
template <typename V>
......@@ -153,9 +153,9 @@ static void BM_BigVec_Multeq(benchmark::State& state) { // benchmark
}
DO_NATIVEVECTOR_BENCHMARK(BM_BigVec_Multeq)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Multeq, BE2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Multeq, BE4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Multeq, BE6Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Multeq, M2Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Multeq, M4Vector)
DO_VECTOR_BENCHMARK_TEMPLATE(BM_BigVec_Multeq, M6Vector)
//execute the benchmarks
BENCHMARK_MAIN()
......@@ -34,14 +34,14 @@ using namespace lbcrypto;
template<typename V>
inline V makeVector(usint ringdim, const typename V::Integer& mod) {
DiscreteUniformGeneratorImpl<typename V::Integer,V> dug;
DiscreteUniformGeneratorImpl<V> dug;
dug.SetModulus(mod);
return dug.GenerateVector(ringdim);
}
inline NativeVector makeNativeVector(usint ringdim, const NativeInteger& mod) {
DiscreteUniformGeneratorImpl<NativeInteger,NativeVector> dug;
DiscreteUniformGeneratorImpl<NativeVector> dug;
dug.SetModulus(mod);
return dug.GenerateVector(ringdim);
......
No preview for this file type
......@@ -51,7 +51,7 @@ PROJECT_BRIEF = "A lattice crypto library for software engineers by sof
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO = "PALISADE_badger.jpg"
PROJECT_LOGO = "PUG.png"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
......
......@@ -23,7 +23,7 @@
*
*/
#include "../lib/math/transfrm.h"
#include "../lib/math/dftransfrm.h"
using namespace lbcrypto;
......@@ -110,4 +110,4 @@ int main() {
std::cin.ignore();
std::cin.get();
}
\ No newline at end of file
}
......@@ -42,16 +42,13 @@
#include <chrono>
#include <exception>
#include "utils/debug.h"
#include <omp.h> //open MP header
using namespace std;
using namespace lbcrypto;
//define the main sections of the test
void test_BigVector(usint nloop); // test old version of big int vector
void test_ubintvec(usint nloop); // test new vector version
//main() need this for Kurts' makefile to ignore this.
......
......@@ -51,7 +51,6 @@
#include <chrono>
#include <exception>
#include "utils/debug.h"
#include <omp.h> //open MP header
using namespace std;
using namespace lbcrypto;
......
......@@ -44,7 +44,6 @@
#include <chrono>
#include <exception>
#include "utils/debug.h"
#include <omp.h> //open MP header
using namespace std;
using namespace lbcrypto;
......@@ -209,11 +208,11 @@ void test_NTT (const usint level, const usint nloop) {
//Precomputations for FTT
TIC(t_setup);
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(rootOfUnity1, m, q1);
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(rootOfUnity2, m, q2);
ChineseRemainderTransformFTT<BigVector>::PreCompute(rootOfUnity1, m, q1);
ChineseRemainderTransformFTT<BigVector>::PreCompute(rootOfUnity2, m, q2);
cout<<"CRT 2 setup time "<<TOC_US(t_setup)<<" usec"<<endl;
TIC(t_setup);
ChineseRemainderTransformFTT<BigInteger,BigVector>::PreCompute(rootOfUnity3, m, q3);
ChineseRemainderTransformFTT<BigVector>::PreCompute(rootOfUnity3, m, q3);
cout<<"CRT 3 setup time "<<TOC_US(t_setup)<<" usec"<<endl;
time1af = 0.0;
......
......@@ -33,10 +33,7 @@
#include <chrono>
#include <thread>
#include "utils/debug.h"
#include <omp.h> //open MP header
//using namespace std;
//using namespace lbcrypto;
#include "utils/parallel.h"
//function to verify our generated array
void verify(float *foo, uint32_t array_size){
......@@ -64,6 +61,8 @@ int main(int argc, char* argv[]){
// note if you set dbg_flag = true then all the following DEBUG() statments print to stdout.
bool dbg_flag = true;
lbcrypto::PalisadeParallelControls.Enable();
uint32_t array_size = 1000;
DEBUGEXP(argc);
DEBUGEXP(argv[0]);
......
......@@ -40,8 +40,17 @@ bool PackedEncoding::Encode() {
if( this->isEncoded ) return true;
auto mod = this->encodingParams->GetPlaintextModulus();
if( this->typeFlag == IsNativePoly ) {
NativeVector temp(this->GetElementRingDimension(), this->GetElementModulus().ConvertToInt());
if (( this->typeFlag == IsNativePoly ) || (this->typeFlag == IsDCRTPoly )) {
NativeVector temp;
if ( this->typeFlag == IsNativePoly )
temp = NativeVector(this->GetElementRingDimension(), this->GetElementModulus().ConvertToInt());
else {
NativeInteger q0 = this->encodedVectorDCRT.GetParams()->GetParams()[0]->GetModulus().ConvertToInt();
temp = NativeVector(this->GetElementRingDimension(), q0);
if( q0 < mod )
throw std::logic_error("the plaintext modulus size is larger than the size of CRT moduli; either decrease the plaintext modulus or increase the CRT moduli.");
}
size_t i;
for( i=0; i < value.size(); i++ ) {
......@@ -59,9 +68,28 @@ bool PackedEncoding::Encode() {
temp[i] = NativeInteger(0);
this->isEncoded = true;
this->GetElement<NativePoly>().SetValues(temp, Format::EVALUATION); //output was in coefficient format
if ( this->typeFlag == IsNativePoly ) {
this->GetElement<NativePoly>().SetValues(temp, Format::EVALUATION); //the input plaintext data is in the evaluation format
this->Pack(&this->GetElement<NativePoly>(), this->encodingParams->GetPlaintextModulus());//ilVector coefficients are packed and resulting ilVector is in COEFFICIENT form.
}
else
{
NativePoly firstElement = this->GetElement<DCRTPoly>().GetElementAtIndex(0);
firstElement.SetValues(temp, Format::EVALUATION); //the input plaintext data is in the evaluation format
this->Pack(&firstElement, this->encodingParams->GetPlaintextModulus());//ilVector coefficients are packed and resulting ilVector is in COEFFICIENT form.
this->encodedVectorDCRT.SetElementAtIndex(0,firstElement);
const shared_ptr<ILDCRTParams<BigInteger>> params = this->encodedVectorDCRT.GetParams();
const std::vector<std::shared_ptr<ILNativeParams>> &nativeParams = params->GetParams();
for (size_t i = 1; i < nativeParams.size(); i++ ) {
NativePoly temp(firstElement);
temp.SwitchModulus(nativeParams[i]->GetModulus(),nativeParams[i]->GetRootOfUnity());
this->encodedVectorDCRT.SetElementAtIndex(i,temp);
}
}
this->Pack(&this->GetElement<NativePoly>(), this->encodingParams->GetPlaintextModulus());//ilVector coefficients are packed and resulting ilVector is in COEFFICIENT form.
}
else {
BigVector temp(this->GetElementRingDimension(), BigInteger(this->GetElementModulus()));
......@@ -82,16 +110,11 @@ bool PackedEncoding::Encode() {
temp[i] = BigInteger(0);
this->isEncoded = true;
this->GetElement<Poly>().SetValues(temp, Format::EVALUATION); //output was in coefficient format
this->GetElement<Poly>().SetValues(temp, Format::EVALUATION); //the input plaintext data is in the evaluation format
this->Pack(&this->GetElement<Poly>(), this->encodingParams->GetPlaintextModulus());//ilVector coefficients are packed and resulting ilVector is in COEFFICIENT form.
}
if( this->typeFlag == IsDCRTPoly ) {
this->encodedVectorDCRT = this->encodedVector;
}
return true;
}
......@@ -107,9 +130,17 @@ bool PackedEncoding::Decode() {
auto