Skip to content

Commit 8740126

Browse files
committed
Enhance CI scripts and GitHub Actions workflow
Summary: - Updated `install-triton.sh` to include system `libstdc++` updates for compatibility with newer C++ features and improved error handling during Triton installation verification. - Modified `setup.sh` to install cuDNN and verify its installation, enhancing the setup process for the Triton environment. - Updated `test.yml` to reflect changes in CUDA version from 12.6 to 12.8 and added a new linting job to ensure code quality. These changes improve the robustness of the CI setup and ensure compatibility with the latest dependencies.
1 parent 64027f4 commit 8740126

File tree

3 files changed

+122
-67
lines changed

3 files changed

+122
-67
lines changed

.ci/install-triton.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ if [ -z "$CONDA_ENV" ]; then
1313
exit 1
1414
fi
1515

16+
# Update system libstdc++ to support newer C++ features
17+
echo "Updating system libstdc++..."
18+
sudo apt-get update
19+
sudo apt-get install -y gcc-12 g++-12 libstdc++6
20+
1621
# Activate conda environment
1722
source /opt/miniconda3/etc/profile.d/conda.sh
1823
conda activate "$CONDA_ENV"
@@ -52,7 +57,15 @@ pip install -e .
5257

5358
# Verify Triton installation
5459
echo "Verifying Triton installation..."
55-
python -c "import triton; print(f'Triton version: {triton.__version__}')"
60+
python -c "import triton; print(f'Triton version: {triton.__version__}')" || {
61+
echo "ERROR: Failed to import triton"
62+
echo "This might be due to libstdc++ version issues"
63+
echo "Checking system libstdc++ version:"
64+
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX | tail -5
65+
echo "Checking conda libstdc++ version:"
66+
strings /opt/miniconda3/envs/tritonparse/lib/libstdc++.so.6 | grep GLIBCXX | tail -5
67+
exit 1
68+
}
5669
python -c "import triton; print(f'Triton path: {triton.__file__}')"
5770

58-
echo "Triton installation completed successfully!"
71+
echo "Triton installation completed successfully!"

.ci/setup.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,29 @@ fi
6363
export CUDA_VERSION="$CUDA_VERSION"
6464
echo "Using CUDA version: $CUDA_VERSION"
6565

66+
# Install cuDNN
67+
echo "Installing cuDNN..."
68+
conda install -c conda-forge cudnn=9.10.1.4 -y
69+
70+
# Verify cuDNN installation
71+
echo "Verifying cuDNN installation..."
72+
python -c "import torch; print(f'cuDNN version: {torch.backends.cudnn.version()}')" 2>/dev/null || echo "cuDNN verification failed"
73+
74+
# Show cuDNN installation location
75+
echo "cuDNN installation location:"
76+
find $CONDA_PREFIX -name "*cudnn*" 2>/dev/null | head -5 || echo "cuDNN files not found in conda environment"
77+
6678
# Install PyTorch nightly
6779
echo "Installing PyTorch nightly..."
68-
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu126
80+
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
6981

7082
# Verify PyTorch installation
7183
echo "Verifying PyTorch installation..."
7284
python -c "import torch; print(f'PyTorch version: {torch.__version__}')"
7385
python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')"
7486
if python -c "import torch; print(torch.cuda.is_available())" | grep -q "True"; then
7587
python -c "import torch; print(f'CUDA version: {torch.version.cuda}')"
88+
python -c "import torch; print(f'cuDNN available: {torch.backends.cudnn.is_available()}')"
7689
fi
7790

7891
echo "Setup completed successfully!"

.github/workflows/test.yml

Lines changed: 93 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,113 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main, develop, findhao/setup_ci ]
5+
branches: [main, develop, findhao/setup_ci]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88
workflow_dispatch:
99
inputs:
1010
test-type:
11-
description: 'Type of tests to run'
11+
description: "Type of tests to run"
1212
required: true
13-
default: 'all'
13+
default: "all"
1414
type: choice
1515
options:
16-
- 'all'
17-
- 'cpu'
18-
- 'cuda'
16+
- "all"
17+
- "cpu"
18+
- "cuda"
1919
coverage:
20-
description: 'Enable coverage reporting'
20+
description: "Enable coverage reporting"
2121
required: true
2222
default: false
2323
type: boolean
2424

2525
jobs:
2626
test:
2727
runs-on: 4-core-ubuntu-gpu-t4
28+
timeout-minutes: 120
2829
steps:
29-
- uses: actions/checkout@v4
30-
31-
- name: Set up Python 3.11
32-
uses: actions/setup-python@v4
33-
with:
34-
python-version: "3.11"
35-
36-
- name: Install CUDA 12.6
37-
run: |
38-
sudo apt-get update
39-
sudo apt-get install -y cuda-toolkit-12.6
40-
41-
- name: Setup environment
42-
env:
43-
CONDA_ENV: tritonparse
44-
PYTHON_VERSION: "3.11"
45-
CUDA_VERSION: "12.6"
46-
run: |
47-
bash .ci/setup.sh
48-
49-
- name: Install Triton from source
50-
env:
51-
CONDA_ENV: tritonparse
52-
run: |
53-
bash .ci/install-triton.sh
54-
55-
- name: Install project dependencies
56-
env:
57-
CONDA_ENV: tritonparse
58-
run: |
59-
bash .ci/install-project.sh
60-
61-
- name: Cache pip dependencies
62-
uses: actions/cache@v3
63-
with:
64-
path: ~/.cache/pip
65-
key: ${{ runner.os }}-pip-3.11-${{ hashFiles('**/pyproject.toml') }}
66-
restore-keys: |
67-
${{ runner.os }}-pip-3.11-
68-
69-
- name: Run tests
70-
env:
71-
CONDA_ENV: tritonparse
72-
TEST_TYPE: ${{ github.event.inputs.test-type || 'all' }}
73-
COVERAGE: ${{ github.event.inputs.coverage || 'false' }}
74-
run: |
75-
bash .ci/run-tests.sh
76-
77-
- name: Upload coverage to Codecov
78-
if: ${{ github.event.inputs.coverage == 'true' }}
79-
uses: codecov/codecov-action@v3
80-
with:
81-
file: ./coverage.xml
82-
flags: unittests
83-
name: codecov-umbrella
84-
fail_ci_if_error: false
30+
- uses: actions/checkout@v4
8531

32+
- name: Set up Python 3.11
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: "3.11"
36+
37+
- name: Install CUDA 12.8
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y cuda-toolkit-12.8
41+
42+
- name: Setup environment
43+
env:
44+
CONDA_ENV: tritonparse
45+
PYTHON_VERSION: "3.11"
46+
CUDA_VERSION: "12.8"
47+
run: |
48+
bash .ci/setup.sh
49+
50+
- name: Install Triton from source
51+
env:
52+
CONDA_ENV: tritonparse
53+
run: |
54+
bash .ci/install-triton.sh
55+
56+
- name: Install project dependencies
57+
env:
58+
CONDA_ENV: tritonparse
59+
run: |
60+
bash .ci/install-project.sh
61+
62+
- name: Cache pip dependencies
63+
uses: actions/cache@v3
64+
with:
65+
path: ~/.cache/pip
66+
key: ${{ runner.os }}-pip-3.11-${{ hashFiles('**/pyproject.toml') }}
67+
restore-keys: |
68+
${{ runner.os }}-pip-3.11-
69+
70+
- name: Run tests
71+
env:
72+
CONDA_ENV: tritonparse
73+
TEST_TYPE: ${{ github.event.inputs.test-type || 'all' }}
74+
COVERAGE: ${{ github.event.inputs.coverage || 'false' }}
75+
run: |
76+
bash .ci/run-tests.sh
77+
78+
lint:
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v4
82+
83+
- name: Set up Python 3.11
84+
uses: actions/setup-python@v4
85+
with:
86+
python-version: "3.11"
87+
88+
- name: Install linting dependencies
89+
run: |
90+
python -m pip install --upgrade pip
91+
pip install ruff black isort mypy
92+
93+
- name: Install project dependencies
94+
run: |
95+
pip install -e ".[test]"
96+
97+
- name: Run ruff (linter)
98+
run: |
99+
ruff check tritonparse/
100+
ruff check tests/
101+
102+
- name: Run black (code formatter)
103+
run: |
104+
black --check tritonparse/
105+
black --check tests/
106+
107+
- name: Run isort (import sorter)
108+
run: |
109+
isort --check-only tritonparse/
110+
isort --check-only tests/
111+
112+
- name: Run mypy (type checker)
113+
run: |
114+
mypy tritonparse/ --ignore-missing-imports

0 commit comments

Comments
 (0)