code: def __init__(self, mat, dtype):
      self.dtype = np.dtype(dtype)
      self.index_dtype = np.dtype(np.int32)
      self.shape = mat.shape
  
      self.block_size = 128
  
      from scipy.sparse import coo_matrix
  
      coo_mat = coo_matrix(mat, dtype=self.dtype)
  
      self.row_gpu = gpuarray.to_gpu(
          coo_mat.row.astype(self.index_dtype)
      )
      self.col_gpu = gpuarray.to_gpu(
          coo_mat.col.astype(self.index_dtype)
      )
      self.data_gpu = gpuarray.to_gpu(coo_mat.data)
      self.nnz = coo_mat.nnz
  
      from pycuda.tools import DeviceData
  
      dev = drv.Context.get_device()
      devdata = DeviceData()
      max_threads = (
          devdata.warps_per_mp
          * devdata.warp_size
          * dev.multiprocessor_count
      )
      max_blocks = 4 * max_threads // self.block_size
      warps_per_block = self.block_size // dev.warp_size
  
      if self.nnz:
  
          def divide_into(x, y):
              return (x + y - 1) // y
  
          num_units = self.nnz // dev.warp_size
          num_warps = min(num_units, warps_per_block * max_blocks)
          self.num_blocks = divide_into(num_warps, warps_per_block)
          num_iters = divide_into(num_units, num_warps)
  
          self.interval_size = dev.warp_size * num_iters
          self.tail = num_units * dev.warp_size
  
file_path: pycuda/pycuda/sparse/coordinate.py
imports: from __future__ import division
  from __future__ import absolute_import
  from pytools import memoize_method
  import pycuda.driver
  import pycuda.gpuarray
  from pycuda.compiler import SourceModule
  import numpy
label_desc: Use image node_id 1 to create a new CoordinateSpMV object  with example: obj = CoordinateSpMV(mat, dtype)