nvcc编译
文件后缀说明
后缀名 | Description | 说明 |
---|---|---|
.cu | CUDA source file, containing host code and device functions | cuda源文件 |
.c | C source file | c源文件 |
.cc, .cxx, .cpp | C++ source file | C++源文件 |
.ptx | PTX intermediate assembly file | 中间汇编文件 |
.cubin | CUDA device code binary file (CUBIN) for a single GPU architecture | 包括一个GPU构架的设备二进制文件 |
.fatbin | CUDA fat binary file that may contain multiple PTX and CUBIN files | 多个PTX和CUBIN的二进制文件 |
.o | .obj Object file | 目标文件 |
.a | ,.lib Library file | 库文件 |
.res | Resource file | 资源文件 |
.so | Shared object file | 动态库文件 |
编译步骤
常用命令说明
阶段性编译命令
下面说的名字是没有使用–outputfile指明生成文件名的时候,按照默认生成的。
阶段 | 编译器 | 擦参数 | 输入文件 | 默认文件名 |
---|---|---|---|---|
.cu文件编译成c/c++文件 | nvcc | –cuda -cuda |
x.cu | x.cu.cpp.ii. |
C/C++ 预处理 | –preprocess -E |
标准输出 | ||
C/C++ 编译成目标文件 | –compile -c |
x.o | ||
cuda原文件生成cubin | –cubin -cubin |
x.cu | x.cubin | |
ptx文件生成cubin | –cubin -cubin |
x.ptx | x.cubin | |
cu文件生成ptx | –ptx -ptx |
x.cu | x.ptx | |
cu,ptx,cubin文件生成fatbinary | –fatbin -fatbin |
x.fatbin | ||
可链接设备代码生成 | –device-link -dlink |
a_dlink.o | ||
cubin从可链接设备代码生成 | –device-link–cubin -dlink-cubin |
a_dlink.cubin | ||
fatbinary从可链接设备代码生成 | –device-link–fatbin -dlink-fatbin |
a_dlink.fatbin | ||
生成可执行文件 | a.out | |||
生成库文件 | –lib -lib |
a.lib | ||
make dependency generation | –generate-dependencies -M |
标准输出 | ||
make dependency generation without headers in system paths | –generate-nonsystem-dependencies -MM |
标准输出 | ||
Running an executable | –run -run |