diff options
| author | Mahmoud <[email protected]> | 2019-05-31 13:22:29 -0400 |
|---|---|---|
| committer | Mahmoud <[email protected]> | 2019-05-31 13:22:29 -0400 |
| commit | 5d55ca32e2d81ee2c9187566050c5d399a142373 (patch) | |
| tree | 02d2990704307f79a140f9af62212d9c4d53c976 | |
| parent | ed9f0e6b2a99840e9649551825a40a04e236dcd9 (diff) | |
add new params to the global stryct and fixing some bugs
| -rw-r--r-- | libcuda/cuda_runtime_api.cc | 6 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.cc | 4 | ||||
| -rw-r--r-- | src/gpgpusim_entrypoint.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index 4990edf..3d85b62 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -421,7 +421,8 @@ struct _cuda_device_id *GPGPUSim_Init() prop->maxThreadsPerMultiProcessor = the_gpu->threads_per_core(); #endif the_gpu->set_prop(prop); - the_device = new _cuda_device_id(the_gpu); + GPGPUsim_ctx_ptr()->the_cude_device = new _cuda_device_id(the_gpu); + the_device = GPGPUsim_ctx_ptr()->the_cude_device; } start_sim_thread(1); return the_device; @@ -433,7 +434,8 @@ static CUctx_st* GPGPUSim_Context() CUctx_st *the_context = GPGPUsim_ctx_ptr()->the_context; if( the_context == NULL ) { _cuda_device_id *the_gpu = GPGPUSim_Init(); - the_context = new CUctx_st(the_gpu); + GPGPUsim_ctx_ptr()->the_context = new CUctx_st(the_gpu); + the_context = GPGPUsim_ctx_ptr()->the_context; } return the_context; } diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 6f19640..a557d6f 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -1131,7 +1131,7 @@ void gpgpu_sim::gpu_print_stat() time_t curr_time; time(&curr_time); - unsigned long long elapsed_time = MAX( curr_time - g_simulation_starttime, 1 ); + unsigned long long elapsed_time = MAX( curr_time - GPGPUsim_ctx_ptr()->g_simulation_starttime, 1 ); printf( "gpu_total_sim_rate=%u\n", (unsigned)( ( gpu_tot_sim_insn + gpu_sim_insn ) / elapsed_time ) ); //shader_print_l1_miss_stat( stdout ); @@ -1701,7 +1701,7 @@ void gpgpu_sim::cycle() time_t days, hrs, minutes, sec; time_t curr_time; time(&curr_time); - unsigned long long elapsed_time = MAX(curr_time - g_simulation_starttime, 1); + unsigned long long elapsed_time = MAX(curr_time - GPGPUsim_ctx_ptr()->g_simulation_starttime, 1); if ( (elapsed_time - last_liveness_message_time) >= m_config.liveness_message_freq && DTRACE(LIVENESS) ) { days = elapsed_time/(3600*24); hrs = elapsed_time/3600 - 24*days; diff --git a/src/gpgpusim_entrypoint.h b/src/gpgpusim_entrypoint.h index 2ad0fdf..406dd00 100644 --- a/src/gpgpusim_entrypoint.h +++ b/src/gpgpusim_entrypoint.h @@ -33,7 +33,7 @@ #include <semaphore.h> #include <time.h> -extern time_t g_simulation_starttime; +//extern time_t g_simulation_starttime; struct GPGPUsim_ctx { |
