只是为了看看CUDA生成了什么样的代码我喜欢除了目标文件之外还要编译成ptx。 由于我的一些循环展开可能需要一段时间,我希望能够编译*.cu → *.ptx → *.o而不是浪费时间*.cu → *.ptx和*.cu → *.o ,我现在正在做的。
只需将-ptx添加到nvcc *.cu行即可获得所需的ptx输出。
使用ptxas -c将*.ptx编译为*.o有效,但在我的可执行文件链接中导致错误: Relocations in generic ELF (EM: 190) 。
尝试使用nvcc编译*.ptx 无声地失败,不会输出任何内容。
这张图片非常有帮助:
我需要传递给ptxas吗? 我应该如何使用单独的编译通过ptx正确编译? 或者,我可以告诉nvcc保留ptx吗?
Just to see what kind of code CUDA is generating I like to compile to ptx in addition to an object file. Since some of my loop unrolling can take quite a while I'd like to be able to compile *.cu→*.ptx→*.o instead of wasting time with both *.cu→*.ptx and *.cu→*.o, which I'm currently doing.
Simply adding -ptx to the nvcc *.cu line gives the desired ptx output.
Using ptxas -c to compile *.ptx to *.o works, but causes an error in my executable linking: Relocations in generic ELF (EM: 190).
Attempting to compile the *.ptx with nvcc fails silently, outputting nothing.
this image is quite helpful:
Is there some option I need to pass to ptxas? How should I properly compile via ptx with separate compilation? Alternatively, can I just tell nvcc to keep the ptx?
最满意答案
或者,我可以告诉nvcc保留ptx吗?
是的,您可以告诉nvcc 保留所有中间文件 ,其中一个是.ptx文件。
nvcc -keep ...保留所有中间文件有点乱,但我相信你可以拿出一个脚本来整理,并且只保存你想要的文件。
Alternatively, can I just tell nvcc to keep the ptx?
Yes, you can tell nvcc to keep all intermediate files, one of which will be the .ptx file.
nvcc -keep ...Keeping all the intermediate files is a bit messy, but I'm sure you can come up with a script to tidy things up, and only save the files you want.
NVCC使用PTX输出单独编译(NVCC separate compilation with PTX output)只是为了看看CUDA生成了什么样的代码我喜欢除了目标文件之外还要编译成ptx。 由于我的一些循环展开可能需要一段时间,我希望能够编译*.cu → *.ptx → *.o而不是浪费时间*.cu → *.ptx和*.cu → *.o ,我现在正在做的。
只需将-ptx添加到nvcc *.cu行即可获得所需的ptx输出。
使用ptxas -c将*.ptx编译为*.o有效,但在我的可执行文件链接中导致错误: Relocations in generic ELF (EM: 190) 。
尝试使用nvcc编译*.ptx 无声地失败,不会输出任何内容。
这张图片非常有帮助:
我需要传递给ptxas吗? 我应该如何使用单独的编译通过ptx正确编译? 或者,我可以告诉nvcc保留ptx吗?
Just to see what kind of code CUDA is generating I like to compile to ptx in addition to an object file. Since some of my loop unrolling can take quite a while I'd like to be able to compile *.cu→*.ptx→*.o instead of wasting time with both *.cu→*.ptx and *.cu→*.o, which I'm currently doing.
Simply adding -ptx to the nvcc *.cu line gives the desired ptx output.
Using ptxas -c to compile *.ptx to *.o works, but causes an error in my executable linking: Relocations in generic ELF (EM: 190).
Attempting to compile the *.ptx with nvcc fails silently, outputting nothing.
this image is quite helpful:
Is there some option I need to pass to ptxas? How should I properly compile via ptx with separate compilation? Alternatively, can I just tell nvcc to keep the ptx?
最满意答案
或者,我可以告诉nvcc保留ptx吗?
是的,您可以告诉nvcc 保留所有中间文件 ,其中一个是.ptx文件。
nvcc -keep ...保留所有中间文件有点乱,但我相信你可以拿出一个脚本来整理,并且只保存你想要的文件。
Alternatively, can I just tell nvcc to keep the ptx?
Yes, you can tell nvcc to keep all intermediate files, one of which will be the .ptx file.
nvcc -keep ...Keeping all the intermediate files is a bit messy, but I'm sure you can come up with a script to tidy things up, and only save the files you want.
发布评论