Segmentation fault with NullMessageSimulatorImpl

54 views
Skip to first unread message

Rui Cunha

unread,
Jun 15, 2022, 9:54:43 AM6/15/22
to ns-3-users
I was trying to run some tests with MPI and NS-3.35 and I encounter some issues when using the NullMessageSimulatorImpl algorithm.

When using the DistributedSimulatorImpl everything works as expected, but when switching to the NullMessageSimulatorImpl segmentation faults occur. This happens even with just a simple example with just two hosts and a Ping application.

Looking at the gdb output it appears the segmentation occurs in the ns3::NullMessageMpiInterface::SendNullMessage method when trying to send the MPI message.

I suspect this could be a bug, but before opening an issue I would like to make sure this is not a problem in my end.

Is anyone able to use NullMessageSimulatorImpl?

Rui Cunha

unread,
Jun 15, 2022, 9:56:06 AM6/15/22
to ns-3-users
Simple example to reproduce:

/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
#include "ns3/object.h"
#include "ns3/point-to-point-helper.h"
#include <ns3/core-module.h>
#include <ns3/csma-module.h>
#include <ns3/internet-apps-module.h>
#include <ns3/internet-module.h>
#include <ns3/network-module.h>
#include "ns3/mpi-module.h"

using namespace ns3;

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

  bool nullmsg = false;

  CommandLine cmd;
  cmd.AddValue ("nullmsg", "Enable the use of null-message synchronization", nullmsg);
  cmd.Parse (argc, argv);

  if (nullmsg)
    {
      GlobalValue::Bind ("SimulatorImplementationType",
                         StringValue ("ns3::NullMessageSimulatorImpl"));
    }
  else
    {
      GlobalValue::Bind ("SimulatorImplementationType",
                         StringValue ("ns3::DistributedSimulatorImpl"));
    }

  MpiInterface::Enable (&argc, &argv);

  Ptr<Node> node0 = CreateObject<Node> (0);
  Ptr<Node> node1 = CreateObject<Node> (1);

  NodeContainer hosts;
  hosts.Add (node0);
  hosts.Add (node1);

  NetDeviceContainer hostDevices;

  PointToPointHelper p2pHelper;
  hostDevices = p2pHelper.Install (hosts);

  // Install the TCP/IP stack into hosts nodes
  InternetStackHelper internet;
  internet.Install (hosts);

  // Set IPv4 host addresses
  Ipv4AddressHelper ipv4helpr;
  Ipv4InterfaceContainer hostIpIfaces;
  ipv4helpr.SetBase ("10.1.1.0", "255.255.255.0");
  hostIpIfaces = ipv4helpr.Assign (hostDevices);

  if (MpiInterface::GetSystemId () == 0)
    {
      // Configure ping application between hosts
      V4PingHelper pingHelper = V4PingHelper (hostIpIfaces.GetAddress (1));
      pingHelper.SetAttribute ("Verbose", BooleanValue (true));
      ApplicationContainer pingApps = pingHelper.Install (hosts.Get (0));
      pingApps.Start (Seconds (0));
    }

  // Run the simulation
  Simulator::Stop (Seconds (10));
  Simulator::Run ();
  Simulator::Destroy ();

  MpiInterface::Disable ();
}

Tom Henderson

unread,
Jun 20, 2022, 1:27:45 PM6/20/22
to ns-3-users
Thanks for the report; I was able to confirm there is an issue and will ask someone to look into it.  It is being tracked here:
- Tom

Reply all
Reply to author
Forward
0 new messages