- CUDA C/C++ kernels are now compiled to standard ELF format
architecture {sm_10}
abiversion {1}
modname {cubin}
code {
name = cuFunction_Laser
lmem = 0
smem = 44
reg = 6
bar = 0
bincode {
0x10004209 0x0023c780 0x40024c09 0x00200780
0xa000000d 0x04000780 0x20000411 0x0400c780
0x3004d1fd 0x642107c8 0x30000003 0x00000500
...
abiversion {1}
modname {cubin}
code {
name = cuFunction_Laser
lmem = 0
smem = 44
reg = 6
bar = 0
bincode {
0x10004209 0x0023c780 0x40024c09 0x00200780
0xa000000d 0x04000780 0x20000411 0x0400c780
0x3004d1fd 0x642107c8 0x30000003 0x00000500
...
blah..blah..blah
}
}
Rather than ship cubin files with libraries, I have always built them into the file as a string resource and then use the windows API functions such as FindResource and LoadResource to get a pointer to the string. This is then passed to the CUDA cuModuleLoadDataEx function for final compilation into the GPU code.
With CUDA3.0 and this new ELF format, cubin files look slightly different since they are now a binary file:
When I compiled some old projects against CUDA3.0, everything went very wrong due to this change.
The problem was that my old method used to copy the cubin resource string into another memory location using strcpy and add also a final \0 character for good measure at the end of the string. With the new binary format, the string copy does not work and a partially mangled buffer ended up being passed to the CUDA compiler, which promptly fell over.
So if anybody else out there is using string resources to include and manipulate cubin files, this may catch you out too. The fix is easy, simply treat the new cubin files as binary data not strings.
One final point, if you really want to stick with the previous cubin string format, then apparently (I haven't confirmed this) you can direct nvcc to emit string cubin files by changing the nvcc.profile and the CUBINS_ARE_ELF flag.
Vision Experts