forked from pytorch/pytorch-integration-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (53 loc) · 2.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
SHELL=/usr/bin/env bash
GPU_PROGRAM ?= nvidia-smi
GPU_RESULT = $(shell which $(GPU_PROGRAM) 2>/dev/null)
GPU_TEST = $(notdir $(GPU_RESULT))
ifeq ($(GPU_TEST), $(GPU_PROGRAM))
GPU_FLAG = --gpus all
endif
PYTORCH_DOWNLOAD_LINK ?= https://download.pytorch.org/whl/test/cu101/torch_test.html
# Used by CI to do plain buildkit progress
BUILD_PROGRESS ?=
DOCKER_BUILD = cat Dockerfile | DOCKER_BUILDKIT=1 docker build --target $@ $(BUILD_PROGRESS) --build-arg "PYTORCH_DOWNLOAD_LINK=$(PYTORCH_DOWNLOAD_LINK)" -t pytorch/integration-testing:$@ -
DOCKER_RUN = set -o pipefail; docker run --rm -it $(GPU_FLAG) --shm-size 8G -v "$(PWD)/output:/output" pytorch/integration-testing:$@
CHOWN_TO_USER = docker run --rm -v "$(PWD)":/v -w /v alpine chown -R "$(shell id -u):$(shell id -g)" .
.PHONY: all
all:
@echo "please specify your target"
logs/:
mkdir -p logs/
.PHONY: pyro
pyro: logs/
$(DOCKER_BUILD)
$(DOCKER_RUN) pip list > logs/$@_metadata.log
$(DOCKER_RUN) pytest -v -c /dev/null -n auto --color=no --junitxml=/output/$@_results.xml --stage unit | tee logs/[email protected]
.PHONY: detectron2
detectron2: logs/
$(DOCKER_BUILD)
$(DOCKER_RUN) pip list > logs/$@_metadata.log
# We have to install detectron2 here since it won't actually do the cuda build unless it has direct access to the GPU, :shrug:
$(DOCKER_RUN) \
sh -c 'pip install -U -e /detectron2 && pytest -v --color=no --junitxml=/output/$@_results.xml /detectron2/tests' 2>&1 \
| tee logs/[email protected]
.PHONY: transformers
transformers: logs/
$(DOCKER_BUILD)
$(DOCKER_RUN) pip list > logs/$@_metadata.log
$(DOCKER_RUN) pytest -n auto --dist=loadfile --color=no --junitxml=/output/$@_results.xml -s -v ./tests/ 2>&1 | tee logs/[email protected]
.PHONY: fairseq
fairseq: logs/
$(DOCKER_BUILD)
$(DOCKER_RUN) pip list > logs/$@_metadata.log
$(DOCKER_RUN) pytest --color=no --junitxml=/output/$@_results.xml -s -v ./tests/ 2>/dev/null | tee logs/[email protected]
.PHONY: pytorch-lightning
pytorch-lightning: logs/
$(DOCKER_BUILD)
$(DOCKER_RUN) pip list > logs/$@_metadata.log
$(DOCKER_RUN) pytest pytorch_lightning tests -v --durations=0 --ignore=tests/loggers/test_all.py --ignore=tests/models/test_amp.py --junitxml=/output/$@_results.xml 2>/dev/null | tee logs/[email protected]
.PHONY: chown-to-user
chown-to-user:
$(CHOWN_TO_USER)
.PHONY: clean
clean: chown-to-user
$(RM) -r output/
$(RM) -r logs/