Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
106 lines (89 loc) · 3.49 KB
/
Copy pathMakefile
File metadata and controls
106 lines (89 loc) · 3.49 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.PHONY: test test-verbose checkstyle test-convergence test-cutedsl test-cutile test-cute all serve build clean
all: checkstyle test test-convergence
# Command to run pytest for correctness tests
test:
python -m pytest --disable-warnings \
--ignore=test/convergence \
--ignore=test/cutedsl \
--ignore=test/cutile \
--ignore=test/cute \
test/
# Command to run pytest for CuTe DSL kernel tests
# Requires nvidia-cutlass-dsl: pip install -e '.[cutedsl]'
test-cutedsl:
LIGER_KERNEL_IMPL=cutedsl python -m pytest --disable-warnings test/cutedsl/
# Command to run pytest for cuTile kernel tests
# Requires cuda-tile: pip install -e '.[cutile]' (or '.[cutile-tileiras]')
test-cutile:
LIGER_KERNEL_IMPL=cutile python -m pytest --disable-warnings test/cutile/
# Command to run pytest for the cute fused-MoE tests
# The pure-Python registration/import-guard tests always run; the functional
# tests need the separate liger_cute_kernels (lck) wheel and >=2 CUDA devices.
# LIGER_KERNEL_IMPL is intentionally NOT set to 'cute': selecting it would force
# `import liger_kernel.ops` to load the lck wheel and break the always-on tests.
test-cute:
python -m pytest --disable-warnings test/cute/
# Command to run pytest for correctness tests with coverage reporting and full test-duration breakdown
test-verbose:
python -m pytest --disable-warnings \
--cov=src/liger_kernel \
--cov-report=term-missing \
--cov-report=html \
--cov-config=pyproject.toml \
--durations=0 \
--ignore=test/convergence \
--ignore=test/cutedsl \
--ignore=test/cutile \
--ignore=test/cute \
test/
# Command to run coverage report
coverage:
coverage report -m
# Command to run ruff for linting and formatting code
checkstyle:
ruff check --output-format=concise .; ruff_check_status=$$?; \
ruff format --check --diff .; ruff_format_status=$$?; \
ruff check . --fix; \
ruff format .; \
if [ $$ruff_check_status -ne 0 ] || [ $$ruff_format_status -ne 0 ]; then \
exit 1; \
fi
# Command to run pytest for convergence tests
# We have to explicitly set HF_DATASETS_OFFLINE=1, or dataset will silently try to send metrics and timeout (80s) https://github.com/huggingface/datasets/blob/37a603679f451826cfafd8aae00738b01dcb9d58/src/datasets/load.py#L286
test-convergence:
HF_DATASETS_OFFLINE=1 python -m pytest --disable-warnings \
test/convergence/fp32/test_mini_models.py \
test/convergence/fp32/test_mini_models_multimodal.py \
test/convergence/fp32/test_mini_models_with_logits.py \
test/convergence/bf16/test_mini_models.py \
test/convergence/bf16/test_mini_models_multimodal.py \
test/convergence/bf16/test_mini_models_with_logits.py
# Command to run all benchmark scripts and update benchmarking data file
# By default this doesn't overwrite existing data for the same benchmark experiment
# run with `make run-benchmarks OVERWRITE=1` to overwrite existing benchmark data
BENCHMARK_DIR = benchmark/scripts
BENCHMARK_SCRIPTS = $(wildcard $(BENCHMARK_DIR)/benchmark_*.py)
OVERWRITE ?= 0
run-benchmarks:
@for script in $(BENCHMARK_SCRIPTS); do \
echo "Running benchmark: $$script"; \
if [ $(OVERWRITE) -eq 1 ]; then \
python $$script --overwrite; \
else \
python $$script; \
fi; \
done
# MkDocs Configuration
MKDOCS = mkdocs
CONFIG_FILE = mkdocs.yml
SITE_DIR = site
# MkDocs targets
# Serve the documentation
serve:
$(MKDOCS) serve -f $(CONFIG_FILE)
# Build the documentation into the specified site directory
build:
$(MKDOCS) build -f $(CONFIG_FILE) --site-dir $(SITE_DIR)
# Clean the output directory
clean:
rm -rf $(SITE_DIR)/