diff --git a/README.md b/README.md index 3f3265b1..3dcdedcf 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index c8ce0c3e..d0fcd1e1 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -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() diff --git a/bazel/seal.BUILD b/bazel/seal.BUILD index 629b1fa9..78f9c194 100644 --- a/bazel/seal.BUILD +++ b/bazel/seal.BUILD @@ -59,5 +59,5 @@ spu_cmake_external( out_static_libs = ["libseal-4.1.a"], deps = [ "@com_github_facebook_zstd//:zstd", - ], + ] ) diff --git a/benchmark/setup_dockers_and_run.sh b/benchmark/setup_dockers_and_run.sh index dd8a9f4c..14bba654 100644 --- a/benchmark/setup_dockers_and_run.sh +++ b/benchmark/setup_dockers_and_run.sh @@ -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 && \ @@ -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 diff --git a/build_wheel_entrypoint.sh b/build_wheel_entrypoint.sh index 17d70cf4..4e29a6ef 100755 --- a/build_wheel_entrypoint.sh +++ b/build_wheel_entrypoint.sh @@ -15,6 +15,7 @@ # limitations under the License. # + pip install numpy python setup.py bdist_wheel diff --git a/libspu/mpc/utils/BUILD.bazel b/libspu/mpc/utils/BUILD.bazel index cce3ca41..017ef23b 100644 --- a/libspu/mpc/utils/BUILD.bazel +++ b/libspu/mpc/utils/BUILD.bazel @@ -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"], diff --git a/libspu/psi/core/labeled_psi/psi_params.cc b/libspu/psi/core/labeled_psi/psi_params.cc index af5bd802..e3ab2c22 100644 --- a/libspu/psi/core/labeled_psi/psi_params.cc +++ b/libspu/psi/core/labeled_psi/psi_params.cc @@ -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 diff --git a/setup.py b/setup.py index ca44ad98..038500dd 100644 --- a/setup.py +++ b/setup.py @@ -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 = []