code: def _syevd(a, UPLO, with_eigen_vector, overwrite_a=False):
      from cupy_backends.cuda.libs import cublas
      from cupy_backends.cuda.libs import cusolver
  
      if UPLO not in ("L", "U"):
          raise ValueError("UPLO argument must be 'L' or 'U'")
  
      # reject_float16=False for backward compatibility
      dtype, v_dtype = _util.linalg_common_type(a, reject_float16=False)
      real_dtype = dtype.char.lower()
      w_dtype = v_dtype.char.lower()
  
      # Note that cuSolver assumes fortran array
      v = a.astype(dtype, order="F", copy=not overwrite_a)
  
      m, lda = a.shape
      w = cupy.empty(m, real_dtype)
      dev_info = cupy.empty((), numpy.int32)
      handle = device.Device().cusolver_handle
  
      if with_eigen_vector:
          jobz = cusolver.CUSOLVER_EIG_MODE_VECTOR
      else:
          jobz = cusolver.CUSOLVER_EIG_MODE_NOVECTOR
  
      if UPLO == "L":
          uplo = cublas.CUBLAS_FILL_MODE_LOWER
      else:  # UPLO == 'U'
          uplo = cublas.CUBLAS_FILL_MODE_UPPER
  
      if not runtime.is_hip:
          if dtype.char not in "fdFD":
              raise RuntimeError(
                  "Only float32, float64, complex64, and "
                  "complex128 are supported"
              )
          type_v = _dtype.to_cuda_dtype(dtype)
          type_w = _dtype.to_cuda_dtype(real_dtype)
          params = cusolver.createParams()
          try:
              (
                  work_device_size,
                  work_host_sizse,
              ) = cusolver.xsyevd_bufferSize(
                  handle,
                  params,
                  jobz,
                  uplo,
                  m,
                  type_v,
                  v.data.ptr,
                  lda,
                  type_w,
                  w.data.ptr,
                  type_v,
              )
              work_device = cupy.empty(work_device_size, "b")
              work_host = numpy.empty(work_host_sizse, "b")
              cusolver.xsyevd(
                  handle,
                  params,
                  jobz,
                  uplo,
                  m,
                  type_v,
                  v.data.ptr,
                  lda,
                  type_w,
                  w.data.ptr,
                  type_v,
                  work_device.data.ptr,
                  work_device_size,
                  work_host.ctypes.data,
                  work_host_sizse,
                  dev_info.data.ptr,
              )
          finally:
              cusolver.destroyParams(params)
          cupy.linalg._util._check_cusolver_dev_info_if_synchronization_allowed(
              cusolver.xsyevd, dev_info
          )
      else:
          if dtype == "f":
              buffer_size = cusolver.ssyevd_bufferSize
              syevd = cusolver.ssyevd
          elif dtype == "d":
              buffer_size = cusolver.dsyevd_bufferSize
              syevd = cusolver.dsyevd
          elif dtype == "F":
              buffer_size = cusolver.cheevd_bufferSize
              syevd = cusolver.cheevd
          elif dtype == "D":
              buffer_size = cusolver.zheevd_bufferSize
              syevd = cusolver.zheevd
          else:
              raise RuntimeError(
                  "Only float32, float64, complex64, and "
                  "complex128 are supported"
              )
  
          work_size = buffer_size(
              handle, jobz, uplo, m, v.data.ptr, lda, w.data.ptr
          )
          work = cupy.empty(work_size, dtype)
          syevd(
              handle,
              jobz,
              uplo,
              m,
              v.data.ptr,
              lda,
              w.data.ptr,
              work.data.ptr,
              work_size,
              dev_info.data.ptr,
          )
          cupy.linalg._util._check_cusolver_dev_info_if_synchronization_allowed(
              syevd, dev_info
          )
  
      return w.astype(w_dtype, copy=False), v.astype(
          v_dtype, copy=False
      )
  
file_path: cupy/cupy/linalg/_eigenvalue.py
imports: import numpy
  import cupy
  from cupy.cuda import device
  from cupy.cuda import runtime
  from cupy.linalg import _util
  from cupy._core import _dtype
label_desc: Use image node_id 1 for calling a global function with example usage: _syevd(a, UPLO, with_eigen_vector, overwrite_a) and returns: w,  v