Skip to content

Commit 2c82220

Browse files
authored
Merge pull request #3 from fishingfly/main
Support github runner
2 parents 03c5942 + e5760a0 commit 2c82220

File tree

5 files changed

+84
-4
lines changed

5 files changed

+84
-4
lines changed

.github/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM ubuntu:22.04
2+
3+
LABEL name="Moore Threads Mtml Python Library CI Base Image"
4+
LABEL summary="Python Library CI Base Image for Moore Threads Mtml"
5+
LABEL description="See summary"
6+
LABEL vendor="MOORE THREADS CORPORATION"
7+
LABEL maintainer="MOORE THREADS CORPORATION <mt-sw-cloudcomputing@mthreads.com>"
8+
9+
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
12+
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak \
13+
&& sed -i 's@//.*archive.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list \
14+
&& sed -i 's@//.*security.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list
15+
16+
RUN apt-get update \
17+
&& apt-get install -y --no-install-recommends \
18+
python3 python3-pip python3-dev build-essential ca-certificates \
19+
git curl \
20+
libicu-dev \
21+
sudo \
22+
&& apt-get clean \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
RUN ln -s /usr/bin/python3 /usr/bin/python
26+
27+
RUN python3 -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple \
28+
&& pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
29+
30+
RUN groupdel render 2>/dev/null || true \
31+
&& sed -i '/:109:/d' /etc/group
32+
33+
RUN groupadd -g 109 render
34+
35+
RUN groupadd -g 1001 mccxadmin
36+
37+
RUN useradd -l -u 1000 -g 1001 -G video,render -s /bin/bash -m mccxadmin
38+
39+
RUN echo "mccxadmin ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/mccxadmin \
40+
&& chmod 0440 /etc/sudoers.d/mccxadmin
41+
42+
WORKDIR /app
43+
44+
RUN chown -R mccxadmin:mccxadmin /app
45+
46+
USER mccxadmin
47+
48+
CMD ["/bin/bash"]

.github/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Start ci container
2+
```
3+
docker container create --name ci-mtml-py --env MTHREADS_VISIBLE_DEVICES=all --env MTHREADS_DRIVER_CAPABILITIES=all -v $PWD:/app/test -it registry.cn-hangzhou.aliyuncs.com/fishingfly/mthreads-ml-py-ci:latest bash
4+
```

.github/workflows/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: mthreads-ml-py local runner
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
Unit-test-job:
7+
runs-on: self-hosted
8+
steps:
9+
- name: Print device info
10+
run: mthreads-gmi
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
- name: Test mtml sglang compatibility
14+
run: python test_sglang_compat.py
15+
- name: Test mtml
16+
run: |
17+
export CI_MTML_SKIP_ECC=1
18+
python test_pymtml.py
19+
- name: Test pynvml
20+
run: |
21+
python test_pynvml.py

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cython_debug/
182182
.abstra/
183183

184184
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189189
# .vscode/
190190

@@ -205,3 +205,6 @@ cython_debug/
205205
marimo/_static/
206206
marimo/_lsp/
207207
__marimo__/
208+
209+
# Vscode
210+
.vscode/

test_pymtml.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import sys
88
import traceback
9+
import os
910

1011
from pymtml import *
1112

@@ -81,7 +82,9 @@ def test_device_pci_apis(self, device, device_idx):
8182
if pci_info.busId and pci_info.busId[0].isalnum():
8283
print_result("PCI Info busId populated", pci_info.busId)
8384
else:
84-
print_result("PCI Info busId populated", "[FAIL: busId is empty or invalid]")
85+
print_result(
86+
"PCI Info busId populated", "[FAIL: busId is empty or invalid]"
87+
)
8588
test_error("PCIe Slot Info", lambda: mtmlDeviceGetPcieSlotInfo(device))
8689

8790
def test_device_fan_apis(self, device, device_idx):
@@ -198,7 +201,8 @@ def test_ecc_apis(self, device, device_idx):
198201

199202
try:
200203
memory = mtmlDeviceInitMemory(device)
201-
test_error("ECC Mode", lambda: mtmlMemoryGetEccMode(memory))
204+
if not os.getenv("CI_MTML_SKIP_ECC") == "1":
205+
test_error("ECC Mode", lambda: mtmlMemoryGetEccMode(memory))
202206
test_error(
203207
"Retired Pages Count", lambda: mtmlMemoryGetRetiredPagesCount(memory)
204208
)

0 commit comments

Comments
 (0)