Distributed Simulation scenario doesn't work...

165 views
Skip to first unread message

Vaison

unread,
May 19, 2015, 2:27:33 PM5/19/15
to ns-3-...@googlegroups.com
Hi there!

I'm playing aroung with distributed simulation in ns-3, I read the documentation and I've already execute the simple-distribution.cc examples comes in ns-3, then I tried to extend this scenario without any result... Always had an error, so I decided to create a very simple scenario, let's say a "hello world" and doesn't work neither. This is the code:

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mpi-interface.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/ipv4-list-routing-helper.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-nix-vector-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet-sink-helper.h"

#ifdef NS3_MPI
#include <mpi.h>
#endif

using namespace ns3;

NS_LOG_COMPONENT_DEFINE
("hwmpi");

int main (int argc, char *argv[])
{
#ifdef NS3_MPI

 
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::DistributedSimulatorImpl"));

 
// Enable parallel simulator with the command line arguments
 
MpiInterface::Enable (&argc, &argv);

  std
::cout << " System Count " << MpiInterface::GetSize () << std::endl;

 
NodeContainer nodes;
  nodes
.Create (5, 0);

 
NodeContainer nodes1;
  nodes1
.Create (5, 1);

 
NodeContainer nodes2;
  nodes2
.Create (5, 2);

 
// Exit the MPI execution environment
 
MpiInterface::Disable ();
 
return 0;
#else
  NS_FATAL_ERROR
("Can't use distributed simulator without MPI compiled in");
#endif
}

And my command to execute that is:
mpirun -np 4 ./waf --run filename

The error is something about shared memory...

OSError: [Errno 2] No such file or directory
OSError: [Errno 2] No such file or directory

unable to create shared memory BTL coordinating strucure :: size 134217728

I read about it but I can't to understand what I'm doing wrong... BTW my OpenMPI version is 1.8.5 and the ns-3 is version 3.22

Any help will be welcome,

Cheers,

~V

Matt Anonyme

unread,
May 29, 2015, 8:51:39 AM5/29/15
to ns-3-...@googlegroups.com
OSError is a python exception so my guess would be that the error happens before launching the actual binary (maybe it can't find it). Is mpirun a python script ?

pdbarnes

unread,
May 29, 2015, 9:41:49 AM5/29/15
to ns-3-...@googlegroups.com
What is the name of your script, "scratch/filename.cc"?

Could you please try this command:
$ ./waf --run filename --command-template="mpirun -np 4 %"

Peter
Reply all
Reply to author
Forward
0 new messages