Ns3使用MPI加速仿真速度

Ns3中在大规模拓扑仿真中,为加速仿真速度,可以利用MPI工具,实现多进程联合仿真。

  1. linux系统下安装openmpi.
    参考链接# ubuntu下安装openMPI
  2. 成功运行ns-3中的文件
    命令1:
    sudo gedit /etc/profile
    
    打开文件,加入ns-3的路径:
    最后此文件的最后两行为:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/jing/m_allFile/project/sourceInsight/ns3SourceFile/ns-allinone-3.25/ns-3.25
    

第一行与第二行用户根据自己电脑的安装环境进行配置
第一行的路径为ubuntu系统安装openmpi的路径;
第二行为ns-3的安装路径。

命令2:

source /etc/profile

更新源

命令3:

sudo /sbin/ldconfig -v

然后,就可以运行ns-3的simple-distributed.cc文件了:
重新编译ns3

CXXFLAGS="-Wno-error" ./waf configure --enable-mpi

命令:

mpirun -np 2 ./waf --run scratch/simple-distributed

结果:

At time 1.02264s packet sink received 512 bytes from 10.1.1.1 port 49153 total Rx 512 bytes  
At time 1.0235s packet sink received 512 bytes from 10.1.2.1 port 49153 total Rx 512 bytes  
At time 1.02437s packet sink received 512 bytes from 10.1.3.1 port 49153 total Rx 512 bytes  
At time 1.02524s packet sink received 512 bytes from 10.1.4.1 port 49153 total Rx 512 bytes

参考链接

UBUNTU安装OPENMPI && NS-3 MPI
https://www.nsnam.org/docs/models/html/distributed.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值