run_perf_client.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. # Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. MODEL_NAME=${1:-"bert"}
  15. MODEL_VERSION=${2:-1}
  16. BATCH_SIZE=${3:-1}
  17. MAX_LATENCY=${4:-100}
  18. MAX_CLIENT_THREADS=${5:-10}
  19. MAX_CONCURRENCY=${6:-50}
  20. SERVER_HOSTNAME=${7:-"localhost"}
  21. if [[ $SERVER_HOSTNAME == *":"* ]]; then
  22. echo "ERROR! Do not include the port when passing the Server Hostname. These scripts require that the TRITON HTTP endpoint is on Port 8000 and the gRPC endpoint is on Port 8001. Exiting..."
  23. exit 1
  24. fi
  25. if [ "$SERVER_HOSTNAME" = "localhost" ]
  26. then
  27. if [ ! "$(docker inspect -f "{{.State.Running}}" triton_server_cont)" = "true" ] ; then
  28. echo "Launching TRITON server"
  29. bash triton/scripts/launch_server.sh
  30. SERVER_LAUNCHED=true
  31. function cleanup_server {
  32. echo "Killing TRITON server"
  33. docker kill triton_server_cont
  34. }
  35. # Ensure we cleanup the server on exit
  36. # trap "exit" INT TERM
  37. trap cleanup_server EXIT
  38. fi
  39. fi
  40. # Wait until server is up. curl on the health of the server and sleep until its ready
  41. bash triton/scripts/wait_for_triton_server.sh $SERVER_HOSTNAME
  42. TIMESTAMP=$(date "+%y%m%d_%H%M")
  43. bash scripts/docker/launch.sh mkdir -p /results/perf_client/${MODEL_NAME}
  44. OUTPUT_FILE_CSV="/results/perf_client/${MODEL_NAME}/results_${TIMESTAMP}.csv"
  45. ARGS="\
  46. --max-threads ${MAX_CLIENT_THREADS} \
  47. -m ${MODEL_NAME} \
  48. -x ${MODEL_VERSION} \
  49. -p 200000 \
  50. -d \
  51. -v -z \
  52. -i gRPC \
  53. -u ${SERVER_HOSTNAME}:8001 \
  54. -b ${BATCH_SIZE} \
  55. -l ${MAX_LATENCY} \
  56. -c ${MAX_CONCURRENCY} \
  57. -f ${OUTPUT_FILE_CSV}"
  58. echo "Using args: $(echo "$ARGS" | sed -e 's/ -/\n-/g')"
  59. bash scripts/docker/launch.sh /workspace/install/bin/perf_client $ARGS