Skip to content

Commit cb09baa

Browse files
author
yefubao
committed
Add L0 Pytorch Unittest
1 parent 6e5f543 commit cb09baa

1 file changed

Lines changed: 46 additions & 42 deletions

File tree

.github/workflows/qa_l0_pytorch.yml

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ jobs:
7575
free -h
7676
7777
# - name: Install dependencies and build transformer_engine
78-
# env:
7978
# run: |
8079
# echo "\n=============== Install transformer_engine ==============="
8180
# pip install --no-build-isolation -vvv . --no-deps
@@ -86,6 +85,22 @@ jobs:
8685
run: |
8786
python3 tests/pytorch/test_sanity_import.py
8887
88+
- name: PyTorch C++ Lint
89+
id: pytorch_cpplint
90+
env:
91+
CPP_ONLY: 1
92+
TE_PATH: ./
93+
run: bash ./qa/L0_pytorch_lint/test.sh
94+
continue-on-error: true
95+
96+
- name: PyTorch Python Lint
97+
id: pytorch_pylint
98+
env:
99+
PYTHON_ONLY: 1
100+
TE_PATH: ./
101+
run: bash ./qa/L0_pytorch_lint/test.sh
102+
continue-on-error: true
103+
89104
- name: GPU Usage Check / Verification
90105
run: |
91106
source .github/workflows/scripts/gpu_check.sh
@@ -109,53 +124,42 @@ jobs:
109124
# export OMP_NUM_THREADS=$((NUM_PHYSICAL_CORES / NUM_PARALLEL_JOBS))
110125
# ctest --test-dir build -j$NUM_PARALLEL_JOBS
111126

112-
- name: L0_pytorch_debug_unittest
127+
128+
129+
- name: L0 Pytorch Debug Unittest
113130
id: L0_pytorch_debug_unittest
131+
continue-on-error: true
114132
env:
115-
PYTEST_ADDOPTS: "-v -s"
116-
NVTE_TEST_NVINSPECT_FEATURE_DIRS: "transformer_engine/debug/features"
117-
NVTE_TEST_NVINSPECT_CONFIGS_DIR: "tests/pytorch/debug/test_configs/"
118-
NVTE_TEST_NVINSPECT_DUMMY_CONFIG_FILE: "tests/pytorch/debug/test_configs/dummy_feature.yaml"
119133
XML_LOG_DIR: "/logs/pytorch/debug"
134+
TE_PATH: ./
120135
run: |
121-
# Build log storage directory
122-
mkdir -p "$XML_LOG_DIR"
123-
124-
# It is not installed as a requirement,
125-
# because it is not available on PyPI.
126-
pip uninstall -y nvdlfw-inspect
127-
pip install git+https://github.com/NVIDIA/nvidia-dlfw-inspect.git
128-
pip install pytest==8.2.1
129-
130-
run_pytest() {
131-
local test_file=$1
132-
local xml_name=$2
133-
local extra_opts=${3:-""}
134-
echo "🚀 Running test: $test_file"
135-
pytest --junitxml="${XML_LOG_DIR}/${xml_name}" "${test_file}" "${extra_opts}"
136-
if [ $? -eq 0 ]; then
137-
echo "✅ Test $"xml_name" passed"
138-
else
139-
echo "❌ Test $"xml_name" failed"
140-
exit 1
141-
fi
142-
}
143-
144-
# tests/pytorch/debug
145-
run_pytest "tests/pytorch/debug/test_sanity.py" "test_sanity.xml" "--feature_dirs=$NVTE_TEST_NVINSPECT_FEATURE_DIRS"
146-
run_pytest "tests/pytorch/debug/test_config.py" "test_config.xml" "--feature_dirs=$NVTE_TEST_NVINSPECT_FEATURE_DIRS"
147-
run_pytest "tests/pytorch/debug/test_numerics.py" "test_numerics.xml" "--feature_dirs=$NVTE_TEST_NVINSPECT_FEATURE_DIRS"
148-
run_pytest "tests/pytorch/debug/test_log.py" "test_log.xml" "--feature_dirs=$NVTE_TEST_NVINSPECT_FEATURE_DIRS --configs_dir=$NVTE_TEST_NVINSPECT_CONFIGS_DIR"
149-
run_pytest "tests/pytorch/debug/test_perf.py" "test_perf.xml" "--feature_dirs=$NVTE_TEST_NVINSPECT_FEATURE_DIRS --configs_dir=$NVTE_TEST_NVINSPECT_CONFIGS_DIR"
150-
# NVTE_TORCH_COMPILE=0 run_pytest "tests/pytorch/debug/test_api_features.py" "test_api_features.xml" "--feature_dirs=$NVTE_TEST_NVINSPECT_FEATURE_DIRS --configs_dir=$NVTE_TEST_NVINSPECT_CONFIGS_DIR"
151-
152-
153-
# standard sanity and numerics tests with initialized debug
154-
NVTE_TEST_NVINSPECT_ENABLED=1 NVTE_TEST_NVINSPECT_CONFIG_FILE=$NVTE_TEST_NVINSPECT_DUMMY_CONFIG_FILE NVTE_TEST_NVINSPECT_FEATURE_DIRS=$NVTE_TEST_NVINSPECT_FEATURE_DIRS PYTORCH_JIT=0 NVTE_TORCH_COMPILE=0 NVTE_ALLOW_NONDETERMINISTIC_ALGO=0 pytest --junitxml=$XML_LOG_DIR/test_sanity_2.xml tests/pytorch/test_sanity.py
155-
# NVTE_TEST_NVINSPECT_ENABLED=1 NVTE_TEST_NVINSPECT_CONFIG_FILE=$NVTE_TEST_NVINSPECT_DUMMY_CONFIG_FILE NVTE_TEST_NVINSPECT_FEATURE_DIRS=$NVTE_TEST_NVINSPECT_FEATURE_DIRS PYTORCH_JIT=0 NVTE_TORCH_COMPILE=0 NVTE_ALLOW_NONDETERMINISTIC_ALGO=0 NVTE_FUSED_ATTN=0 pytest --junitxml=$XML_LOG_DIR/test_numerics_2.xml tests/pytorch/test_numerics.py
136+
ignore_files=("test_api_features.py" "test_numerics.py")
137+
138+
for file in "${ignore_files[@]}"; do
139+
sed -i 's/^.*${file}.*$/#&/' ./qa/L0_pytorch_debug_unittest/test.sh
140+
done
141+
142+
bash ./qa/L0_pytorch_debug_unittest/test.sh
143+
144+
- name: L0 Pytorch Unittest
145+
id: L0_pytorch_unittest
146+
continue-on-error: true
147+
env:
148+
XML_LOG_DIR: "/logs/pytorch"
149+
TE_PATH: ./
150+
run: |
151+
ignore_files=("test_numerics.py" "test_permutation.py" "test_attention.py" "test_checkpoint.py")
152+
153+
for file in "${ignore_files[@]}"; do
154+
sed -i 's/^.*${file}.*$/#&/' ./qa/L0_pytorch_unittest/test.sh
155+
done
156+
157+
bash ./qa/L0_pytorch_unittest/test.sh
156158
157159
- name: Upload Installation Logs
158-
if: failure() && steps.L0_pytorch_debug_unittest.outcome == 'failure'
160+
if: |
161+
(steps.L0_pytorch_debug_unittest.outcome == 'failure' || steps.L0_pytorch_unittest.outcome == 'failure')
162+
&& failure()
159163
uses: actions/upload-artifact@v4
160164
with:
161165
name: L0_pytorch-logs-${{ github.run_id }}

0 commit comments

Comments
 (0)