Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pytorch test #41

Merged
merged 10 commits into from
Sep 24, 2024
22 changes: 21 additions & 1 deletion .github/workflows/runs_on_ascend.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: runs on ascend
on:
workflow_dispatch:
inputs:
run_test_use_pytorch:
description: 'Run Test_use_pytorch job'
required: true
default: 'false'
type: boolean
push:
branches:
- main
Expand Down Expand Up @@ -46,5 +52,19 @@ jobs:
source /mnt/cache/share/platform/cienv/ditorch_env
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER} && rm -rf ${GITHUB_JOB} && cp -R Build ${GITHUB_JOB} && cd ${GITHUB_JOB}
echo "start to test"
bash ci/test.sh
bash ci/run_op_tools_test_cases.sh

Test_use_pytorch_test_case:
name: run pytorch test case on ascend
runs-on: tps-ascend-ci-910b
if: ${{ github.event.inputs.run_test_use_pytorch == 'true' || github.ref == 'refs/heads/main' }}
needs: [Build]
steps:
- name: test
run: |
set -ex
source /mnt/cache/share/platform/cienv/ditorch_env
export PYTHONPATH=${PYTHONPATH}:$PWD
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER} && rm -rf ${GITHUB_JOB} && cp -R Build ${GITHUB_JOB} && cd ${GITHUB_JOB}
echo "start to test"
bash ci/run_pytorch_test_cases.sh 2>&1
22 changes: 21 additions & 1 deletion .github/workflows/runs_on_camb.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: runs on camb
on:
workflow_dispatch:
inputs:
run_test_use_pytorch:
description: 'Run Test_use_pytorch job'
required: false
default: 'false'
push:
branches:
- main
Expand Down Expand Up @@ -45,4 +50,19 @@ jobs:
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER} && rm -rf ${GITHUB_JOB} && cp -R Build ${GITHUB_JOB} && cd ${GITHUB_JOB}
echo "start to test"
source /mnt/cache/share/platform/env/ditorch_env
srun -p camb_mlu370_m8 -n 1 --gres=mlu:1 bash ci/test.sh
srun -p camb_mlu370_m8 -n 1 --gres=mlu:1 bash ci/run_op_tools_test_cases.sh

Test_use_pytorch_test_case:
name: run pytorch test case on camb
runs-on: tps-camb-ci
if: ${{ github.event.inputs.run_test_use_pytorch == 'true' || github.ref == 'refs/heads/main' }}
needs: [Build]
steps:
- name: test
run: |
set -ex
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER} && rm -rf ${GITHUB_JOB} && cp -R Build ${GITHUB_JOB} && cd ${GITHUB_JOB}
echo "start to test"
source /mnt/cache/share/platform/env/ditorch_env
export PYTHONPATH=${PYTHONPATH}:$PWD
srun -p camb_mlu370_m8 -n 1 --gres=mlu:1 bash ci/run_pytorch_test_cases.sh
21 changes: 20 additions & 1 deletion .github/workflows/runs_on_nv.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: runs on nv
on:
workflow_dispatch:
inputs:
run_test_use_pytorch:
description: 'Run Test_use_pytorch job'
required: false
default: 'false'
push:
branches:
- main
Expand Down Expand Up @@ -44,4 +49,18 @@ jobs:
set -ex
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER} && rm -rf ${GITHUB_JOB} && cp -R Build ${GITHUB_JOB} && cd ${GITHUB_JOB}
echo "start to test"
srun --job-name=${GITHUB_JOB} bash -c "source /mnt/cache/share/platform/env/ditorch_env && cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${GITHUB_JOB} && bash ci/test.sh"
srun --job-name=${GITHUB_JOB} bash -c "source /mnt/cache/share/platform/env/ditorch_env && cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${GITHUB_JOB} && bash ci/run_op_tools_test_cases.sh"

Test_use_pytorch_test_case:
name: run pytorch test case on nv
runs-on: tps-sco-ci
if: ${{ github.event.inputs.run_test_use_pytorch == 'true' || github.ref == 'refs/heads/main' }}
needs: [Build]
steps:
- name: test
run: |
set -ex
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER} && rm -rf ${GITHUB_JOB} && cp -R Build ${GITHUB_JOB} && cd ${GITHUB_JOB}
echo "start to test"
srun --job-name=${GITHUB_JOB} bash -c "source /mnt/cache/share/platform/env/ditorch_env && export PYTHONPATH=${PYTHONPATH}:$PWD && cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${GITHUB_JOB} && bash ci/run_pytorch_test_cases.sh"

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ cmake-build-*/

#.core file
core.*
extra-info/ # ascend coredump relate file

# CI temp directory
mmlab_pack
pytorch_test_temp
pytorch_test_result

# CMake
CMakeLists.txt.user
Expand All @@ -143,6 +146,7 @@ CMakeUserPresets.json

# Autogened on ascend
fusion_result.json
ge_check_op.json

op_tools_results/
export_only_prof_dir/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import torch
import ditorch
```

[ditorch + Ascend910 pytorch原生测例通过情况](ditorch/test/ascend_summary_of_pytorch_test_case_testing.csv)

[ditorch + mlu370_m8 pytorch原生测例通过情况](ditorch/test/camb_summary_of_pytorch_test_case_testing.csv)

## **2. 提供多个基础工具,解决训练过程的问题**

提供模型训练过程中需要的基础工具,解决模型训练过程中出现的痛点问题 [算子工具](op_tools/README.md)。
Expand Down
11 changes: 11 additions & 0 deletions ci/run_op_tools_test_cases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
date
find op_tools/ -name test*.py | xargs -I {} bash -c ' echo "start run {}";date;time python {} && echo "Test {} PASSED\n\n\n" || echo "Test {} FAILED\n\n\n"' 2>&1 | tee test_op_tools_cases.log

# Check if any tests failed
if grep -Eq "FAILED" test_op_tools_cases.log; then
echo "tests failed"
exit 1
else
echo "all tests passed"
exit 0
fi
1 change: 1 addition & 0 deletions ci/run_pytorch_test_cases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python ditorch/test/test_torch_testcase.py 2>&1 | tee test_pytorch_case.log
11 changes: 0 additions & 11 deletions ci/test.sh

This file was deleted.

3 changes: 3 additions & 0 deletions ditorch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@
except Exception as e: # noqa: F841
pass


from ditorch import common_adapter # noqa: F401,E402

print(f"ditorch.framework: {framework}")
Empty file added ditorch/common_adapter.py
Empty file.
Loading
Loading