hebench / reference-palisade-backend

The PALISADE-CPU backend is a Reference backend engine for HEBench which is a shared library that implements the required functions specified in either the hebench::APIBridge or hebench::cpp wrapper. It is intended only as a reference on how to implement a PALISADE backend for HEBench and it is not fully optimized for performance.
Apache License 2.0
6 stars 2 forks source link

MatMulValCKKS Takes Significant Amount of Memory/Time During Decrypt #15

Closed kylanerace closed 2 years ago

kylanerace commented 2 years ago
Version Information (Put N/A for Not Applicable) Software Version(s)
Linux Ubuntu 20.04.1
Git 2.25.1
CMake 3.13.3
Compiler (GCC, Clang, etc.) gcc 9.3.0-17
GLIBC (ldd) 2.31-0ubuntu9
Doxygen N/A
HEBench Frontend v0.5.1-beta*
HEBench API Bridge v0.5.1-beta
Reference Backend dev (2775191)

*Issue also present in anticipated v0.6.0-beta release (bd7f856)

Describe the bug
Running on 36c72t ICX Machine When running MatMulValCKKS with "large" input sizes 8192x100x10, the memory and performance behavior drastically changes as the pipeline gets to the decryption step. Referring to the following step in the pipeline: https://github.com/hebench/backend-cpu-palisade/blob/cb191ebd67306d89e582d3f80b218f37eacb9878/src/benchmarks/ckks/palisade_ckks_matmultval_benchmark.cpp#L357

Note that the same step in the bfv version of MatMulVal is similar (if not the same): https://github.com/hebench/backend-cpu-palisade/blob/cb191ebd67306d89e582d3f80b218f37eacb9878/src/benchmarks/bfv/palisade_bfv_matmultval_benchmark.cpp#L356

Max memory usage at each primary steps (BFV included for reference) (8192x100x10): BFV:

CKKS:

To Reproduce
Steps to reproduce the behavior:

  1. Clone Backend (either development or main)
  2. Potentially temporarily add Multithreading to decrypt step if taking too long just to get it to complete (#pragma omp parallel for above outer decrypt loop here: https://github.com/hebench/backend-cpu-palisade/blob/27751918ec31c22c816b8c13cd80947d9a557655/src/benchmarks/ckks/palisade_ckks_matmultval_benchmark.cpp#L365). Though be aware some instability may be introduced by adding MT to decrypt or encrypt steps.
  3. Create Build Directory and CMake config & Build with: cmake -DCMAKE_INSTALL_PREFIX=./ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_C_COMPILER=gcc-9 .. && make -j install
  4. Run with attached configuration file (change to .yml): matmul-val-ckks-8192x100x10.txt ./bin/test_harness -b ./libhebench_palisade_backend.so --config_file matmul-val-ckks-8192x100x10.yml

Expected behavior
Test completes with a relative increase of memory usage.

Screenshots
N/A

Additional context
N/A

kylanerace commented 2 years ago

Similar issue with element-wise workloads:

kylanerace commented 2 years ago

Closing due to expected behavior for Key Switching Technique used