简单的CUDA项目Netbeans链接问题 [英] simple CUDA project Netbeans linking issue
问题描述
当我取消选中在NetBeans IDE中启用依赖关系检查(请参见此问题)时,现在IDE使用nvcc并编译my。 cu to .o但是它根本没有链接:
when I unchecked Enable Make Dependency Checking in NetBeans IDE (see this issue) now IDE uses nvcc and compiles my .cu to .o but it doesn't do linking at all:
/ usr / bin / make-f nbproject / Makefile- Debug.mk QMAKE = SUBPROJECTS =
.build-conf make 1 :输入目录
/ me / NetBeansProjects / my_CUDA_1'/ usr / bin / make-f
/ me / NetBeansProjects / my_CUDA_1'mkdir
nbproject / Makefile-Debug.mk dist / Debug / GNU-Linux-x86 / libmy_cuda_1.a
make [2]:输入目录
-p build / Debug / GNU-Linux-x86 / usr / local / cuda -5.0 / bin / nvcc -c -g -I / usr / local / cuda-5.0 / include -I / usr / local / cuda-5.0 /samples/common/inc-o build / Debug / GNU-Linux-x86 / cudaMain.o cudaMain.cu mkdir -p dist / Debug / GNU-Linux-x86 rm -f dist / Debug / GNU-Linux-x86 / libmy_cuda_1.a
ar -rv dist / Debug / GNU-Linux-x86 /libmy_cuda_1.a
build / Debug / GNU-Linux-x86 / cudaMain.o ar:creating
dist / Debug / GNU-Linux-x86 / libmy_cuda_1.aa -
build / Debug / GNU-Linux-x86 / cudaMain.o ranlib
dist / Debug / GNU-Linux-x86 / libmy_cuda_1.a make [2]:离开目录
/ me / NetBeansProjects / my_CUDA_1 'make [1]:离开目录
/ me / NetBeansProjects / my_CUDA_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make1: Entering directory
/me/NetBeansProjects/my_CUDA_1' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/libmy_cuda_1.a make[2]: Entering directory
/me/NetBeansProjects/my_CUDA_1' mkdir -p build/Debug/GNU-Linux-x86 /usr/local/cuda-5.0/bin/nvcc -c -g -I/usr/local/cuda-5.0/include -I/usr/local/cuda-5.0/samples/common/inc -o build/Debug/GNU-Linux-x86/cudaMain.o cudaMain.cu mkdir -p dist/Debug/GNU-Linux-x86 rm -f dist/Debug/GNU-Linux-x86/libmy_cuda_1.a ar -rv dist/Debug/GNU-Linux-x86/libmy_cuda_1.a build/Debug/GNU-Linux-x86/cudaMain.o ar: creating dist/Debug/GNU-Linux-x86/libmy_cuda_1.a a - build/Debug/GNU-Linux-x86/cudaMain.o ranlib dist/Debug/GNU-Linux-x86/libmy_cuda_1.a make[2]: Leaving directory/me/NetBeansProjects/my_CUDA_1' make[1]: Leaving directory
/me/NetBeansProjects/my_CUDA_1'
BUILD SUCCESSFUL(总时间:2s) / p>
BUILD SUCCESSFUL (total time: 2s)
我可以从终端连接:
comp @ comp:#ls
cudaMain.o
comp@comp:# ls
cudaMain.o
comp @ comp:#g ++ -m64 -o cudaMain cudaMain.o -L / usr / local / cuda-5.0 / lib64 -lcudart
comp @ comp:#。/ cudaMain
comp @ comp:/ me / NetBeansProjects / my_CUDA_1 / build / Debug / GNU-Linux-x86#
comp@comp:# g++ -m64 -o cudaMain cudaMain.o -L/usr/local/cuda-5.0/lib64 -lcudart comp@comp:#./cudaMain comp@comp:/me/NetBeansProjects/my_CUDA_1/build/Debug/GNU-Linux-x86#
我认为这是一个事实,它不检查make依赖(?)
检查/取消选中/删除/添加/更改IDE中以启用链接?
我不知道为什么,但没有与项目 - >属性中的链接相关的选项。
I think this is something related to the fact that it doesn't check make dependency (?) what to check/uncheck/delete/add/change in IDE to enable linking? I don't know why but there is no options related to linking in Projects->Properties.
编辑:
此时我解决了所有问题要安装(使用 Soroosh 帮助,再次感谢)CUDA -5.0在Ubuntu 12.10(并使用NVIDIA二进制Xorg驱动程序,内核模块和VDPAU库从nvidia-current驱动程序 - 只有这给我额外的图形/解决方案)和编译与Netbeans所有的样本项目,并编译和运行我自己。 如果有任何问题,请询问
at this moment I resolved ALL issues to install (with Soroosh help, thanks again) CUDA-5.0 on Ubuntu 12.10 (and use "NVIDIA binary Xorg driver, kernel module and VDPAU library from nvidia-current" driver - only this gives me extra graphics/resolution) and compile with Netbeans ALL samples projects and to compile and run my own. if anyone has any problems, please ask
推荐答案
我在配置类型之前更改为静态库,应用程序,然后链接是可能的。我必须将Ide中的Run命令从调试位置更改为:
I changed before Configuration Type to Static Library and it was mistake: should be Application, then linking is possible. and I have to change Run command in Ide from debug location to:
dist / Debug / GNU-Linux-x86 / my_cuda_1
dist/Debug/GNU-Linux-x86/my_cuda_1
并使用GNU工具集。
现在确定。它构建.o,然后链接到libcudart.so以创建可执行文件:
and use GNU Tool Collections. now it is ok. it build .o and then links with libcudart.so to create executable:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory `/me/NetBeansProjects/my_CUDA_1'
rm -f -r build/Debug
rm -f dist/Debug/GNU-Linux-x86/my_cuda_1
make[1]: Leaving directory `/me/NetBeansProjects/my_CUDA_1'
CLEAN SUCCESSFUL (total time: 113ms)
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/me/NetBeansProjects/my_CUDA_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/my_cuda_1
make[2]: Entering directory `/me/NetBeansProjects/my_CUDA_1'
mkdir -p build/Debug/GNU-Linux-x86
/usr/local/cuda-5.0/bin/nvcc -c -g -I/usr/local/cuda-5.0/include -I/usr/local/cuda-5.0/samples/common/inc -o build/Debug/GNU-Linux-x86/cudaMain.o cudaMain.cu
mkdir -p dist/Debug/GNU-Linux-x86
/usr/local/cuda-5.0/bin/nvcc -o dist/Debug/GNU-Linux-x86/my_cuda_1 build/Debug/GNU-Linux-x86/cudaMain.o -lcudart
make[2]: Leaving directory `/me/NetBeansProjects/my_CUDA_1'
make[1]: Leaving directory `/me/NetBeansProjects/my_CUDA_1'
BUILD SUCCESSFUL (total time: 2s)
CUDA时钟样本GPU设备0:GeForce GT 630with compute
capabilities 2.1
CUDA Clock sample GPU Device 0: "GeForce GT 630" with compute capability 2.1
总时钟数= 52926
Total clocks = 52926
RUN SUCCESSFUL :151ms)
RUN SUCCESSFUL (total time: 151ms)
这篇关于简单的CUDA项目Netbeans链接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!