Skip to content

Commit

Permalink
Attempt to get ncu working
Browse files Browse the repository at this point in the history
  • Loading branch information
msaroufim committed Nov 23, 2024
1 parent d7b7019 commit 4e4fe2e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/nvidia_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
description: 'Name of script (supports .py or .cu)'
required: true
type: string

jobs:
train:
runs-on: [gpumode-nvidia-arc]
Expand All @@ -22,25 +21,18 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Setup Python environment
run: |
uv venv .venv
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Create script file
run: |
cat << 'EOL' > ${{ github.event.inputs.filename }}
${{ github.event.inputs.script_content }}
EOL
cat ${{ github.event.inputs.filename }} # Debug: show file contents
- name: Install dependencies
run: |
if grep -rE "(import torch|from torch)" "${{ github.event.inputs.filename }}"; then
Expand All @@ -51,20 +43,22 @@ jobs:
echo "Triton detected, installing triton"
uv pip install triton
fi
- name: Run script
shell: bash
run: |
if [[ "${{ github.event.inputs.filename }}" == *.cu ]]; then
echo "Compiling and running CUDA file..."
nvcc "${{ github.event.inputs.filename }}" -o cuda_program
./cuda_program > training.log 2>&1
echo "Profiling with NCU..."
ncu --csv --set full -o profile ./cuda_program
else
echo "Running Python file..."
python3 "${{ github.event.inputs.filename }}" > training.log 2>&1
echo "Profiling with NCU..."
ncu --csv --set full -o profile python3 "${{ github.event.inputs.filename }}"
fi
cat training.log # Debug: show output
cat training.log
- name: Upload training artifacts
uses: actions/upload-artifact@v4
if: always()
Expand All @@ -73,6 +67,6 @@ jobs:
path: |
training.log
${{ github.event.inputs.filename }}
profile.csv
env:
CUDA_VISIBLE_DEVICES: 0
CUDA_VISIBLE_DEVICES: 0

0 comments on commit 4e4fe2e

Please sign in to comment.