[CMake] FindCUDA - creating .ptx and .cubin files as final build target

Alex G mr.nuke.me at gmail.com
Fri Sep 10 15:06:47 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a project that I'm converting from plain ole' makefile to cmake.
I need to have the build result be .ptx and .cubin (both, as the app
attempts to read the .cubin first, and if it's incompatible with the GPU
architecture, assemble the .ptx file).

The way I did it with the ole' makefile approach was to invoke nvcc
- --ptx on File1.cu and File2.cu, and then invoke nvcc --cubin on the
resulting File1.ptx, and File2.ptx. The latter step created File1.cubin,
and File2.cubin.

I've looked over the documentation of FindCUDA, and it seemed that
CUDA_COMPILE and CUDA_COMPILE_PTX might be my best bets; however, I
can't figure out how to set targets to be .ptx, or .cubin files.
CUDA_ADD_LIBRARY wants to generate an (empty) object library, which only
adds headaches, as the project compilation fails when gcc is invoked to
create these libs. This is both redundant and annoying.

I only need the .ptx and .cubin files. I would greatly appreciate a hint
or pointers.

Alex
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMioHCAAoJEL0kPHNPXJJKlL0P/ihLAxpUZSKvDbGkCIesk84E
tzXBAuIu5nWpFY7jHaD3cI0lAb62RXql4kbJKdlJ8RuWMZy3ZclsTx0Ph3TYnaoX
dVOCOqxYGwbt3q74NtVDM8mvIfMxKSEyiQbn6V9KCU0sKqW4pvlxXl37Qbh75ILT
cWMOx4dm/XH1z/YE+EJfhWSZw9JonwghR1E5XHI7i4y9hr1MyQ/sOkytEUFQEYos
J7DTFHcdUPwDtOFYsG54BkuyvzacGl++h6X/sS/rB+UyCbJaFr6z68LmiS6mg25H
g5q5S8FGJyEz3cOkINo1viLMhFbM1eWVwHvQOkGHw3+aFL6FY/FPruMKaqEcklk5
EYA9qZlrU+gvVSNBptl8Y0d3Lajvk8rFMl0zwuENNIgh7vtc6QhHjtHTX57b36JM
d/8S7R+lsw9jsW/NODNBO2NeGjcCN380ntUG9R05O6sYUZlBAHkbcMBdiVg9YM0n
V2G4rkpFL9VtiZyArme+X7Sa/K6G6ODhM0ivmz6FOswi2pCi40ZBjBLM97hPOmHa
DAQkJxpjntMYMmKL6PZ9rkp4De6SdihCMYNakGPFTutmZO6KNqLDtPz+PBkY69Jk
JIhvROFN5c9ijN/6wwitc213BPGzLDvBZxbPkrLaC9ogYnVyBfedaLVkp3DsZqcc
ujxmOVL4+AZcRxlnSozs
=Tt5O
-----END PGP SIGNATURE-----


More information about the CMake mailing list