[Ns-developers] Questions about Packet, Buffers, and zero payloads
George Riley
riley at ece.gatech.edu
Wed Jun 10 11:47:45 PDT 2009
Hi All,
I am nearing completion on the MPI-based distributed simulation for
ns-3.
The code to do time synchronization is working perfectly, as is the code
to detect transient messages. I have implemented the code to send
packets
using MPI sends and packet serializatino, but am puzzled by a couple
of issues
and could use some advise
After quite a bit of trying various methods, the code ended up looking
like this:
// Serialize the packet
i->buffer = p->Serialize();
// Add the dest node and dest device
i->buffer.AddAtStart(sizeof(node) + sizeof(dev));
Buffer::Iterator it = i->buffer.Begin();
it.WriteU32(node);
it.WriteU32(dev);
// Find the system id for the destination node
Ptr<Node> destNode = NodeList::GetNode(node);
uint32_t nodeSysId = destNode->GetSystemId();
MPI_Isend((void*)i->buffer.PeekData(), i->buffer.GetSize(),
MPI_CHAR, nodeSysId,
0, MPI_COMM_WORLD, &(i->request));
cout << "MPI Packet sent" << endl;
This seems to work; but one question is does the "AddAtStart" after
the serialization
cause a buffer re-alloc and copy? If so this is not acceptable.
Second question is
that the i->buffer.GetSize() on the MPI_Isend returns the size of the
buffer including
the zero-byte (and non-existent) payload. Shouldn't we only send the
actual packet data
without the zero payload? How do I get the zero payload back on the
receiving end?
I did not see where this is handled in Packet::Serialize() and
Packet::DeSerialize().
Any advise appreciated.
George
--------------------------------------------------
George Riley
Associate Professor
Georgia Tech
Electrical and Computer Engineering
riley at ece.gatech.edu
404-894-4767
Klaus Advanced Computing Building
Room 3360
266 Ferst Drive
Atlanta, Georgia 30332-0765
ECE4110 Web page:
http://users.ece.gatech.edu/~riley/ece4110/
ECE4112 Web page:
http://users.ece.gatech.edu/~riley/ece4112/
More information about the Ns-developers
mailing list