Skip to content

Commit

Permalink
Add system shared memory test support for jetson (triton-inference-se…
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderHam authored Feb 5, 2021
1 parent ca2bef3 commit d003332
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 7 additions & 6 deletions qa/L0_shared_memory/shared_memory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import unittest
import os
import test_util as tu
import tritongrpcclient as grpcclient
import tritonhttpclient as httpclient
import tritonshmutils.shared_memory as shm
from tritonclientutils import *
import tritonclient.grpc as grpcclient
import tritonclient.http as httpclient
import tritonclient.utils.shared_memory as shm
from tritonclient import utils


class SharedMemoryTest(tu.TestResultCollector):
Expand Down Expand Up @@ -207,11 +207,12 @@ def _basic_inference(self,
else:
output_datatype = output.datatype
output_shape = output.shape
output_dtype = triton_to_np_dtype(output_datatype)
output_dtype = utils.triton_to_np_dtype(output_datatype)
output_data = shm.get_contents_as_numpy(shm_op0_handle,
output_dtype, output_shape)
self.assertTrue(
(output_data[0] == (input0_data + input1_data)).all())
(output_data[0] == (input0_data + input1_data)).all(),
"Model output does not match expected output")
except Exception as ex:
error_msg.append(str(ex))

Expand Down
10 changes: 7 additions & 3 deletions qa/L0_shared_memory/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -28,7 +28,11 @@
CLIENT_LOG="./client.log"
SHM_TEST=shared_memory_test.py

SERVER=/opt/tritonserver/bin/tritonserver
# Configure to support test on jetson as well
OPTDIR=${OPTDIR:="/opt"}
SERVER=${OPTDIR}/tritonserver/bin/tritonserver
BACKEND_DIR=${OPTDIR}/tritonserver/backends
SERVER_ARGS_EXTRA="--backend-directory=${BACKEND_DIR}"
source ../common/util.sh

RET=0
Expand All @@ -46,7 +50,7 @@ for i in \
test_mixed_raw_shm \
test_unregisterall; do
for client_type in http grpc; do
SERVER_ARGS="--model-repository=`pwd`/models --log-verbose=1"
SERVER_ARGS="--model-repository=`pwd`/models --log-verbose=1 ${SERVER_ARGS_EXTRA}"
SERVER_LOG="./$i.$client_type.serverlog"
run_server
if [ "$SERVER_PID" == "0" ]; then
Expand Down

0 comments on commit d003332

Please sign in to comment.