天人合一之毕设——准备阶段——3 HME仿真器

毕设做的是异构内存方面的研究,需要在模拟器上仿真,目前已经实现的有很多,gem5、nvmain等等

无奈实验室师兄太牛自己设计了一款模拟器,我就直接用他的咯!

学名HME,一种轻量级的仿真器,gitup上已开源https://github.com/CGCL-codes/HME

1.原理

HME是一款基于DRAM的性能仿真器,可以模拟即将推出的NVM技术的性能和能量特性。

HME利用商品NUMA体系结构中可用的功能来模拟两种内存:快速本地DRAM和其他NUMA节点上较慢的远程NVM。

HME可以通过在远程NUMA节点上注入不同的内存访问延迟来模拟各种NVM延迟和带宽。

为了帮助程序员和研究人员评估NVM对应用程序性能的影响,我们还提供了一个高级编程接口来从NVM或DRAM池(AHME)分配内存。

2.功能

(1)延迟仿真

由于现有硬件中没有编程接口来直接控制存储器访问延迟,所以我们采用软件方法来模拟NVM延迟。

基本思想是在固定大小的时间间隔内为应用程序注入软件生成的附加延迟。

该策略可以模拟应用程序可以识别的总内存访问延迟,以近似于一段时间内的NVM延迟。

HME使用本地代理(HA)的英特尔Xeon处理器非核PMU(性能监控单元),来记录内存读取访问次数(LLC未命中)并写入访问到远程节点的DRAM,

并且这些内存请求应该从在本地节点上运行的应用程序发出。 HME通过处理器间中断(IPIs)向本地节点的内核注入额外的延迟。

 以这种方式,HME增加了远程内存访问延迟,以模拟NVM延迟。

(2)带宽仿真

HME通过限制最大可用DRAM带宽来模拟NVM带宽。

带宽节制是通过利用商用英特尔至强处理器中提供的DRAM热控制接口来实现的。

(3)能源仿真

HME还建立了一个能耗模型来计算NVM的能源消耗。

由于缺乏用于统计主存储器能耗的硬件级功能,我们选择一种统计方法对NVM能耗进行建模。

与DRAM不同,NVM不会产生静态功耗,所以我们只需要计算NVM的读写能耗。

我们通过PMU统计NVM的读写数量,估算NVM的能耗。

3.使用方法

(1)安装外部依赖
     

  Before install hybrid simulator HME, it's essential that you have already install dependencies listing below.

· gcc(>=4.6)

· numactl-devel

· libconfig or libconfig-devel

· kernel-devel

· python(>=2.7)

· PMU Toolkit (When you using Multicore version, it needs to be manually installed and configured)

 链接:https://github.com/andikleen/pmu-tools

You can run 'sudo /scripts/install.sh' in order to automatically install some of these dependencies.

(2)编译和安装

  • Compiling the emulator's module. From the emulator's source code /Regular_version/HME folder, execute make.

[root @node1 HME]# cd Regular_version

[root @node1 Regular_version]# cd HME

[root @node1 HME]# make  //to compiling the HME

  • Update configuration to your HME configuration through/Regular_version/HME/scripts/nvmini.in

[Latency]:    DRAM_Read_latency_ns = 100          //DRAM read latency(ns)  

 DRAM_Write_latency_ns = 200         //DRAM write latency(ns)  

 NVM_Read_latency_ns = 400           //NVM read latency(ns)  

 NVM_Write_latency_ns = 1800         //NVM write latency(ns)

[Bandwith]:     NVM_bw_ratio = 2                    //One proportion of Bandwidth of DRAM / Bandwidth of NVM

[Model]:    epoch_duration_us = 100             //Simulator polling time  

 type = 1                            

//when type =0 it means you using the lib AHME; When type=1 it means you using libnuma to put all in nvm;

When type=2 it means you using libnuma policy interleave to put it in DRAM and NVM

[Consumption]:    NVM_read_w = 100                    //NVM read consumption  

 NVM_write_w = 2000                  //NVM write consumption

  •  Use HME through /Regular_version/HME/scripts/runenv.sh

[root @node1 scripts]# sh runenv.sh runspec --config=Example-linux64-amd64-gcc43.cfg --noreportable --iteration=1

Using runenv.sh to run your command , it will be put in the HME to emulation the hybrid memory.

 4.AMHE:编程接口

(1)原理

我们扩展Glibc库以提供nvm malloc函数,以便应用程序可以通过malloc或nvm malloc分配混合内存。

为了实现nvm malloc函数,我们修改Linux内核,为nvm mmap内存分配提供一个分支。

分支在nvm malloc函数中处理程序分配页面。同时,在原始VMA(虚拟地址空间)中NVM页面不同于DRAM页面。

(2)编译安装过程

  • AHME kernel Compiling and install

 Compiling and Installation,From the emulator's source code /...._version/AHME/kernel,

[root @node1 kernel]# cp config .config            //To config the configration of linux kernel

[root @node1 kernel]# sh -c 'yes "" | make oldconfig'             

 //Use the old kernel configuration and automatically accept the default settings for each new option

[root @node1 kernel]# sudo make -j20 bzImage

[root @node1 kernel]# sudo make -j20 modules

[root @node1 kernel]# sudo make -j20 modules_install

[root @node1 kernel]# sudo make install

You can run 'sudo /...._version/AHME/kernel/bulid.sh' in order to automatically install

  • Reboot to change to the AHME kernel(重新启动以更改为AHME内核)

[root @node1 kernel]# sudo vim /etc/default/grub      //To change the default kernel you using (always to set 0)

[root @node1 kernel]# sudo grub2-mkconfig -o /boot/grub2/grub.cfg

[root @node1 kernel]# reboot

  • AHME Glibc Compiling and install

·Compiling and Installation From the emulator's source code /...._version/AHME/glibc,

[root @node1 AHME]# mkdir glibc-build

 [root @node1 AHME]# cd glibc-build     //to compiling the HME

[root @node1 glibc-build]# ../glibc/configure  --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

[root @node1 glibc-build]# make[root @node1 glibc-build]# make install

(3)使用方法

#include <malloc.h>p = nvm_malloc(1024*8);

Then you must run this in type 0 (/HME/Regular_version/scripts/nvmini.in)





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值