Skip to content
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
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ If a formatting test fails, it will fix the modified code in place and abort
the `git commit`. After looking over the changes, you can `git add <modified files>`
and then repeat the previous `git commit` command.

You can also run:
```
make format
```
which will do the same as above, and it'll also automatically build a `venv` python environment if you
don't already have one, which will isolate the requirements of this project from requirements of other projects.

## Testing
DeepSpeed tracks two types of tests: unit tests and more costly model convergence tests.
Expand All @@ -38,6 +44,11 @@ You can also provide the `-v` flag to `pytest` to see additional information abo
tests. Note that [pytest-forked](https://github.com/pytest-dev/pytest-forked) and the
`--forked` flag are required to test CUDA functionality in distributed tests.

You can also run:
```
make test
```

### Model Tests
To execute model tests, first [install DeepSpeed](#installation). The
[DeepSpeedExamples](https://github.com/deepspeedai/DeepSpeedExamples/) repository is cloned
Expand Down
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# usage: make help

.PHONY: help test format
.DEFAULT_GOAL := help

help: ## this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-22s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
echo $(MAKEFILE_LIST)

test: ## run tests
pytest --forked tests/unit/

format: ## fix formatting
@if [ ! -d "venv" ]; then \
python -m venv venv; \
. venv/bin/activate; \
pip install pre-commit -U; \
pre-commit clean; \
pre-commit uninstall; \
pre-commit install; \
deactivate; \
fi
. venv/bin/activate && pre-commit run --files $$(git diff --name-only master) && deactivate
Loading