summaryrefslogtreecommitdiff
path: root/src/gpuwattch/gpgpu_sim_wrapper.cc
diff options
context:
space:
mode:
authorAhmed El-Shafiey <[email protected]>2012-12-19 06:52:31 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:49:23 -0700
commit7c67c73a642794e2f95cb9b7f5b8377363adc0f2 (patch)
tree7bf867e60550a888480a5ae613019de76ec272f1 /src/gpuwattch/gpgpu_sim_wrapper.cc
parentecdbb77acbbc8613aefa2f2e5408ff3a6bf84865 (diff)
fixig more valgrind errors in CACTI due to uinitialized variables + fixing a bug in the interconect stats (initializing the n_mem_to_simt metric to zero)
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 14843]
Diffstat (limited to 'src/gpuwattch/gpgpu_sim_wrapper.cc')
-rw-r--r--src/gpuwattch/gpgpu_sim_wrapper.cc61
1 files changed, 36 insertions, 25 deletions
diff --git a/src/gpuwattch/gpgpu_sim_wrapper.cc b/src/gpuwattch/gpgpu_sim_wrapper.cc
index 1b06e26..cf658cd 100644
--- a/src/gpuwattch/gpgpu_sim_wrapper.cc
+++ b/src/gpuwattch/gpgpu_sim_wrapper.cc
@@ -94,7 +94,7 @@ enum pwr_cmp_t {
};
-gpgpu_sim_wrapper::gpgpu_sim_wrapper() {
+gpgpu_sim_wrapper::gpgpu_sim_wrapper( char* xmlfile) {
count=0;
gcount=0;
@@ -120,13 +120,44 @@ gpgpu_sim_wrapper::gpgpu_sim_wrapper() {
const_dynamic_power=0;
gpu_min_power=0;
gpu_tot_min_power=0;
+ proc_power=0;
+ g_power_filename = NULL;
+ g_power_trace_filename = NULL;
+ g_metric_trace_filename = NULL;
+ g_steady_state_tracking_filename = NULL;
+ xml_filename= xmlfile;
+ g_power_simulation_enabled= false;
+ g_power_trace_enabled= false;
+ g_steady_power_levels_enabled= false;
+ g_power_trace_zlevel= 0;
+ g_power_per_cycle_dump= false;
+ gpu_steady_power_deviation= 0;
+ gpu_steady_min_period= 0;
+
+ gpu_stat_sample_freq=0;
+ p=new ParseXML();
+ p->parse(xml_filename);
+ proc = new Processor(p);
+ power_trace_file = NULL;
+ metric_trace_file = NULL;
+ steady_state_tacking_file = NULL;
+ has_written_avg=false;
+ init_inst_val=false;
}
gpgpu_sim_wrapper::~gpgpu_sim_wrapper() { }
+bool gpgpu_sim_wrapper::sanity_check(double a, double b)
+{
+ if (b == 0)
+ return (abs(a-b)<0.00001);
+ else
+ return (abs(a-b)/abs(b)<0.00001);
+ return false;
+}
void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* power_trace_filename,char* metric_trace_filename,
char * steady_state_filename, bool power_sim_enabled,bool trace_enabled,
bool steady_state_enabled,bool power_per_cycle_dump,double steady_power_deviation,
@@ -138,12 +169,6 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow
gpu_max_power=0;
pavg=0;
- pwr_cmp_avg=(double *)calloc(100,sizeof(double));
- pwr_cmp_min=(double *)calloc(100,sizeof(double));
- pwr_cmp_max=(double *)calloc(100,sizeof(double));
- perf_count_avg=(double *)calloc(100,sizeof(double));
- perf_count_min=(double *)calloc(100,sizeof(double));
- perf_count_max=(double *)calloc(100,sizeof(double));
gpu_min_power=0;
static bool mcpat_init=true;
@@ -176,10 +201,6 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow
gpu_stat_sample_freq=stat_sample_freq;
-
- p=new ParseXML();
- p->parse(xml_filename);
- proc = new Processor(p);
//p->sys.total_cycles=gpu_stat_sample_freq*4;
p->sys.total_cycles=gpu_stat_sample_freq;
power_trace_file = NULL;
@@ -382,21 +403,8 @@ void gpgpu_sim_wrapper::set_NoC_power(double noc_tot_reads,double noc_tot_writes
{
p->sys.NoC[0].total_accesses = noc_tot_reads * p->sys.scaling_coefficients[NOC_A] + noc_tot_writes * p->sys.scaling_coefficients[NOC_A];
perf_count[NOC_A]=noc_tot_reads+noc_tot_writes;
-
-
}
-bool gpgpu_sim_wrapper::sanity_check(double a, double b)
-{
- if (b == 0)
- return (abs(a-b)<0.00001);
- else if(abs(a-b)/abs(b)<0.00001) {
- return true;
- }
-
- printf("a = %f, b = %f a-b = %f\n", a,b,a-b);
- return false;
-}
void gpgpu_sim_wrapper::power_metrics_calculations()
{
@@ -591,6 +599,7 @@ void gpgpu_sim_wrapper::update_components_power()
pwr_cmp[IDLE_COREP]=proc->cores[0]->IdleCoreEnergy/(proc->cores[0]->executionTime);
//this constant dynamic part is estimated via regression model
+ pwr_cmp[CONST_DYNAMICP]=0;
pwr_cmp[CONST_DYNAMICP]=p->sys.scaling_coefficients[CONST_DYNAMICN]-proc->get_const_dynamic_power()/(proc->cores[0]->executionTime);
pwr_cmp[CONST_DYNAMICP]= (pwr_cmp[CONST_DYNAMICP]>0)? pwr_cmp[CONST_DYNAMICP]:0;
@@ -600,7 +609,9 @@ void gpgpu_sim_wrapper::update_components_power()
for(unsigned i=0; i<num_pwr_cmps; i++){
sum_pwr_cmp+=pwr_cmp[i];
}
- assert("Total Power does not equal the sum of the components\n" && sanity_check(sum_pwr_cmp,proc_power));
+ bool check=false;
+ check=sanity_check(sum_pwr_cmp,proc_power);
+ assert("Total Power does not equal the sum of the components\n" && (check));
}