Skip to content

Commit a1836e8

Browse files
committed
Build ARM64 support for lINUX
1 parent 9f30ff9 commit a1836e8

File tree

11 files changed

+184
-43
lines changed

11 files changed

+184
-43
lines changed

.github/workflows/build.yaml

+56-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,61 @@ jobs:
156156
destination_dir: built-wheels/${{ inputs.build_id }}/${{ !matrix.designated && 'matrix/' || '' }}
157157
endpoint: http://botmaster.tgr:9000
158158

159+
build_linux_arm64:
160+
name: Build Linux
161+
timeout-minutes: 30
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
cuda: [ '', cuda ]
166+
llvm: [ '', llvm ]
167+
gl: [ '', gl ]
168+
vk: [ '', vk ]
169+
python: ${{ fromJSON(inputs.python) }}
170+
include:
171+
- { cuda: cuda, llvm: llvm, gl: gl, vk: vk, designated: designated }
172+
exclude:
173+
- { llvm: '', cuda: cuda }
174+
runs-on: [ ubuntu24.04-arm ]
175+
env:
176+
TAICHI_CMAKE_ARGS: >-
177+
-DTI_WITH_CUDA:BOOL=${{ matrix.cuda && 'ON' || 'OFF' }}
178+
-DTI_WITH_LLVM:BOOL=${{ matrix.llvm && 'ON' || 'OFF' }}
179+
-DTI_WITH_OPENGL:BOOL=${{ matrix.gl && 'ON' || 'OFF' }}
180+
-DTI_WITH_VULKAN:BOOL=${{ matrix.vk && 'ON' || 'OFF' }}
181+
-DTI_WITH_METAL:BOOL=OFF
182+
-DTI_WITH_BACKTRACE:BOOL=ON
183+
-DTI_BUILD_TESTS:BOOL=ON
184+
185+
steps:
186+
- name: Workaround checkout Needed single revision issue
187+
run: git submodule foreach 'git rev-parse HEAD > /dev/null 2>&1 || rm -rf $PWD' || true
188+
189+
- uses: actions/checkout@v3
190+
with:
191+
submodules: 'recursive'
192+
fetch-depth: '0'
193+
194+
- name: Build
195+
run: |
196+
. .github/workflows/scripts/common-utils.sh
197+
ci-docker-run-gpu \
198+
-v $(pwd):/home/dev/taichi \
199+
registry.botmaster.tgr/taichi-build-cuda:${{ env.CI_IMAGE_VERSION }} \
200+
/home/dev/taichi/build.py ${NIGHTLY:+--nightly} --python=${{ matrix.python }} ${SHOULD_TAG_CONFIG:+--tag-config}
201+
env:
202+
SHOULD_TAG_CONFIG: ${{ !matrix.designated && 'yes' || '' }}
203+
204+
- name: Upload Built Wheel
205+
uses: shallwefootball/[email protected]
206+
with:
207+
aws_key_id: ${{ secrets.BOT_MINIO_ACCESS_KEY }}
208+
aws_secret_access_key: ${{ secrets.BOT_MINIO_SECRET_KEY }}
209+
aws_bucket: built-wheels
210+
source_dir: dist
211+
destination_dir: built-wheels/${{ inputs.build_id }}/${{ !matrix.designated && 'matrix/' || '' }}
212+
endpoint: http://botmaster.tgr:9000
213+
159214
build_amdgpu_linux:
160215
name: Build AMDGPU
161216
timeout-minutes: 30
@@ -350,4 +405,4 @@ jobs:
350405
with:
351406
name: libtaichi_c_api.iOS.a
352407
path: 'dist/C-API-iOS/*.a'
353-
retention-days: 7
408+
retention-days: 7

.github/workflows/initiator.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
3737
preparation:
3838
name: Preparation
39-
runs-on: [self-hosted, Linux]
39+
runs-on: [self-hosted, Linux, ubuntu-24.04-arm]
4040
outputs:
4141
date: ${{ steps.gather.outputs.date }}
4242
short_sha: ${{ steps.gather.outputs.short_sha }}
@@ -58,7 +58,7 @@ jobs:
5858
with:
5959
build_id: ${{ needs.preparation.outputs.build_id }}
6060
nightly: false
61-
python: '["3.9", "3.10", "3.11"]'
61+
python: '["3.10", "3.11", "3.12", "3.13"]'
6262
secrets:
6363
BOT_MINIO_ACCESS_KEY: ${{ secrets.BOT_MINIO_ACCESS_KEY }}
6464
BOT_MINIO_SECRET_KEY: ${{ secrets.BOT_MINIO_SECRET_KEY }}

.github/workflows/release.yml

+63-11
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
if: github.repository_owner == 'taichi-dev'
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3838

3939
- name: Save new version
4040
run: |
@@ -85,7 +85,59 @@ jobs:
8585
-DTI_BUILD_TESTS:BOOL=ON
8686
8787
steps:
88-
- uses: actions/checkout@v3
88+
- uses: actions/checkout@v4
89+
with:
90+
submodules: 'recursive'
91+
fetch-depth: '0'
92+
93+
- name: Prepare Environment
94+
run: |
95+
. .github/workflows/scripts/common-utils.sh
96+
prepare-build-cache
97+
echo CI_DOCKER_RUN_EXTRA_ARGS="-v $(pwd):/home/dev/taichi" >> $GITHUB_ENV
98+
99+
- name: Build
100+
run: |
101+
. .github/workflows/scripts/common-utils.sh
102+
103+
ci-docker-run-gpu --name taichi-build \
104+
registry.botmaster.tgr/taichi-build-cuda:${{ env.CI_IMAGE_VERSION }} \
105+
/home/dev/taichi/.github/workflows/scripts/build.py $NIGHTLY
106+
107+
- name: Archive Wheel Artifacts
108+
uses: actions/upload-artifact@v3
109+
with:
110+
name: dist
111+
path: dist/*.whl
112+
retention-days: 20
113+
114+
- name: Test
115+
run: |
116+
. .github/workflows/scripts/common-utils.sh
117+
118+
ci-docker-run-gpu --name taichi-test \
119+
registry.botmaster.tgr/taichi-test-cuda:${{ env.CI_IMAGE_VERSION }} \
120+
/home/dev/taichi/.github/workflows/scripts/unix_test.sh
121+
env:
122+
PY: ${{ matrix.python }}
123+
124+
build_and_test_linux_arm:
125+
name: Build and Upload (linux Arm only)
126+
needs: matrix_prep
127+
strategy:
128+
fail-fast: false
129+
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
130+
runs-on: [ ubuntu24.04-arm, cuda, vulkan, cn, release, sm70 ]
131+
env:
132+
PY: ${{ matrix.python }}
133+
PROJECT_NAME: ${{ matrix.name }}
134+
TAICHI_CMAKE_ARGS: >-
135+
-DTI_WITH_OPENGL:BOOL=ON
136+
-DTI_WITH_VULKAN:BOOL=ON
137+
-DTI_BUILD_TESTS:BOOL=ON
138+
139+
steps:
140+
- uses: actions/checkout@v4
89141
with:
90142
submodules: 'recursive'
91143
fetch-depth: '0'
@@ -136,7 +188,7 @@ jobs:
136188
# -DTI_WITH_OPENGL:BOOL=OFF
137189
# -DTI_BUILD_TESTS:BOOL=ON
138190
# steps:
139-
# - uses: actions/checkout@v3
191+
# - uses: actions/checkout@v4
140192
# with:
141193
# submodules: 'recursive'
142194
# fetch-depth: '0'
@@ -188,7 +240,7 @@ jobs:
188240
-DTI_BUILD_TESTS:BOOL=ON
189241
190242
steps:
191-
- uses: actions/checkout@v3
243+
- uses: actions/checkout@v4
192244
with:
193245
submodules: 'recursive'
194246
fetch-depth: '0'
@@ -243,12 +295,12 @@ jobs:
243295
git config --system core.longpaths true
244296
git submodule foreach 'git rev-parse HEAD > /dev/null 2>&1 || rm -rf $PWD'
245297
246-
- uses: actions/checkout@v3
298+
- uses: actions/checkout@v4
247299
with:
248300
submodules: 'recursive'
249301
fetch-depth: '0'
250302

251-
- uses: actions/setup-python@v4
303+
- uses: actions/setup-python@v5
252304
with:
253305
python-version: ${{ matrix.python }}
254306

@@ -289,11 +341,11 @@ jobs:
289341
290342
upload_to_pypi:
291343
name: Upload release to PyPI
292-
needs: [build_and_test_linux, build_and_test_m1, build_and_test_windows]
344+
needs: [build_and_test_linux, build_and_test_m1, build_and_test_windows, build_and_test_linux_arm]
293345
runs-on: ubuntu-latest
294346
steps:
295-
- uses: actions/checkout@v3
296-
- uses: actions/setup-python@v4
347+
- uses: actions/checkout@v4
348+
- uses: actions/checkout@v5
297349
with:
298350
python-version: 3.9
299351

@@ -331,11 +383,11 @@ jobs:
331383
runs-on: ubuntu-latest
332384
if: ${{ github.event.inputs.version }}
333385
steps:
334-
- uses: actions/checkout@v3
386+
- uses: actions/checkout@v4
335387
with:
336388
fetch-depth: 0
337389

338-
- uses: actions/setup-python@v4
390+
- uses: actions/checkout@v5
339391
with:
340392
python-version: 3.9
341393

.github/workflows/scripts/ti_build/dep.py

+3
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ def download_dep(url, outdir, *, strip=0, force=False, args=None, plain=False, e
153153
elif name.endswith(".tar.gz") or name.endswith(".tgz"):
154154
outdir.mkdir(parents=True, exist_ok=True)
155155
tar("-xzf", local_cached, "-C", outdir, f"--strip-components={strip}")
156+
elif name.endswith(".tar.xz"):
157+
outdir.mkdir(parents=True, exist_ok=True)
158+
tar("-xJf", local_cached, "-C", outdir, f"--strip-components={strip}")
156159
elif name.endswith(".sh"):
157160
bash(local_cached, *args)
158161
elif "." not in name and args is not None:

.github/workflows/scripts/ti_build/entry.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,17 @@ def build_wheel(python: Command, pip: Command) -> None:
5151
elif wheel_tag:
5252
proj_tags.extend(["egg_info", f"--tag-build={wheel_tag}"])
5353

54-
if platform.system() == "Linux":
54+
u = platform.uname()
55+
if (u.system, u.machine) == ("Linux", "x86_64"):
5556
if is_manylinux2014():
5657
extra.extend(["-p", "manylinux2014_x86_64"])
5758
else:
58-
extra.extend(["-p", "manylinux_2_27_x86_64"])
59+
extra.extend(["-p", "manylinux_2_28_x86_64"])
60+
elif (u.system, u.machine) in (("Linux", "arm64"), ("Linux", "aarch64")):
61+
extra.extend(["-p", "manylinux_2_28_aarch64"])
62+
else:
63+
extra.extend(["-p", "manylinux_2_28_x86_64"])
64+
5965

6066
python("setup.py", "clean")
6167
python("misc/make_changelog.py", "--ver", "origin/master", "--repo_dir", "./", "--save")

.github/workflows/scripts/ti_build/llvm.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def setup_llvm() -> None:
1919
Download and install LLVM.
2020
"""
2121
u = platform.uname()
22-
if u.system == "Linux":
22+
if (u.system, u.machine) == ("Linux", "x86_64"):
2323
if cmake_args.get_effective("TI_WITH_AMDGPU"):
2424
out = get_cache_home() / "llvm15-amdgpu-005"
2525
url = "https://github.com/GaleSeLee/assets/releases/download/v0.0.5/taichi-llvm-15.0.0-linux.zip"
@@ -31,6 +31,11 @@ def setup_llvm() -> None:
3131
out = get_cache_home() / "llvm15"
3232
url = "https://github.com/taichi-dev/taichi_assets/releases/download/llvm15/taichi-llvm-15-linux.zip"
3333
download_dep(url, out, strip=1)
34+
35+
elif (u.system, u.machine) in (("Linux", "arm64"), ("Linux", "aarch64")):
36+
out = get_cache_home() / "llvm15-manylinux2014"
37+
# FIXME: ARM LLVM!
38+
pass
3439
elif (u.system, u.machine) == ("Darwin", "arm64"):
3540
out = get_cache_home() / "llvm15-m1-nozstd"
3641
url = "https://github.com/taichi-dev/taichi_assets/releases/download/llvm15/taichi-llvm-15-m1-nozstd.zip"

.github/workflows/scripts/ti_build/python.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@
1515
from .misc import banner, get_cache_home, path_prepend, info
1616
from .tinysh import Command, sh
1717

18-
1918
# -- code --
20-
def setup_mambaforge(prefix):
19+
def setup_miniforge(prefix):
2120
u = platform.uname()
22-
if u.system == "Linux":
23-
url = "https://github.com/conda-forge/miniforge/releases/download/23.1.0-1/Mambaforge-23.1.0-1-Linux-x86_64.sh"
21+
if (u.system, u.machine) == ("Linux", "x86_64"):
22+
url = "https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-24.11.3-0-Linux-x86_64.sh"
23+
download_dep(url, prefix, args=["-bfp", str(prefix)])
24+
elif (u.system, u.machine) in (("Linux", "arm64"), ("Linux", "aarch64")):
25+
url = "https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-24.11.3-0-Linux-aarch64.sh"
2426
download_dep(url, prefix, args=["-bfp", str(prefix)])
2527
elif (u.system, u.machine) == ("Darwin", "arm64"):
26-
url = "https://github.com/conda-forge/miniforge/releases/download/23.1.0-1/Mambaforge-23.1.0-1-MacOSX-arm64.sh"
28+
url = "https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-24.11.3-0-MacOSX-arm64.sh"
2729
download_dep(url, prefix, args=["-bfp", str(prefix)])
2830
elif (u.system, u.machine) == ("Darwin", "x86_64"):
29-
url = "https://github.com/conda-forge/miniforge/releases/download/23.1.0-1/Mambaforge-23.1.0-1-MacOSX-x86_64.sh"
31+
url = "https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-24.11.3-0-MacOSX-x86_64.sh"
3032
download_dep(url, prefix, args=["-bfp", str(prefix)])
3133
elif u.system == "Windows":
3234
url = (
33-
"https://github.com/conda-forge/miniforge/releases/download/23.1.0-1/Mambaforge-23.1.0-1-Windows-x86_64.exe"
35+
"https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-Windows-x86_64.exe"
3436
)
3537
download_dep(
3638
url,
@@ -82,8 +84,8 @@ def setup_python(version: str) -> Tuple[Command, Command]:
8284

8385
windows = platform.system() == "Windows"
8486

85-
prefix = get_cache_home() / "mambaforge"
86-
setup_mambaforge(prefix)
87+
prefix = get_cache_home() / "miniforge"
88+
setup_miniforge(prefix)
8789

8890
if windows:
8991
conda_path = prefix / "Scripts" / "conda.exe"
@@ -92,9 +94,9 @@ def setup_python(version: str) -> Tuple[Command, Command]:
9294

9395
if not conda_path.exists():
9496
shutil.rmtree(prefix, ignore_errors=True)
95-
setup_mambaforge(prefix)
97+
setup_miniforge(prefix)
9698
if not conda_path.exists():
97-
raise RuntimeError(f"Failed to setup mambaforge at {prefix}")
99+
raise RuntimeError(f"Failed to setup miniforge at {prefix}")
98100

99101
conda = sh.bake(str(conda_path))
100102

.github/workflows/scripts/ti_build/sccache.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,22 @@ def setup_sccache() -> Command:
3131
raise RuntimeError(f"Unsupported platform: {u.system} {u.machine}")
3232

3333
if not exe.exists():
34-
if u.system == "Linux":
35-
url = "https://github.com/mozilla/sccache/releases/download/v0.4.1/sccache-v0.4.1-x86_64-unknown-linux-musl.tar.gz"
34+
if (u.system, u.machine) == ("Linux", "x86_64"):
35+
url = "https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-unknown-linux-musl.tar.gz"
36+
37+
elif (u.system, u.machine) in (("Linux", "arm64"), ("Linux", "aarch64")):
38+
url = "https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-aarch64-unknown-linux-musl.tar.gz"
39+
3640
elif (u.system, u.machine) == ("Darwin", "arm64"):
3741
url = (
38-
"https://github.com/mozilla/sccache/releases/download/v0.4.1/sccache-v0.4.1-aarch64-apple-darwin.tar.gz"
42+
"https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-aarch64-apple-darwin.tar.gz"
3943
)
4044
elif (u.system, u.machine) == ("Darwin", "x86_64"):
4145
url = (
42-
"https://github.com/mozilla/sccache/releases/download/v0.4.1/sccache-v0.4.1-x86_64-apple-darwin.tar.gz"
46+
"https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-apple-darwin.tar.gz"
4347
)
4448
elif u.system == "Windows":
45-
url = "https://github.com/mozilla/sccache/releases/download/v0.4.1/sccache-v0.4.1-x86_64-pc-windows-msvc.tar.gz"
49+
url = "https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-pc-windows-msvc.tar.gz"
4650
else:
4751
raise RuntimeError(f"Unsupported platform: {u.system} {u.machine}")
4852

.github/workflows/scripts/ti_build/vulkan.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,34 @@
1212

1313

1414
# -- code --
15-
@banner("Setup Vulkan 1.3.236.0")
15+
@banner("Setup Vulkan 1.4.304.0")
1616
def setup_vulkan():
1717
u = platform.uname()
18-
if u.system == "Linux":
19-
url = "https://sdk.lunarg.com/sdk/download/1.3.236.0/linux/vulkansdk-linux-x86_64-1.3.236.0.tar.gz"
20-
prefix = get_cache_home() / "vulkan-1.3.236.0"
18+
if (u.system, u.machine) == ("Linux", "x86_64"):
19+
url = "https://sdk.lunarg.com/sdk/download/1.4.304.0/linux/vulkansdk-linux-x86_64-1.4.304.0.tar.xz"
20+
prefix = get_cache_home() / "vulkan-1.4.304.0"
2121
download_dep(url, prefix, strip=1)
2222
sdk = prefix / "x86_64"
2323
os.environ["VULKAN_SDK"] = str(sdk)
2424
path_prepend("PATH", sdk / "bin")
2525
path_prepend("LD_LIBRARY_PATH", sdk / "lib")
2626
os.environ["VK_LAYER_PATH"] = str(sdk / "etc" / "vulkan" / "explicit_layer.d")
27-
# elif (u.system, u.machine) == ("Darwin", "arm64"):
27+
elif (u.system, u.machine) in (("Linux", "arm64"), ("Linux", "aarch64")):
28+
url = (
29+
"https://github.com/johnnynunez/vulkan-sdk-arm/releases/download/1.4.304.0/"
30+
"vulkansdk-linux-arm64-ubuntu-22.04-arm-1.4.304.0.zip"
31+
)
32+
prefix = get_cache_home() / "vulkan-1.4.304.0"
33+
download_dep(url, prefix, strip=1)
34+
sdk = prefix / "arm64"
35+
os.environ["VULKAN_SDK"] = str(sdk)
36+
path_prepend("PATH", sdk / "bin")
37+
path_prepend("LD_LIBRARY_PATH", sdk / "lib")
38+
os.environ["VK_LAYER_PATH"] = str(sdk / "etc" / "vulkan" / "explicit_layer.d")
2839
# elif (u.system, u.machine) == ("Darwin", "x86_64"):
2940
elif (u.system, u.machine) == ("Windows", "AMD64"):
30-
url = "https://sdk.lunarg.com/sdk/download/1.3.236.0/windows/VulkanSDK-1.3.236.0-Installer.exe"
31-
prefix = get_cache_home() / "vulkan-1.3.236.0"
41+
url = "https://sdk.lunarg.com/sdk/download/1.4.304.0/windows/VulkanSDK-1.4.304.0-Installer.exe"
42+
prefix = get_cache_home() / "vulkan-1.4.304.0"
3243
download_dep(
3344
url,
3445
prefix,

0 commit comments

Comments
 (0)