From 02663035677e3b0555fa46f7469f8a1e2e4d329d Mon Sep 17 00:00:00 2001 From: pranavm Date: Fri, 22 Nov 2024 15:36:43 -0800 Subject: [PATCH] Enables testing for pull requests --- .github/workflows/build-and-test.yml | 57 ++++++++++++++++++++++++++++ python/test/test_api.py | 6 +-- src/test/input_byte_size_test.cc | 2 +- 3 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 000000000..d0f7d578b --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,57 @@ +name: Build And Test + +on: + pull_request: + branches: + - main + types: [synchronize, opened, reopened, ready_for_review] + + +jobs: + test: + runs-on: ubuntu-latest + container: + image: nvcr.io/nvidia/tritonserver:24.10-py3 + volumes: + - ${{ github.workspace }}:/core + + steps: + # Based on https://stackoverflow.com/q/75536771 + - name: Free disk space + run: | + sudo docker system prune -a -f + sudo rm -rf \ + /usr/share/dotnet "$AGENT_TOOLSDIRECTORY" /usr/local/lib/android /opt/ghc \ + /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ + /usr/lib/jvm + + sudo apt-get purge microsoft-edge-stable || true + sudo apt-get purge google-cloud-cli || true + sudo apt-get purge dotnet-sdk-* || true + sudo apt-get purge google-chrome-stable || true + + sudo apt-get autoremove -y + sudo apt-get autoclean -y + + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + apt update + apt install -y --no-install-recommends clang-format-15 cmake libb64-dev rapidjson-dev libre2-dev + wget -O /tmp/boost.tar.gz https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz && (cd /tmp && tar xzf boost.tar.gz) && mv /tmp/boost_1_80_0/boost /usr/include/boost + pip install build pytest + + - name: Build + run: | + mkdir -p /core/build + cd /core/build + cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install -DTRITON_CORE_HEADERS_ONLY=OFF .. + export TRITON_PYBIND="_c/triton_bindings.cpython-310-x86_64-linux-gnu.so" + make -j8 + + - name: Run tests with pytest + run: | + cd /core + python3 -m pip install --force-reinstall build/python/generic/wheel/dist/tritonserver-*.whl + pytest python/test -v diff --git a/python/test/test_api.py b/python/test/test_api.py index c15847aab..af910e71d 100644 --- a/python/test/test_api.py +++ b/python/test/test_api.py @@ -357,11 +357,7 @@ def test_stop(self): { "backend": "python", "parameters": {"decoupled": {"string_value": "False"}}, - # Keep instance count low for fast startup/cleanup. - # Alternatively can use KIND_CPU here, but keeping gpus/count explicit. - "instance_group": [ - {"kind": "KIND_GPU", "gpus": [0], "count": 1} - ], + "instance_group": [{"kind": "KIND_CPU"}], } ) }, diff --git a/src/test/input_byte_size_test.cc b/src/test/input_byte_size_test.cc index cf3e3bd58..1774fe7b4 100644 --- a/src/test/input_byte_size_test.cc +++ b/src/test/input_byte_size_test.cc @@ -378,7 +378,7 @@ TEST_F(InputByteSizeTest, InputByteSizeLarge) "setting request release callback"); // Define input shape and data - size_t element_cnt = (1LL << 31) / sizeof(float); + int64_t element_cnt = (1LL << 31) / sizeof(float); std::vector shape{1, element_cnt}; std::vector input_data(element_cnt, 1); const auto input0_byte_size = sizeof(input_data[0]) * input_data.size();