This directory contains sample kernels implemented using google test and google benchmark for Microsoft SEAL and PALISADE. These sample kernels are for operations that are not full standalone use cases. An example of such an operation is matrix multiplication for which we provide several different sample kernels showing alternative methods of implementing the same algorithm using different approaches, libraries, and schemes. The full set of available sample kernels for each library and a brief description are described in the details section below.
This directory contains sample kernels which benchmark a set of more complex HE operations in both SEAL and PALISADE.
To run the sample kernels such as dot product, call
# Note, these will take several minutes
$HE_SAMPLES/build/sample-kernels/sample-kernels-seal
$HE_SAMPLES/build/sample-kernels/sample-kernels-palisade
this will output timing results using google benchmark.
For unit test, run
$HE_SAMPLES/build/sample-kernels/test/unit-test
The following tables list and give a brief description of the different sample kernels available. All sample kernels use N = 8192 with 3 Coefficient modulus primes.
Sample Kernel Name | Brief Description |
---|---|
DotPlainBatchAxis_CKKS | Ciphertext-plaintext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ CKKS. |
DotCipherBatchAxis_CKKS | Ciphertext-ciphertext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ CKKS. |
MatMulVal_CKKS | Matrix multiplication w/ matrix represented one row per ciphertext and manual computation using a collection of adds, multiplications, and rotations w/ CKKS. |
LogisticRegression_CKKS | Computes logistic regression inference using a batch of inputs. |
DotPlainBatchAxis_BFV | Ciphertext-plaintext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ BFV. |
DotCipherBatchAxis_BFV | Ciphertext-ciphertext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ BFV. |
MatMulVal_BFV | Matrix multiplication w/ matrix represented one row per ciphertext and manual computation using a collection of adds, multiplications, and rotations w/ BFV. |
MatMulRow_BFV | Matrix multiplication w/ one matrix represented fully in a single ciphertext and the other matrix represented two rows at a time w/ BFV. |
Sample Kernel Name | Brief Description |
---|---|
DotPlainBatchAxis_CKKS | Ciphertext-plaintext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ CKKS. |
DotCipherBatchAxis_CKKS | Ciphertext-ciphertext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ CKKS. |
MatMulEIP_CKKS | Matrix multiplication w/ matrix represented one row per ciphertext using Palisade’s internal dot product calculation w/ CKKS. |
MatMulVal_CKKS | Matrix multiplication w/ matrix represented one row per ciphertext and manual computation using a collection of adds, multiplications, and rotations w/ CKKS. |
MatMulRow_CKKS | Matrix multiplication w/ one matrix represented fully in a single ciphertext and the other matrix represented row by row w/ CKKS. |
LogisticRegression_CKKS | Computes logistic regression inference using a batch of inputs. |
DotPlainBatchAxis_BFV | Ciphertext-plaintext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ BFV. |
DotCipherBatchAxis_BFV | Ciphertext-ciphertext matrix multiplication w/ matrix represented as one element per ciphertext using a collection of adds and multiplications w/ BFV. |
MatMulEIP_BFV | Matrix multiplication w/ matrix represented one row per ciphertext using Palisade’s internal dot product calculation w/ BFV. |
MatMulVal_BFV | Matrix multiplication w/ matrix represented one row per ciphertext and manual computation using a collection of adds, multiplications, and rotations w/ BFV. |
MatMulRow_BFV | Matrix multiplication w/ one matrix represented fully in a single ciphertext and the other matrix represented row by row w/ BFV. |