A Script for Performance Test with Intel® Media SDK Samples

ID 671646
Updated 11/5/2017
Version Latest
Public

author-image

By

1. Introduce the Script

When Intel® Media SDK run on difference platform, performance test usually needed when do the evaluation. Intel Media SDK sample is very good tools to do the performance, it supports media classic pipeline: decode, VPP, and encode, also has useful information to calculate the performance like running time, frame number etc. When do performance test, we also need to need the resources usage, including CPU, memory, GPU usage etc. So auto run script is better to handle this. Followings will introduce this such scripts.

2. Download the Script from GitHub*

$ git clone https://github.com/zchrzhou/mdk-perf-script.git

highly recommend to read : mdk-perf-script

3. Features of Intel® Media SDK Performance Script

  • Perl script, easy extend, auto collect performance data (FPS/GPU/CPU/MEM usage).
  • Batch run many test cases in order.
  • Loop run test cases for stress test.
  • Support Intel Media SDK sample_decode, sample_encode, sample_vpp, sample_multi_transcode
  • Multi-OS support, support both Windows* and Linux*.

4. How to Use this Tool

$ ./run.sh or ./main.pl
Welcome to Intel MediaSDK sample multiable process test tool.
Enjoy and good luck.
Performance test with Intel MSDK sample
Use example:
    main.pl [--test <item-1> --test <item-n>] [--all] [--loop n] [--start n1 --end n2]
    main.pl [--test A01 --test B1 --test C1] [--loop 2]
    main.pl [--start 1 --end 10] [--loop 2]
    main.pl [--test A01] [--loop -1]

    --loop:         loop run (-1 will run forever)
    --start|--end:  run with the range from --start to --end
                    refer to lib/config.pl -> %conf{"range_template"}
    --all:          for all test items in lib/config.pl -> %test_map
    --test:         test item, refter to lib/config.pl -> %test_map

    --input-dir:    set input file folder
    --output-dir:   set output file folder
    --sample-dir:   set sample binary folder

    --with-output:  save output of transcode
    --with-par:     only for transcode test
    --with-gpu:     only for linux
    --with-cpu-mem  only for linux

5. Configure Your Test Cases

please modify config.pm to custom your tests.

$ vim lib/config.pm
### Test Map
##Transcode: ITEM => [channel-num, test-type, input-codec, input-file, output-codex, output-ext, head-args, tail-args]
##Decode:    ITEM => [channel-num, test-type, input-param, input-file, output-param, output-ext, head-args, tail-args]
##Encode:    ITEM => [channel-num, test-type, input-param, input-file, output-param, output-ext, head-args, tail-args]
##VPP:       ITEM => [channel-num, test-type, input-param, input-file, output-param, output-ext, head-args, tail-args]
our %test_map = (
    "A01" => [1,  "transcode",  "-i::h264", "1080p.h264", "-o::h264", "h264", "", "-hw -w 1920 -h 1080 -u 7 -b 6000"],
    "A02" => [2,  "transcode",  "-i::h264", "1080p.h264", "-o::h264", "h264", "", "-hw -w 1920 -h 1080 -u 7 -b 6000"],

    "B1"  => [5,  "transcode",  "-i::h264", "1080p.h264", "-o::h264", "h264", "", "-hw -w 1280 -h 720 -u 7 -b 2048"],
    "C5"  => [4,  "transcode",  "-i::mpeg2", "1080p.m2t", "-o::h264", "h264", "", "-hw -w 176  -h 144  -u 7 -b 80"  ],

    "D2"  => [6,  "decode", "-i", "JOY_1080.h264", "-o", "yuv",  "h264", "-hw" ],
    "D3"  => [2,  "decode", "-i", "JOY_1080.h264", "-r", "",     "h264", "-hw" ],

    "E2"  => [6,  "encode", "-i", "JOY_1080.yuv", "-o", "h264", "h264", "-hw -w 1920  -h 1080" ],

    "F1"  => [2,  "vpp", "-i", "JOY_1080.yuv", "-o", "yuv", "-lib hw", "-scc nv12 -dcc nv12 -sw 1920  -sh 1080 -dw 1280  -dh 720 -n 5" ],

    "V0"  => [16, "transcode",  "-i::h264", "1080p.h264", "-o::h264", "h264", "", "-hw -w 1920 -h 1080 -u 7 -b 15000"],
    "V1"  => [16, "transcode",  "-i::h264", "1080p.h264", "-o::h264", "h264", "", "-hw -w 1920 -h 1080 -u 7 -b 15000"],
    "V2"  => [16, "transcode",  "-i::h264", "1080p.h264", "-o::h264", "h264", "", "-hw -w 1920 -h 1080 -u 7 -b 15000"],
);

6. A Demo of this Script

$ ./run.sh --test A02 --with-fps --with-cpu-mem --with-par --with-gpu
Welcome to Intel MediaSDK sample multiable process test tool.
Enjoy and good luck.
mkdir -p input
mkdir -p output/A02
rm -rf   output/A02/*
rm -f input/1080p.h264
cp -f /home/zhoujd/perf-script/stream/1080p.h264 input/1080p.h264
Start top by child process
Test --with-par is used
Start top by child process
/home/zhoujd/perf-script/binary/sample_multi_transcode  -par output/A02/multi-channel.par > output/A02/A02-with-par.log
libva info: VA-API version 0.99.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
[sudo] password for zhoujd:
top process num: zhoujd   18207 18200  0 22:20 pts/5    00:00:00 /bin/bash /home/zhoujd/perf-script/tools/cpu_mem/top.sh 1 sample_m

gpu process num: zhoujd   18208 18200  0 22:20 pts/5    00:00:00 /bin/bash /home/zhoujd/perf-script/tools/gpu/metrics_monitor.sh

0-time: 4.21 sec
0-frames: 500
0-fps: 118.69
1-time: 4.21 sec
1-frames: 500
1-fps: 118.75
AVG FPS: 118.72
Num Stream: 2
CPU: 13.1 %
MEM: 46.86 MB
GPU: 58.00% 95.75% 0.00%
mv /home/zhoujd/perf-script/tools/cpu_mem/cpu_mem.txt output/A02
mv /home/zhoujd/perf-script/tools/gpu/gpu.log output/A02
Wait 2s ...
run finished