BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.12k stars 18.69k forks source link

Support linking of BLIS library with Caffe #5977

Open santanu-thangaraj opened 7 years ago

santanu-thangaraj commented 7 years ago

We have been using Caffe as a benchmark for our optimization work, and working on accelerating BLAS library called BLIS(https://github.com/flame/blis).

After linking Caffe with BLIS, we observe good performance improvement for handwritten digit recognition. More about it here: http://developer.amd.com/wordpress/media/2013/12/Accelerating-Machine-Learning-using-BLIS.pdf

Caffe does not support linking with BLIS by default, hence requesting you to add this feature. If required I can raise a PR for the same with this feature.

vanduc103 commented 7 years ago

Hi @santanu-thangaraj, I followed your instructions at : https://github.com/BVLC/caffe/wiki/Linking-Caffe-with-BLIS but I got this problem when compiling Caffe with BLIS (I've compiled successfully Caffe with ATLAS and Intel MKL):

CXX/LD -o .build_release/tools/upgrade_net_proto_binary.bin .build_release/lib/libcaffe.so: undefined reference to cblas_sgemv' .build_release/lib/libcaffe.so: undefined reference tocblas_dgemm' .build_release/lib/libcaffe.so: undefined reference to cblas_sscal' .build_release/lib/libcaffe.so: undefined reference tocblas_dgemv' .build_release/lib/libcaffe.so: undefined reference to cblas_saxpy' .build_release/lib/libcaffe.so: undefined reference tocblas_ddot' .build_release/lib/libcaffe.so: undefined reference to cblas_dasum' .build_release/lib/libcaffe.so: undefined reference tocblas_sgemm' .build_release/lib/libcaffe.so: undefined reference to cblas_dscal' .build_release/lib/libcaffe.so: undefined reference tocblas_scopy' .build_release/lib/libcaffe.so: undefined reference to cblas_sasum' .build_release/lib/libcaffe.so: undefined reference tocblas_daxpy' .build_release/lib/libcaffe.so: undefined reference to cblas_dcopy' .build_release/lib/libcaffe.so: undefined reference tocblas_sdot' collect2: error: ld returned 1 exit status make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1

I modified BLAS_INCLUDE and BLAS_LIB in Makefile.config to BLIS installation library (at /blis/include/blis and /blis/lib).

Thank you very much !

santanu-thangaraj commented 7 years ago

Hi @vanduc103, It seems like while you configured BLIS, you haven't enabled cblas interface. So to be sure 1) make distclean 2) ./configure --enable-cblas auto 3) make 4) make install

Regards

vanduc103 commented 7 years ago

Thank you very much @santanu-thangaraj ! I re-configured BLIS and Caffe is now happy to link with BLIS :)