Skip to content

Latest commit

 

History

History
130 lines (85 loc) · 3.46 KB

CONTRIBUTING.md

File metadata and controls

130 lines (85 loc) · 3.46 KB

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.

Repo layout

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, except:

  • Exceptions are allowed and encouraged where appropriate.
  • Header guards should use #pragma once.
  • Adopts camelBack for function names.

The compiler portion of the project follows MLIR style.

Other tips

  • Git commit message should be meaningful, we suggest imperative keywords.
  • Developer must write unit-test (line coverage must be greater than 80%), tests should be deterministic.
  • Read awesome Abseil Tips

Build

Prerequisite

Docker

## start container
docker run -d -it --name spu-gcc11-anolis-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/secretflow-gcc11-anolis-dev:latest

# attach to build container
docker exec -it spu-gcc11-anolis-dev-$(whoami) bash

Linux

Install gcc>=11.2, cmake>=3.18, ninja, nasm>=2.15, python==3.8, bazel==5.1.1

python3 -m pip install -r requirements.txt

macOS

# macOS >= 11, Xcode >=13.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
brew install bazel cmake ninja nasm libomp

# Extra setup step for Apple Silicon users
conda install grpcio

# Install python dependencies
pip install -r requirements.txt

Build & UnitTest

# 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 //... --config=[macos-]asan
bazel test //... --config=[macos-]ubsan

Bazel build options

  • --define gperf=on enable gperf
  • --define tracelog=on enable link trace log.

Build docs

# prerequisite
pip install -U docs/requirements.txt

cd docs & make html  # html docs will be in docs/_build/html

Release cycle

SPU recommends users "live-at-head" like abseil-cpp, just like abseil, spu also provide Long Term Support Releases to which we backport fixes for severe bugs.

We use the release date as the version number, see change log for example.

Change log

Please keep updating changes to the staging area of change log Changelog should contain:

  • all public API changes, including new features, breaking changes and deprecations.
  • notable internal changes, like performance improvement.