mirror of
https://github.com/deepspeedai/DeepSpeed.git
synced 2025-10-20 06:53:47 +08:00
add Makefile
to ease maintenance (#7267)
adding `Makefile` with `make format` and `make test` to make things easier to maintain. --------- Signed-off-by: Stas Bekman <stas@stason.org>
This commit is contained in:
@ -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.
|
||||
@ -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
|
||||
|
23
Makefile
Normal file
23
Makefile
Normal file
@ -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
|
Reference in New Issue
Block a user