diff options
| author | Wilson Fung <[email protected]> | 2013-01-26 13:50:40 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:49:24 -0700 |
| commit | 8d8fa45b0fa6bc3afcb65463890c38d1c9255ec0 (patch) | |
| tree | b656b84fc3623a20e17c8b9620111cbd231ccf62 | |
| parent | b3de117ec61c3b59dc386562dc821fed6627e38b (diff) | |
Now even the power model log will have kernel names printed out.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 15110]
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.cc | 43 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.h | 3 | ||||
| -rw-r--r-- | src/gpuwattch/gpgpu_sim_wrapper.cc | 3 | ||||
| -rw-r--r-- | src/gpuwattch/gpgpu_sim_wrapper.h | 2 |
4 files changed, 34 insertions, 17 deletions
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 2eab0b9..ff5427a 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -70,6 +70,9 @@ class gpgpu_sim_wrapper {}; #include <stdio.h> #include <string.h> +#include <iostream> +#include <sstream> +#include <string> #define MAX(a,b) (((a)>(b))?(a):(b)) @@ -712,23 +715,37 @@ void gpgpu_sim::deadlock_check() } } -void gpgpu_sim::gpu_print_stat() -{ - FILE *statfout = stdout; +/// printing the names and uids of a set of executed kernels (usually there is only one) +std::string gpgpu_sim::executed_kernel_info_string() +{ + std::stringstream statout; - // printing the names and uids of a set of executed kernels (usually there is only one) - fprintf(statfout, "kernel_name = "); + statout << "kernel_name = "; for (unsigned int k = 0; k < m_executed_kernel_names.size(); k++) { - fprintf(statfout, "'%s' ", m_executed_kernel_names[k].c_str()); + statout << m_executed_kernel_names[k] << " "; } - fprintf(statfout, "\n"); - fprintf(statfout, "kernel_launch_uid = "); + statout << std::endl; + statout << "kernel_launch_uid = "; for (unsigned int k = 0; k < m_executed_kernel_uids.size(); k++) { - fprintf(statfout, "%d ", m_executed_kernel_uids[k]); + statout << m_executed_kernel_uids[k] << " "; } - fprintf(statfout, "\n"); + statout << std::endl; + + return statout.str(); +} + +void gpgpu_sim::clear_executed_kernel_info() +{ m_executed_kernel_names.clear(); m_executed_kernel_uids.clear(); +} + +void gpgpu_sim::gpu_print_stat() +{ + FILE *statfout = stdout; + + std::string kernel_info_str = executed_kernel_info_string(); + fprintf(statfout, "%s", kernel_info_str.c_str()); printf("gpu_sim_cycle = %lld\n", gpu_sim_cycle); printf("gpu_sim_insn = %lld\n", gpu_sim_insn); @@ -754,7 +771,7 @@ void gpgpu_sim::gpu_print_stat() m_shader_stats->print(stdout); #ifdef GPGPUSIM_POWER_MODEL if(m_config.g_power_simulation_enabled){ - m_gpgpusim_wrapper->print_power_kernel_stats(gpu_sim_cycle,gpu_tot_sim_cycle,gpu_tot_sim_insn + gpu_sim_insn ); + m_gpgpusim_wrapper->print_power_kernel_stats(gpu_sim_cycle, gpu_tot_sim_cycle, gpu_tot_sim_insn + gpu_sim_insn, kernel_info_str ); } #endif @@ -800,9 +817,7 @@ void gpgpu_sim::gpu_print_stat() time_vector_print(); fflush(stdout); - - - + clear_executed_kernel_info(); } diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h index 93b7b0c..c04c1c1 100644 --- a/src/gpgpu-sim/gpu-sim.h +++ b/src/gpgpu-sim/gpu-sim.h @@ -459,7 +459,8 @@ private: std::vector<std::string> m_executed_kernel_names; //< names of kernel for stat printout std::vector<unsigned> m_executed_kernel_uids; //< uids of kernel launches for stat printout - + std::string executed_kernel_info_string(); //< format the kernel information into a string for stat printout + void clear_executed_kernel_info(); //< clear the kernel information after stat printout public: unsigned long long gpu_sim_insn; diff --git a/src/gpuwattch/gpgpu_sim_wrapper.cc b/src/gpuwattch/gpgpu_sim_wrapper.cc index 22d0659..3bee7b0 100644 --- a/src/gpuwattch/gpgpu_sim_wrapper.cc +++ b/src/gpuwattch/gpgpu_sim_wrapper.cc @@ -586,10 +586,11 @@ void gpgpu_sim_wrapper::compute() { proc->compute(); } -void gpgpu_sim_wrapper::print_power_kernel_stats(double gpu_sim_cycle, double gpu_tot_sim_cycle, double init_value) +void gpgpu_sim_wrapper::print_power_kernel_stats(double gpu_sim_cycle, double gpu_tot_sim_cycle, double init_value, const std::string & kernel_info_string) { detect_print_steady_state(1,init_value); if(g_power_simulation_enabled){ + powerfile<<kernel_info_string<<std::endl; powerfile<<"Kernel Average Power Data:"<<std::endl; powerfile<<"gpu_avg_power = "<< gpu_avg_power/ count<<std::endl; diff --git a/src/gpuwattch/gpgpu_sim_wrapper.h b/src/gpuwattch/gpgpu_sim_wrapper.h index 97cffd3..0d9d546 100644 --- a/src/gpuwattch/gpgpu_sim_wrapper.h +++ b/src/gpuwattch/gpgpu_sim_wrapper.h @@ -61,7 +61,7 @@ public: void print_trace_files(); void update_components_power(); void update_coefficients(); - void print_power_kernel_stats(double gpu_sim_cycle, double gpu_tot_sim_cycle, double init_value); + void print_power_kernel_stats(double gpu_sim_cycle, double gpu_tot_sim_cycle, double init_value, const std::string & kernel_info_string); void power_metrics_calculations(); void set_inst_power(bool clk_gated_lanes, double tot_cycles, double busy_cycles, double tot_inst, double int_inst, double fp_inst, double load_inst, double store_inst, double committed_inst); void set_regfile_power(double reads, double writes, double ops); |
