提交 8cc2f7e0 authored 作者: Josh Bleecher Snyder's avatar Josh Bleecher Snyder

make cuda initialization code slightly more DRY

上级 7f066345
...@@ -50,10 +50,9 @@ def set_cuda_disabled(): ...@@ -50,10 +50,9 @@ def set_cuda_disabled():
#cuda_ndarray compile and import #cuda_ndarray compile and import
cuda_path = os.path.abspath(os.path.split(__file__)[0]) cuda_path = os.path.abspath(os.path.split(__file__)[0])
date = os.stat(os.path.join(cuda_path,'cuda_ndarray.cu'))[stat.ST_MTIME] cuda_files = ('cuda_ndarray.cuh', 'cuda_ndarray.cuh', 'conv_full_kernel.cu', 'conv_kernel.cu')
date = max(date,os.stat(os.path.join(cuda_path,'cuda_ndarray.cuh'))[stat.ST_MTIME]) stat_times = [os.stat(os.path.join(cuda_path, cuda_file))[stat.ST_MTIME] for cuda_file in cuda_files]
date = max(date,os.stat(os.path.join(cuda_path,'conv_full_kernel.cu'))[stat.ST_MTIME]) date = max(stat_times)
date = max(date,os.stat(os.path.join(cuda_path,'conv_kernel.cu'))[stat.ST_MTIME])
cuda_ndarray_loc = os.path.join(config.compiledir,'cuda_ndarray') cuda_ndarray_loc = os.path.join(config.compiledir,'cuda_ndarray')
cuda_ndarray_so = os.path.join(cuda_ndarray_loc,'cuda_ndarray.so') cuda_ndarray_so = os.path.join(cuda_ndarray_loc,'cuda_ndarray.so')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论