Skip to content

Commit

Permalink
Repo sync (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinxc authored Jul 5, 2023
1 parent 381b8dc commit 0004ce6
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 17 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ This documentation also contains instructions for [build and testing](CONTRIBUTI

Please follow [Installation Guidelines](INSTALLATION.md) to install SPU.

## Citing SPU

If you think SPU helpful for your research or development, please consider citing our [paper](https://www.usenix.org/conference/atc23/presentation/ma):

```text
@inproceedings {288747,
author = {Junming Ma and Yancheng Zheng and Jun Feng and Derun Zhao and Haoqi Wu and Wenjing Fang and Jin Tan and Chaofan Yu and Benyu Zhang and Lei Wang},
title = {{SecretFlow-SPU}: A Performant and {User-Friendly} Framework for {Privacy-Preserving} Machine Learning},
booktitle = {2023 USENIX Annual Technical Conference (USENIX ATC 23)},
year = {2023},
address = {Boston, MA},
url = {https://www.usenix.org/conference/atc23/presentation/ma},
publisher = {USENIX Association},
month = jul,
}
```

## Acknowledgement

We thank the significant contributions made by [Alibaba Gemini Lab](https://alibaba-gemini-lab.github.io).
2 changes: 1 addition & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

SECRETFLOW_GIT = "https://github.com/secretflow"

YACL_COMMIT_ID = "e42508bc288a5fee70cb44ae6fce555483dc5265"
YACL_COMMIT_ID = "fff880ff9e1e50d5260c5a881ff7abc051cc27d5"

def spu_deps():
_bazel_platform()
Expand Down
2 changes: 1 addition & 1 deletion bazel/seal.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ spu_cmake_external(
out_static_libs = ["libseal-4.1.a"],
deps = [
"@com_github_facebook_zstd//:zstd",
],
]
)
4 changes: 2 additions & 2 deletions benchmark/setup_dockers_and_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ echo -e "${COLOR_GREEN}Cleanup old docker${COLOR_END}"
docker rm -f spu-build

echo -e "${COLOR_GREEN}Build spu-build${COLOR_END}"
docker run --name spu-build --mount type=bind,source="$(pwd)",target=/home/admin/dev/ secretflow/spu-ci:0.6 \
docker run --name spu-build --mount type=bind,source="$(pwd)",target=/home/admin/dev/ secretflow/spu-ci:latest \
sh -c "cd /home/admin/dev && \
python3 -m pip install -U pip && \
python3 -m pip install -r requirements.txt && \
Expand All @@ -42,7 +42,7 @@ sleep 10

echo -e "${COLOR_GREEN}Run benchmark${COLOR_END}"
docker run --rm --mount type=bind,source="$(pwd)",target=/home/admin/dev/ --network nn-benchmark spu-build:v1 \
sh -c "cd /home/admin/dev && bash benchmark/run_bench.sh $@" | tee benchmark_results.log
sh -c "cd /home/admin/dev && bash benchmark/run_bench.sh $@" | tee benchmark_results.log;

echo -e "${COLOR_GREEN}Shutdown docker compose${COLOR_END}"
docker-compose -f .circleci/benchmark.yml down
Expand Down
1 change: 1 addition & 0 deletions build_wheel_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.
#


pip install numpy

python setup.py bdist_wheel
Expand Down
2 changes: 1 addition & 1 deletion libspu/mpc/utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ spu_cc_library(
srcs = ["linalg.cc"],
hdrs = ["linalg.h"],
deps = [
"@com_github_eigenteam_eigen//:eigen3",
"//libspu/core:parallel_utils",
"//libspu/core:prelude",
"@com_github_eigenteam_eigen//:eigen3",
] + select({
"@bazel_tools//src/conditions:darwin_x86_64": ["@local_homebrew_x64//:openmp"],
"@bazel_tools//src/conditions:darwin_arm64": ["@local_homebrew_arm64//:openmp"],
Expand Down
18 changes: 7 additions & 11 deletions libspu/psi/core/labeled_psi/psi_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,17 @@ apsi::PSIParams GetPsiParams(size_t nr, size_t ns) {
// query_powers reference Challis and Robinson (2010)
// http://emis.library.cornell.edu/journals/JIS/VOL13/Challis/challis6.pdf
if (seal_params.poly_modulus_degree == 4096) {
// 1M-256-288.json
table_params.max_items_per_bin = 512;
// 256K-512.json
table_params.max_items_per_bin = 64;

query_params.ps_low_degree = 0;
query_params.query_powers = {
1, 3, 4, 6, 10, 13, 15, 21, 29, 37, 45, 53, 61, 69,
75, 77, 80, 84, 86, 87, 89, 90, 181, 183, 188, 190, 195, 197,
206, 213, 214, 222, 230, 238, 246, 254, 261, 337, 338, 345, 353, 361,
370, 372, 377, 379, 384, 386, 477, 479, 486, 487, 495, 503, 511};
query_params.query_powers = {1, 3, 4, 9, 11, 16, 21, 23, 28, 29, 31, 32};
} else if (seal_params.poly_modulus_degree == 8192) {
// 256M-4096.json
table_params.max_items_per_bin = 4000;
// 1M-1-32.json
table_params.max_items_per_bin = 228;

query_params.ps_low_degree = 310;
query_params.query_powers = {1, 4, 10, 11, 28, 33, 78, 118, 143, 311, 1555};
query_params.ps_low_degree = 0;
query_params.query_powers = {1, 3, 8, 19, 33, 39, 92, 102};
}

// seal param
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def build(build_python, build_cpp):
bazel_flags = ["--verbose_failures"]
if BAZEL_MAX_JOBS:
n = int(BAZEL_MAX_JOBS) # the value must be an int
bazel_flags.append(f"--jobs={n}")
bazel_flags.append("--jobs")
bazel_flags.append(f"{n}")

bazel_precmd_flags = []

Expand Down

0 comments on commit 0004ce6

Please sign in to comment.