-
Notifications
You must be signed in to change notification settings - Fork 6
186 lines (153 loc) · 5.39 KB
/
Copy pathcommit_check.yml
File metadata and controls
186 lines (153 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Formatting and tests
on: [push, pull_request]
jobs:
formatting:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # Get full git history
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.14.0'
- name: Install package
run: |
pip install --upgrade pip
pip install uv
uv venv --python 3.10.17
uv pip install -e ".[dev]" --torch-backend=auto
- name: Pytest
run: |
source .venv/bin/activate
make pylint
make pycodestyle
make mypy
make black
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # Get full git history
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopenblas-dev
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.14.0'
- name: Download and install Miniconda
run: |
# Check if we're running in act (local testing)
if [ -n "$ACT" ]; then
echo "Running in act (local environment)"
fi
# Detect system architecture and OS
ARCH=$(uname -m)
OS=$(uname -s)
echo "Detected OS: $OS, Architecture: $ARCH"
# Determine the correct Miniconda download URL
if [[ "$OS" == "Linux" ]]; then
if [[ "$ARCH" == "x86_64" ]]; then
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh"
else
echo "Unsupported Linux architecture: $ARCH"
exit 1
fi
elif [[ "$OS" == "Darwin" ]]; then
if [[ "$ARCH" == "x86_64" ]]; then
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh"
elif [[ "$ARCH" == "arm64" ]]; then
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh"
else
echo "Unsupported macOS architecture: $ARCH"
exit 1
fi
else
echo "Unsupported OS: $OS"
exit 1
fi
echo "Downloading Miniconda from: $MINICONDA_URL"
curl -sSL "$MINICONDA_URL" -o miniconda.sh
# Install Miniconda
bash miniconda.sh -b -p $HOME/miniconda
# Initialize conda
source $HOME/miniconda/bin/activate
conda init bash
# Add to PATH for current and future steps
echo "$HOME/miniconda/bin" >> $GITHUB_PATH
export PATH="$HOME/miniconda/bin:$PATH"
# Verify installation
conda --version
# Delete .sh file
rm miniconda.sh
- name: Create conda environment
run: |
export PATH="$HOME/miniconda/bin:$PATH"
conda create -n myenv python=3.10 -y
conda info --envs
- name: Install dependencies
run: |
# from aihwkit-lightning one up
cd ../
pwd
which python # /usr/bin/python (system Python)
which pip
export PATH="$HOME/miniconda/bin:$PATH"
source $HOME/miniconda/bin/activate myenv
which python # conda
which pip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Check disk space before triton installation
echo "=== Disk space before triton installation ==="
df -h
# triton
git clone https://github.com/triton-lang/triton.git
cd triton
git checkout c1ed673b74e1c9aa69416459a4ae9f4fcf8cc6da
pwd
pip install -r python/requirements.txt --no-deps
cd python
MAX_JOBS=8 pip install -v -e .
cd ../..
python -c "import triton ; print(f'Triton imported successfully from {triton.__file__}')"
# Check disk space after triton installation
echo "=== Disk space after triton installation ==="
df -h
# Clean up triton build artifacts and temp files
echo "=== Cleaning up triton build artifacts ==="
rm -rf triton
# Clean up tmp directory
echo "=== Cleaning up /tmp directory ==="
sudo rm -rf /tmp/*
# Check disk space after cleanup
echo "=== Disk space after cleanup ==="
df -h
# aihwkit
pwd
git clone https://github.com/IBM/aihwkit.git
cd aihwkit
git checkout ee8bbf066f1c2a38b4a50f60c357a5581b33e916
pip install -r requirements.txt
pip install -r requirements-dev.txt
conda install -c conda-forge openblas -y
make build_inplace
export PYTHONPATH=$(pwd)/src
echo "PYTHONPATH set to $PYTHONPATH"
cd ..
# aihwkit-lightning
cd aihwkit-lightning
pip install -r requirements_dev.txt
pip install -v -e .
# actually execute the tests
make pytest