def get_nvcc_version(nvcc): cmdline = [nvcc, "--version"] try: try: from pytools.prefork import call_capture_output except ImportError: from pytools.prefork import call_capture_stdout return call_capture_stdout(cmdline) else: retcode, stdout, stderr = call_capture_output(cmdline) return stdout except OSError, e: raise OSError("%s was not found (is it on the PATH?) [%s]" % (nvcc, str(e)))
def get_nvcc_version(nvcc): cmdline = [nvcc, "--version"] try: try: from pytools.prefork import call_capture_output except ImportError: from pytools.prefork import call_capture_stdout result = call_capture_stdout(cmdline) else: retcode, stdout, stderr = call_capture_output(cmdline) result = stdout if result is None: from warnings import warn warn("NVCC version could not be determined.") result = "nvcc unknown version" return result except OSError, e: raise OSError("%s was not found (is it on the PATH?) [%s]" % (nvcc, str(e)))