      @property
      def _cuda_version(self):
          """ str: The installed CUDA version. """
          # TODO Handle multiple CUDA installs
          chk = Popen("nvcc -V", shell=True, stdout=PIPE, stderr=PIPE)
          stdout, stderr = chk.communicate()
          if not stderr:
              version = re.search(r".*release (?P<cuda>\d+\.\d+)", stdout.decode(self._encoding))
              version = version.groupdict().get("cuda", None)
              if version:
                  return version
          # Failed to load nvcc
          if self._is_linux:
              version = self._cuda_version_linux()
          elif self._is_windows:
              version = self._cuda_version_windows()
          else:
              version = "Unsupported OS"
              if self._is_conda:
                  version += ". Check Conda packages for Conda Cuda"
          return version
  
      @property
 
</s> remove                 version += ". Check Conda packages for Conda Cuda"
        return version
 </s> add                 retval += ". Check Conda packages for Conda Cuda"
        return retval </s> remove             version = re.search(r".*release (?P<cuda>\d+\.\d+)", stdout.decode(self.env.encoding))
            self.env.cuda_version = version.groupdict().get("cuda", None)
            if self.env.cuda_version:
                self.output.info("CUDA version: " + self.env.cuda_version)
                return
        # Failed to load nvcc
        if self.env.os_version[0] == "Linux":
            self.cuda_check_linux()
        elif self.env.os_version[0] == "Windows":
            self.cuda_check_windows()

    def cuda_check_linux(self):
        """ Check Linux CUDA Version """
 </s> add             version = re.search(r".*release (?P<cuda>\d+\.\d+)",
                                stdout.decode(locale.getpreferredencoding()))
            self.cuda_version = version.groupdict().get("cuda", None)
            locate = "where" if self._os == "windows" else "which"
            path = os.popen(f"{locate} nvcc").read()
            if path:
                path = path.split("\n")[0]  # Split multiple entries and take first found
                while True:  # Get Cuda root folder
                    path, split = os.path.split(path)
                    if split == "bin":
                        break
                self.cuda_path = path
            return

        # Failed to load nvcc, manual check
        getattr(self, f"_cuda_check_{self._os}")()

    def _cuda_check_linux(self):
        """ For Linux check the dynamic link loader for libcudart. If not found with ldconfig then
        attempt to find it in LD_LIBRARY_PATH. """ </s> remove     @property
    def _cuda_keys_windows(self):
        """ list: The CUDA Path environment variables stored for Windows users. """
        return [key for key in os.environ.keys() if key.lower().startswith("cuda_path_v")]

 </s> add  </s> remove         if self._is_linux:
            cudnn_checkfiles = self._cudnn_checkfiles_linux()
        elif self._is_windows:
            cudnn_checkfiles = self._cudnn_checkfiles_windows()
        else:
            retval = "Unsupported OS"
            if self._is_conda:
                retval += ". Check Conda packages for Conda cuDNN"
            return retval

        cudnn_checkfile = None
        for checkfile in cudnn_checkfiles:
            if os.path.isfile(checkfile):
                cudnn_checkfile = checkfile
                break

        if not cudnn_checkfile:
            retval = "No global version found"
            if self._is_conda:
                retval += ". Check Conda packages for Conda cuDNN"
            return retval

        found = 0
        with open(cudnn_checkfile, "r") as ofile:
            for line in ofile:
                if line.lower().startswith("#define cudnn_major"):
                    major = line[line.rfind(" ") + 1:].strip()
                    found += 1
                elif line.lower().startswith("#define cudnn_minor"):
                    minor = line[line.rfind(" ") + 1:].strip()
                    found += 1
                elif line.lower().startswith("#define cudnn_patchlevel"):
                    patchlevel = line[line.rfind(" ") + 1:].strip()
                    found += 1
                if found == 3:
                    break
        if found != 3:
 </s> add         retval = self._cuda_check.cudnn_version
        if not retval: </s> remove     def cuda_check(self):
        """ Check Cuda for Linux or Windows """
 </s> add class CudaCheck():  # pylint:disable=too-few-public-methods
    """ Find the location of system installed Cuda and cuDNN on Windows and Linux. """

    def __init__(self):
        self.cuda_path = None
        self.cuda_version = None
        self.cudnn_version = None

        self._os = platform.system().lower()
        self._cuda_keys = [key for key in os.environ if key.lower().startswith("cuda_path_v")]
        self._cudnn_header_files = ["cudnn_version.h", "cudnn.h"]

        if self._os in ("windows", "linux"):
            self._cuda_check()
            self._cudnn_check()

    def _cuda_check(self):
        """ Obtain the location and version of Cuda and populate :attr:`cuda_version` and
        :attr:`cuda_path`

        Initially just calls `nvcc -V` to get the installed version of Cuda currently in use.
        If this fails, drills down to more OS specific checking methods.
        """
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
      @property
      def _cuda_version(self):
          """ str: The installed CUDA version. """
          # TODO Handle multiple CUDA installs
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
        retval = self._cuda_check.cuda_version
        if not retval:
            retval = "No global version found"
              if self._is_conda:
                  version += ". Check Conda packages for Conda Cuda"
          return version
  
      @property
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 sysinfo/setup - Standardize cuda/cudnn checks 
lib/sysinfo.py