zoukankan      html  css  js  c++  java
  • ubuntu安装openmpi && ns-3 mpi

    最近在做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

    结束---

  • 相关阅读:
    SpringFramework|@Autowired
    SpringFramework|@Required的使用
    SpringFramework|基于XML的两种自动装配
    SpringFramework|基于XML的各类集合注入
    SpringFramework|基于XML的依赖注入
    erlang vim
    svn 强制输入提交日志
    vim配置
    克隆centos6后配置网络
    git 免密
  • 原文地址:https://www.cnblogs.com/jingjingblog/p/7469004.html
Copyright © 2011-2022 走看看