forked from secretflow/heu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo-sync-2023-08-25T17:34:40+0800 (secretflow#92)
* repo-sync-2023-08-25T17:34:40+0800 * repo-sync-2023-08-25T17:44:49+0800 * repo-sync-2023-08-25T17:47:11+0800 * Update algo_choice.po
- Loading branch information
Showing
17 changed files
with
169 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,14 +37,13 @@ HEU 安装包已经发布到了 PyPi,您可以通过 pip 工具安装 HEU | |
- `Bazel <https://docs.bazel.build/versions/main/install.html>`_ | ||
- GCC >= 11 | ||
|
||
安装: | ||
编译和安装: | ||
|
||
.. code-block:: bash | ||
git clone --recursive [email protected]:secretflow/heu.git | ||
cd heu | ||
bazel build //heu/pylib -c opt | ||
pip install bazel-bin/heu/pylib/(cat bazel-bin/heu/pylib/pylib.name) --force-reinstall | ||
sh build_wheel_entrypoint.sh | ||
测试运行 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: HEU \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-07-26 11:37+0800\n" | ||
"POT-Creation-Date: 2023-08-21 18:43+0800\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -207,6 +207,7 @@ msgstr "security" | |
|
||
#: ../../getting_started/algo_choice.rst:68 | ||
#: ../../getting_started/algo_choice.rst:205 | ||
#: ../../getting_started/algo_choice.rst:346 | ||
msgid "IND-CPA 安全,语义安全(Semantic Security)" | ||
msgstr "IND-CPA Security, Semantic Security" | ||
|
||
|
@@ -901,11 +902,13 @@ msgid "同态特性取决于底层循环群 G 的定义,根据 G 的不同 Elg | |
msgstr "" | ||
|
||
#: ../../getting_started/algo_choice.rst:333 | ||
msgid "取决于 G 上离散对数问题(DLP)的困难性" | ||
msgid "" | ||
"如果定义在 G 上的 Decisional Diffie–Hellman assumption (DDH) " | ||
"是困难的,则算法是语义安全(Semantic Security)的,不可区分性满足 IND-CPA" | ||
msgstr "" | ||
|
||
#: ../../getting_started/algo_choice.rst:335 | ||
msgid "离散对数难题 DLP" | ||
msgid "CDH & DDH" | ||
msgstr "" | ||
|
||
#: ../../getting_started/algo_choice.rst:337 | ||
|
@@ -924,12 +927,8 @@ msgstr "Information of EC ElGamal" | |
msgid "取决于明文到 EC Group 的映射方式,如果映射妥当,则 EC ElGamal 满足加法同态特性" | ||
msgstr "" | ||
|
||
#: ../../getting_started/algo_choice.rst:346 | ||
msgid "取决于椭圆曲线离散对数问题(ECDLP)的困难性" | ||
msgstr "" | ||
|
||
#: ../../getting_started/algo_choice.rst:348 | ||
msgid "椭圆曲线离散对数难题 ECDLP" | ||
msgid "定义在椭圆曲线上的 CDH & DDH" | ||
msgstr "" | ||
|
||
#: ../../getting_started/algo_choice.rst:350 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: HEU \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-02-02 20:22+0800\n" | ||
"POT-Creation-Date: 2023-08-23 11:26+0800\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -17,6 +17,7 @@ msgstr "" | |
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 2.10.3\n" | ||
|
||
#: ../../getting_started/installation.rst:2 | ||
#: ../../getting_started/installation.rst:16 | ||
msgid "安装" | ||
msgstr "Installation" | ||
|
@@ -80,18 +81,18 @@ msgid "GCC >= 11" | |
msgstr "" | ||
|
||
#: ../../getting_started/installation.rst:40 | ||
msgid "安装:" | ||
msgid "编译和安装:" | ||
msgstr "Compile and install:" | ||
|
||
#: ../../getting_started/installation.rst:51 | ||
#: ../../getting_started/installation.rst:50 | ||
msgid "测试运行" | ||
msgstr "Test running" | ||
|
||
#: ../../getting_started/installation.rst:53 | ||
#: ../../getting_started/installation.rst:52 | ||
msgid "安装完成后,建议执行以下命令检查 HEU 是否工作正常" | ||
msgstr "After installation, it is a good idea to test HEU using:" | ||
|
||
#: ../../getting_started/installation.rst:59 | ||
#: ../../getting_started/installation.rst:58 | ||
msgid "" | ||
"上述命令,如果没有任何输出,则说明安装成功;反之如果报错,则说明安装未成功,请参考 :doc:`FAQ " | ||
"</getting_started/faq>`" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# SEAL-GPU | ||
|
||
SEAL-GPU is an easy-to-use SEAL library using GPU acceleration developed by the software and hardware combination group at AntGroup. SEAL-GPU provides APIs similar with SEAL, and will provide richer functions and interfaces later. | ||
|
||
> Just for GPU Part | ||
**//// Link GPULIB FIRST ////** | ||
|
||
## Environment | ||
|
||
* cmake version >= 3.24 | ||
* gnu version >= 9 | ||
* cuda version >= 11 | ||
* gmp required | ||
* ntl required | ||
|
||
## gpu_lib | ||
|
||
This folder provides GPU library devolped by cuda. | ||
|
||
## How to build | ||
|
||
* `-DSEAL_USE_GPU` should be set `ON` to enhance GPU boost. If set `OFF`, SEAL-GPU will appear nothing different from the raw SEAL. | ||
* `-DCMAKE_INSTALL_PREFIX` should be set as the SEAL-GPU's install path. | ||
* `-DCMAKE_PREFIX_PATH` is the path where SEAL-GPU can find the `GPULIB` package. | ||
|
||
Or simply build step-by-step: | ||
```sh | ||
cmake -S . -B build -DSEAL_USE_GPU=ON -DCMAKE_INSTALL_PREFIX=<INSTALL_PATH> -DCMAKE_PREFIX_PATH=<GPULIB_PATH> | ||
cmake --build build | ||
sudo cmake --install build | ||
``` | ||
|
||
## Examples | ||
|
||
* Calling GPULIB to do the `relinearization` in SEAL can be done in 3 steps: | ||
|
||
1. Use a `SEALContext` instance to construct the context used by GPULIB, and enable RMM based memory pool. | ||
|
||
```c++ | ||
auto gpu_context = context.convert2GPU(); | ||
gpu_context.EnableMemoryPool(); | ||
``` | ||
|
||
2. Copy the `RelinKeys` instance to GPU memory. | ||
|
||
```c++ | ||
auto gpu_evk = static_cast<const KSwitchKeys&>(relin_keys).convert2GPU(context); | ||
``` | ||
|
||
3. Suppose you have a `Ciphertext` instance in SEAL whose size is precisely 3, a `relinearize_inplace` or `relinearize` can reduce its size to 2 via GPULIB. The method needs aforementioned `gpu_context` and `gpu_evk` as arguments. | ||
|
||
> Test end-to-end performance in this step. | ||
|
||
```C++ | ||
evaluator.relinearize_inplace(x_encrypted, gpu_evk, gpu_context); | ||
``` | ||
|
||
* Calling GPULIB to do the `rotation` in SEAL can be done in 3 steps: | ||
|
||
1. Use a `SEALContext` instance to construct the context used by GPULIB, and enable RMM based memory pool. | ||
|
||
```c++ | ||
auto gpu_context = context.convert2GPU(); | ||
gpu_context.EnableMemoryPool(); | ||
``` | ||
|
||
2. Copy the `GaloisKeys` instance to GPU memory. I store the `pair<size_t, ckks::EvaluationKey> (elt, gpu_evk)` in an `unordered_map`. | ||
|
||
```C++ | ||
std::unordered_map<size_t, ckks::EvaluationKey> gpu_evks; | ||
|
||
for (size_t i = 0; i < galois_keys.data().size(); i++) | ||
{ | ||
if (galois_keys.has_key(i)) | ||
{ | ||
gpu_evks.insert(make_pair(i, | ||
static_cast<const KSwitchKeys&>(galois_keys).convert2GPU(context, GaloisKeys::get_index(i)))); | ||
} | ||
} | ||
``` | ||
|
||
3. Use the `rotate_vector` method to rotate a `Ciphertext` instance via GPULIB. The method needs aforementioned `gpu_context` and `gpu_evks` as arguments. | ||
|
||
> Test end-to-end performance in this step. | ||
```c++ | ||
evaluator.rotate_vector(encrypted, step, gpu_evks, rotated, gpu_context); | ||
``` | ||
|
||
* `example` works when `poly_modulus_degree` is `8192` and `16384`. Other configurations have not been tested. | ||
* Support rotation. | ||
* A new example :matrix multiply vector is already add in SEAL-GPU examples, which is an end-to-end gpu compute example. | ||
|
||
## Flaws & TODOs | ||
|
||
* **The version is not completely end-to-end!** | ||
* Some new functions will be finished. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.