Ubuntu 安装SimPoint工具

在gem5模拟器上运行程序是时间开销是十分庞大的,尤其是乱序模拟的时候,时间往往不可接受。
那么如何加快程序运行时间呢?SimPoint工具应运而生。
把程序切成片段,每一个片段有他们的feature,对这些片段进行聚类。SimPoint认为一个cluster里的片段是相似的,用聚类最靠近中心点或者其它指标来选最有代表性的片段。一个cluster有多大,这个片段的权重就多大。

下载SimPoint:https://cseweb.ucsd.edu//~calder/simpoint/simpoint-3-0.htm
解压后进入文件目录,运行make命令。会出现如下错误:

Utilities.h: In member function ‘int Random::randInt()’:
Utilities.h:165:59: error: ‘INT_MAX’ was not declared in this scope
  165 |         inline int randInt() { return (int)(randFloat() * INT_MAX); }
      |                                                           ^~~~~~~
Utilities.h:88:1: note: ‘INT_MAX’ is defined in header ‘<climits>; did you forget to ‘#include <climits>’?

按照提示,在Utilities.h文件中添加头文件:‘#include <climits>’

CmdLineParser.cpp: In member function ‘bool CmdLineParser::parseCmdLine(int, char**)’:
CmdLineParser.cpp:80:13: error: ‘strlen’ was not declared in this scope
   80 |         if (strlen(arg) == 0) {
      |             ^~~~~~
CmdLineParser.cpp:74:1: note: ‘strlen’ is defined in header ‘<cstring>; did you forget to ‘#include <cstring>’?

按照提示,在CmdLineParser.cpp文件中添加头文件:‘#include <cstring>’

Datapoint.h:111:20: error: ‘ostream’ has not been declared
  111 |         void write(ostream &os) const;
      |                    ^~~~~~~
Datapoint.h:114:19: error: ‘istream’ has not been declared
  114 |         void read(istream &is);
      |                   ^~~~~~~
Datapoint.h:118:26: error: ‘ostream’ has not been declared
  118 |         void writeBinary(ostream &os) const;
      |                          ^~~~~~~
Datapoint.h:121:25: error: ‘istream’ has not been declared
  121 |         void readBinary(istream &is);
      |                         ^~~~~~~
Datapoint.h:127:1: error: ‘ostream’ does not name a type
  127 | ostream &operator<<(ostream &os, const Datapoint &dp);
      | ^~~~~~~

在Datapoint.h文件中添加头文件:‘#include <iostream>’

FVParser.cpp: In member function ‘bool FVParser::nextLine(std::__cxx11::list<FVParserToken>*)’:
FVParser.cpp:106:29: error: ‘strlen’ was not declared in this scope
  106 |     } while ((! eof()) && ((strlen(buffer) == 0) || ('T' != buffer[0])));
      |                             ^~~~~~
FVParser.cpp:86:1: note: ‘strlen’ is defined in header ‘<cstring>; did you forget to ‘#include <cstring>’?
   85 |     #include <sstream>
  +++ |+#include <cstring>
   86 | #else

在FVParser.cpp文件中添加头文件:‘#include <cstring>’ 或者将#include <string> 改为#include <string.h>

再次运行make命令,会出现如下报错:

Simpoint.cpp: In member function ‘void Simpoint::loadData()’:
Simpoint.cpp:178:34: error: cannot convert ‘std::ifstream’ {aka ‘std::basic_ifstream<char>} to ‘bool’
  178 |                 Utilities::check(input, "Simpoint::loadData(): could not open file " +
      |                                  ^~~~~
      |                                  |
      |                                  std::ifstream {aka std::basic_ifstream<char>}
In file included from Simpoint.cpp:83:
Utilities.h:129:39: note:   initializing argument 1 of ‘static void Utilities::check(bool, const string&)129 |         static inline void check(bool checkval, const string &msg) {
      |                                  ~~~~~^~~~~~~~

这里应该是类型转换的错误。我的解决方法是在Simpoint.cpp文件中,在调用Utilities::check()函数的地方,第一个参数前加强制类型转换bool。
修改前为:

Utilities::check(input, "Simpoint::loadData(): could not open file " + options.loadProjMatrixTxtFmtName);

修改后为:

Utilities::check(bool (input), "Simpoint::loadData(): could not open file " + options.loadProjMatrixTxtFmtName);

编译完成进入bin目录下,执行测试用例:

./simpoint -maxK 30 -loadFVFile ../input/sample.bb -saveSimpoints simpoints -saveSimpointWeights weights

看到新生成simpoints和weights文件即表示安装和运行成功。

运行环境:

操作系统:Ubuntu 20.04 LTS
gcc:9.4.0
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值