admin管理员组文章数量:1435859
Suppose my machine has GPUs with compute capabilities XX and YY. Having read:
I know I can call nvcc like so:
nvcc \
-o myapp \
-gencode arch=compute_XX,code=sm_XX \
myapp.cu
or like so:
nvcc \
-o myapp \
-gencode arch=compute_XX,code=sm_XX \
-gencode arch=compute_YY,code=sm_YY \
myapp.cu
for both GPUs. But - suppose I want to use the arch=native
option, which we got a few years back, instead of specifying individual values. It should be easier and more straightforward, yet - I can't seem to get it right:
$ nvcc -o myapp -gencode arch=native myapp.cu
nvcc fatal : Option '--generate-code arch=native', missing code
$ nvcc -o myapp -gencode arch=native,code=sm_89 myapp.cu
nvcc fatal : Unsupported gpu architecture 'native'
Note: Using CUDA 12.6' version of NVCC.
Suppose my machine has GPUs with compute capabilities XX and YY. Having read:
https://stackoverflow/a/35657430/1593077
I know I can call nvcc like so:
nvcc \
-o myapp \
-gencode arch=compute_XX,code=sm_XX \
myapp.cu
or like so:
nvcc \
-o myapp \
-gencode arch=compute_XX,code=sm_XX \
-gencode arch=compute_YY,code=sm_YY \
myapp.cu
for both GPUs. But - suppose I want to use the arch=native
option, which we got a few years back, instead of specifying individual values. It should be easier and more straightforward, yet - I can't seem to get it right:
$ nvcc -o myapp -gencode arch=native myapp.cu
nvcc fatal : Option '--generate-code arch=native', missing code
$ nvcc -o myapp -gencode arch=native,code=sm_89 myapp.cu
nvcc fatal : Unsupported gpu architecture 'native'
Note: Using CUDA 12.6' version of NVCC.
Share Improve this question asked Nov 15, 2024 at 20:52 einpoklumeinpoklum 133k80 gold badges422 silver badges867 bronze badges1 Answer
Reset to default 1It's actually easier than all that. Use:
nvcc -o myapp -arch=native myapp.cu
without a -gencode
argument.
Note that, as the CUDA Programming Guide states:
When
-arch=native
is specified, nvcc detects the visible GPUs on the system and generates codes for them, no PTX program will be generated for this option. It is a warning if there are no visible supported GPU on the system, and the default architecture will be used.
本文标签:
版权声明:本文标题:compiler errors - If I tell NVCC to -gencode arch=native, what do I use for the code= argument? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745672034a2669627.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论