Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
additional updates to "bump-to-v0.3.2" (#39)
Browse files Browse the repository at this point in the history
SUMMARY
* update `TORCH_CUDA_ARCH_LIST` to match `magic_wand`
* update "test vllm" action to run tests serially
* add helper script to find *.py tests, run them serially, and output
JUnit formatted xml

TEST
working through changes manually on debug instance

---------

Co-authored-by: andy-neuma <andy@neuralmagic.com>
  • Loading branch information
andy-neuma and andy-neuma authored Feb 23, 2024
1 parent 4b44479 commit 9209f15
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 22 deletions.
2 changes: 0 additions & 2 deletions .github/actions/nm-build-vllm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ runs:
steps:
- id: build
run: |
# TODO: this is a hack ... fix it later
# pyenv hardcoded ... python version hardcoded ...
COMMIT=${{ github.sha }}
VENV="${{ inputs.venv }}-${COMMIT:0:7}"
source $(pyenv root)/versions/${{ inputs.python }}/envs/${VENV}/bin/activate
Expand Down
13 changes: 9 additions & 4 deletions .github/actions/nm-set-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
name: set neuralmagic env
description: 'sets environment variables for neuralmagic'
inputs:
hf_home:
hf_token:
description: 'Hugging Face home'
required: true
Gi_per_thread:
description: 'requested GiB to reserve per thread'
required: true
runs:
using: composite
steps:
- run: |
echo "HF_HOME=${HF_HOME_TOKEN}" >> $GITHUB_ENV
echo "TORCH_CUDA_ARCH_LIST=8.0+PTX" >> $GITHUB_ENV
echo "HF_TOKEN=${HF_TOKEN_SECRET}" >> $GITHUB_ENV
NUM_THREADS=$(./.github/scripts/determine-threading -G ${{ inputs.Gi_per_thread }})
echo "MAX_JOBS=${NUM_THREADS}" >> $GITHUB_ENV
echo "VLLM_INSTALL_PUNICA_KERNELS=1" >> $GITHUB_ENV
echo "PYENV_ROOT=/usr/local/apps/pyenv" >> $GITHUB_ENV
echo "XDG_CONFIG_HOME=/usr/local/apps" >> $GITHUB_ENV
WHOAMI=$(whoami)
echo "PATH=/usr/local/apps/pyenv/plugins/pyenv-virtualenv/shims:/usr/local/apps/pyenv/shims:/usr/local/apps/pyenv/bin:/usr/local/apps/nvm/versions/node/v16.20.2/bin:/usr/local/cuda-12.1/bin:/usr/local/cuda-12.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/${WHOAMI}/.local/bin:" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64::/usr/local/cuda-12.1/lib64:" >> $GITHUB_ENV
echo "PROJECT_ID=12" >> $GITHUB_ENV
env:
HF_HOME_TOKEN: ${{ inputs.hf_home }}
HF_TOKEN_SECRET: ${{ inputs.hf_token }}
shell: bash
12 changes: 6 additions & 6 deletions .github/actions/nm-test-vllm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ inputs:
test_directory:
description: 'test directory, path is relative to neuralmagic-vllm'
required: true
test_xml:
description: 'filename for xml test results'
test_results:
description: 'top-level directory for xml test results'
required: true
python:
description: 'python version, e.g. 3.10.12'
Expand All @@ -22,15 +22,15 @@ runs:
steps:
- id: test
run: |
SUCCESS=0
# TODO: this is a hack ... fix it later
# pyenv hardcoded ... python version hardcoded ...
COMMIT=${{ github.sha }}
VENV="${{ inputs.venv }}-${COMMIT:0:7}"
source $(pyenv root)/versions/${{ inputs.python }}/envs/${VENV}/bin/activate
pip3 install --index-url http://192.168.201.226:8080/ --trusted-host 192.168.201.226 magic-wand
pip3 install -r requirements-dev.txt
pytest --junitxml=${{ inputs.test_xml }} ${{ inputs.test_directory }} || SUCCESS=$?
# run tests via runner script (serially)
SUCCESS=0
./.github/scripts/run-tests -t ${{ inputs.test_directory }} -r ${{ inputs.test_results }} || SUCCESS=$?
echo "was this a SUCCESS? ${SUCCESS}"
echo "status=${SUCCESS}" >> "$GITHUB_OUTPUT"
exit ${SUCCESS}
shell: bash
6 changes: 6 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SUMMARY:
"please provide a brief summary"

TEST PLAN:
"please outline how the changes were tested"

66 changes: 66 additions & 0 deletions .github/scripts/run-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash -e

# simple helper script to manage concurrency while running tests

usage() {
echo "Usage: ${0} <options>"
echo
echo " -t - test directory, i.e. location of *.py test files. (default 'tests/')"
echo " -r - desired results base directory. xml results will mirror provided tests directory structure. (default 'test-results/')"
echo " -h - this list of options"
echo
echo "note: all paths are relative to 'neuralmagic-vllm' root"
echo
exit 1
}

TEST_DIR=tests
RESULTS_DIR=test-results

while getopts "ht:r:" OPT; do
case "${OPT}" in
h)
usage
;;
t)
TEST_DIR="${OPTARG}"
;;
r)
RESULTS_DIR="${OPTARG}"
;;
esac
done

# check if variables are valid
if [ -z "${RESULTS_DIR}" ]; then
echo "please set desired results base directory"
usage
fi

if [ -z "${TEST_DIR}" ]; then
echo "please set test directory"
usage
fi

if [ ! -d "${TEST_DIR}" ]; then
echo "specified test directory, '${TEST_DIR}' does not exist ..."
usage
fi

# run tests serially
TESTS_DOT_PY=$(find ${TEST_DIR} -not -name "__init__.py" -name "*.py")
TESTS_TO_RUN=($TESTS_DOT_PY)
SUCCESS=0
for TEST in "${TESTS_TO_RUN[@]}"
do
LOCAL_SUCCESS=0
RESULT_XML=$(echo ${TEST} | sed -e "s/${TEST_DIR}/${RESULTS_DIR}/" | sed -e "s/.py/.xml/")
pytest --junitxml=${RESULT_XML} ${TEST} || LOCAL_SUCCESS=$?
SUCCESS=$((SUCCESS + LOCAL_SUCCESS))
done

if [ "${SUCCESS}" -eq "0" ]; then
exit 0
else
exit 1
fi
24 changes: 17 additions & 7 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: "git commit hash or branch name"
type: string
required: true
Gi_per_thread:
description: 'requested GiB to reserve per thread'
type: string
required: true
python:
description: "python version, e.g. 3.10.12"
type: string
Expand All @@ -35,6 +39,10 @@ on:
description: "git commit hash or branch name"
type: string
required: true
Gi_per_thread:
description: 'requested GiB to reserve per thread'
type: string
required: true
python:
description: "python version, e.g. 3.10.12"
type: string
Expand All @@ -61,7 +69,8 @@ jobs:
id: setenv
uses: ./.github/actions/nm-set-env/
with:
hf_home: ${{ secrets.NM_HF_HOME }}
hf_token: ${{ secrets.NM_HF_TOKEN }}
Gi_per_thread: ${{ inputs.Gi_per_thread }}

- name: set python
id: set_python
Expand All @@ -88,7 +97,7 @@ jobs:
id: build
uses: ./.github/actions/nm-build-vllm/
with:
Gi_per_thread: 1
Gi_per_thread: ${{ inputs.Gi_per_thread }}
python: ${{ inputs.python }}
venv: TEST

Expand All @@ -97,7 +106,7 @@ jobs:
uses: ./.github/actions/nm-test-vllm/
with:
test_directory: tests
test_xml: test-results/all_tests.xml
test_results: test-results
python: ${{ inputs.python }}
venv: TEST

Expand Down Expand Up @@ -134,12 +143,13 @@ jobs:
TEST_STATUS: ${{ steps.test.outputs.status }}
run: |
echo "checkout status: ${CHECKOUT}"
if [[ "${CHECKOUT}" != *"success"* ]]; then exit 1; fi
if [ ${LINT_STATUS} -ne 0 ]; then exit 1; fi
if [ ${BUILD_STATUS} -ne 0 ]; then exit 1; fi
echo "lint status: ${LINT_STATUS}"
echo "build status: ${BUILD_STATUS}"
if [ ${TEST_STATUS} -ne 0 ]; then exit 1; fi
echo "test status: ${TEST_STATUS}"
if [[ "${CHECKOUT}" != *"success"* ]]; then exit 1; fi
if [ -z "${LINT_STATUS}" ] || [ "${LINT_STATUS}" -ne "0" ]; then exit 1; fi
if [ -z "${BUILD_STATUS}" ] || [ "${BUILD_STATUS}" -ne "0" ]; then exit 1; fi
if [ -z "${TEST_STATUS}" ] || [ "${TEST_STATUS}" -ne "0" ]; then exit 1; fi
- name: complete testmo run
uses: ./.github/actions/nm-testmo-run-complete/
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/remote-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:

# TODO: expand python matrix later, once CI system has
# matured.
# TODO: adjust timeout after we get a bit more experience.
# making it 60 is a bit permissive.

# TODO: enable this later
AWS-AVX2-32G-A10G-24G:
Expand All @@ -24,7 +22,8 @@ jobs:
uses: ./.github/workflows/build-test.yml
with:
label: aws-avx2-32G-a10g-24G
timeout: 60
timeout: 180
gitref: '${{ github.ref }}'
Gi_per_thread: 4
python: ${{ matrix.python }}
secrets: inherit

0 comments on commit 9209f15

Please sign in to comment.