先说下网上千篇一律的编译过程,包括官方文档也是这样写的(https://bitbucket.org/mrp5060/nvmain/):
1、下载nvmain,https://bitbucket.org/mrp5060/nvmain/
2、解压,并进入nvmain根目录
3、编译,scons –build-type=[fast|debug|prof]
,这里的三个选项选择一个就可以了,关于三个选项的功能详见官方文档说明,比如:scons –build-type=fast
,scons没有安装的,执行sudo apt install scons
安装
这里问题就出现了,按照官方文档说明,这里应该很理想,直接编译成功,在根目录生成nvmain.fast文件,但是我编译时候却直接报错了,如下:
ypf@ypf:~/nvmain$ scons –build-type=fast
scons: Reading SConscript files ...
ImportError: No module named gem5_scons:
File "/home/ypf/nvmain/SConstruct", line 253:
SConscript(joinpath(root, 'SConscript'), variant_dir=build_dir)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(*args, **kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
exec _file_ in call_stack[-1].globals
File "/home/ypf/nvmain/build/SConscript", line 36:
from gem5_scons import Transform
网上查了n多文章,就是没有见到这种错误的,囧,这个就有点背了。。。于是,只能自己动手了,根据错误提示,问题最终出现在:File “/home/ypf/nvmain/build/SConscript”, line 36,找到这行
from gem5_scons import Transform
原来是使用from import导入的gem5_scons模块,但是并没有找到这个模块,所以就报错了,一不做二不休,干脆就直接注释掉了这一行,结果,,,编译就通过了o(╯□╰)o,根目录产生编译后的文件:nvmain.fast
root@ypf:/home/ypf/nvmain# scons --build-type=fast
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
[CXX] Compiling Bank Factory "BankFactory" ==> BankFactory.fo
[CXX] Compiling Bank "CachedDDR3Bank" ==> CachedDDR3Bank.fo
[CXX] Compiling Bank "DDR3Bank" ==> DDR3Bank.fo
[CXX] Compiling Data Encoder Factory "DataEncoderFactory" ==> DataEncoderFactory.fo
[CXX] Compiling Data Encoder "FlipNWrite" ==> FlipNWrite.fo
[CXX] Compiling Address Translator "DRCDecoder" ==> DRCDecoder.fo
[CXX] Compiling Address Translator Factory "DecoderFactory" ==> DecoderFactory.f
......
这么做肯定是有其他影响的,但是没有找到更好的解决办法,暂时只能先这样了,哪位小哥哥小姐姐有解决办法烦请告知(^▽^)
补充:在使用gem5时候需要用到Transform,如果不使用gem5这里暂时没有用。使用gem5时候的解决办法在另外一篇博客给出。
4、测试:
./nvmain.fast Config/PCM_ISSCC_2012_4GB.config Tests/Traces/hello_world.nvt 1000000
......
i0.defaultMemory.channel0.FRFCFS-WQF.averageQueueLatency 2088.42
i0.defaultMemory.channel0.FRFCFS-WQF.averageTotalLatency 2174.86
i0.defaultMemory.channel0.FRFCFS-WQF.measuredLatencies 26485
i0.defaultMemory.channel0.FRFCFS-WQF.measuredQueueLatencies 26485
i0.defaultMemory.channel0.FRFCFS-WQF.measuredTotalLatencies 26485
i0.defaultMemory.channel0.FRFCFS-WQF.simulation_cycles 1000000
i0.defaultMemory.channel0.FRFCFS-WQF.wakeupCount 54116
i0.defaultMemory.totalReadRequests 13933
i0.defaultMemory.totalWriteRequests 12608
i0.defaultMemory.successfulPrefetches 0
i0.defaultMemory.unsuccessfulPrefetches 0
Exiting at cycle 5000000 because simCycles 5000000 reached.
Note: 57 requests still in-flight.