提交 1a9022e8 authored 作者: Frederic Bastien's avatar Frederic Bastien

get the nvcc version

上级 d12dafcc
...@@ -29,11 +29,17 @@ def debug(*args): ...@@ -29,11 +29,17 @@ def debug(*args):
_logger.debug("DEBUG: "+' '.join(str(a) for a in args)) _logger.debug("DEBUG: "+' '.join(str(a) for a in args))
nvcc_path = 'nvcc' nvcc_path = 'nvcc'
nvcc_version = None
def is_nvcc_available(): def is_nvcc_available():
"""Return True iff the nvcc compiler is found.""" """Return True iff the nvcc compiler is found."""
try: try:
subprocess.call(['nvcc', '--version'], stdout=subprocess.PIPE, p = subprocess.Popen(['nvcc', '--version'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
p.wait()
s = p.stdout.readlines()[-1].split(',')[1].strip().split()
assert s[0]=='release'
global nvcc_version
nvcc_version = s[1]
return True return True
except: except:
#try to find nvcc into cuda.root #try to find nvcc into cuda.root
...@@ -43,7 +49,7 @@ def is_nvcc_available(): ...@@ -43,7 +49,7 @@ def is_nvcc_available():
nvcc_path = p nvcc_path = p
return True return True
else: return False else: return False
is_nvcc_available()#to set nvcc_path correctly. is_nvcc_available()#to set nvcc_path correctly and get the version
def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[], lib_dirs=[], libs=[], def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[], lib_dirs=[], libs=[],
preargs=[]): preargs=[]):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论