mtp: Add tests for the hybrid simulator
This commit is contained in:
@@ -68,8 +68,6 @@ NS_LOG_COMPONENT_DEFINE("SimpleHybrid");
|
|||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
LogComponentEnable("LogicalProcess", LOG_LEVEL_INFO);
|
|
||||||
|
|
||||||
bool nix = true;
|
bool nix = true;
|
||||||
bool tracing = false;
|
bool tracing = false;
|
||||||
bool testing = false;
|
bool testing = false;
|
||||||
@@ -216,7 +214,7 @@ main(int argc, char* argv[])
|
|||||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tracing == true)
|
if (tracing)
|
||||||
{
|
{
|
||||||
if (systemId == 0)
|
if (systemId == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
set(example_as_test_suite)
|
set(example_as_test_suite)
|
||||||
if(${ENABLE_EXAMPLES})
|
if(${ENABLE_EXAMPLES})
|
||||||
|
if(${ENABLE_MPI})
|
||||||
|
set(example_as_test_suite
|
||||||
|
test/hybrid-test-suite.cc
|
||||||
|
)
|
||||||
|
else()
|
||||||
set(example_as_test_suite
|
set(example_as_test_suite
|
||||||
test/mtp-test-suite.cc
|
test/mtp-test-suite.cc
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
build_lib(
|
build_lib(
|
||||||
|
|||||||
42
src/mtp/test/hybrid-fat-tree-incast.reflog
Normal file
42
src/mtp/test/hybrid-fat-tree-incast.reflog
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
- Setup the topology...
|
||||||
|
|
||||||
|
- Calculating routes...
|
||||||
|
Host NodeId System Address
|
||||||
|
0 20 0 10.0.0.1
|
||||||
|
1 21 0 10.0.0.3
|
||||||
|
2 22 0 10.0.1.1
|
||||||
|
3 23 0 10.0.1.3
|
||||||
|
4 24 1 10.1.0.1
|
||||||
|
5 25 1 10.1.0.3
|
||||||
|
6 26 1 10.1.1.1
|
||||||
|
7 27 1 10.1.1.3
|
||||||
|
8 28 0 10.2.0.1
|
||||||
|
9 29 0 10.2.0.3
|
||||||
|
10 30 0 10.2.1.1
|
||||||
|
11 31 0 10.2.1.3
|
||||||
|
12 32 1 10.3.0.1
|
||||||
|
13 33 1 10.3.0.3
|
||||||
|
14 34 1 10.3.1.1
|
||||||
|
15 35 1 10.3.1.3
|
||||||
|
|
||||||
|
- Generating traffic...
|
||||||
|
Expected data rate = 0.48Gbps
|
||||||
|
Generated data rate = 0.322004Gbps
|
||||||
|
Expected avg flow size = 1.71125MB
|
||||||
|
Generated avg flow size = 1.19742MB
|
||||||
|
Total flow count = 34
|
||||||
|
|
||||||
|
- Start simulation...
|
||||||
|
Progressed to 0.1s
|
||||||
|
Progressed to 0.2s
|
||||||
|
Progressed to 0.3s
|
||||||
|
Progressed to 0.4s
|
||||||
|
Progressed to 0.5s
|
||||||
|
Progressed to 0.6s
|
||||||
|
Progressed to 0.7s
|
||||||
|
Progressed to 0.8s
|
||||||
|
Progressed to 0.9s
|
||||||
|
|
||||||
|
- Done!
|
||||||
|
|
||||||
42
src/mtp/test/hybrid-fat-tree.reflog
Normal file
42
src/mtp/test/hybrid-fat-tree.reflog
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
- Setup the topology...
|
||||||
|
|
||||||
|
- Calculating routes...
|
||||||
|
Host NodeId System Address
|
||||||
|
0 20 0 10.0.0.1
|
||||||
|
1 21 0 10.0.0.3
|
||||||
|
2 22 0 10.0.1.1
|
||||||
|
3 23 0 10.0.1.3
|
||||||
|
4 24 1 10.1.0.1
|
||||||
|
5 25 1 10.1.0.3
|
||||||
|
6 26 1 10.1.1.1
|
||||||
|
7 27 1 10.1.1.3
|
||||||
|
8 28 0 10.2.0.1
|
||||||
|
9 29 0 10.2.0.3
|
||||||
|
10 30 0 10.2.1.1
|
||||||
|
11 31 0 10.2.1.3
|
||||||
|
12 32 1 10.3.0.1
|
||||||
|
13 33 1 10.3.0.3
|
||||||
|
14 34 1 10.3.1.1
|
||||||
|
15 35 1 10.3.1.3
|
||||||
|
|
||||||
|
- Generating traffic...
|
||||||
|
Expected data rate = 0.48Gbps
|
||||||
|
Generated data rate = 0.322004Gbps
|
||||||
|
Expected avg flow size = 1.71125MB
|
||||||
|
Generated avg flow size = 1.19742MB
|
||||||
|
Total flow count = 34
|
||||||
|
|
||||||
|
- Start simulation...
|
||||||
|
Progressed to 0.1s
|
||||||
|
Progressed to 0.2s
|
||||||
|
Progressed to 0.3s
|
||||||
|
Progressed to 0.4s
|
||||||
|
Progressed to 0.5s
|
||||||
|
Progressed to 0.6s
|
||||||
|
Progressed to 0.7s
|
||||||
|
Progressed to 0.8s
|
||||||
|
Progressed to 0.9s
|
||||||
|
|
||||||
|
- Done!
|
||||||
|
|
||||||
0
src/mtp/test/hybrid-simple.reflog
Normal file
0
src/mtp/test/hybrid-simple.reflog
Normal file
138
src/mtp/test/hybrid-test-suite.cc
Normal file
138
src/mtp/test/hybrid-test-suite.cc
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 State Key Laboratory for Novel Software Technology
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation;
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Author: Songyuan Bai <i@f5soft.site>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ns3/example-as-test.h"
|
||||||
|
#include "ns3/mpi-module.h"
|
||||||
|
#include "ns3/mtp-module.h"
|
||||||
|
#include "ns3/test.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace ns3;
|
||||||
|
|
||||||
|
class HybridTestCase : public ExampleAsTestCase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* \copydoc ns3::ExampleAsTestCase::ExampleAsTestCase
|
||||||
|
*
|
||||||
|
* \param [in] postCmd The post processing command
|
||||||
|
*/
|
||||||
|
HybridTestCase(const std::string name,
|
||||||
|
const std::string program,
|
||||||
|
const std::string dataDir,
|
||||||
|
const std::string args = "",
|
||||||
|
const std::string postCmd = "",
|
||||||
|
const bool shouldNotErr = true);
|
||||||
|
|
||||||
|
/** Destructor */
|
||||||
|
~HybridTestCase() override
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produce the `--command-template` argument
|
||||||
|
*
|
||||||
|
* \returns The `--command-template` string.
|
||||||
|
*/
|
||||||
|
std::string GetCommandTemplate() const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove time statistics
|
||||||
|
*
|
||||||
|
* \returns The post processing command
|
||||||
|
*/
|
||||||
|
std::string GetPostProcessingCommand() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** The post processing command. */
|
||||||
|
std::string m_postCmd;
|
||||||
|
};
|
||||||
|
|
||||||
|
HybridTestCase::HybridTestCase(const std::string name,
|
||||||
|
const std::string program,
|
||||||
|
const std::string dataDir,
|
||||||
|
const std::string args /* = "" */,
|
||||||
|
const std::string postCmd /* = "" */,
|
||||||
|
const bool shouldNotErr /* = true */)
|
||||||
|
: ExampleAsTestCase(name, program, dataDir, args, shouldNotErr),
|
||||||
|
m_postCmd(postCmd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
HybridTestCase::GetCommandTemplate() const
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "mpirun -np 2 %s " << m_args;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
HybridTestCase::GetPostProcessingCommand() const
|
||||||
|
{
|
||||||
|
std::string command(m_postCmd);
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
class HybridTestSuite : public TestSuite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* \copydoc MpiTestCase::MpiTestCase
|
||||||
|
*
|
||||||
|
* \param [in] duration Amount of time this test takes to execute
|
||||||
|
* (defaults to QUICK).
|
||||||
|
*/
|
||||||
|
HybridTestSuite(const std::string name,
|
||||||
|
const std::string program,
|
||||||
|
const std::string dataDir,
|
||||||
|
const std::string args = "",
|
||||||
|
const std::string postCmd = "",
|
||||||
|
const TestDuration duration = QUICK,
|
||||||
|
const bool shouldNotErr = true)
|
||||||
|
: TestSuite(name, EXAMPLE)
|
||||||
|
{
|
||||||
|
AddTestCase(new HybridTestCase(name, program, dataDir, args, postCmd, shouldNotErr),
|
||||||
|
duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // class HybridTestSuite
|
||||||
|
|
||||||
|
static HybridTestSuite g_hybridFatTree1("hybrid-fat-tree",
|
||||||
|
"fat-tree-hybrid",
|
||||||
|
NS_TEST_SOURCEDIR,
|
||||||
|
"--bandwidth=100Mbps --thread=2",
|
||||||
|
"| grep -v 'Simulation time' | grep -v 'Event count'",
|
||||||
|
TestCase::TestDuration::QUICK);
|
||||||
|
|
||||||
|
static HybridTestSuite g_hybridFatTree2("hybrid-fat-tree-incast",
|
||||||
|
"fat-tree-hybrid",
|
||||||
|
NS_TEST_SOURCEDIR,
|
||||||
|
"--bandwidth=100Mbps --incast=1 --thread=2",
|
||||||
|
"| grep -v 'Simulation time' | grep -v 'Event count'",
|
||||||
|
TestCase::TestDuration::QUICK);
|
||||||
|
|
||||||
|
static HybridTestSuite g_hybridSimple("hybrid-simple",
|
||||||
|
"simple-hybrid",
|
||||||
|
NS_TEST_SOURCEDIR,
|
||||||
|
""
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
TestCase::TestDuration::QUICK);
|
||||||
Reference in New Issue
Block a user