瑞萨单片机william hill官网
直播中

jf_1137202360

8年用户 1358经验值
擅长:嵌入式技术
私信 关注
[经验]

【瑞萨RA4系列开发板体验】基准性能测试之二:浮点计算能力whetstone

前言
上一篇我们使用Dhrystone进行了整数运算性能的测试。这次我们使用whetstone进行浮点相关的计算性能测试。
过程添加代码
获取代码
http://www.roylongbottom.org.uk/classic_benchmarks.tar.gz
解压classic_benchmarks.tar.gz将classic_benchmarksclassic_benchmarkssource_codewhetstone文件夹复制到自己的工程。
添加代码
classic_benchmarkssource_codewhetstone文件夹复制到工程目录,并添加工程中
移植接口
whets.c中
161行 **************************************************************************
改为
**************************************************************************/
167行注释掉
//#include "cpuidh.h"
添加 extern uint32_t Systick_Gettime(void);
#include
201行int main(int argc, char *argv[])
改为
int whets_main(int argc, char *argv[])
212行
int nopause = 1;
改为
    int nopause = 0;
注释掉228行以下内容
#if 0
    getDetails();
    for (i=1; i<10; i++)
    {
        printf("%sn", configdata);
    }
    local_time();
    printf("n");
    printf("##########################################n");
    printf("%s Precision C Whetstone Benchmark %s, %sn", Precision, opt, timeday);
    outfile = fopen("whets.txt","a+");
    if (outfile == NULL)
      {
       printf ("Cannot open results file nn");
       printf("Press Enter to exitn");
       i = getchar();
       exit (0);
      }
      #endif
注释掉314行以下内容
#if 0
fprintf (outfile, "n");
fprintf (outfile, "##############################################nn");
for (i=1; i<10; i++)
{
     fprintf(outfile, "%s n", configdata);
}
fprintf (outfile, "n");
fprintf (outfile, "##############################################nn");
fprintf (outfile, "Whetstone %s Precision C Benchmark  %s, %sn",Precision, opt, timeday);
fprintf (outfile, "n");
fprintf (outfile,"Loop content                   Result"
            "              MFLOPS      MOPS   Secondsnn");
for (section=1; section<9; section++)
    {
     fprintf (outfile, "%s  %24.17f   ", headings[section],
                                              results[section]);
     if (loop_mops[section] == 99999)
       {         
        fprintf (outfile,"  %9.3f           %9.3fn",
                 loop_mflops[section], loop_time[section]);
       }
       else
       {      
        fprintf (outfile, "            %9.3f %9.3fn",
             loop_mops[section], loop_time[section], results[section]);
       }
    }
fflush(outfile);
fprintf (outfile, "nMWIPS             ");
fprintf (outfile, "%39.3f%20.3fnn",mwips,TimeUsed);
fprintf (outfile, "Results  to  load  to  spreadsheet   ");
fprintf (outfile, "     MWIPS   Mflops1   Mflops2   Mflops3   Cosmops"
                      "   Expmops  Fixpmops    Ifmops    Eqmopsn");
fprintf (outfile, "Results  to  load  to  spreadsheet   ");   
               
fprintf (outfile, " %9.3f %9.3f %9.3f", mwips, loop_mflops[1],
                                                         loop_mflops[2]);
fprintf (outfile, " %9.3f %9.3f %9.3f", loop_mflops[6],
                                             loop_mops[5], loop_mops[8]);
fprintf (outfile, " %9.3f %9.3f %9.3fnn", loop_mops[4],
                                              loop_mops[3], loop_mops[7]);
fflush(outfile);
   
fclose (outfile);
printf ("n");
printf ("A new results file, whets.txt,  will have been created in the samen");
printf ("directory as the .EXE files, if one did not already exist.nn");
if (nopause)
{
    printf(" Press Enternn");
    i = getchar();
}  
#endif
407行
start_time();改为
uint32_t s_stime_u32 = SysTick_Gettime();
423行
end_time();改为
uint32_t s_etime_u32 = SysTick_Gettime()();
其他地方类似不再枚举
测试
hal_entry
申明 void whets_main (int argc, char *argv[]);
调用whets_main(0,0);
http://www.roylongbottom.org.uk/whetstone%20results.htm
下可以对比
总结
本篇测试了浮点运算能力,还有其他的线性浮点运算能力测试linpack并发计算基准测试livermore_loops等都可以参考,不再一一测试。

附件: 您需要登录才可以下载或查看附件。没有帐号?注册

回帖(1)

h1654155285.8644

2022-12-12 09:33:35
浮点运算能力相当于AM386,但是这个单片机的频率100MHz以上,是不是说明该架构的浮点运算能力较差。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分