Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo-sync-2024-12-17T15:14:30+0800 #216

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
USE_BAZEL_VERSION=7.4.1
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
common --experimental_repo_remote_exec
common --experimental_cc_shared_library

common --registry=https://raw.githubusercontent.com/secretflow/bazel-registry/main
common --registry=https://bcr.bazel.build
common --registry=https://baidu.github.io/babylon/registry

build --incompatible_new_actions_api=false
build --copt=-fdiagnostics-color=always
build --enable_platform_specific_config
Expand Down
1 change: 0 additions & 1 deletion .bazelversion

This file was deleted.

1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ CheckOptions:

- key: performance-unnecessary-value-param.AllowedTypes
value: PtBufferView

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Pipfile

# bazel
bazel-*
MODULE.bazel.lock

# cmake related
abseil-cpp
Expand All @@ -44,4 +45,4 @@ rpc_data
coverity*/
idir/

ossutil_output/
ossutil_output/
116 changes: 116 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Contribution guidelines

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project.

## Style

### C++ coding style

In general, please use clang-format to format code, and follow clang-tidy tips.

Most of the code style is derived from the
[Google C++ style guidelines](https://google.github.io/styleguide/cppguide.html), except:

- Exceptions are allowed and encouraged where appropriate.
- Header guards should use `#pragma once`.
- Adopt [camelBack](https://llvm.org/docs/Proposals/VariableNames.html#variable-names-coding-standard-options)
for function names.
- Use [fixed width integer types](https://en.cppreference.com/w/cpp/types/integer) whenever possible.
- Avoid using size_t on interface APIs.

The compiler portion of the project follows [MLIR style](https://mlir.llvm.org/getting_started/DeveloperGuide/#style-guide).

### Other tips

- Git commit message should be meaningful, we suggest imperative [keywords](https://github.com/joelparkerhenderson/git_commit_message#summary-keywords).
- Developer must write unit-test (line coverage must be greater than 80%), tests should be deterministic.
- Read awesome [Abseil Tips](https://abseil.io/tips/)

## Build

### Prerequisite


#### Docker

```sh
## start container
docker run -d -it --name psi-dev-$(whoami) \
--mount type=bind,source="$(pwd)",target=/home/admin/dev/ \
-w /home/admin/dev \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
--cap-add=NET_ADMIN \
--privileged=true \
secretflow/ubuntu-base-ci:latest \
bash

# attach to build container
docker exec -it psi-dev-$(whoami) bash
```

#### Linux

```sh
Install gcc>=11.2, cmake>=3.26, ninja, nasm>=2.15, python>=3.10, bazelisk, xxd, lld
```

#### macOS

```sh
# macOS >= 13.0, Xcode >= 15.0

# Install Xcode
https://apps.apple.com/us/app/xcode/id497799835?mt=12

# Select Xcode toolchain version
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

# Install homebrew
https://brew.sh/

# Install dependencies
# Be aware, brew may install a newer version of bazel, when that happens bazel will give an error message during build.
# Please follow instructions in the error message to install the required version
brew install bazelisk cmake ninja libomp wget

# For Intel mac only
brew install nasm
```

### Build & UnitTest




``` sh
# build as debug
bazel build //... -c dbg

# build as release
bazel build //... -c opt

# test
bazel test //...

# [optional] build & test with ASAN or UBSAN, for macOS users please use configs with macOS prefix
bazel test //... --features=asan
bazel test //... --features=ubsan
```

### Bazel build options

- `--define gperf=on` enable gperf

### Build docs

```sh
# prerequisite
pip install -U -r docs/requirements.txt

cd docs && make html # html docs will be in docs/_build/html
```
83 changes: 83 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################

module(
name = "psi",
version = "0.6.0.dev241212",
compatibility_level = 1,
)

bazel_dep(name = "yacl", version = "20241212.0-871832a")

single_version_override(
module_name = "grpc",
patch_strip = 1,
patches = [
"//bazel/patches:grpc-1.66.patch",
"//bazel/patches:grpc-module-file.patch",
],
version = "1.66.0.bcr.3",
)

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "apple_support", version = "1.17.1")
bazel_dep(name = "rules_cc", version = "0.0.13")
bazel_dep(name = "rules_proto", version = "6.0.0.bcr.1")
bazel_dep(name = "rules_foreign_cc", version = "0.12.0")
bazel_dep(name = "protobuf", version = "27.3")
bazel_dep(name = "spdlog", version = "1.14.1")
bazel_dep(name = "fmt", version = "11.0.2")
bazel_dep(name = "abseil-cpp", version = "20240722.0")
bazel_dep(name = "gflags", version = "2.2.2")
bazel_dep(name = "rapidjson", version = "1.1.0.bcr.20241007")
bazel_dep(name = "boost.math", version = "1.83.0")
bazel_dep(name = "boost.uuid", version = "1.83.0")
bazel_dep(name = "boost.algorithm", version = "1.83.0.bcr.1")
bazel_dep(name = "boost.multiprecision", version = "1.83.0")
bazel_dep(name = "zlib", version = "1.3.1.bcr.3")

# --registry=https://baidu.github.io/babylon/registry
bazel_dep(name = "openssl", version = "3.3.2")

# self-host registry
bazel_dep(name = "org_interconnection", version = "0.0.1")
bazel_dep(name = "fourqlib", version = "0.0.0-20220901-1031567")
bazel_dep(name = "arrow", version = "10.0.0", repo_name = "org_apache_arrow")
bazel_dep(name = "ippcp", version = "2021.8")
bazel_dep(name = "libdivide", version = "5.0")
bazel_dep(name = "emp-tool", version = "0.2.5")
bazel_dep(name = "sparsehash", version = "2.0.4")
bazel_dep(name = "sse2neon", version = "1.7.0-20240330-8df2f48")

# non mododule dependencies
non_module_dependencies = use_extension("//bazel:defs.bzl", "non_module_dependencies")
use_repo(
non_module_dependencies,
"apsi",
"curve25519-donna",
"kuku",
"perfetto",
"seal",
"zstd",
)

new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
new_local_repository(
name = "macos_omp_x64",
build_file = "@yacl//bazel:local_openmp_macos.BUILD",
path = "/usr/local/opt/libomp",
)

new_local_repository(
name = "macos_omp_arm64",
build_file = "@yacl//bazel:local_openmp_macos.BUILD",
path = "/opt/homebrew/opt/libomp/",
)

# test
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True, repo_name = "com_google_googletest")
bazel_dep(name = "google_benchmark", version = "1.8.5", dev_dependency = True, repo_name = "com_github_google_benchmark")
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ In the first terminal, run the following command
docker run -it --rm --network host --mount type=bind,source=/tmp/receiver,target=/root/receiver --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --cap-add=NET_ADMIN --privileged=true secretflow-registry.cn-hangzhou.cr.aliyuncs.com/secretflow/psi-anolis8:latest --config receiver/receiver.config
```

In the other terminal, run the following command simultaneously.
In the other terminal, run the following command simultaneously.

```bash
docker run -it --rm --network host --mount type=bind,source=/tmp/sender,target=/root/sender --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --cap-add=NET_ADMIN --privileged=true secretflow-registry.cn-hangzhou.cr.aliyuncs.com/secretflow/psi-anolis8:latest --config sender/sender.config
Expand Down Expand Up @@ -166,7 +166,7 @@ Install gcc>=11.2, cmake>=3.26, ninja, nasm>=2.15, python>=3.8, bazel, golang, x
```

> **Note**<br>
Please install bazel with version in .bazelversion or use bazelisk.
Please install bazel with version in .bazeliskrc or use bazelisk.

### Build & UnitTest

Expand Down Expand Up @@ -213,3 +213,4 @@ Please refer to [PSI V2 Benchmark](docs/user_guide/psi_v2_benchmark.md)
## APSI Benchmark

Please refer to [APSI Benchmark](docs/user_guide/apsi_benchmark.md)

2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
## v0.3.0beta
- [Improvement] add uuid in system temp folder.
- [Improvement] use arrow csv reader in pir.
- [Bugfix] fix typo in psi config check.
- [Bugfix] fix typo in psi config check.

## v0.3.0.dev240304
- [API] expose ic_mode in RunLegacyPsi api
Expand Down
60 changes: 0 additions & 60 deletions WORKSPACE

This file was deleted.

Loading
Loading