1+ name : Torch API Tests in Container
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+
11+ jobs :
12+ torch-api-test :
13+ runs-on : self-hosted
14+ container :
15+ image : localhost:5000/flagscale:cuda12.4.1-cudnn9.5.0-python3.12-torch2.6.0-time2505241715
16+ options : --gpus all --privileged --ipc=host --ulimit memlock=-1 --ulimit stack=67108864
17+ steps :
18+ - name : Checkout Code
19+ uses : actions/checkout@v4
20+ with :
21+ repository : ${{ github.event.pull_request.head.repo.full_name }}
22+ ref : ${{ github.event.pull_request.head.ref }}
23+ ssh-strict : true
24+ ssh-user : git
25+ persist-credentials : true
26+ clean : true
27+ sparse-checkout-cone-mode : true
28+ fetch-tags : false
29+ show-progress : true
30+ lfs : false
31+ submodules : false
32+ set-safe-directory : true
33+
34+ - name : Set up Install Dependencies
35+ run : |
36+ source /root/miniconda3/bin/activate flagscale-train
37+ apt update -y
38+ apt-get install -y git rdma-core ibverbs-utils perftest infiniband-diags libibverbs-dev librdmacm-dev
39+ cd /__w/FlagCX/FlagCX
40+ git config --global --add safe.directory /__w/FlagCX/FlagCX
41+ git status
42+ pip install setuptools==77.0.1 pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple
43+ pre-commit install
44+
45+ - name : Run Code Format Check with pre-commit
46+ run : |
47+ cd /__w/FlagCX/FlagCX
48+ apt update -y
49+ apt-get install clang-format -y
50+ git fetch --all
51+ from_ref=${GITHUB_HEAD_REF}
52+ to_ref=${GITHUB_BASE_REF}
53+
54+ echo "From branch: $from_ref, To branch: $to_ref"
55+
56+ pre-commit run --from-ref "origin/$from_ref" --to-ref "origin/$to_ref"
57+ continue-on-error : false
58+
59+ - name : Run `make` to build the project
60+ run : |
61+ cd /__w/FlagCX/FlagCX
62+ export MPI_HOME=/usr/local/mpi
63+ make USE_NVIDIA=1
64+
65+ - name : Enter plugin/torch and install FlagCX PyTorch Plugin
66+ run : |
67+ cd /__w/FlagCX/FlagCX/plugin/torch
68+ python setup.py develop --adaptor nvidia
69+
70+ - name : Run PyTorch API tests
71+ run : |
72+ cd /__w/FlagCX/FlagCX/test/script/
73+ bash torch_api_test.sh
0 commit comments