diff options
| author | Tayler Hetherington <[email protected]> | 2015-06-05 14:49:14 -0700 |
|---|---|---|
| committer | Tayler Hetherington <[email protected]> | 2015-06-05 14:49:14 -0700 |
| commit | 07b1e93f19bef20a9e35fcfc48b091fa36d56d1b (patch) | |
| tree | 0f8fa652aab482ae0487465f5c0ad34b16b7ae99 /src/stream_manager.cc | |
| parent | 3ab52d670fbe4fc79eeba1c9a0061dba69fad3b5 (diff) | |
Fixing bug with max cycle/instruction/cta + bug with C++ name de-mangling with spaces (e.g., using templates)
Diffstat (limited to 'src/stream_manager.cc')
| -rw-r--r-- | src/stream_manager.cc | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/src/stream_manager.cc b/src/stream_manager.cc index 07cd44a..dd42f0a 100644 --- a/src/stream_manager.cc +++ b/src/stream_manager.cc @@ -223,19 +223,38 @@ bool stream_manager::register_finished_kernel(unsigned grid_uid) { // called by gpu simulation thread if(grid_uid > 0){ - CUstream_st *stream = m_grid_id_to_stream[grid_uid]; - kernel_info_t *kernel = stream->front().get_kernel(); - assert( grid_uid == kernel->get_uid() ); - stream->record_next_done(); - m_grid_id_to_stream.erase(grid_uid); - delete kernel; - return true; + CUstream_st *stream = m_grid_id_to_stream[grid_uid]; + kernel_info_t *kernel = stream->front().get_kernel(); + assert( grid_uid == kernel->get_uid() ); + stream->record_next_done(); + m_grid_id_to_stream.erase(grid_uid); + delete kernel; + return true; }else{ return false; } return false; } +void stream_manager::stop_all_running_kernels(){ + pthread_mutex_lock(&m_lock); + + // Signal m_gpu to stop all running kernels + m_gpu->stop_all_running_kernels(); + + // Clean up all streams waiting on running kernels + int count=0; + while(check_finished_kernel()){ + count++; + } + + // If any kernels completed, print out the current stats + if(count > 0) + m_gpu->print_stats(); + + pthread_mutex_unlock(&m_lock); +} + stream_operation stream_manager::front() { // called by gpu simulation thread @@ -366,11 +385,19 @@ void stream_manager::push( stream_operation op ) }; pthread_mutex_lock(&m_lock); - if( stream && !m_cuda_launch_blocking ) { - stream->push(op); - } else { - op.set_stream(&m_stream_zero); - m_stream_zero.push(op); + if(!m_gpu->cycle_insn_cta_max_hit()) { + // Accept the stream operation if the maximum cycle/instruction/cta counts are not triggered + if( stream && !m_cuda_launch_blocking ) { + stream->push(op); + } else { + op.set_stream(&m_stream_zero); + m_stream_zero.push(op); + } + }else { + // Otherwise, ignore operation and continue + printf("GPGPU-Sim API: Maximum cycle, instruction, or CTA count hit. Skipping:"); + op.print(stdout); + printf("\n"); } if(g_debug_execution >= 3) print_impl(stdout); |
