提交 3e3ae398 编写于 作者: H HexToString

add batch_size

上级 7cf4a296
...@@ -56,9 +56,13 @@ def single_func(idx, resource): ...@@ -56,9 +56,13 @@ def single_func(idx, resource):
]) ])
image_file = "daisy.jpg" image_file = "daisy.jpg"
img = seq(image_file) img = seq(image_file)
feed_data = np.array(img)
feed_data = np.expand_dims(feed_data, 0).repeat(
args.batch_size, axis=0)
result = client.predict( result = client.predict(
feed={"image": img}, feed={"image": feed_data},
fetch=["save_infer_model/scale_0.tmp_0"]) fetch=["save_infer_model/scale_0.tmp_0"],
batch=True)
l_end = time.time() l_end = time.time()
if latency_flags: if latency_flags:
latency_list.append(l_end * 1000 - l_start * 1000) latency_list.append(l_end * 1000 - l_start * 1000)
......
...@@ -20,7 +20,7 @@ python3.6 benchmark.py --thread 1 --batch_size 1 --model $2/serving_client_conf. ...@@ -20,7 +20,7 @@ python3.6 benchmark.py --thread 1 --batch_size 1 --model $2/serving_client_conf.
echo -e "import psutil\nimport time\nwhile True:\n\tcpu_res = psutil.cpu_percent()\n\twith open('cpu.txt', 'a+') as f:\n\t\tf.write(f'{cpu_res}\\\n')\n\ttime.sleep(0.1)" > cpu.py echo -e "import psutil\nimport time\nwhile True:\n\tcpu_res = psutil.cpu_percent()\n\twith open('cpu.txt', 'a+') as f:\n\t\tf.write(f'{cpu_res}\\\n')\n\ttime.sleep(0.1)" > cpu.py
for thread_num in 1 2 4 8 for thread_num in 1 2 4 8
do do
for batch_size in 1 for batch_size in 1 4 8 16 32 64
do do
job_bt=`date '+%Y%m%d%H%M%S'` job_bt=`date '+%Y%m%d%H%M%S'`
nvidia-smi --id=$gpu_id --query-compute-apps=used_memory --format=csv -lms 100 > gpu_memory_use.log 2>&1 & nvidia-smi --id=$gpu_id --query-compute-apps=used_memory --format=csv -lms 100 > gpu_memory_use.log 2>&1 &
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册