summaryrefslogtreecommitdiff
path: root/src/intersim2/main.cpp
diff options
context:
space:
mode:
authorDongdong Li <[email protected]>2013-11-22 11:31:19 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:50:59 -0700
commit3f74773ce1ffe8ed5044a103d84459b56d4e9c20 (patch)
treef7265582ead4f320b890fa744ac6af093b9e27e0 /src/intersim2/main.cpp
parent24f29469c042761d8b8d185c374493fbde79aca4 (diff)
Update with Booksim2.0 from Stanford
- Warning fixed - Unused file deleted - Add support for node map configuration. Code Review: Issue 93001 [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 17410]
Diffstat (limited to 'src/intersim2/main.cpp')
-rw-r--r--src/intersim2/main.cpp178
1 files changed, 90 insertions, 88 deletions
diff --git a/src/intersim2/main.cpp b/src/intersim2/main.cpp
index 9b43fff..1e92250 100644
--- a/src/intersim2/main.cpp
+++ b/src/intersim2/main.cpp
@@ -3,19 +3,19 @@
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
+
+ Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
@@ -23,7 +23,7 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+*/
/*main.cpp
*
@@ -55,6 +55,8 @@
#include "power_module.hpp"
#include "interconnect_interface.hpp"
+
+
///////////////////////////////////////////////////////////////////////////////
//Global declarations
//////////////////////
@@ -114,58 +116,58 @@ ostream * gWatchOut;
bool Simulate( BookSimConfig const & config )
{
- vector<Network *> net;
-
- int subnets = config.GetInt("subnets");
- /*To include a new network, must register the network here
- *add an else if statement with the name of the network
- */
- net.resize(subnets);
- for (int i = 0; i < subnets; ++i) {
- ostringstream name;
- name << "network_" << i;
- net[i] = Network::New( config, name.str() );
- }
-
- /*tcc and characterize are legacy
- *not sure how to use them
- */
-
- assert(trafficManager == NULL);
- trafficManager = TrafficManager::New( config, net ) ;
-
- /*Start the simulation run
- */
-
- double total_time; /* Amount of time we've run */
- struct timeval start_time, end_time; /* Time before/after user code */
- total_time = 0.0;
- gettimeofday(&start_time, NULL);
-
- bool result = trafficManager->Run() ;
-
-
- gettimeofday(&end_time, NULL);
- total_time = ((double)(end_time.tv_sec) + (double)(end_time.tv_usec)/1000000.0)
- - ((double)(start_time.tv_sec) + (double)(start_time.tv_usec)/1000000.0);
-
- cout<<"Total run time "<<total_time<<endl;
-
- for (int i=0; i<subnets; ++i) {
-
- ///Power analysis
- if(config.GetInt("sim_power") > 0){
- Power_Module pnet(net[i], config);
- pnet.run();
- }
-
- delete net[i];
+ vector<Network *> net;
+
+ int subnets = config.GetInt("subnets");
+ /*To include a new network, must register the network here
+ *add an else if statement with the name of the network
+ */
+ net.resize(subnets);
+ for (int i = 0; i < subnets; ++i) {
+ ostringstream name;
+ name << "network_" << i;
+ net[i] = Network::New( config, name.str() );
+ }
+
+ /*tcc and characterize are legacy
+ *not sure how to use them
+ */
+
+ assert(trafficManager == NULL);
+ trafficManager = TrafficManager::New( config, net ) ;
+
+ /*Start the simulation run
+ */
+
+ double total_time; /* Amount of time we've run */
+ struct timeval start_time, end_time; /* Time before/after user code */
+ total_time = 0.0;
+ gettimeofday(&start_time, NULL);
+
+ bool result = trafficManager->Run() ;
+
+
+ gettimeofday(&end_time, NULL);
+ total_time = ((double)(end_time.tv_sec) + (double)(end_time.tv_usec)/1000000.0)
+ - ((double)(start_time.tv_sec) + (double)(start_time.tv_usec)/1000000.0);
+
+ cout<<"Total run time "<<total_time<<endl;
+
+ for (int i=0; i<subnets; ++i) {
+
+ ///Power analysis
+ if(config.GetInt("sim_power") > 0){
+ Power_Module pnet(net[i], config);
+ pnet.run();
}
-
- delete trafficManager;
- trafficManager = NULL;
-
- return result;
+
+ delete net[i];
+ }
+
+ delete trafficManager;
+ trafficManager = NULL;
+
+ return result;
}
#ifdef CREATE_LIBRARY
@@ -173,37 +175,37 @@ bool Simulate( BookSimConfig const & config )
#else
int main( int argc, char **argv )
{
-
- BookSimConfig config;
-
-
- if ( !ParseArgs( &config, argc, argv ) ) {
- cerr << "Usage: " << argv[0] << " configfile... [param=value...]" << endl;
- return 0;
- }
-
-
- /*initialize routing, traffic, injection functions
- */
- InitializeRoutingMap( config );
-
- gPrintActivity = (config.GetInt("print_activity") > 0);
- gTrace = (config.GetInt("viewer_trace") > 0);
-
- string watch_out_file = config.GetStr( "watch_out" );
- if(watch_out_file == "") {
- gWatchOut = NULL;
- } else if(watch_out_file == "-") {
- gWatchOut = &cout;
- } else {
- gWatchOut = new ofstream(watch_out_file.c_str());
- }
-
-
- /*configure and run the simulator
- */
- bool result = Simulate( config );
- return result ? -1 : 0;
+
+ BookSimConfig config;
+
+
+ if ( !ParseArgs( &config, argc, argv ) ) {
+ cerr << "Usage: " << argv[0] << " configfile... [param=value...]" << endl;
+ return 0;
+ }
+
+
+ /*initialize routing, traffic, injection functions
+ */
+ InitializeRoutingMap( config );
+
+ gPrintActivity = (config.GetInt("print_activity") > 0);
+ gTrace = (config.GetInt("viewer_trace") > 0);
+
+ string watch_out_file = config.GetStr( "watch_out" );
+ if(watch_out_file == "") {
+ gWatchOut = NULL;
+ } else if(watch_out_file == "-") {
+ gWatchOut = &cout;
+ } else {
+ gWatchOut = new ofstream(watch_out_file.c_str());
+ }
+
+
+ /*configure and run the simulator
+ */
+ bool result = Simulate( config );
+ return result ? -1 : 0;
}
#endif