码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu安装openmpi && ns-3 mpi

时间:2017-09-03 12:22:39      阅读:328      评论:0      收藏:0      [点我收藏+]

标签:htm   命令   span   port   distrib   文件的   etc   pen   系统   

最近在做ns-3的网络仿真,但是当网络拓扑比较大或者速率很高时,仿真效率很低。

了解到ns-3的mpi模块可以提高仿真效率,就开始学习使用。

整个过程分为两步:

1. linux系统下安装openmpi.可以参考下面两篇文章:

http://blog.csdn.net/jacketinsysu/article/details/44840611

http://www.linuxidc.com/Linux/2015-04/116448.htm

我根据这两篇文章操作之后,运行mpirun -np 4 hello_c可以成功;但是,重新打开终端后,再次运行,就会出现如下错误

mpirun: error while loading shared libraries: libopen-rte.so.20: cannot open shared object file: No such file or directory

经过尝试,可以用如下方法解决:

用命令更新文件 /sbin/ldconfig -v ,否则问题依旧。

2. 成功运行ns-3中的simple-distributed.cc文件

命令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文件了:

命令: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

标签:htm   命令   span   port   distrib   文件的   etc   pen   系统   

原文地址:http://www.cnblogs.com/jingjingblog/p/7469004.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!