logo资料库

nvcc编译器配置——实用详细步骤.doc

第1页 / 共1页
资料共1页,全文预览结束
NVCC 编译环境的配置 一、Setting->Complier and debugger 在 VS2005 编译器情况下点击 copy,建议命名为 NVCC 二、在 NVCC 中的 search directories 选项卡中 Complier 加入 $(CUDA_INC_PATH) Linker 加入 $(CUDA_LIB_PATH) 三、在 Toolchain executables 选项卡中 将 Compiler’s installation directory 改为$(CUDA_BIN_PATH) 在 Program Files 中,将 C complier 改为 CUDA->BIN 下的 nvcc.exe 将 C++ complier 改为 CUDA->BIN 下的 nvcc.exe 四、在 Other settings 选项卡中,点击 Advanced options 在 Commands 页面中,将 Command line macro 改为 “$compiler -c $options $includes $file --output-file $object” (引号内的内容) 在 Others 页面中,将 Add headers files search path 改为” --include-path ” (引号内的内 容,注意 path 后面有一空格) 将 Add preprocessor definition 改为 “-D” 将 Generic switch character 改为 “-” 五、在 Linker settings 选项卡中 在 Linker libraries 中加入 cuda.lib 和 cudart.lib 在 Other linker options 中加入 “/NODEFAULTLIB:LIBCMT.lib” 六、至此,编译器配置完成,新建一个工程,例如“控制台”工程,然后完成下面的步骤。 七、Project->Build options,对于总工程、Debug 和 Release, 在 Compiler settings 选项卡中,Compiler Flags 下将所有的勾选的方框取消, Other options 下的语句全部删除, #define 下的语句全部删除 八、在 Linker settings 选项卡中, 总工程加入 cuda.lib Debug 加入 libcpmt.lib cudart.lib 九、如果电脑不支持 CUDA,则需要配置一个模拟编译器,即在 CPU 上模拟 GPU 上运行, 需要进行下列操作。 十、建立工程并重复上述步骤 十一、Project->Properties->Build targets 下,点击 Duplicate ,建立一个新的编译模式,比如 命名为 Emulation Debug 和 Emulation Release 十二、Project->Build options->Emulation Debug->Compiler settings->Other options 加入下面语 句”—device-emulation”,Emulation Release 类似。 十三、保存一份模板,免去以后每次工程都要配置的麻烦。
分享到:
收藏