本文主要是介绍显卡计算能力profile文件修改,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
CUDA深度学习显卡算力文件修改
参考:aiuai
目的:在使用Pytorch进行深度学习训练的时候,在setup时需要对算力进行设置,根据机器使用的不同的GPU型号,需要改写nvcc编译使用的参数。
例如:
#!/usr/bin/env python3
import os
import torchfrom setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDAExtensioncxx_args = ['-std=c++11']nvcc_args = ['-gencode', 'arch=compute_50,code=sm_50','-gencode', 'arch=compute_52,code=sm_52','-gencode', 'arch=compute_60,code=sm_60','-gencode', 'arch=compute_61,code=sm_61'# '-gencode', 'arch=compute_70,code=sm_70',# '-gencode', 'arch=compute_70,code=compute_70'
]setup(name='depthflowprojection_cuda',ext_modules=[CUDAExtension('depthflowprojection_cuda', ['depthflowprojection_cuda.cc','depthflowprojection_cuda_kernel.cu'], extra_compile_args={'cxx': cxx_args, 'nvcc': nvcc_args})],cmdclass={'build_ext': BuildExtension})
这篇关于显卡计算能力profile文件修改的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!