Bugzilla – Full Text Bug Listing |
Summary: | MPI code doesn't compile | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Josh Pelkey <jpelkey> |
Component: | mpi | Assignee: | George Riley <riley> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gjcarneiro, john.abraham.in, ns-bugs, vedran |
Priority: | P5 | ||
Version: | ns-3-dev | ||
Hardware: | All | ||
OS: | All | ||
Attachments: |
patch to fix
mpi results |
Description
Josh Pelkey
2011-03-25 11:09:07 EDT
Why not make MpiNetDevice a new ns3::Object that is aggregated to the existing ns3::NetDevice subclass? Inside PointToPointNetDevice you can GetObject<MpiNetDevice> (). It's the logical thing to do IMHO... (In reply to comment #1) > Why not make MpiNetDevice a new ns3::Object that is aggregated to the existing > ns3::NetDevice subclass? Inside PointToPointNetDevice you can > GetObject<MpiNetDevice> (). It's the logical thing to do IMHO... Hi, John and I discussed this for a while today, and while he probably has a better understanding of the situation, I am still not certain of the best way to proceed. I was wondering why we shouldn't just add a virtual function to the NetDevice called Receive (or MpiReceive). It seems to me that this should be in there anyway (don't all netdevices need to receive?). This way, in mpi-interface, we can just use a generic NetDevice to call Receive (or MpiReceive) and the appropriate net-device object calls its receive function. BTW, the whole reason we have this issue is because we are trying to avoid a dependency on point-to-point (or any other more specific) net-device within the mpi model, which I couldn't figure out how to eliminate if using the AggregateObject method suggested above. (In reply to comment #2) > (In reply to comment #1) > > Why not make MpiNetDevice a new ns3::Object that is aggregated to the existing > > ns3::NetDevice subclass? Inside PointToPointNetDevice you can > > GetObject<MpiNetDevice> (). It's the logical thing to do IMHO... > > Hi, John and I discussed this for a while today, and while he probably has a > better understanding of the situation, I am still not certain of the best way > to proceed. I was wondering why we shouldn't just add a virtual function to the > NetDevice called Receive (or MpiReceive). It seems to me that this should be in > there anyway (don't all netdevices need to receive?). I guess the interface between Channel and NetDevice is proprietary for each link layer technology type, therefore it does not need an abstract virtual method. This gives l2 models more freedom... > This way, in > mpi-interface, we can just use a generic NetDevice to call Receive (or > MpiReceive) and the appropriate net-device object calls its receive function. > > BTW, the whole reason we have this issue is because we are trying to avoid a > dependency on point-to-point (or any other more specific) net-device within the > mpi model, which I couldn't figure out how to eliminate if using the > AggregateObject method suggested above. What we have now is: class PointToPointNetDevice : public NetDevice, public MpiNetDevice AggregateObject is a (saner) alternative to multiple-inheritance. Sure, you don't have dependency on point-to-point in the mpi model, but you have dependency on mpi in the point-to-point model. I suggest only to replace multiple-inheritance with "interface aggregation" (which is what AggregateObject means with a non-intuitive name IMHO) functionality of ns3::Object. (In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > Why not make MpiNetDevice a new ns3::Object that is aggregated to the existing > > > ns3::NetDevice subclass? Inside PointToPointNetDevice you can > > > GetObject<MpiNetDevice> (). It's the logical thing to do IMHO... > > > > Hi, John and I discussed this for a while today, and while he probably has a > > better understanding of the situation, I am still not certain of the best way > > to proceed. I was wondering why we shouldn't just add a virtual function to the > > NetDevice called Receive (or MpiReceive). It seems to me that this should be in > > there anyway (don't all netdevices need to receive?). > > I guess the interface between Channel and NetDevice is proprietary for each > link layer technology type, therefore it does not need an abstract virtual > method. This gives l2 models more freedom... > > > This way, in > > mpi-interface, we can just use a generic NetDevice to call Receive (or > > MpiReceive) and the appropriate net-device object calls its receive function. > > > > BTW, the whole reason we have this issue is because we are trying to avoid a > > dependency on point-to-point (or any other more specific) net-device within the > > mpi model, which I couldn't figure out how to eliminate if using the > > AggregateObject method suggested above. > > What we have now is: > > class PointToPointNetDevice : public NetDevice, public MpiNetDevice > > AggregateObject is a (saner) alternative to multiple-inheritance. > > Sure, you don't have dependency on point-to-point in the mpi model, but you > have dependency on mpi in the point-to-point model. I suggest only to replace > multiple-inheritance with "interface aggregation" (which is what > AggregateObject means with a non-intuitive name IMHO) functionality of > ns3::Object. Will aggregation cause any concerns or hit any limitations, when there are multiple MPI interfaces on the same node? Just double-check (In reply to comment #4) > Will aggregation cause any concerns or hit any limitations, when there are > multiple MPI interfaces on the same node? Just double-check If you aggregate an Mpi object to a NetDevice, you can only have one Mpi object per NetDevice. But if you have multiple NetDevices in a Node, you get multiple Mpi objects on that same Node. Created attachment 1091 [details]
patch to fix
This patch implements Gustavo's suggestion; it was tested against third-distributed and simple-distributed.
Created attachment 1099 [details]
mpi results
I've run some performance tests using the nms-p2p-nix-distributed example (slightly modified to reduce the total wall clock time). It looks like there is minimal difference on the total simulation time with this patch. I tested ns-3-dev with this patch against the old ns-3.9 branch. I also tested it against ns-3.9 with this patch applied for a more direct test. Results attached. In summary, there is little or no difference with this patch applied. It seems like ns-3-dev performs better in general though, possibly due to the re-modularization efforts.
I pushed this fix to ns-3-dev, changeset 5feb5c87d56f
|