使用nvcc时,arch和代码选项的默认值是什么? [英] What are the default values for arch and code options when using nvcc?
问题描述
编译CUDA代码时,必须选择要为其生成代码的体系结构。 nvcc
提供两个参数来指定此架构,基本上是:
When compiling your CUDA code, you have to select for which architecture your code is being generated. nvcc
provides two parameters to specify this architecture, basically:
-
arch
指定虚拟arquictecture,它可以是compute_10
,compute_11
等。 -
代码
指定真正的架构,可以是sm_10
,sm_11
等。
arch
specifies the virtual arquictecture, which can becompute_10
,compute_11
, etc.code
specifies the real architecture, which can besm_10
,sm_11
, etc.
所以这样的命令:
nvcc x.cu -arch=compute_13 -code=sm_13
将为具有1.3计算能力的设备生成cubin代码。如果我错了,请纠正我。我想知道哪些是这两个参数的默认值? 这是nvcc在 arch
或 c
是否已指定?
Will generate 'cubin' code for devices with 1.3 compute capability. Please correct me if I'm wrong. Which I would like to know is which are the default values for these two parameters? Which is the default architecture that nvcc uses when no value for arch
or code
is specified?
推荐答案
默认值。我的错误不是从NVCC文档的开始到非常结束阅读关于GPU编译的整章。所以,
Ok, I've finally managed to discover the default values. My fault for not reading the whole chapter on GPU compilation in the NVCC documentation from the beginning to the very very end. So,
nvcc x.cu
等效于
nvcc x.cu –arch=compute_10 -code=sm_10,compute_10
这些是默认值。默认情况下,编译将执行到虚拟体系结构 compute_10
,而编译结果的 a.out
实际架构的 sm_10
的CUBIN代码以及 compute_10
架构的PTX汇编代码,如果您的体系结构大于 sm_10
,则由CUDA驱动程序按时完成。
Those are the default values. The compilation is performed by default to the virtual architecture compute_10
, and the a.out
that results from the compilation will include the CUBIN code for the sm_10
real architecture, and the PTX assembly code for the compute_10
architecture, which will be recompiled 'just in time' by the CUDA driver if your architecture is greater than sm_10
.
这篇关于使用nvcc时,arch和代码选项的默认值是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!