@@ -6,24 +6,44 @@ CONCMD := docker
66ifdef PODMAN
77 CONCMD = podman
88endif
9- FST_DIR := $(shell python3 -c "import os; os.chdir('/tmp') ; import fastsafetensors; print(os.path.dirname(fastsafetensors.__file__))")
109
1110.PHONY : install
1211install :
1312 pip install . --no-cache-dir --no-build-isolation
1413
15- .PHONY : unittest
14+ .PHONY : unittest unittest-parallel unittest-paddle unittest-paddle-gpu htmlcov
15+
16+ FST_DIR := $(shell python3 -c "import os; os.chdir('/tmp') ; import fastsafetensors; print(os.path.dirname(fastsafetensors.__file__))")
17+
1618unittest :
17- COVERAGE_FILE=.coverage_0 pytest -s --cov=$(FST_DIR ) tests/test_fastsafetensors.py
18- COVERAGE_FILE=.coverage_1 CUDA_VISIBLE_DEVICES=" " pytest -s --cov=$(FST_DIR ) tests/test_fastsafetensors.py
19- COVERAGE_FILE=.coverage_2 torchrun --nnodes=2 --master_addr=0.0.0.0 --master_port=1234 --node_rank=0 --no-python pytest -s --cov=${FST_DIR} tests/test_multi.py > /tmp/2.log 2>&1 &
20- COVERAGE_FILE=.coverage_3 torchrun --nnodes=2 --master_addr=0.0.0.0 --master_port=1234 --node_rank=1 --no-python pytest -s --cov=${FST_DIR} tests/test_multi.py > /tmp/3.log 2>&1
21- coverage combine .coverage_0 .coverage_1 .coverage_2 .coverage_3
22- coverage html
19+ @FST_DIR=$(FST_DIR ) ; \
20+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_0 pytest -s --cov=$(FST_DIR ) tests/test_fastsafetensors.py && \
21+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_1 CUDA_VISIBLE_DEVICES=" " pytest -s --cov=$(FST_DIR ) tests/test_fastsafetensors.py && \
22+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_2 pytest -s --cov=$(FST_DIR ) -s tests/test_vllm.py
23+
24+ unittest-parallel :
25+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_3 torchrun --nnodes=4 --master_addr=0.0.0.0 --master_port=1234 --node_rank=0 tests/test_multi.py --cov=$(FST_DIR ) -s tests/test_multi.py > /tmp/3.log 2>&1 & \
26+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_4 torchrun --nnodes=4 --master_addr=0.0.0.0 --master_port=1234 --node_rank=1 tests/test_multi.py --cov=$(FST_DIR ) -s tests/test_multi.py > /tmp/4.log 2>&1 & \
27+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_5 torchrun --nnodes=4 --master_addr=0.0.0.0 --master_port=1234 --node_rank=2 tests/test_multi.py --cov=$(FST_DIR ) -s tests/test_multi.py > /tmp/5.log 2>&1 & \
28+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_6 torchrun --nnodes=4 --master_addr=0.0.0.0 --master_port=1234 --node_rank=3 tests/test_multi.py --cov=$(FST_DIR ) -s tests/test_multi.py > /tmp/6.log 2>&1 && \
29+ wait && \
30+ TEST_FASTSAFETENSORS_FRAMEWORK=torch COVERAGE_FILE=.coverage_7 torchrun --nnodes=1 --master_addr=0.0.0.0 --master_port=1234 --node_rank=0 tests/test_multi.py --cov=$(FST_DIR ) -s tests/test_multi.py > /tmp/7.log 2>&1 & \
31+ wait
2332
24- .PHONY : integrationtest
25- integrationtest :
26- cd tests && COVERAGE_FILE=.coverage pytest -s test_vllm.py
33+ unittest-paddle :
34+ @FST_DIR=$(FST_DIR ) ; \
35+ TEST_FASTSAFETENSORS_FRAMEWORK=paddle COVERAGE_FILE=.coverage_8 CUDA_VISIBLE_DEVICES=" " pytest -s --cov=$(FST_DIR ) tests/test_fastsafetensors.py && \
36+ TEST_FASTSAFETENSORS_FRAMEWORK=paddle COVERAGE_FILE=.coverage_9 CUDA_VISIBLE_DEVICES=" " WORLD_SIZE=2 python3 -m paddle.distributed.launch --nnodes 2 --master 127.0.0.1:1234 --rank 0 tests/test_multi.py --cov=$(FST_DIR ) -s tests/test_multi.py > /tmp/9.log 2>&1 & \
37+ TEST_FASTSAFETENSORS_FRAMEWORK=paddle COVERAGE_FILE=.coverage_10 CUDA_VISIBLE_DEVICES=" " WORLD_SIZE=2 python3 -m paddle.distributed.launch --nnodes 2 --master 127.0.0.1:1234 --rank 1 tests/test_multi.py --cov=$(FST_DIR ) -s tests/test_multi.py > /tmp/10.log 2>&1 && \
38+ wait
39+
40+ unittest-paddle-gpu :
41+ @FST_DIR=$(FST_DIR ) ; \
42+ TEST_FASTSAFETENSORS_FRAMEWORK=paddle COVERAGE_FILE=.coverage_11 pytest -s --cov=$(FST_DIR ) tests/test_fastsafetensors.py
43+
44+ htmlcov :
45+ coverage combine .coverage_* && \
46+ coverage html
2747
2848.PHONY : builder
2949builder : Dockerfile.build
@@ -45,7 +65,20 @@ upload:
4565 python3 -m twine upload -u __token__ dist/fastsafetensors-$(shell grep version pyproject.toml | sed -e 's/version = "\([0-9.]\+\) " /\1/g')*
4666
4767perf/dist :
48- cd perf && python3 -m build
68+ cd perf && pip install .
69+
70+ .PHONY : format
71+ format :
72+ black8 .
73+ isort .
74+
75+ .PHONY : lint
76+ lint :
77+ black .
78+ isort .
79+ flake8 . --select=E9,F63,F7,F82
80+ mypy . --ignore-missing-imports
4981
82+ .PHONY : clean
5083clean :
5184 rm -rf dist build fastsafetensors.egg-info
0 commit comments