Why the compiled binary gets smaller when -gencode used?

我只是一个虾纸丫 提交于 2019-12-08 06:15:25

问题


Why the compiled binary gets smaller when -gencode used?

My GPU's capability is 3.0.

NVCC option:

Without -gencode option:

1,780,520 bytes

-gencode=arch=compute_30,code=sm_30:

1,719,080 bytes, gets smaller

-gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_61,code=sm_61:

1,780,800 bytes


回答1:


Nvidia documentation tells that:

Example:

nvcc x.cu

is equivalent to:

nvcc x.cu --gpu-architecture=compute_30 --gpu-code=sm_30,compute_30

but in your case:

nvcc x.cu -gencode=arch=compute_30,code=sm_30

is equivalent to:

nvcc x.cu --gpu-architecture=compute_30 --gpu-code=sm_30

which does not include the PTX code for the virtual architecture (such as compute_30)



来源:https://stackoverflow.com/questions/47532255/why-the-compiled-binary-gets-smaller-when-gencode-used

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!