1

NetBeans IDEで[依存関係チェックを有効にする]をオフにすると(この問題を参照)、IDEはnvccを使用して.cuを.oにコンパイルしますが、リンクはまったく行われません。

"/ usr / bin / make" -f nbproject / Makefile-Debug.mk QMAKE = SUBPROJECTS = .build-conf make 1:ディレクトリ /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: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]: Leaving directory / me / NetBeansProjects /my_CUDA_1'を離れます

成功を収める(合計時間:2秒)

ターミナルからリンクできます:

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#

これは、make依存関係(?)をチェックしないという事実に関連していると思います。リンクを有効にするためにIDEで何をチェック/チェック解除/削除/追加/変更しますか?理由はわかりませんが、[プロジェクト]->[プロパティ]にリンクに関連するオプションはありません。

編集:

この時点で、Ubuntu 12.10にCUDA-5.0をインストールするためのすべての問題を解決しました(そして、「NVIDIAバイナリXorgドライバー、カーネルモジュール、およびnvidia-currentのVDPAUライブラリを使用します」-これだけで追加のグラフィックスが得られます/ resolution)そしてNetbeans ALLサンプルプロジェクトでコンパイルし、自分でコンパイルして実行します。誰か問題があれば、聞いてください

ここに画像の説明を入力してください

4

1 に答える 1

1

構成タイプの前に静的ライブラリに変更しましたが、それは間違いでした。アプリケーションである必要があり、リンクが可能です。そして、IdeのRunコマンドをデバッグ場所から次の場所に変更する必要があります。

dist / Debug / GNU-Linux-x86 / my_cuda_1

GNUツールコレクションを使用します。今は大丈夫です。.oをビルドしてから、libcudart.soとリンクして実行可能ファイルを作成します。

"/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:計算機能2.1を備えた「GeForceGT630」

合計クロック=52926

実行成功(合計時間:151ms)

于 2013-03-09T22:34:50.387 に答える