-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo-sync-2024-12-17T15:14:30+0800 (#216)
* repo-sync-2024-12-17T15:14:30+0800 * repo-sync-2024-12-17T16:57:18+0800
- Loading branch information
1 parent
8caf034
commit 063be68
Showing
293 changed files
with
6,042 additions
and
12,452 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
USE_BAZEL_VERSION=7.4.1 |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -76,3 +76,4 @@ CheckOptions: | |
|
||
- key: performance-unnecessary-value-param.AllowedTypes | ||
value: PtBufferView | ||
|
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,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 | ||
``` |
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,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") |
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.