Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

100% gpu&cpu usage on ~3 HD streams

rshal2
New Contributor II
927 Views

Hello,

I am trying to evaluate gpu usage on live video with multiple streams (6 HD 1920x1080).

I suuccessfuly done that, but saw that gpu and cpu usage is 100%, so I started a step backwords, and checked media sdk with multiple files (instead of live video), but even than I get 100% gpu and cpu usage.

I used script which runs encode_sample_drm 5 times, each time on different input file and got 100% cpu usage, and 100% gpu usage:

I try to encode 6 streams of yv12 file,  640x480 using sample_encode, and check the gpu usage with metrics monitor, and cpu usage with simple top command from shell:

gpu usage:

RENDER usage: 100.00,    VIDEO usage: 100.00,    VIDEO_E usage: 0.00    VIDEO2 usage: 100.00

cpu usage 100 %

This is the script I am using

sample_encode_drm h264 -i ${SAMPLES_FOLDER}/colorbar_yv12_640_480_1.yuv  -o output1.h264 -w 640 -h 480 -b 10000 -f 30 -u speed   -d3d -hw  -async 4 &
sample_encode_drm h264 -i ${SAMPLES_FOLDER}/colorbar_yv12_640_480_2.yuv -o output2.h264 -w 640 -h 480 -b 10000 -f 30 -u speed   -d3d -hw -async 4 &
sample_encode_drm h264 -i ${SAMPLES_FOLDER}/colorbar_yv12_640_480_3.yuv -o output3.h264 -w 640 -h 480 -b 10000 -f 30 -u speed   -d3d -hw  -async 4 &
sample_encode_drm h264 -i ${SAMPLES_FOLDER}/colorbar_yv12_640_480_4.yuv -o output4.h264 -w 640 -h 480 -b 10000 -f 30 -u speed   -d3d -hw  -async 4 &
sample_encode_drm h264 -i ${SAMPLES_FOLDER}/colorbar_yv12_640_480_5.yuv -o output5.h264 -w 640 -h 480 -b 10000 -f 30 -u speed   -d3d -hw  -async 4 &
sample_encode_drm h264 -i ${SAMPLES_FOLDER}/colorbar_yv12_640_480_6.yuv -o output6.h264 -w 640 -h 480 -b 10000 -f 30 -u speed   -d3d -hw  -async 4 &

I also not sure if running sample_encode application multiple times will use the resources effectively. I tried to change async parameter, but it didn't help.

Best Regards,

Ran

0 Kudos
11 Replies
Jiandong_Z_Intel
Employee
927 Views

Hi Ran,

Do you use top to measure CPU usage ?

Can you send following command line for understand your system information ?

$ uname -r

$ cat /proc/cpuinfo | grep -i intel

$ lspci -nn | grep -i vga

$ cat vainfo

 

Thanks,

Zachary

0 Kudos
rshal2
New Contributor II
927 Views

Hi Zachari,

[user@localhost scripts]$  uname -r
3.10.0-229.1.2.39163.MSSr4.el7.centos.x86_64
[user@localhost scripts]$  cat /proc/cpuinfo | grep -i intel
vendor_id    : GenuineIntel
model name    : Intel(R) Core(TM) i7-5650U CPU @ 2.20GHz
vendor_id    : GenuineIntel
model name    : Intel(R) Core(TM) i7-5650U CPU @ 2.20GHz
vendor_id    : GenuineIntel
model name    : Intel(R) Core(TM) i7-5650U CPU @ 2.20GHz
vendor_id    : GenuineIntel
model name    : Intel(R) Core(TM) i7-5650U CPU @ 2.20GHz
[user@localhost scripts]$  lspci -nn | grep -i vga
00:02.0 VGA compatible controller [0300]: Intel Corporation Broadwell-U Integrated Graphics [8086:1626] (rev 09)
[user@localhost scripts]$  cat vainfo
cat: vainfo: No such file or directory

I am not sure about the above error "no such file or directory", because on starting sample encode I do see libva info as following:

libva info: VA-API version 0.35.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
Encoding Sample Version 0.0.000.0000

Input file format    YUV420
Output video        AVC
Source picture:
    Resolution    640x480
    Crop X,Y,W,H    0,0,640,480
Destination picture:
    Resolution    640x480
    Crop X,Y,W,H    0,0,640,480
Frame rate    30.00
Bit rate(Kbps)    10000
Target usage    speed
Memory type    system
Media SDK impl        hw
Media SDK version    1.16

cpu 100% usage using top, I can see with the simplest running of sample encode (one time):

sample_encode_drm h264 -i ../../../samples/colorbar_yv12_640_480_1.yuv  -o output1.h264 -w 640 -h 480 -b 10000 -f 30 -u speed   -d3d -hw

top result:

top - 08:41:01 up 24 min,  4 users,  load average: 1.11, 0.99, 0.60
Tasks: 209 total,   2 running, 205 sleeping,   2 stopped,   0 zombie
%Cpu(s): 11.3 us, 15.9 sy,  0.0 ni, 72.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 16166096 total,  8463672 free,  2191864 used,  5510560 buff/cache
KiB Swap:  8191996 total,  8191996 free,        0 used. 13441164 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 7386 user      20   0  272544  24504  10940 R 100.3  0.2   1:29.97 sample_enc+
 5928 user      20   0 1330100 460700  55076 S   2.7  2.8   0:48.45 firefox
 1694 root      20   0  345620  63116  42124 S   1.0  0.4   0:11.71 Xorg
 3520 user      20   0 1911732 115516  37036 S   1.0  0.7   0:16.72 gnome-shell
 3943 user      20   0  551988  22172  12408 S   1.0  0.1   0:07.69 gnome-term+
 7580 user      20   0  146152   2052   1416 R   0.7  0.0   0:00.03 top
   13 root      20   0       0      0      0 S   0.3  0.0   0:00.33 rcu_sched
 3428 user      20   0   37340   2236   1400 S   0.3  0.0   0:01.09 dbus-daemon
 3567 user      20   0  576292   8156   5172 S   0.3  0.1   0:02.22 caribou
    1 root      20   0  192112   7424   2616 S   0.0  0.0   0:01.90 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/0
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:+
    7 root      rt   0       0      0      0 S   0.0  0.0   0:00.02 migration/0
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh
    9 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/0
   10 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/1
   11 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/2
   12 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuob/3
   14 root      20   0       0      0      0 S   0.0  0.0   0:00.13 rcuos/0
   15 root      20   0       0      0      0 S   0.0  0.0   0:00.15 rcuos/1
   16 root      20   0       0      0      0 S   0.0  0.0   0:00.12 rcuos/2
   17 root      20   0       0      0      0 S   0.0  0.0   0:00.10 rcuos/3
   18 root      rt   0       0      0      0 S   0.0  0.0   0:00.00 watchdog/0
   19 root      rt   0       0      0      0 S   0.0  0.0   0:00.00 watchdog/1
   20 root      rt   0       0      0      0 S   0.0  0.0   0:00.02 migration/1
   21 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/1
   23 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/1:+
   24 root      rt   0       0      0      0 S   0.0  0.0   0:00.00 watchdog/2
   25 root      rt   0       0      0      0 S   0.0  0.0   0:00.01 migration/2
   26 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/2
   28 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/2:+
   29 root      rt   0       0      0      0 S   0.0  0.0   0:00.00 watchdog/3
   30 root      rt   0       0      0      0 S   0.0  0.0   0:00.01 migration/3
   31 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/3
   33 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/3:+
   34 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 khelper
   35 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kdevtmpfs
   36 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 netns
   37 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 writeback
   38 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kintegrityd
   39 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset
   40 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kblockd
   41 root      20   0       0      0      0 S   0.0  0.0   0:00.00 khubd
   42 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 md
   43 root      20   0       0      0      0 S   0.0  0.0   0:00.10 kworker/0:1
   45 root      20   0       0      0      0 S   0.0  0.0   0:00.00 khungtaskd
   46 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kswapd0
   47 root      25   5       0      0      0 S   0.0  0.0   0:00.00 ksmd
   48 root      39  19       0      0      0 S   0.0  0.0   0:00.16 khugepaged
   49 root      20   0       0      0      0 S   0.0  0.0   0:00.01 fsnotify_m+
   50 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 crypto
   59 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kthrotld
   62 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kmpath_rda+
   64 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kpsmoused
   65 root      20   0       0      0      0 S   0.0  0.0   0:00.08 kworker/2:2
   84 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 deferwq
  118 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kauditd
  297 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 ata_sff
  306 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_0
  307 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_0
  308 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_1
  309 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_1
  310 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_2
  311 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_2
  312 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_3
  313 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_3
  314 root      20   0       0      0      0 S   0.0  0.0   0:00.15 kworker/u8+
  335 root       0 -20       0      0      0 S   0.0  0.0   0:00.04 kworker/2:+
  336 root       0 -20       0      0      0 S   0.0  0.0   0:00.32 kworker/0:+
  337 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/1:+
  397 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kdmflush
  398 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset
  409 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kdmflush
  410 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset
  413 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/3:+
  424 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfsalloc
  425 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs_mru_ca+
  426 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-buf/dm+
  427 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-data/d+
  428 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-conv/d+
  429 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-cil/dm+
  430 root      20   0       0      0      0 S   0.0  0.0   0:00.20 xfsaild/dm+
  512 root      20   0   36928   5344   4976 S   0.0  0.0   0:00.22 systemd-jo+
  534 root      20   0  129476   4628   1336 S   0.0  0.0   0:00.01 lvmetad
  547 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 rpciod
  550 root      20   0   44456   3228   1464 S   0.0  0.0   0:00.71 systemd-ud+
  680 root     -51   0       0      0      0 S   0.0  0.0   0:00.01 irq/62-mei+
  775 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 hd-audio0
  776 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kvm-irqfd-+
  779 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 hd-audio1
  784 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-buf/sd+
  785 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-data/s+
  786 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-conv/s+
  787 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-cil/sd+
  788 root      20   0       0      0      0 S   0.0  0.0   0:00.00 xfsaild/sd+
  794 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kdmflush
  795 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset
  802 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-buf/dm+
  803 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-data/d+
  804 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-conv/d+
  805 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 xfs-cil/dm+
  807 root      20   0       0      0      0 S   0.0  0.0   0:00.19 xfsaild/dm+
  839 root      16  -4   51216   1772   1320 S   0.0  0.0   0:00.02 auditd
  842 root      12  -8   80220    724    704 S   0.0  0.0   0:00.01 audispd
  844 root      16  -4   26200    932    732 S   0.0  0.0   0:00.00 sedispatch
  863 root      39  19   16876   1492   1172 S   0.0  0.0   0:00.00 alsactl
  864 root      20   0  336356   4892   3728 S   0.0  0.0   0:00.00 ModemManag+
  865 avahi     20   0   30192   1548   1284 S   0.0  0.0   0:00.01 avahi-daem+
  868 root      20   0  219752   4208   2848 S   0.0  0.0   0:00.09 rsyslogd
  871 root      20   0  210456   5436   3664 S   0.0  0.0   0:00.00 abrtd
  876 root      20   0  207968   4516   3160 S   0.0  0.0   0:00.01 abrt-watch+
  877 libstor+  20   0    8528    816    668 S   0.0  0.0   0:00.03 lsmd
  878 root      20   0  203352   1244    784 S   0.0  0.0   0:00.00 gssproxy
  879 dbus      20   0   38656   3372   1456 S   0.0  0.0   0:00.66 dbus-daemon
  880 avahi     20   0   30068    244      0 S   0.0  0.0   0:00.00 avahi-daem+
  900 root      20   0  323568  23308   6340 S   0.0  0.1   0:00.36 firewalld
  901 root      20   0    4372    592    496 S   0.0  0.0   0:00.15 rngd
  902 root      20   0  382636   3788   2956 S   0.0  0.0   0:00.08 accounts-d+
  903 root      20   0   26532   2356   1704 S   0.0  0.0   0:00.02 smartd
  904 root      20   0   19176   1168    952 S   0.0  0.0   0:00.06 irqbalance
  916 rtkit     21   1  164652   1276   1068 S   0.0  0.0   0:00.02 rtkit-daem+
  918 root      20   0   26472   1764   1436 S   0.0  0.0   0:00.05 systemd-lo+
  919 root      20   0  207968   4516   3156 S   0.0  0.0   0:00.01 abrt-watch+
  928 polkitd   20   0  527596  15476   4928 S   0.0  0.1   0:01.84 polkitd
  933 root      20   0  115244    960    708 S   0.0  0.0   0:00.01 ksmtuned
 1024 root      20   0  514716  10316   6360 S   0.0  0.1   0:00.37 NetworkMan+
 1051 root      20   0   53056   2704   2116 S   0.0  0.0   0:00.00 wpa_suppli+
 1565 root      20   0  110512  15792   3340 S   0.0  0.1   0:00.00 dhclient
 1613 root      20   0  553076  18408   5732 S   0.0  0.1   0:00.25 tuned
 1614 root      20   0  191116   4028   2916 S   0.0  0.0   0:00.01 cupsd
 1617 root      20   0   82548   3580   2728 S   0.0  0.0   0:00.00 sshd
 1621 root      20   0  560856  20592  10448 S   0.0  0.1   0:00.19 libvirtd
 1643 root      20   0  546960   6640   3528 S   0.0  0.0   0:00.02 gdm
 1647 root      20   0  126328   1704   1060 S   0.0  0.0   0:00.61 crond
 1648 root      20   0   25960    968    768 S   0.0  0.0   0:00.00 atd
 2876 nobody    20   0   15548    852    660 S   0.0  0.0   0:00.00 dnsmasq
 2878 root      20   0   15520    176      0 S   0.0  0.0   0:00.00 dnsmasq
 2888 root      20   0   93212   2140   1120 S   0.0  0.0   0:00.02 master
 2915 postfix   20   0   93316   3904   2896 S   0.0  0.0   0:00.00 pickup
 2916 postfix   20   0   93384   3924   2916 S   0.0  0.0   0:00.00 qmgr
 2921 root      20   0  363580   6080   4664 S   0.0  0.0   0:00.04 upowerd
 2960 colord    20   0  404280   6024   4428 S   0.0  0.0   0:00.06 colord
 2965 root      20   0  186876   1488   1080 S   0.0  0.0   0:00.29 pcscd
 3031 root      20   0  405516   5900   4432 S   0.0  0.0   0:00.11 packagekitd
 3075 root      20   0  370988   5112   3696 S   0.0  0.0   0:00.15 udisksd
 3179 root      20   0  370708   5332   3928 S   0.0  0.0   0:00.10 gdm-sessio+
 3202 user      20   0  389884   3772   2972 S   0.0  0.0   0:00.01 gnome-keyr+
 3242 user      20   0  649104   7744   5740 S   0.0  0.0   0:00.10 gnome-sess+
 3249 user      20   0   13948    620    472 S   0.0  0.0   0:00.00 dbus-launch
 3250 user      20   0   38404   2276    924 S   0.0  0.0   0:00.37 dbus-daemon
 3315 user      20   0  306568   3540   2868 S   0.0  0.0   0:00.01 gvfsd
 3319 user      20   0  361136   5376   2668 S   0.0  0.0   0:00.00 gvfsd-fuse
 3396 user      20   0   52852    572      0 S   0.0  0.0   0:00.00 ssh-agent
 3424 user      20   0  340052   5360   2756 S   0.0  0.0   0:00.00 at-spi-bus+
 3432 user      20   0  129676   3488   2848 S   0.0  0.0   0:00.38 at-spi2-re+
 3450 user      20   0 1373740  26580  16408 S   0.0  0.2   0:00.73 gnome-sett+
 3459 user       9 -11  633912   7568   4296 S   0.0  0.0   0:00.22 pulseaudio
 3482 user      20   0  516700   7908   4332 S   0.0  0.0   0:00.00 gsd-printer
 3509 root      20   0   39448   2264   1892 S   0.0  0.0   0:00.00 bluetoothd
 3540 user      20   0  469964   5632   3524 S   0.0  0.0   0:00.05 ibus-daemon
 3545 user      20   0  392868   3884   3180 S   0.0  0.0   0:00.00 ibus-dconf
 3547 user      20   0  452168   8204   6272 S   0.0  0.1   0:00.01 ibus-x11
 3553 user      20   0  951964  25688  18924 S   0.0  0.2   0:00.15 gnome-shel+
 3559 user      20   0  961064  27576  20572 S   0.0  0.2   0:00.17 evolution-+
 3565 user      20   0  322060   7492   5880 S   0.0  0.0   0:00.07 mission-co+
 3571 user      20   0  713384  18152  13824 S   0.0  0.1   0:00.01 goa-daemon
 3582 user      20   0  334432   8104   4576 S   0.0  0.1   0:00.04 goa-identi+
 3587 user      20   0  180792   2724   2180 S   0.0  0.0   0:00.00 dconf-serv+
 3596 user      20   0  400584   5020   3788 S   0.0  0.0   0:00.03 gvfs-udisk+
 3607 user      20   0  321588   3808   2964 S   0.0  0.0   0:00.00 gvfs-gphot+
 3613 user      20   0  312512   3300   2644 S   0.0  0.0   0:00.00 gvfs-mtp-v+
 3620 user      20   0  299732   5228   2632 S   0.0  0.0   0:00.00 gvfs-goa-v+
 3626 user      20   0  421764   5152   3936 S   0.0  0.0   0:00.00 gvfs-afc-v+
 3661 user      20   0 1100392  27272  16680 S   0.0  0.2   0:00.26 nautilus
 3690 user      20   0  451400  14688   9732 S   0.0  0.1   0:00.08 abrt-applet
 3693 user      39  19  637480  12504   8044 S   0.0  0.1   0:00.32 tracker-mi+
 3694 user      39  19  469720   9096   6568 S   0.0  0.1   0:00.01 tracker-mi+
 3695 user      39  19  469984  11988   7068 S   0.0  0.1   0:00.03 tracker-mi+
 3696 user      20   0 1080696  31732  22416 S   0.0  0.2   0:00.20 evolution-+
 3698 user      39  19  972684  23528  10176 S   0.0  0.1   0:00.25 tracker-ex+
 3701 user      20   0  671836  16140   9540 S   0.0  0.1   0:00.10 gnome-soft+
 3704 user      20   0  536832  13144   6180 S   0.0  0.1   0:00.29 tracker-st+
 3705 user      20   0  300612   8704   6480 S   0.0  0.1   0:00.01 seapplet
 3735 user      20   0  149836   2492   1984 S   0.0  0.0   0:00.00 gconfd-2
 3804 user      20   0  471452   4164   3308 S   0.0  0.0   0:00.00 gvfsd-trash
 3834 user      20   0 1503216  61628  21168 S   0.0  0.4   0:00.30 evolution-+
 3838 user      20   0  319196   3748   3068 S   0.0  0.0   0:00.00 ibus-engin+
 3897 user      20   0  380300   5472   2780 S   0.0  0.0   0:00.00 gvfsd-burn
 3928 user      20   0  238764   3288   2636 S   0.0  0.0   0:00.00 gvfsd-meta+
 3946 user      20   0    8484    736    608 S   0.0  0.0   0:00.00 gnome-pty-+
 3947 user      20   0  116820   3684   1800 S   0.0  0.0   0:00.14 bash
 4127 user      20   0  116820   3684   1796 S   0.0  0.0   0:00.24 bash
 4538 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/1:0
 4539 user      20   0 1230076 651556   1424 T   0.0  4.0   0:00.85 git
 4540 user      20   0  110248    996    828 T   0.0  0.0   0:00.00 less
 4887 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/3:1
 6010 user      20   0  385784  11368   7508 S   0.0  0.1   0:00.04 eclipse
 6012 user      20   0 4993756 529968  30536 S   0.0  3.3   0:58.95 java
 6033 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/1:2
 7095 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/2:1
 7110 user      20   0  116824   3648   1796 S   0.0  0.0   0:00.03 bash
 7163 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/3:0
 7180 root      20   0       0      0      0 S   0.0  0.0   0:00.01 kworker/1:1
 7201 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/u8+
 7238 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/0:2
 7293 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/3:2
 7428 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0
 7583 root      20   0  107892    620    532 S   0.0  0.0   0:00.00 sleep
[user@localhost modules]$

 

Regards,

Ran

 

 

0 Kudos
Jiandong_Z_Intel
Employee
927 Views

Hi Ran,

I am sorry "cat vainfo" is wrong command, actually I want test "vainfo". Anyway, I have got your UMD information.

How big is your input stream "colorbar_yv12_640_480_1.yuv" ? how many frames are included ?

can you test with sample_multi_transcode_drm ?  let me see if the same result happened.

 

Best Regards,

Zachary

 

0 Kudos
rshal2
New Contributor II
927 Views

Hi Zachari,

Thank for the suuggestions, 
I am rather more interested in encoding sample, becuase this is what we actually are doing in our requirement scenario.

The thing I don't understand is the reason for high cpu usage (100%)
and I am afraid it will not leave the cpu to do other job then encoding.

There is also high gpu usage (100%), but I suspect it is becuase the gpu always have frame to process,
with live video I see lower gpu usage.

this is psaudo code for the encoding sample

while() {
       get surface
       read frame
       encode frame
       sync operation
}

I suspect that there might be something above which acts in sort of "busy wait", which can explaing the 100% usage.

Regards,

Ran
 

0 Kudos
rshal2
New Contributor II
927 Views

Hello,

In continue to my last post on this issue, I've continue to investigate this issue with oprofiler,

I can see that it mainly on GetFreeTaskIndex, and LoadNextFrame.

Still not sure why it takes 100% cpu.

I wander if you also see same result on your platforms.

Screenshot from 2016-01-13 10-37-55_2.jpg

Regards,

Ran

0 Kudos
Jiandong_Z_Intel
Employee
927 Views

Hi Ran,

I can't reproduce this issue on my test.

CPU is not reach to 100%, GPU will reach 100%, because GPU is busy when do the encode.

"LoadNextFrame" for encode is read frame from file. can you check if read or open input file take more CPU time ?

 

Thanks,

Zachary

0 Kudos
rshal2
New Contributor II
927 Views

Hi Zachary,

 

I also use read from file.

What is the cpu usage on your platform.

Sometimes on one encoding it is lower than 100% , but on doing more than one encode it always reach 100%.

What is the cpu usage in your system ?

Thanks,

Ran

0 Kudos
rshal2
New Contributor II
927 Views

Hi,

I would also add that use the samples as-is,

so I think the behaviour should be expected to be the same (in case of same HW of course)

Regards,

Ran

0 Kudos
Jeffrey_M_Intel1
Employee
927 Views

I'd just like to back up Zach's suggestion to start with sample_multi_transcode for performance evaluations.  The sample_multi_transcode approach is a quick way to model encode performance because it has less overhead from reading the raw file.  Completely understand that your use case scenario is encode only, but this is offered as a quick workaround to a known performance issue in sample_encode.

The encode sample was intended to show functionality, not necessarily to be used as a performance benchmark.  (Sample_multi_transcode is often your best benchmark option.)  For example, the default LoadNextFrame  contains a quick to code but inefficient chroma format conversion.  This is an encode sample limitation and doesn't reflect the performance of the underlying HW.

Going back to sample_multi_transcode, the guide that comes with it describes a source/sink format which may be of interest.  This allows multiple encodes to run from a single decode.  Understand it's not exactly the scenario you want but it's probably a closer approximation in terms of hardware load.

The par file could look something like this:

-i::h264 infile.h264 -o::sink
-i::source -b 2000 -o::h264 test0.h264
-i::source -b 4000 -o::h264 test1.h264

Please let us know if this is an acceptable (temporary) workaround, and if you see lower CPU utilization with this test.

Regards, Jeff

0 Kudos
rshal2
New Contributor II
927 Views

Hi Jeffrey, Zachary,

Thank you for your comments.

I think I did some progress with understand this issue.

sample_encode does its work in sort of busy wait loop. It's almost always busy. That's why I say the 100%.

though some interesting notes:

1. debug/release build behaves differently. debug is about 5-8% more busy (cpu usage). for example reading from file in release is about 20% cpu usage in debug bug 30% in release.

2. Reading from file is different from reading from device (read from device is not part of the samples of course). with file, there is always new frame and it wait for sync operation to complete, but with device there are many gaps which it will only wait for device. therefore if the frame is expected every msec it might be better to sleep msec between frames. As far as I understand, there will be no frame loss, and cpu usage will be mush less (less than reading from file).  This is not media sdk issue, but might be interest to others in this community

Thanks,

Ran

 

 

 

 

0 Kudos
Jiandong_Z_Intel
Employee
927 Views

Hi Ran,

Thank you for your notes.

Thanks

Zachary

0 Kudos
Reply