Commit 4dc9319c authored by shengjh's avatar shengjh 🇨🇳
Browse files

Fix a bug that try to get something from nullptr(NetworkInterface*) and add...

Fix a bug that try to get something from nullptr(NetworkInterface*) and add two cancelAndDelete events in HomaTransport class incase I open a simulation but do nothing.
parent 5aa7e12a
......@@ -47,10 +47,14 @@ network dcn
double realLoadFactor;
int nicLinkSpeed @unit(Gbps);
int numTors;
int numServersPerTor;
int numAggSwitches = int( (numServersPerTor * nicLinkSpeed) / (overSubFactor * fabricLinkSpeed) );
// int numTors;
// int numServersPerTor;
// int numAggSwitches = int( (numServersPerTor * nicLinkSpeed) / (overSubFactor * fabricLinkSpeed) );
int numTors = 1;
int numServersPerTor = 2;
int numHosts = numServersPerTor * numTors;
@display("bgb=478,382");
types:
channel FabricChannel extends ned.DatarateChannel
......@@ -63,10 +67,10 @@ network dcn
datarate = nicLinkSpeed;
}
submodules:
aggRouter[numAggSwitches]: Router {
@display("i=abstract/router2;p=257,61");
**.promiscuous = true;
}
// aggRouter[numAggSwitches]: Router {
// @display("i=abstract/router2;p=257,61");
// **.promiscuous = true;
// }
tor[numTors]: Router {
@display("i=abstract/router;p=257,157");
**.promiscuous = true;
......@@ -96,8 +100,8 @@ network dcn
tor[i].ethg$i++ <-- EdgeChannel { delay = (edgeLinkDelay+hostNicSxThinkTime); } <-- host[i * numServersPerTor + j].ethg$o++;
}
for i=0..numAggSwitches-1, for j=0..numTors-1 {
aggRouter[i].ethg++ <--> FabricChannel { delay = (fabricLinkDelay+switchFixDelay); } <--> tor[j].ethg++;
}
// for i=0..numAggSwitches-1, for j=0..numTors-1 {
// aggRouter[i].ethg++ <--> FabricChannel { delay = (fabricLinkDelay+switchFixDelay); } <--> tor[j].ethg++;
// }
}
......@@ -2,37 +2,42 @@
simtime-scale=-15
sim-time-limit = 100000ms
warmup-period = 0ms
record-eventlog = false
**.statistic-recording = false
**.scalar-recording = false
**.vector-recording = false
network=dcn
######################## Homa Transport Parameters ###############################
#rttBytes is computed as sending one full packet in one way and a grant in the other way.
**.host[*].**.rttBytes = ${RTT=0x2710} B ##10000B is the min RTT in bytes
**.host[*].transportSchemeType = "${transportSchemeType = HomaTransport}"
**.host[*].transportScheme.isRoundRobinScheduler = ${isRoundRobinScheduler = false}
**.host[*].transportScheme.useUnschRateInScheduler = ${useUnschRateInScheduler = false}
**.host[*].transportScheme.maxOutstandingRecvBytes = ${maxOutstandingRecvBytes = $RTT} B
**.host[*].**.rttBytes = 0x2710 B ##10000B is the min RTT in bytes
**.host[*].transportSchemeType = "HomaTransport"
**.host[*].transportScheme.isRoundRobinScheduler = false
**.host[*].transportScheme.useUnschRateInScheduler = false
**.host[*].transportScheme.maxOutstandingRecvBytes = 0x2710 B
# Possible string values: STATIC_CBF_UNIFORM, STATIC_CDF_UNIFORM, STATIC_CBF_GRADUATED
# Priority Setting
**.host[*].transportScheme.unschedPrioResolutionMode = "${unschedPrioResolutionMode = STATIC_CBF_GRADUATED}"
**.host[*].transportScheme.unschedPrioResolutionMode = "STATIC_CBF_GRADUATED"
**.host[*].transportScheme.prioLevels = 8
**.host[*].transportScheme.adaptiveSchedPrioLevels = 2
**.host[*].transportScheme.numSendersToKeepGranted = 2
**.host[*].transportScheme.prioResolverPrioLevels = 8 - 2
# Possible values 1.0/2.0, 2.0/3.0, 4.0/3.0. Lower number, mean higher priorities carry more traffic
**.host[*].transportScheme.unschedPrioUsageWeight = ${unschedPrioUsageWeight = 1}
**.host[*].transportScheme.defaultReqBytes = ${defaultReqBytes = 1442 }B
**.host[*].transportScheme.defaultUnschedBytes = ${defaultUnschedBytes = 7886 }B
**.host[*].transportScheme.cbfCapMsgSize = "${cbfCapMsgSize = $RTT }"
**.host[*].transportScheme.boostTailBytesPrio = "${boostTailBytesPrio = $RTT }"
**.host[*].transportScheme.senderScheme = "${senderScheme = SRBF}" #Possible values: OBSERVE_PKT_PRIOS, SRBF
**.host[*].transportScheme.accountForGrantTraffic = ${accountForGrantTraffic = true}
**.host[*].transportScheme.linkCheckBytes = ${linkCheckBytes = 1600}B
**.host[*].transportScheme.unschedPrioUsageWeight = 1
**.host[*].transportScheme.defaultReqBytes = 1442B
**.host[*].transportScheme.defaultUnschedBytes = 7886B
**.host[*].transportScheme.cbfCapMsgSize = "0x2710"
**.host[*].transportScheme.boostTailBytesPrio = "0x2710"
**.host[*].transportScheme.senderScheme = "SRBF" #Possible values: OBSERVE_PKT_PRIOS, SRBF
**.host[*].transportScheme.accountForGrantTraffic = true
**.host[*].transportScheme.linkCheckBytes = 1600B
**.host[*].transportScheme.localPort = 2222
**.host[*].transportScheme.destPort = 2222
**.eth[*].**.transportType = "HomaTransport"
#**.eth[*].**.transportType = "HomaTransport"
[Config TestWorkloadSynthesizer]
dcn.numServersPerTor = 4
dcn.numTors = 1
#dcn.numServersPerTor = 4
#dcn.numTors = 1
dcn.fabricLinkSpeed = 40Gbps
dcn.nicLinkSpeed = 10Gbps
dcn.edgeLinkDelay = 0.0us
......@@ -43,10 +48,10 @@ dcn.switchFixDelay = 0.25us
dcn.isFabricCutThrough = false
*.host[*].numTrafficGeneratorApp = 1
**.realLoadFactor = 0.3
**.host[*].**.workloadType = "${workloadType = FACEBOOK_KEY_VALUE}"
**.host[*].app[*].msgSizeRanges = "${msgSizeRanges =1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 20 22 25 28 31 35 39 44 49 55 61 68 76 85 95 107 119 133 149 167 186 208 233 260 291 325 364 406 454 508 568 635 710 794 887 992 1109 1240 1386 1550 1733 1937 2166 2421 2707 3027 3384 3783 4229 4729 5286 5910 6608 7388 8259 9234 10324 11542 12904 16129 25198 49208 96093 293173 572511 1000000}"
**.host[*].app[*].loadFactor = ${loadFactor = 0.3*.657}
**.host[*].app[*].interArrivalDist = "${interArrivalDist = exponential}"
**.host[*].**.workloadType = "FACEBOOK_KEY_VALUE"
**.host[*].app[*].msgSizeRanges = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 20 22 25 28 31 35 39 44 49 55 61 68 76 85 95 107 119 133 149 167 186 208 233 260 291 325 364 406 454 508 568 635 710 794 887 992 1109 1240 1386 1550 1733 1937 2166 2421 2707 3027 3384 3783 4229 4729 5286 5910 6608 7388 8259 9234 10324 11542 12904 16129 25198 49208 96093 293173 572511 1000000"
**.host[*].app[*].loadFactor = 0.3*.657
**.host[*].app[*].interArrivalDist = "exponential"
**.host[*].app[*].startTime = 0s
**.host[*].app[*].stopTime = 6s
[Config TestPriorityTag]
......
......@@ -27,10 +27,10 @@ namespace inet {
Define_Module(WorkloadSynthesizer);
simsignal_t WorkloadSynthesizer::sentMsgSignal = registerSignal("sentMsg");
simsignal_t WorkloadSynthesizer::rcvdMsgSignal = registerSignal("rcvdMsg");
simsignal_t WorkloadSynthesizer::msgE2EDelaySignal = registerSignal("msgE2EDelay");
simsignal_t WorkloadSynthesizer::mesgStatsSignal = registerSignal("mesgStats");
//simsignal_t WorkloadSynthesizer::sentMsgSignal = registerSignal("sentMsg");
//simsignal_t WorkloadSynthesizer::rcvdMsgSignal = registerSignal("rcvdMsg");
//simsignal_t WorkloadSynthesizer::msgE2EDelaySignal = registerSignal("msgE2EDelay");
//simsignal_t WorkloadSynthesizer::mesgStatsSignal = registerSignal("mesgStats");
WorkloadSynthesizer::WorkloadSynthesizer()
{
......@@ -45,6 +45,8 @@ WorkloadSynthesizer::WorkloadSynthesizer()
const auto& payload = makeShared<HomaPkt>();
payload->setPktType(PktType::UNSCHED_DATA);
maxDataBytesPerPkt = maxDataBytesPerEthFrame - HomaPktHelper::getHeaderSize(payload);
cout<<"WorkloadSynthesizer constructor Finished."<<endl;
}
......@@ -150,7 +152,7 @@ void WorkloadSynthesizer::initialize(int stage)
// Setup templated statistics ans signals
const char* msgSizeRanges = par("msgSizeRanges").stringValue();
registerTemplatedStats(msgSizeRanges);
//registerTemplatedStats(msgSizeRanges);
// Find host id for parent host module of this app
cModule* parentHost = this->getParentModule();
......@@ -278,6 +280,7 @@ void WorkloadSynthesizer::initialize(int stage)
numReceived = 0;
WATCH(numSent);
WATCH(numReceived);
cout<<"WorkloadSynthesizer initialize() Finished."<<endl;
}
}
......@@ -358,6 +361,7 @@ void WorkloadSynthesizer::parseAndProcessXMLConfig()
void
WorkloadSynthesizer::handleMessageWhenUp(cMessage *msg)
{
cout<<"Run into handleMesageWhenUp"<<endl;
if (msg->isSelfMessage()) {
ASSERT(msg == selfMsg);
switch(msg->getKind()) {
......@@ -419,7 +423,7 @@ WorkloadSynthesizer::sendMsg()
payload->setMsgCreationTime(simTime());
payload->setTransportSchedDelay(simTime());
packet->insertAtBack(payload);
emit(sentMsgSignal, packet);
//emit(sentMsgSignal, packet);
send(packet, "transportOut");
numSent++;
}
......@@ -427,17 +431,19 @@ WorkloadSynthesizer::sendMsg()
void
WorkloadSynthesizer::processStart()
{
cout<<"Run into processStart"<<endl;
// set srcAddress. The assumption here is that each host has only one
// non-loopback interface and the IP of that interface is srcAddress.
inet::InterfaceTable* ifaceTable =
check_and_cast<inet::InterfaceTable*>(
getModuleByPath(par("interfaceTableModule").stringValue()));
inet::NetworkInterface* srcIface = nullptr;
auto srcIPv4Data = srcIface->findProtocolData<inet::Ipv4InterfaceData>();
InterfaceTable* ifaceTable =
check_and_cast<inet::InterfaceTable*>( getModuleByPath(par("interfaceTableModule").stringValue()) );
cout<<ifaceTable->getFullPath()<<endl;
NetworkInterface* srcIface = nullptr;
const Ipv4InterfaceData* srcIPv4Data =nullptr;
// auto srcIPv4Data = srcIface->findProtocolData<inet::Ipv4InterfaceData>();
for (int i=0; i < ifaceTable->getNumInterfaces(); i++) {
if ( (srcIface = ifaceTable->getInterface(i))
&& !srcIface->isLoopback()
&& srcIPv4Data ) {
&& (srcIPv4Data = srcIface->findProtocolData<inet::Ipv4InterfaceData>())) {
break;
}
}
......@@ -446,8 +452,10 @@ WorkloadSynthesizer::processStart()
} else if (!srcIPv4Data) {
throw cRuntimeError("Can't find an interface with IPv4 address");
}
srcAddress = inet::L3Address(srcIPv4Data->getIPAddress());
srcAddress = L3Address(srcIPv4Data->getIPAddress());
cout<<srcAddress.str()<<endl;
// call parseXml to complete intialization based on the config.xml file
parseAndProcessXMLConfig();
......@@ -479,6 +487,7 @@ WorkloadSynthesizer::processSend()
void
WorkloadSynthesizer::setupNextSend()
{
cout<<"Run into setupNextSend."<<endl;
double nextSendInterval;
msgSizeGenerator->getSizeAndInterarrival(sendMsgSize, nextDestHostId, nextSendInterval);
simtime_t nextSendTime = nextSendInterval + simTime();
......@@ -496,10 +505,10 @@ WorkloadSynthesizer::processRcvdMsg(Packet* pk)
{
//AppMessage* rcvdMsg = check_and_cast<AppMessage*>(msg);
ASSERT(pk);
emit(rcvdMsgSignal, pk);
//emit(rcvdMsgSignal, pk);
auto rcvdMsg = pk->peekAtFront<AppMessage>();
simtime_t completionTime = simTime() - rcvdMsg->getMsgCreationTime();
emit(msgE2EDelaySignal, completionTime);
// emit(msgE2EDelaySignal, completionTime);
uint64_t msgByteLen = (uint64_t)(B(rcvdMsg->getChunkLength()).get());
EV_INFO << "Received a message of length " << msgByteLen
......@@ -549,7 +558,7 @@ WorkloadSynthesizer::processRcvdMsg(Packet* pk)
mesgStats.stretch = stretchFactor;
mesgStats.queuingDelay = queuingDelay;
mesgStats.transportSchedDelay = rcvdMsg->getTransportSchedDelay();
emit(mesgStatsSignal, &mesgStats);
// emit(mesgStatsSignal, &mesgStats);
delete pk;
numReceived++;
......
......@@ -96,6 +96,8 @@ HomaTransport::~HomaTransport()
delete prioResolver;
delete distEstimator;
delete homaConfig;
cancelAndDelete(sendTimer);
cancelAndDelete(emitSignalTimer);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment