查看: 916|回复: 1

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

[复制链接]

116

主题

134

帖子

3778

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3778
发表于 2023-1-6 09:40:41 | 显示全部楼层 |阅读模式


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

前言
上一篇我们使用Dhrystone进行了整数运算性能的测试。这次我们使用whetstone进行浮点相关的计算性能测试。
过程添加代码
获取代码
解压classic_benchmarks.tar.gz将\classic_benchmarks\classic_benchmarks\source_code\whetstone文件夹复制到自己的工程。
添加代码
\classic_benchmarks\source_code\whetstone文件夹复制到工程目录,并添加工程中


移植接口
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("%s\n", configdata);
}
    local_time();
    printf("\n");
    printf("##########################################\n");
    printf("%s Precision C Whetstone Benchmark %s, %s\n", Precision, opt, timeday);
    outfile = fopen("whets.txt","a+");
    if (outfile == NULL)
      {
       printf ("Cannot open results file \n\n");
       printf("Press Enter to exit\n");
       i = getchar();
       exit (0);
      }
      #endif
注释掉314行以下内容
#if 0
fprintf (outfile, "\n");
fprintf (outfile, "##############################################\n\n");
for (i=1; i<10; i++)
{
     fprintf(outfile, "%s \n", configdata);
}
fprintf (outfile, "\n");
fprintf (outfile, "##############################################\n\n");
fprintf (outfile, "Whetstone %s Precision C Benchmark  %s, %s\n",Precision, opt, timeday);
fprintf (outfile, "\n");
fprintf (outfile,"Loop content                   Result"
            "              MFLOPS      MOPS   Seconds\n\n");
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.3f\n",
                 loop_mflops[section], loop_time[section]);
       }
       else
       {      
        fprintf (outfile, "            %9.3f %9.3f\n",
             loop_mops[section], loop_time[section], results[section]);
       }
    }
fflush(outfile);
fprintf (outfile, "\nMWIPS             ");
fprintf (outfile, "%39.3f%20.3f\n\n",mwips,TimeUsed);
fprintf (outfile, "Results  to  load  to  spreadsheet   ");
fprintf (outfile, "     MWIPS   Mflops1   Mflops2   Mflops3   Cosmops"
                      "   Expmops  Fixpmops    Ifmops    Eqmops\n");
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.3f\n\n", 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 same\n");
printf ("directory as the .EXE files, if one did not already exist.\n\n");
if (nopause)
{
    printf(" Press Enter\n\n");
    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等都可以参考,不再一一测试。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

3

主题

195

帖子

1540

积分

金牌会员

Rank: 6Rank: 6

积分
1540
发表于 2023-3-14 11:27:34 | 显示全部楼层

不错,学习一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

用户排行榜

RA助手

主题: 116帖子:134精华:0

RA_Lance

主题: 92帖子:132精华:9

lugl

主题: 45帖子:134精华:0

xujiwei263

主题: 16帖子:73精华:0

books咦

主题: 11帖子:11精华:2

Juggernaut

主题: 9帖子:95精华:0
快速回复 返回顶部 返回列表