diff --git a/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/devtuner.py b/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/devtuner.py
index 624800aa9b3b70d6d6717753c0c2b7c7c2d0c23b..64f589c80b74a251b3a17d2f13116e04e4a689cc 100644
--- a/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/devtuner.py
+++ b/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/devtuner.py
@@ -93,6 +93,7 @@ class DevTuner(MeasurementInterface):
     self.process = subprocess.Popen([run_cmd, str(runs)], stdout = FNULL)
 
 
+    
   def signalPipe(self):
 
       fifo = open("/tmp/opentuner_fifo", "w")
@@ -102,20 +103,24 @@ class DevTuner(MeasurementInterface):
 
 
 
-
   def pollOnProcess(self, self2):
 
     print (" self.piped_execution = ", self.piped_execution, "*** \n")
     sleep(5)
     
-    while (1):
+    while (not self.escape_poll_thread):
       poll = self.process.poll()
       #print ("POLLING")
         
       if poll is not None:  # If process aborted, invoke another instance
-        self.corrupted_run = True
-        self.invokeBinary(100000)
-        self.signalPipe()
+        sleep(6)
+        
+        poll = self.process.poll()
+        if not utils.check_pid(self.process.pid) and poll is not None: # Second check for process existence
+          self.corrupted_run = True
+          utils.process_kill(self.process.pid) # Kill existing process if exists
+          self.invokeBinary(100000)
+          self.signalPipe()
         
       
   
@@ -145,6 +150,7 @@ class DevTuner(MeasurementInterface):
     # Adding knob to use piped execution instead
     self.piped_execution = True
     self.corrupted_run = False
+    self.escape_poll_thread = False
     
     objective = ThresholdAccuracyMinimizeTime(self.tunerData.accuracy_threshold)
     input_manager = FixedInputManager(size=self.tunerData.num_layers)
@@ -251,6 +257,8 @@ class DevTuner(MeasurementInterface):
 
   def save_final_config(self, configuration):
 
+    # Indication to terminate polling thread
+    self.escape_poll_thread = True  
 
     if self.piped_execution:
       #self.stopProcess()
@@ -260,7 +268,7 @@ class DevTuner(MeasurementInterface):
     print "Final configuration", configuration.data
 
     print "Done with Autotuning Run \n"
-    sleep(6)
+    sleep(4)
 
     return
 
diff --git a/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/utils.py b/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/utils.py
index 50f780eceada4abd79aa9ec214e85b18f68b64bf..bcad381ff178928ae62b6fc3b610301ccd48d5f8 100644
--- a/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/utils.py
+++ b/llvm/projects/hpvm-tensor-rt/autotuner/opentuner/autotuner/utils.py
@@ -1,6 +1,9 @@
 
 
 import psutil
+from time import sleep
+import os
+
 
 
 def readCostFile(cost_file_path):
@@ -119,11 +122,36 @@ def addInfoToOutFile(f_path, accuracy, total_runs, total_comps, speedup):
     
 
 
+def check_pid(pid):
+
+    """ Check For the existence of a unix pid. """
+    try:
+        os.kill(pid, 0)
+    except OSError:
+        return False
+    else:
+        return True
+                    
+                
 
 def process_kill(proc_pid):
+
+  if not check_pid(proc_pid):
+    return # Return if process does not exist    
+    
   process = psutil.Process(proc_pid)
-  for proc in process.children(recursive=True):
-    proc.kill()
-  process.kill()
-      
- 
+
+  try:
+    for proc in process.children(recursive=True):
+      proc.kill()
+    process.kill()
+
+    print ("\n\n\n\n\n\ %%%%% Killed Process \n\n\n\n")
+    
+  except:
+    print ("\n\n\n\n PROCESS NOT KILLED ------- \n\n\n\n\n\n\n")
+
+  #sleep(20)  
+
+
+