original_docstring: 
          This function implements the GPU version of the RANSAC plane fitting
          algorithm. This routine calls two separate CUDA kernels. The first
          kernel generates a matrix of constants corresponding to the plane. The
          second kernel then determine which set of points generates the optimal
          fit for the point cloud.
          
docstring: This function implements the GPU version of the RANSAC plane fitting
  algorithm. This routine calls two separate CUDA kernels. The first
  kernel generates a matrix of constants corresponding to the plane. The
  second kernel then determine which set of points generates the optimal
  fit for the point cloud.
docstring_tokens: This function implements the GPU version of the RANSAC plane fitting algorithm . This routine calls two separate CUDA kernels . The first kernel generates a matrix of constants corresponding to the plane . The second kernel then determine which set of points generates the optimal fit for the point cloud .
code: def gpu(self,x_eval=None,y_eval=None,do_time_gpu=True,debug=True):
          """
          This function implements the GPU version of the RANSAC plane fitting
          algorithm. This routine calls two separate CUDA kernels. The first
          kernel generates a matrix of constants corresponding to the plane. The
          second kernel then determine which set of points generates the optimal
          fit for the point cloud.
          """
          print("Running GPU Version")
  
          # Assign the Local Data (If applicable)
          if x_eval is not None: self.x_eval = x_eval
          if y_eval is not None: self.y_eval = y_eval
          if debug: print("X_eval Shape",self.x_eval.shape)
          if debug: print("Y_eval Shape",self.y_eval.shape)
  
          if do_time_gpu:
              gpu_timer = my_timer.MyTimer()
              gpu_timer.start()
  
  
          # Explicitly Create Numbas Types for the DEVICE
          plane_constants = np.zeros((self.num_iters,5))
          count_constants = np.zeros((self.num_iters,1))
          d_plane_constants = cuda.to_device(plane_constants)
          d_count_constants = cuda.to_device(count_constants)
          d_x_eval = cuda.to_device(self.x_eval)#,dtype=float32)
          d_y_eval = cuda.to_device(self.y_eval)#,dtype=int32)
  
          # Set up the Kernel
          # threadsperblock = (int(np.sqrt(self.tpb)), int(np.sqrt(self.tpb)))
          threadsperblock = (self.tpb, 1)
          print("Threads Per Block",threadsperblock)
          blockspergrid_x = math.ceil(self.num_iters / threadsperblock[0])
          blockspergrid_y = 1
          blockspergrid = (blockspergrid_x, blockspergrid_y)
          print("Blocks Per Grid",blockspergrid)
  
          # Seed the Random Number Generator for the Kernel
          # rng_states = create_xoroshiro128p_states(threadsperblock * blockspergrid_x, seed=1)
          # rng_states=1
          # if debug: print(rng_states)
          if do_time_gpu: print("GPU Setup Time:",gpu_timer.lap())
  
          # Launch the Kernel 1
          print("Launching GPU Kernel 1")
          kernelRANSAC_1[blockspergrid,threadsperblock](d_x_eval,d_plane_constants,RNG_STATES)
  
          # Set up Kernel 2
          threadsperblock = (int(np.sqrt(self.tpb)), int(np.sqrt(self.tpb)))
          print("Threads Per Block",threadsperblock)
          blockspergrid_y = math.ceil(self.x_train.shape[0] / threadsperblock[1])
          # blockspergrid_y = math.ceil(self.x_train.shape[1] / threadsperblock[1])
          blockspergrid = (blockspergrid_x, blockspergrid_y)
          print("Blocks Per Grid",blockspergrid)
  
          # Launch the Kernel 2
          print("Launching GPU Kernel 2")
          kernelRANSAC_2[blockspergrid,threadsperblock](d_x_eval,d_plane_constants,self.dist_thresh,d_count_constants)
  
          # Copy back to the host
          plane_constants = d_plane_constants.copy_to_host()
          count_constants = d_count_constants.copy_to_host()
  
          # Determine the best constants
          if debug: print(np.argmax(count_constants[:,0]))
          constants_best = plane_constants[np.argmax(count_constants[:,0]),0:-1]
  
          if do_time_gpu: print("GPU Runtime Time:",gpu_timer.lap())
  
  
          if debug:
              # Write Labels to CSV File for Analysis
              self.io.saveCSV(plane_constants,"ransac-plane_constants.csv")
              self.io.saveCSV(count_constants,"ransac-count_constants.csv")
  
          return constants_best
code_tokens: def gpu ( self , x_eval = None , y_eval = None , do_time_gpu = True , debug = True ) : print ( "Running GPU Version" ) if x_eval is not None : self . x_eval = x_eval if y_eval is not None : self . y_eval = y_eval if debug : print ( "X_eval Shape" , self . x_eval . shape ) if debug : print ( "Y_eval Shape" , self . y_eval . shape ) if do_time_gpu : gpu_timer = my_timer . MyTimer ( ) gpu_timer . start ( ) plane_constants = np . zeros ( ( self . num_iters , 5 ) ) count_constants = np . zeros ( ( self . num_iters , 1 ) ) d_plane_constants = cuda . to_device ( plane_constants ) d_count_constants = cuda . to_device ( count_constants ) d_x_eval = cuda . to_device ( self . x_eval ) d_y_eval = cuda . to_device ( self . y_eval ) threadsperblock = ( self . tpb , 1 ) print ( "Threads Per Block" , threadsperblock ) blockspergrid_x = math . ceil ( self . num_iters / threadsperblock [ 0 ] ) blockspergrid_y = 1 blockspergrid = ( blockspergrid_x , blockspergrid_y ) print ( "Blocks Per Grid" , blockspergrid ) if do_time_gpu : print ( "GPU Setup Time:" , gpu_timer . lap ( ) ) print ( "Launching GPU Kernel 1" ) kernelRANSAC_1 [ blockspergrid , threadsperblock ] ( d_x_eval , d_plane_constants , RNG_STATES ) threadsperblock = ( int ( np . sqrt ( self . tpb ) ) , int ( np . sqrt ( self . tpb ) ) ) print ( "Threads Per Block" , threadsperblock ) blockspergrid_y = math . ceil ( self . x_train . shape [ 0 ] / threadsperblock [ 1 ] ) blockspergrid = ( blockspergrid_x , blockspergrid_y ) print ( "Blocks Per Grid" , blockspergrid ) print ( "Launching GPU Kernel 2" ) kernelRANSAC_2 [ blockspergrid , threadsperblock ] ( d_x_eval , d_plane_constants , self . dist_thresh , d_count_constants ) plane_constants = d_plane_constants . copy_to_host ( ) count_constants = d_count_constants . copy_to_host ( ) if debug : print ( np . argmax ( count_constants [ : , 0 ] ) ) constants_best = plane_constants [ np . argmax ( count_constants [ : , 0 ] ) , 0 : - 1 ] if do_time_gpu : print ( "GPU Runtime Time:" , gpu_timer . lap ( ) ) if debug : self . io . saveCSV ( plane_constants , "ransac-plane_constants.csv" ) self . io . saveCSV ( count_constants , "ransac-count_constants.csv" ) return constants_best
short_docstring: This function implements the GPU version of the RANSAC plane fitting
  algorithm.
short_docstring_tokens: This function implements the GPU version of the RANSAC plane fitting algorithm .
comment: """
          This function implements the GPU version of the RANSAC plane fitting
          algorithm. This routine calls two separate CUDA kernels. The first
          kernel generates a matrix of constants corresponding to the plane. The
          second kernel then determine which set of points generates the optimal
          fit for the point cloud.
          """$SEP$# Assign the Local Data (If applicable)$SEP$# Explicitly Create Numbas Types for the DEVICE$SEP$#,dtype=float32)$SEP$#,dtype=int32)$SEP$# Set up the Kernel$SEP$# threadsperblock = (int(np.sqrt(self.tpb)), int(np.sqrt(self.tpb)))$SEP$# Seed the Random Number Generator for the Kernel$SEP$# rng_states = create_xoroshiro128p_states(threadsperblock * blockspergrid_x, seed=1)$SEP$# rng_states=1$SEP$# if debug: print(rng_states)$SEP$# Launch the Kernel 1$SEP$# Set up Kernel 2$SEP$# blockspergrid_y = math.ceil(self.x_train.shape[1] / threadsperblock[1])$SEP$# Launch the Kernel 2$SEP$# Copy back to the host$SEP$# Determine the best constants$SEP$# Write Labels to CSV File for Analysis