質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CUDA

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

Python 2.7

Python 2.7は2.xシリーズでは最後のメジャーバージョンです。Python3.1にある機能の多くが含まれています。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

1回答

5459閲覧

makeすると『シンボル 'cudaGetErrorString' への未定義参照です』というエラーが出ます。

R_12.Kunc

総合スコア14

CUDA

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

Python 2.7

Python 2.7は2.xシリーズでは最後のメジャーバージョンです。Python3.1にある機能の多くが含まれています。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2016/08/23 04:16

python版faster R-CNNのモデルの実行を以下の手順で行いました。

①コンパイル

git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git cd ~/py-faster-rcnn/lib #cythonモジュールのビルド make cd ../caffe-fast-rcnn/ cp Makefile.config.example Makefile.config

②Make.configのCPU_ONLY := 1とWITH_PYTHON_LAYER := 1の行のコメントアウトを解除
Make.configの中身は以下の通りです

## Refer to http://caffe.berkeleyvision.org/installation.html # Contributions simplifying and improving our build system are welcome! # cuDNN acceleration switch (uncomment to build with cuDNN). # USE_CUDNN := 1 # CPU-only switch (uncomment to build without GPU support). CPU_ONLY := 1 # uncomment to disable IO dependencies and corresponding data layers # USE_OPENCV := 0 # USE_LEVELDB := 0 # USE_LMDB := 0 # uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary) # You should not set this flag if you will be reading LMDBs with any # possibility of simultaneous read and write # ALLOW_LMDB_NOLOCK := 1 # Uncomment if you're using OpenCV 3 #OPENCV_VERSION := 3 # To customize your choice of compiler, uncomment and set the following. # N.B. the default for Linux is g++ and the default for OSX is clang++ # CUSTOM_CXX := g++ # CUDA directory contains bin/ and lib/ directories that we need. CUDA_DIR := /usr/local/cuda # On Ubuntu 14.04, if cuda tools are installed via # "sudo apt-get install nvidia-cuda-toolkit" then use this instead: # CUDA_DIR := /usr # CUDA architecture setting: going with all of them. # For CUDA < 6.0, comment the *_50 lines for compatibility. CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \ -gencode arch=compute_20,code=sm_21 \ -gencode arch=compute_30,code=sm_30 \ -gencode arch=compute_35,code=sm_35 \ -gencode arch=compute_50,code=sm_50 \ -gencode arch=compute_50,code=compute_50 # BLAS choice: # atlas for ATLAS (default) # mkl for MKL # open for OpenBlas BLAS := atlas # Custom (MKL/ATLAS/OpenBLAS) include and lib directories. # Leave commented to accept the defaults for your choice of BLAS # (which should work)! # BLAS_INCLUDE := /path/to/your/blas # BLAS_LIB := /path/to/your/blas # Homebrew puts openblas in a directory that is not on the standard search path # BLAS_INCLUDE := $(shell brew --prefix openblas)/include # BLAS_LIB := $(shell brew --prefix openblas)/lib # This is required only if you will compile the matlab interface. # MATLAB directory should contain the mex binary in /bin. # MATLAB_DIR := /usr/local # MATLAB_DIR := /Applications/MATLAB_R2012b.app # NOTE: this is required only if you will compile the python interface. # We need to be able to find Python.h and numpy/arrayobject.h. PYTHON_INCLUDE := /usr/include/python2.7 \ /usr/lib/python2.7/dist-packages/numpy/core/include # Anaconda Python distribution is quite popular. Include path: # Verify anaconda location, sometimes it's in root. # ANACONDA_HOME := $(HOME)/anaconda # PYTHON_INCLUDE := $(ANACONDA_HOME)/include \ # $(ANACONDA_HOME)/include/python2.7 \ # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \ # Uncomment to use Python 3 (default is Python 2) # PYTHON_LIBRARIES := boost_python3 python3.5m # PYTHON_INCLUDE := /usr/include/python3.5m \ # /usr/lib/python3.5/dist-packages/numpy/core/include # We need to be able to find libpythonX.X.so or .dylib. PYTHON_LIB := /usr/lib # PYTHON_LIB := $(ANACONDA_HOME)/lib # Homebrew installs numpy in a non standard path (keg only) # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include # PYTHON_LIB += $(shell brew --prefix numpy)/lib # Uncomment to support layers written in Python (will link against Python libs) WITH_PYTHON_LAYER := 1 # Whatever else you find you need goes here. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies # INCLUDE_DIRS += $(shell brew --prefix)/include # LIBRARY_DIRS += $(shell brew --prefix)/lib # Uncomment to use `pkg-config` to specify OpenCV library paths. # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.) # USE_PKG_CONFIG := 1 BUILD_DIR := build DISTRIBUTE_DIR := distribute # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171 # DEBUG := 1 # The ID of the GPU that 'make runtest' will use to run unit tests. TEST_GPUID := 0 # enable pretty build (comment to see full commands) Q ?= @

③ビルド実行

make

すると、以下のエラーが出てきました。

CXX/LD -o .build_release/tools/caffe.bin /usr/bin/ld: .build_release/tools/caffe.o: シンボル 'cudaGetErrorString' への未定義参照です /usr/local/cuda-7.5/lib64/libcudart.so.7.5: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [.build_release/tools/caffe.bin] エラー 1

これはどういう意味でしょうか?cuda、caffeは共に実装済みなのでどこかでリンクが途切れていることが原因でしょうか?
どなたかご教授よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

たぶんですが,リンク時に明示的に-lcudartを指定してやる必要があるかと.

DSO missing from command lineは,リンク対象が明示的に指定されていない時に起こる印象.

投稿2016/08/23 08:57

tamy

総合スコア442

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

R_12.Kunc

2016/08/24 05:59

ご解答ありがとうございます。 初歩的な質問で申し訳ございませんが、具体的には make -lcudart とコマンドを打てばよろしいのでしょうか?
tamy

2016/08/24 06:28

いや,すみません,CPU_ONLY := 1 なので,-lcudart が自動追加されない(追加する必要がない)んですね. Makefile.config 内の CUDA_DIR := /usr/local/cuda を CUDA_DIR := /usr/local/cuda-7.5 に変えてみてください.
R_12.Kunc

2016/08/25 02:11 編集

おはようございます。 tamyさんのアドバイス通り試してみたのですが、以下のエラーが出ました。 CXX/LD -o .build_release/tools/caffe.bin /usr/bin/ld: -lcudnn が見つかりません collect2: error: ld returned 1 exit status make: *** [.build_release/tools/caffe.bin] エラー 1 こちらの方はcudnnのシンボリックリンクを作成すればよろしいでしょうか? ちなみに、トップディレクトリからcudnnをfindしてみたところ以下の場所にありました。 /usr/local/cuda-6.5/include/cudnn.h /usr/local/cuda-6.5/lib64/libcudnn.so.6.5 /usr/local/cuda-6.5/lib64/libcudnn.so /usr/local/cuda-6.5/lib64/libcudnn_static.a /usr/local/cuda-6.5/lib64/libcudnn.so.6.5.48 (他にも多くのcudnn関連のファイルが存在しましたが、caffeディレクトリやpy-faster-rcnnディレクトリの中だったりしたので、関連のありそうな部分だけ記載しています。)
R_12.Kunc

2016/08/25 02:02

連投失礼いたします。 上記のエラーが出たのは Make.configの ①USE_CUDNNのコメントアウトを解除し、 ②GPU環境があるため、CPU_ONRY=1をコメントアウト した後の結果です。
tamy

2016/08/25 06:46

もしかして,cuda6.5 と cuda7.5 を両方インストールしてます?(最初のエラー文では cuda-7.5 を参照してるのに 前コメの cudnn を検索した時には cuda-6.5 を参照しているので…) だとすると,おそらく cuda7.5 向けの cuDNN が入っていないと思われます. なので,そいつをインストールするか,CUDA_DIR := /usr/local/cuda-6.5 でどうにかなりませんかね? たぶんですが,cuda インストール時に /usr/local/cuda -> /usr/local/cuda-7.5 のリンクが自動生成されているはずなので,cuda 7.5 向けの cuDNN がないと,cud 6.5 向けの cuDNN があったとしても,それを見つけられないのだと思います.
R_12.Kunc

2016/08/26 05:17 編集

(長文で失礼いたします。。。) cuda6.5,cuda7.5両方インストールしているようです。(先輩の引継ぎなので誰がいつどこに何をインストールしたのかを把握し切れておりません。。。) cuda7.5向けのcudnn ( cudnn-7.5-linux-x64-v5.0-ga.taz )をインストールし、その後、 ①ホーム/ダウンロード/cuda/includeの中身( cudnn.h)を usr/local/cuda/includeのなかにコピーしました sudo cp cudnn.h /usr/local/cuda/include/ ②ホーム/ダウンロード/cuda/lib64の中身 (libcudnn.so, libcudnn.so.5,libcudnn.so.5.0.5,libcudnn_static.a) を/usr/local/cuda/lib64の中にコピーしました。 この後、再びMakefile.configのディレクトリに戻り、makeしましたが、以下の同様のエラーが出ました。 CXX/LD -o .build_release/tools/caffe.bin /usr/bin/ld: -lcudnn が見つかりません collect2: error: ld returned 1 exit status make: *** [.build_release/tools/caffe.bin] エラー 1 おかしいと思い、findしてみたところ、/usr/local/cuda以下に入れたはずのcudnn関連のライブラリが存在しませんでした。 find / -name *cudnn* /usr/local/cuda-6.5/include/cudnn.h /usr/local/cuda-6.5/lib64/libcudnn.so.6.5 /usr/local/cuda-6.5/lib64/libcudnn.so /usr/local/cuda-6.5/lib64/libcudnn_static.a /usr/local/cuda-6.5/lib64/libcudnn.so.6.5.48 /usr/local/cuda-7.5/targets/x86_64-linux/include/cudnn.h 関係があるかはわかりませんが、cudnnをインストールしたときに、ホーム/ダウンロード/cuda/include内のcudnn.hは鍵マークがついていました。 追記です。 cudaディレクトリのリンクを確かめたところ、cuda-7.5とシンボリックリンクを形成しているようでした。 ls -l /usr/local/cuda lrwxrwxrwx 1 root root 8 12月 20 2015 /usr/local/cuda -> cuda-7.5
R_12.Kunc

2016/08/26 06:10

追記2 cuda-7.5にlib64関連のファイルをコピーしてみました. ~/ダウンロード/cuda/lib64$ cp *cudnn* /usr/local/cuda-7.5/lib64 その後,Make.configのあるディレクトリに移動し,makeしたところ,以下の新たなエラーが出てきました... ~/py-faster-rcnn/caffe-fast-rcnn$ make CXX/LD -o .build_release/tools/caffe.bin /usr/bin/ld: warning: libcudart.so.6.5, needed by /usr/local/lib/libopencv_core.so, may conflict with libcudart.so.7.5 .build_release/lib/libcaffe.so: `cv::imread(cv::String const&, int)' に対する定義されていない参照です .build_release/lib/libcaffe.so: `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)' に対する定義されていない参照です .build_release/lib/libcaffe.so: `cv::imdecode(cv::_InputArray const&, int)' に対する定義されていない参照です collect2: error: ld returned 1 exit status make: *** [.build_release/tools/caffe.bin] エラー 1
tamy

2016/08/26 06:33

たぶん,OpenCV が cuda-6.5 に依存してるのに,/usr/local/cuda が cuda-7.5 を指しているからだと思います(つまりライブラリごとに依存するバージョンが違ってしまっている). ここまでくると openCV および cuda-7.5 をクリーンインストールする方が早いかも… もしくは,py-faster-rcnn が対応しているのであれば,/usr/local/cuda のリンク先を /usr/local/cuda-6.5 に変えて,素直に cuda-6.5 を使うとか.
R_12.Kunc

2016/08/26 06:52

/usr/local/cuda-6.5に変えても同じようなエラーが出ますね... CXX/LD -o .build_release/tools/caffe.bin /usr/bin/ld: warning: libcudart.so.7.5, needed by .build_release/lib/libcaffe.so, may conflict with libcudart.so.6.5 /usr/bin/ld: warning: libcublas.so.7.5, needed by .build_release/lib/libcaffe.so, may conflict with libcublas.so.6.5 /usr/bin/ld: warning: libcurand.so.7.5, needed by .build_release/lib/libcaffe.so, may conflict with libcurand.so.6.5 .build_release/lib/libcaffe.so: `cv::imread(cv::String const&, int)' に対する定義されていない参照です .build_release/lib/libcaffe.so: `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)' に対する定義されていない参照です .build_release/lib/libcaffe.so: `cv::imdecode(cv::_InputArray const&, int)' に対する定義されていない参照です collect2: error: ld returned 1 exit status make: *** [.build_release/tools/caffe.bin] エラー 1 openCVとcuda-7.5のクリーンインストールを検討してみたいと思います.
tamy

2016/08/26 06:59

これは ./build_release 内のエラーなので,py-faster-rcnn が cuda-6.5 に対応してないんですね. まだ間に合えばですが,まず openCV だけクリーンインストールしてみてください.
R_12.Kunc

2016/08/29 07:08

返信が遅くなり申し訳ございません. 以下のサイトを参考にしながらopencv3.0のインストールを行いました. www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-phttp://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/ython-2-7-on-ubuntu/ しかし,端末でバージョンを確認したところ,3.0.0が反映されていませんでした. ~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '2.4.8'
tamy

2016/08/30 09:09

cv.so を置く場所とか間違えてませんか?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問