Skip to content

Commit da8b599

Browse files
committed
workflow update
1 parent 15748d6 commit da8b599

File tree

4 files changed

+57
-46
lines changed

4 files changed

+57
-46
lines changed

.github/workflows/nvidia_workflow.yml

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
description: 'Content of the user submission, as json string'
77
required: true
88
type: string
9+
requirements:
10+
description: 'Contents for a requirements.txt file'
11+
required: false
12+
type: string
913

1014
jobs:
1115
run:
@@ -14,47 +18,52 @@ jobs:
1418
container:
1519
image: nvidia/cuda:12.4.0-devel-ubuntu22.04
1620
steps:
17-
- uses: actions/checkout@v3
18-
19-
- name: Setup Python
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: '3.10'
23-
24-
- name: Install uv
25-
uses: astral-sh/setup-uv@v3
26-
with:
27-
version: "latest"
28-
29-
- name: Setup Python environment
30-
run: |
31-
uv venv .venv
32-
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
33-
echo "$PWD/.venv/bin" >> $GITHUB_PATH
34-
# TODO the old script was more selective!
35-
uv pip install numpy torch setuptools ninja
36-
uv pip install triton
37-
38-
- name: Create input files
39-
shell: bash
40-
run: |
41-
cat > "payload.json" <<EOL
42-
${{ github.event.inputs.payload }}
43-
EOL
44-
45-
- name: Run script
46-
shell: bash
47-
run: |
48-
python .github/workflows/runner.py
49-
cat result.json # Debug: show output
50-
51-
- name: Upload training artifacts
52-
uses: actions/upload-artifact@v4
53-
if: always()
54-
with:
55-
name: run-result
56-
path: |
57-
result.json
21+
- uses: actions/checkout@v3
22+
23+
- name: Setup Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.10'
27+
28+
- name: Create input files
29+
shell: bash
30+
run: |
31+
cat > "payload.json" <<'EOL'
32+
${{ github.event.inputs.payload }}
33+
EOL
34+
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v3
37+
with:
38+
version: "latest"
39+
40+
- name: Setup Python environment
41+
shell: bash
42+
run: |
43+
uv venv .venv
44+
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
45+
echo "$PWD/.venv/bin" >> $GITHUB_PATH
46+
47+
if [[ -n "${{ github.event.inputs.requirements }}" ]]; then
48+
cat > "requirements.txt" <<'EOL'
49+
${{ github.event.inputs.requirements }}
50+
EOL
51+
uv pip install -r "requirements.txt"
52+
fi
53+
54+
- name: Run script
55+
shell: bash
56+
run: |
57+
python .github/workflows/runner.py
58+
cat result.json # Debug: show output
59+
60+
- name: Upload training artifacts
61+
uses: actions/upload-artifact@v4
62+
if: always()
63+
with:
64+
name: run-result
65+
path: |
66+
result.json
5867
5968
env:
6069
CUDA_VISIBLE_DEVICES: 0

.github/workflows/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
result = {"compile": asdict(comp), "run": asdict(run)}
2222
else:
2323
run = run_pytorch_script(
24-
config.get("eval.py", py_eval), config["reference.py"], config["submission.py"], arch=None
24+
config.get("eval.py", py_eval), config.get("reference.py", None), config.get("submission.py", None), arch=None
2525
)
2626
result = {"run": asdict(run)}
2727

examples/identity_py/reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ def generate_input() -> List[torch.Tensor]:
4141

4242

4343
if __name__ == "__main__":
44-
inputs = generate_input(seed=42)
44+
inputs = generate_input()
4545
for idx, tensor in enumerate(inputs):
4646
print(f"Input Tensor {idx + 1} (Shape: {tensor.shape}):\n{tensor}")

src/discord-cluster-manager/cogs/github_cog.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,13 @@ async def trigger_github_nvidia(
151151

152152
payload = json.dumps(config)
153153

154+
inputs = {"payload": payload}
155+
if lang == "py":
156+
inputs["requirements"] = "numpy\ntorch\nsetuptools\nninja\ntriton"
157+
154158
success = workflow.create_dispatch(
155159
get_github_branch_name(),
156-
{
157-
"payload": payload,
158-
},
160+
inputs=inputs
159161
)
160162
if success:
161163
await asyncio.sleep(2)

0 commit comments

Comments
 (0)