-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Contribute and logging #5181
Merged
wangkuiyi
merged 5 commits into
PaddlePaddle:develop
from
wangkuiyi:contribute_and_logging
Oct 30, 2017
Merged
Contribute and logging #5181
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
efed904
Create vlog_guide.md
e2ac0ae
Move design/vlog_guide.md into CONTRIBUTE.md
307c28c
In response to comments from Yu Yang and Tony
439bf2f
In response to comments from Luo Tao
88e9607
Merge branch 'develop' of https://github.com/paddlepaddle/paddle into…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1 +1,122 @@ | ||
./doc/howto/dev/contribute_to_paddle_en.md | ||
# Contribute Code | ||
|
||
We sincerely appreciate your contribution. This document explains our workflow and work style. | ||
|
||
|
||
## Workflow | ||
|
||
PaddlePaddle uses this [Git branching model](http://nvie.com/posts/a-successful-git-branching-model/). The following steps guide usual contributions. | ||
|
||
1. Fork | ||
|
||
Our development community has been growing fastly; it doesn't make sense for everyone to write into the official repo. So, please file Pull Requests from your fork. To make a fork, just head over to the GitHub page and click the ["Fork" button](https://help.github.com/articles/fork-a-repo/). | ||
|
||
1. Clone | ||
|
||
To make a copy of your fork to your local computers, please run | ||
|
||
```bash | ||
git clone https://github.com/your-github-account/paddle | ||
cd paddle | ||
``` | ||
|
||
1. Create the local feature branch | ||
|
||
For daily works like adding a new feature or fixing a bug, please open your feature branch before coding: | ||
|
||
```bash | ||
git checkout -b my-cool-stuff | ||
``` | ||
|
||
1. Commit | ||
|
||
Before issuing your first `git commit` command, please install [`pre-commit`](http://pre-commit.com/) and our customized hook, which checks the style of code and documentation you changed in the most recent commit. | ||
|
||
```bash | ||
pip install pre-commit | ||
pre-commit install | ||
``` | ||
|
||
1. Build and test | ||
|
||
Users can build PaddlePaddle natively on Linux and Mac OS X. But to unify the building environment and to make it easy for debugging, the recommended way is [using Docker](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/howto/dev/contribute_to_paddle_en.md). | ||
|
||
1. Keep pulling | ||
|
||
An experienced Git user pulls from the official repo often -- daily or even hourly, so they notice conflicts with others work early, and it's easier to resolve smaller conflicts. | ||
|
||
```bash | ||
git remote add upstream https://github.com/PaddlePaddle/Paddle | ||
git pull upstream develop | ||
``` | ||
|
||
1. Push and file a pull request | ||
|
||
You can "push" your local work into your forked repo: | ||
|
||
```bash | ||
git push origin my-cool-stuff | ||
``` | ||
|
||
The push allows you to create a pull request, requesting owners of this [official repo](https://github.com/PaddlePaddle/Paddle) to pull your change into the official one. | ||
|
||
To create a pull request, please follow [these steps](https://help.github.com/articles/creating-a-pull-request/). | ||
|
||
If your change is for fixing an issue, please write ["Fixes <issue-URL>"](https://help.github.com/articles/closing-issues-using-keywords/) in the description section of your pull request. Github would close the issue when the owners merge your pull request. | ||
|
||
Please remember to specify some reviewers for your pull request. If you don't know who are the right ones, please follow Github's recommendation. | ||
|
||
|
||
1. Delete local and remote branches | ||
|
||
To keep your local workspace and your fork clean, you might want to remove merged branches: | ||
|
||
```bash | ||
git push origin :my-cool-stuff | ||
git checkout develop | ||
git pull upstream develop | ||
git branch -d my-cool-stuff | ||
``` | ||
|
||
### Good Manner in Code Review | ||
|
||
- Please feel free to ping your reviewers by sending them the URL of your pull request via IM or email. Please do this after your pull request passes the CI. | ||
|
||
- Please answer reviewers' every comment. If you are to follow the comment, please write "Done"; please give a reason otherwise. | ||
|
||
- If you don't want your reviewers to get overwhelmed by email notifications, you might reply their comments by [in a batch](https://help.github.com/articles/reviewing-proposed-changes-in-a-pull-request/). | ||
|
||
- Reduce the unnecessary commits. Some developers commit often. It is recommended to append a sequence of small changes into one commit by running `git commit --amend` instead of `git commit`. | ||
|
||
## Logging in the Code | ||
|
||
We use [glog](https://github.com/google/glog) for logging in our C/C++ code. | ||
|
||
For general information, please use `LOG`. For debug information, please use [`VLOG`](http://htmlpreview.github.io/?https://github.com/google/glog/blob/master/doc/glog.html#verbose). The reason is at [here](https://groups.google.com/a/chromium.org/d/msg/chromium-dev/3NDNd1KzXeY/AZKMMx37fdQJ). | ||
|
||
`VLOG` requires a *verbose level* parameter. For example: | ||
|
||
```c++ | ||
VLOG(3) << "Operator FC is taking " << num_inputs << "inputs." | ||
``` | ||
|
||
When we run a PaddlePaddle application or test, we can specify a verbose threshold. For example: | ||
|
||
```bash | ||
GLOG_vmodule=buddy_allocator=2 \ | ||
GLOG_v=10 \ | ||
python \ | ||
../python/paddle/v2/framework/tests/test_recurrent_op.py | ||
``` | ||
|
||
This will enable VLOG messages generated by `buddy_allocator.{h,cc}` and in the verbose range of 0 to 3, so you will see above example VLOG message, which is in level 3. This suggests that we output overall messages in lower verbose levels, so they display with higher probability. When coding C++, please follow the verbose level convention as follows: | ||
|
||
- verbose level 1: | ||
- [framework](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/framework) | ||
- verbose level 3: | ||
- [operators](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/operators) | ||
- verbose level 5: | ||
- [memory](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/memory) | ||
- [platform](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/platform) | ||
- verbose level 7: | ||
- [math](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/math) |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the URL of
using Docker
correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected it to be (https://github.com/PaddlePaddle/Paddle/blob/develop/doc/howto/dev/build_en.md).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not. Thanks for pointing out. I am correcting it.