我正在研究cudaDecodeD3D9 示例以了解 CUDA 的工作原理,并在编译时从 .cu 文件生成 .ptx 文件。据我所知,这个 .ptx 文件是一个中间表示,它将为任何特定的 GPU 即时编译。该示例使用类 cudaModuleMgr 通过 cuModuleLoadDataEx 加载此文件。
.ptx 文件是文本格式,我可以看到它的顶部是我机器上的一堆硬编码路径,包括我的用户文件夹,即:
.file 1 "C:/Users/******/AppData/Local/Temp/tmpxft_00002abc_00000000-7_NV12ToARGB_drvapi.cudafe2.gpu"
.file 2 "c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h"
.file 3 "C:/Program Files (x86)/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include\crt/device_runtime.h"
.file 4 "C:/Program Files (x86)/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include\host_defines.h"
.file 5 "C:/Program Files (x86)/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include\builtin_types.h"
.file 6 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\device_types.h"
.file 7 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\host_defines.h"
.file 8 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\driver_types.h"
.file 9 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\surface_types.h"
.file 10 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\texture_types.h"
.file 11 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\vector_types.h"
.file 12 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\builtin_types.h"
.file 13 "C:/Program Files (x86)/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include\device_launch_parameters.h"
.file 14 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\crt\storage_class.h"
.file 15 "c:\users\******\desktop\cudadecodesample\3_imaging\cudadecoded3d9\cudaProcessFrame.h"
.file 16 "c:\program files (x86)\nvidia gpu computing toolkit\cuda\v5.0\include\math_functions.h"
.file 17 "C:/Users/******/Desktop/CudaDecodeSample/3_Imaging/cudaDecodeD3D9/NV12ToARGB_drvapi.cu"
.file 18 "C:/Program Files (x86)/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include\common_functions.h"
那么我的问题是:由于该文件是在编译时创建的,由于所有这些硬编码路径,它是否只能在我的机器上工作?即使没有安装 CUDA SDK,我应该怎么做才能确保程序可以在任何机器上运行?