欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

测试显卡性能的两种方法

程序员文章站 2024-02-09 18:23:04
...

测试显卡性能的两种方法:

方法一:利用软件包unixbench-5.1.2

用unixbench-5.1.2,需要网上下载相关源码包,并提前需要修改Makefile:
GL_LIBS = -lGL -lXext -lX11 -lm //加上-lm选项

//用unixbench工具测试单3D功能–>ubgears

[email protected]:~/unixbench-5.1.2# ./Run ubgears

gcc -o ./pgms/ubgears -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall ./src/ubgears.c -lGL -lXext -lX11 -lm
make all
make[1]: Entering directory '/root/unixbench-5.1.2'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/root/unixbench-5.1.2'
sh: 1: 3dinfo: not found
   Version 5.1.2                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   December 22, 2007                  johantheghost at yahoo period com

Wide character in print at ./Run line 1510.
Wide character in printf at ./Run line 1541.

1 x 3D graphics: gears  1 2 3
Wide character in printf at ./Run line 1483.
Wide character in printf at ./Run line 1483.

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.2)

   System: kylin-FT-2000-4: GNU/Linux
   OS: GNU/Linux -- 4.4.131-20200710.kylin.desktop-generic -- #kylin SMP Fri Jul 10 13:46:24 CST 2020
   Machine: aarch64 (aarch64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 1: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 2: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 3: Phytium,FT-2000/4 (3456.0 bogomips)
          
   00:32:09 up 4 min,  2 users,  load average: 0.34, 0.30, 0.13; runlevel 5

------------------------------------------------------------------------
Benchmark Run:212 2016 00:32:09 - 00:33:34
4 CPUs in system; running 1 parallel copy of tests

3D graphics: gears                               60.0 fps   (20.0 s, 2 samples)

3D Graphics Benchmarks Index Values          BASELINE       RESULT    INDEX
3D graphics: gears                               33.4         60.0     18.0
                                                                   ========
3D Graphics Benchmarks Index Score                                     18.0

------------------------------------------------------------------------
Benchmark Run:212 2016 00:33:34 - 00:33:34
4 CPUs in system; running 4 parallel copies of tests

//被限制最大只能跑60,要去掉限制需要加vblank_mode=0参数,如下:
//正常加了vblank_mode=0这个参数,会直接返回,此时需要修改Run脚本让它不要退出
[email protected]:~/unixbench-5.1.2# vblank_mode=0 ./Run ubgears

make all
make[1]: Entering directory '/root/unixbench-5.1.2'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/root/unixbench-5.1.2'
sh: 1: 3dinfo: not found
   Version 5.1.2                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   December 22, 2007                  johantheghost at yahoo period com
Wide character in print at ./Run line 1510.
Wide character in printf at ./Run line 1541.

1 x 3D graphics: gears  1 2 3
Wide character in printf at ./Run line 1483.
Wide character in printf at ./Run line 1483.

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.2)

   System: kylin-FT-2000-4: GNU/Linux
   OS: GNU/Linux -- 4.4.131-20200710.kylin.desktop-generic -- #kylin SMP Fri Jul 10 13:46:24 CST 2020
   Machine: aarch64 (aarch64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 1: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 2: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 3: Phytium,FT-2000/4 (3456.0 bogomips)
          
   00:33:42 up 5 min,  2 users,  load average: 0.69, 0.45, 0.20; runlevel 5

------------------------------------------------------------------------
Benchmark Run:212 2016 00:33:42 - 00:35:06
4 CPUs in system; running 1 parallel copy of tests

3D graphics: gears                               60.0 fps   (20.0 s, 2 samples)

3D Graphics Benchmarks Index Values          BASELINE       RESULT    INDEX
3D graphics: gears                               33.4         60.0     18.0
                                                                   ========
3D Graphics Benchmarks Index Score                                     18.0

------------------------------------------------------------------------
Benchmark Run:212 2016 00:35:06 - 00:35:06
4 CPUs in system; running 4 parallel copies of tests

//这里是特殊情况,加了vblank_mode=0参数以后,没有退出且没有解除限制
//如果解除限制会执行一次就退出了,则修改Run脚本为: 将如下函数的exit删除掉

sub abortRun {
    my ( $err ) = @_;
    printf STDERR "\n**********************************************\n";
    printf STDERR "Run: %s; aborting\n", $err;
    exit(1);
}

//用unixbench工具测2D和3D一起的功能->graphics

[email protected]:~/unixbench-5.1.2# sudo vblank_mode=0 ./Run graphics

make all
make[1]: Entering directory '/root/unixbench-5.1.2'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/root/unixbench-5.1.2'
sh: 1: 3dinfo: not found
   Version 5.1.2                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   December 22, 2007                  johantheghost at yahoo period com

Wide character in print at ./Run line 1509.
Wide character in printf at ./Run line 1540.

1 x 2D graphics: rectangles  1 2 3

1 x 2D graphics: ellipses  1 2 3

1 x 2D graphics: aa polygons  1 2 3

1 x 2D graphics: text  1 2 3

1 x 2D graphics: images and blits  1 2 3

1 x 2D graphics: windows  1 2 3

1 x 3D graphics: gears  1 2 3
Wide character in printf at ./Run line 1482.
Wide character in printf at ./Run line 1482.

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.2)

   System: kylin-FT-2000-4: GNU/Linux
   OS: GNU/Linux -- 4.4.131-20200710.kylin.desktop-generic -- #kylin SMP Fri Jul 10 13:46:24 CST 2020
   Machine: aarch64 (aarch64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 1: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 2: Phytium,FT-2000/4 (3456.0 bogomips)
          
   CPU 3: Phytium,FT-2000/4 (3456.0 bogomips)
          
   16:46:32 up 32 min,  2 users,  load average: 0.04, 0.19, 0.44; runlevel 5

------------------------------------------------------------------------
Benchmark Run:824 2021 16:46:32 - 17:03:38
4 CPUs in system; running 1 parallel copy of tests

2D graphics: aa polygons                       3847.1 score (46.5 s, 2 samples)
2D graphics: ellipses                           326.4 score (47.3 s, 2 samples)
2D graphics: images and blits                 85107.3 score (49.1 s, 2 samples)
2D graphics: rectangles                        4465.9 score (44.6 s, 2 samples)
2D graphics: text                             57630.3 score (53.4 s, 2 samples)
2D graphics: windows                            173.2 score (53.6 s, 2 samples)
3D graphics: gears                               60.0 fps   (20.0 s, 2 samples)

2D Graphics Benchmarks Index Values          BASELINE       RESULT    INDEX
2D graphics: aa polygons                         15.0       3847.1   2564.7
2D graphics: ellipses                            15.0        326.4    217.6
2D graphics: images and blits                    15.0      85107.3  56738.2
2D graphics: rectangles                          15.0       4465.9   2977.3
2D graphics: text                                15.0      57630.3  38420.2
2D graphics: windows                             15.0        173.2    115.5
                                                                   ========
2D Graphics Benchmarks Index Score                                   2734.8

3D Graphics Benchmarks Index Values          BASELINE       RESULT    INDEX
3D graphics: gears                               33.4         60.0     18.0
                                                                   ========
3D Graphics Benchmarks Index Score                                     18.0

------------------------------------------------------------------------
Benchmark Run:824 2021 17:03:38 - 17:03:38
4 CPUs in system; running 4 parallel copies of tests

//用在线下载的包:glxgears测单纯的3D功能
[email protected]:~/unixbench-5.1.2# apt install mesa-utils
[email protected]:~/unixbench-5.1.2# vblank_mode=0 glxgears
307 frames in 5.0 seconds = 61.249 FPS
301 frames in 5.0 seconds = 60.053 FPS
301 frames in 5.0 seconds = 60.046 FPS
301 frames in 5.0 seconds = 60.040 FPS
301 frames in 5.0 seconds = 60.037 FPS
301 frames in 5.0 seconds = 60.034 FPS
301 frames in 5.0 seconds = 60.032 FPS

方法二:利用apt-get在线安装的功能

//glmark2测3D和2D功能一起的功能

[email protected]:~/unixbench-5.1.2# apt install glmark2
[email protected]:~/unixbench-5.1.2# glmark2

glmark2 2014.03+git20150611.fa71af2d
    OpenGL Information
    GL_VENDOR:     Shanghai Zhaoxin Semiconductor Co. Ltd
    GL_RENDERER:   GRay
    GL_VERSION:    4.5 23.00.20
[build] use-vbo=false: FPS: 1112 FrameTime: 0.899 ms
[build] use-vbo=true: FPS: 4602 FrameTime: 0.217 ms
[texture] texture-filter=nearest: FPS: 4404 FrameTime: 0.227 ms
[texture] texture-filter=linear: FPS: 4328 FrameTime: 0.231 ms
[texture] texture-filter=mipmap: FPS: 4377 FrameTime: 0.228 ms
[shading] shading=gouraud: FPS: 4070 FrameTime: 0.246 ms
[shading] shading=blinn-phong-inf: FPS: 3868 FrameTime: 0.259 ms
[shading] shading=phong: FPS: 3879 FrameTime: 0.258 ms
[shading] shading=cel: FPS: 3797 FrameTime: 0.263 ms
[bump] bump-render=high-poly: FPS: 3152 FrameTime: 0.317 ms
[bump] bump-render=normals: FPS: 3755 FrameTime: 0.266 ms
[bump] bump-render=height: FPS: 3916 FrameTime: 0.255 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 3468 FrameTime: 0.288 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 3188 FrameTime: 0.314 ms
[pulsar] light=false:quads=5:texture=false: FPS: 2920 FrameTime: 0.342 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 1628 FrameTime: 0.614 ms
[desktop] effect=shadow:windows=4: FPS: 1428 FrameTime: 0.700 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 346 FrameTime: 2.890 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 290 FrameTime: 3.448 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 407 FrameTime: 2.457 ms
[ideas] speed=duration: FPS: 657 FrameTime: 1.522 ms
[jellyfish] <default>: FPS: 2083 FrameTime: 0.480 ms
[terrain] <default>: FPS: 197 FrameTime: 5.076 ms
[shadow] <default>: FPS: 2829 FrameTime: 0.353 ms
[refract] <default>: FPS: 690 FrameTime: 1.449 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 3911 FrameTime: 0.256 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 3905 FrameTime: 0.256 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 3873 FrameTime: 0.258 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 3841 FrameTime: 0.260 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 3873 FrameTime: 0.258 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 3829 FrameTime: 0.261 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 3865 FrameTime: 0.259 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 3958 FrameTime: 0.253 ms
glmark2 Score: 2922 
相关标签: GPU linux gpu