summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gpgpusim_entrypoint.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc
index 04845e7..ad4587a 100644
--- a/src/gpgpusim_entrypoint.cc
+++ b/src/gpgpusim_entrypoint.cc
@@ -91,6 +91,7 @@ void *gpgpu_sim_thread_sequential(void*)
pthread_mutex_t g_sim_lock = PTHREAD_MUTEX_INITIALIZER;
bool g_sim_active = false;
bool g_sim_done = true;
+bool break_limit = false;
void *gpgpu_sim_thread_concurrent(void*)
{
@@ -144,11 +145,13 @@ void *gpgpu_sim_thread_concurrent(void*)
if(g_the_gpu->cycle_insn_cta_max_hit()){
g_stream_manager->stop_all_running_kernels();
g_sim_done = true;
+ break_limit = true;
}
}
active=g_the_gpu->active() || !g_stream_manager->empty_protected();
- } while( active );
+
+ } while( active && !g_sim_done);
if(g_debug_execution >= 3) {
printf("GPGPU-Sim: ** STOP simulation thread (no work) **\n");
fflush(stdout);
@@ -166,6 +169,11 @@ void *gpgpu_sim_thread_concurrent(void*)
printf("GPGPU-Sim: *** simulation thread exiting ***\n");
fflush(stdout);
}
+ if(break_limit) {
+ printf("GPGPU-Sim: ** break due to reaching the maximum cycles (or instructions) **\n");
+ exit(1);
+ }
+
sem_post(&g_sim_signal_exit);
return NULL;
}
@@ -179,7 +187,7 @@ void synchronize()
bool done = false;
do {
pthread_mutex_lock(&g_sim_lock);
- done = g_stream_manager->empty() && !g_sim_active;
+ done = ( g_stream_manager->empty() && !g_sim_active ) || g_sim_done;
pthread_mutex_unlock(&g_sim_lock);
} while (!done);
printf("GPGPU-Sim: detected inactive GPU simulation thread\n");