• CPU性能测试——CoreMark-pro篇


    本文目的:主要介绍CoreMark-pro的移植过程,本文将CoreMark-pro编译为riscv64架构的可执行程序,使用CoreMark-pro测试程序对Xilinx的VC707-u500devkit进行性能的测试,记录了CoreMarK-pro工具的使用以及对其测试结果进行分析
    测试环境:
    PC OS: Ubuntu20.04 LTS
    FPGA的CPU核: u500(ARCH=riscv64,ISA=rv64imafdc)
    Kernel: Linux4.15
    CoreMark: CoreMark-pro
    GNU: riscv64-unknown-linux-gnu

    1、CoreMark-pro简介

      CoreMark-pro是由EEMBC提供的一项全面的高级处理器基准测试,可与经市场验证的行业标准EEMBC-CoreMark基准一起使用并增强其功能。在CoreMark强调CPU管线的同时,CoreMark-Pro测试了整个处理器,增加了对多核技术,整数和浮点工作负载以及用于利用更大内存子系统的数据集的全面支持。EEMBC CoreMarkCoreMark-Pro共同提供了一个标准基准,涵盖了从低端微控制器到高性能计算处理器的范围。

    1.1、与CoreMark相比

      EEMBC CoreMark-Pro基准测试包含五个流行的整数工作负载和四个流行的浮点工作负载。整数工作负载包括JPEG压缩,ZIP压缩,XML解析器,SHA-256安全哈希算法以及原始CoreMark的内存密集型版本。浮点工作负载包括快速傅立叶变换(FFT),从LINPACK派生的线性代数例程,Livermore循环基准的大幅改进版本以及用于评估模式的神经网络算法。

      总之,CoreMark-Pro中的工作负载代表了各种性能特征,内存利用率和指令级并行性。该基准保证可以突出显示任何处理器的优点和缺点。

    2、获取源码

      EEMBC在将CoreMark-pro源码托管在GitHub上可以访问github.com/eembc/coremark-pro直接点击下载获得源码;也可以通过git命令下载到本地。

    imaginemiracle@:Download$ git clone https://github.com/eembc/coremark-pro.git
    imaginemiracle@:Download$ cd coremark-pro/
    imaginemiracle@:coremark-pro$ ls
    benchmarks  coremarkpro.md5  docs  LICENSE.md  Makefile  Makefile.mak  mith  README.md  util  workloads
    

    CoreMark-pro项目的详细介绍,可以查阅当前目录下“EEMBC Symmetric Multicore Benchmark User Guide 2.1.4.pdf”

    3、移植到riscv64架构

    imaginemiracle@:coremark-pro$ cd util/make
    imaginemiracle@:make$ ls
    armcs.mak   fakeio.mak    fdlibm.mak     gcc64.mak            gcc.mak  linux32-x86.mak  linux.mak       suite.mak
    common.mak  fdlibm64.mak  gcc32-x86.mak  gcc-cross-linux.mak  icc.mak  linux64.mak      run_target.ttl
    

    3.1、添加riscv64.mak

    linux64.mak文件拷贝一份重命名为riscv64.mak

    imaginemiracle@:make$ cp linux64.mak riscv64.mak
    imaginemiracle@:make$ vim riscv64.mak
    

      将PLATFORM修改为riscv64并修改TOOLCHAINgcc64-riscv(默认已经配置好riscv64-linux-gnu工具链,有很多优秀的博客介绍了riscv toolchain的编译安装过程可以自行查阅参考):

    #util/make/riscv64.mak文件
    
    # File: util/make/riscv64.mak                                                                                                                         
    # Optional specific files for specialized run and results extraction
    # ==============================Alter by me============================
    PLATFORM=riscv64
    SHELL=/bin/bash
    
    ifndef TOOLCHAIN
    TOOLCHAIN=gcc64-riscv
    # ==============================End Alter==============================
    endif
    
    # Flag: LOAD
    #   Use LOAD to define command used for loading the image to the target
    LOAD =
    
    # Flag: RUN
    #   Use this flag to define a command needed to run the image
    #
    #   Example: if you need to run the image with a simulator, set this flag to point to the simulator executable
    RUN         =
    # Flag: RUN
    #   Use this flag to supply flags before the image name and parameters
    #
    #   Example: if you need want to run the image using gdb, you probably need to set this flag to --args
    RUN_FLAGS   =
    
    ifeq ($(DO_PROFILE),yes)
        RUN_FLAGS           =
        RUN = function dorun() { 
        BENCHNAME=`basename $$1 .exe` && 
        $$@ &&
        gprof $$1 gmon.out > $(DIR_LOG)/$$BENCHNAME.gprof && 
        mv gmon.out $(DIR_LOG)/$$BENCHNAME.gmon ;
        } && dorun 
    endif
    

    3.2、添加riscv64-unknown-linux-gnu-gcc.mak

    gcc64.mak文件拷贝一份重命名为riscv64-unknown-linux-gnu-gcc.mak

    imaginemiracle@:make$ cp gcc64.mak gcc64-riscv.mak
    imaginemiracle@:make$ vim gcc64-riscv.mak
    

      将TOOLS修改为存放riscv64-toolchain的目录,将CC修改为$(TOOLS)/bin/riscv64-unknown-linux-gnu-gccAS修改为$(TOOLS)/bin/riscv64-unknown-linux-gnu-asLD修改为$(TOOLS)/bin/riscv64-unknown-linux-gnu-gccEXE修改为rvexeAR修改为$(TOOLS)/bin/riscv64-unknown-linux-gnu-ar即可。

    #  File: util/make/gcc64-riscv.mak                                                                                                                                                                                                                                                        
    #   GCC Tool Definitions, Host Compile and Run, for riscv64b system
    #  
    #  Author: wxn <imaginemiracle.wxn@outlook.com>
    #  Date  : 2021-01-01
    #==============================================================================
    
    # RUN OPTIONS SECTION
    # Build or run options (i.e. profiling, simulation)
    
    # Enable profiling with 'yes'. All other strings disable profiling.
    ifndef (DO_PROFILE)
    DO_PROFILE=no
    endif
    ifndef (DO_VALGRIND)
    DO_VALGRIND=no
    endif
    
    # ARCHITECTURE SECTION
    # Any specific options (i.e. cpu, fpu)
    
    # SYSTEM ENVIRONMENT SECTION
    # =================================Alter by me==================================
    # Tools Root Directory
    TOOLS   = /home/imaginemiracle/Disk_D/Linux_Workspace/riscv-project/freedom-u-sdk/toolchain
    # ==================================End Alter===================================
    # For Solaris
    #TOOLS  = /usr/local
    # For Solaris
    # (A shell which supports [ file1 -nt file2 ] for office, consumer)
    #SHELL  = /bin/bash
    
    # Tools Executables, Output File Flag and Output File Types
    
    # NOTE :    Spacing between option and values can be compiler dependant.
    #       The following is a trick to ensure that a space follows the -o flag. 
    #       Do not remove the line continuation backslash or the following blank
    #       line.
    #       OBJOUT = -o 
    
    # =================================Alter by me==================================
    # Variable: CC
    #   name of the compiler
    CC      = $(TOOLS)/bin/riscv64-unknown-linux-gnu-gcc
    # Solaris: /usr/ccs/bin/as requires space after -o passed from gcc.
    #OBJOUT = -o #
    OBJOUT  = -o
    COBJT   = -c
    CINCD   = -I
    CDEFN   = -D
    OEXT = .o
    
    AS      = $(TOOLS)/bin/riscv64-unknown-linux-gnu-as
    
    LD      = $(TOOLS)/bin/riscv64-unknown-linux-gnu-gcc
    EXEOUT  = -o
    EXE     = .rvexe
    
    AR      = $(TOOLS)/bin/riscv64-unknown-linux-gnu-ar
    # ==================================End Alter===================================
    LIBTYPE = .a
    LIBOUT  =
    

    4、编译生成测试程序

    编译命令:

    imaginemiracle@:coremark-pro$ make TARGET=riscv64 build
    #编译成功会生成build目录,里面存放着每个测试程序(一共9个)
    imaginemiracle@:coremark-pro$ ls
    benchmarks  builds  coremarkpro.md5  docs  LICENSE.md  Makefile  Makefile.mak  mith  README.md  util  workloads
    imaginemiracle@:coremark-pro$ cd builds/riscv64/gcc64-riscv/bin/
    imaginemiracle@:bin$ tree
    .
    ├── cjpeg-rose7-preset.rvexe			//JPEG compreesion using 7 workers.
    ├── core.rvexe							//CoreMark. 
    ├── data
    ├── linear_alg-mid-100x100-sp.rvexe		//Gaussian elimination with partial pivoting on a 100x100 single-precision matrix dataset;single worker.
    ├── loops-all-mid-10k-sp.rvexe			//Livermore Loops kernel with a 100x100 single-precision matrix;single worker.
    ├── nnet_test.rvexe						//Neural net simulation;single worker.
    ├── parser-125k.rvexe					//XML parser with a 125k dataset;single worker.
    ├── radix2-big-64k.rvexe				//FFT base-2 transform with 64k dataset;single worker.
    ├── sha-test.rvexe						//SHA256 benchmark.
    └── zip-test.rvexe						//ZIP compression benchmark.
    
    1 directory, 9 files
    

    可以通过file命令查看可执行程序的信息,可以看到已经成功编译出riscv64架构的应用程序。

    imaginemiracle@:bin$ file cjpeg-rose7-preset.rvexe 
    cjpeg-rose7-preset.rvexe: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, for GNU/Linux 3.0.0, with debug_info, not stripped
    

    5、在目标平台测试结果

    由于暂时没有保存在目标平台的测试结果,这里通过在x86_64架构的运行结果来介绍测试命令。[注]笔者提前编译好的x86_64架构的测试程序,编译流程与上面类似

      运行所有九个测试(具有四个上下文),收集其输出分数,并通过Perl脚本对其进行处理以生成最终的CoreMark-PRO分数,这将对所有九个测试运行两次,一次使用一个上下文,一次使用用户定义数量的上下文(在这种情况下为四个),然后在两个配置之间生成缩放比例。可以参考文档以获取有关如何更改上下文和工作程序数量的说明。

    imaginemiracle@:coremark-pro$ make TARGET=linux64 XCMD='-c4' certify-all
    

    测试结果如下:

    WORKLOAD RESULTS TABLE
    
                                                     MultiCore SingleCore           
    Workload Name                                     (iter/s)   (iter/s)    Scaling
    ----------------------------------------------- ---------- ---------- ----------
    cjpeg-rose7-preset                                  833.33     212.77       3.92
    core                                                  9.73       2.48       3.92
    linear_alg-mid-100x100-sp                          1041.67     268.82       3.87
    loops-all-mid-10k-sp                                 34.01       8.96       3.80
    nnet_test                                            39.84      11.92       3.34
    parser-125k                                         100.00      27.03       3.70
    radix2-big-64k                                     2732.24     735.84       3.71
    sha-test                                            909.09     270.27       3.36
    zip-test                                            666.67     200.00       3.33
    
    MARK RESULTS TABLE
    
    Mark Name                                        MultiCore SingleCore    Scaling
    ----------------------------------------------- ---------- ---------- ----------
    CoreMark-PRO                                      26611.03    7281.15       3.65
    

    5.1、提交测试结果

    CoreMark-PRO的测试结果可提交在EEMBC平台上。打开提交页面。注册帐户后,输入分数即可,具体步骤不在此介绍。

  • 相关阅读:
    java执行cmd程序
    修改linux 默认ssh的22端口
    docker入门(一)
    关键字:心跳网络、oracle rac 网络异常宕机、packet reassembles failed 、UDP error 转载大佬的一篇文章
    记录数据库心跳网络异常,导致数据库宕机--推荐使用OSWBB监控主机
    python项目一键导入所有安装包
    weblogic 中间件利用bsu 漏洞补丁升级
    weblogic 控制台密码输入5次错误被锁 / 密码忘记 修改密码的方法
    oracle数据泵工作学习记录
    简单粗暴的给Linux系统配置本地yum 源
  • 原文地址:https://www.cnblogs.com/ImagineMiracle-wxn/p/CPU_CoreMark-pro_test.html
Copyright © 2020-2023  润新知