Ptx source code in .obj file Why?


after compiling .cu file to .obj, I noticed that .obj file contains .cubin code and ptx source code, like

[codebox]bincode {

            0xd0800205 0x00400780 0x10004409 0x0023c780

            0xa000020d 0x04000780 0x10004205 0x0023c780


[codebox]_10 .version 1.3

    .target sm_10, map_f64_to_f32

    // compiled with D:\Visual\CUDA\bin/../open64/lib//be.exe

    // nvopencc built on 2008-12-14

.reg .u32 %ra<17>;

    .reg .u64 %rda<17>;

    .reg .f32 %fa<17>;

    .reg .f64 %fda<17>;


I understand that cubin binary code is needed to run on device, but why the ptx code is here?

How to strip object file from it?


In addition of a previous post, I noticed that this is CUDA 2.1 issue.

You may look into two files from

    This is CUDA 2.0 file, no cubin, nor ptx code into .exe. Ths size of exe is 180K.

    This is CUDA 2.1, the half of the .exe files contains cubin and ptx code. The size is 720K! :thumbsdown:

I doubt this is CUDA 2.1 feature, most likely is a bug.

Is this with debug mode on?

I seem to recall that CUDA 2.1 changed the default compilation mode to include both GPU assembly and PTX. There are command line options to change this.

nvcc -c -arch compute_xx -code=sm_xx
where xx=10,11,12,13
will generate no ptx code in the object file

Option “-int” controls the embedded code behavior.