amd / OpenCL-caffe

This is a Experimental version of OpenCL by AMD Research, we now recommend you to use The official BVLC Caffe OpenCL branch is over at Caffe branch now at https://github.com/BVLC/caffe/tree/opencl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cblas missing, cannot build using make or cmake OSX 10.10

matthewbahr opened this issue · comments

I get 3% of the way into building after cmake fires off correctly from a build directory using $ cmake ... Using make manually from Caffe just results in there being the same error:

fatal error:
  'cblas.h' file not found
#include <cblas.h>
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/blob.cpp.o] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

I've looked around and most of the results I've found talk about using CUDA and that's clearly not an option. I have tried reinstalling all of my dependencies via homebrew, I've tried using standard make passing in compile params like $ make all -L /usr/local/Cellar/openblas/0.2.15/lib -I /usr/local/Cellar/openblas/0.2.15/include and followed this suggestion:

The only changes I needed to make to the source code were to replace #include <CL/...> with #include <OpenCL/...> in these files:

include/caffe/common.hpp
include/caffe/util/math_functions.hpp
and to remove #include <malloc.h> from src/caffe/device.cpp

I haven't seen anyone else having these same issues but I'm assuming I'm just doing something stupid and failing to actually link correctly somewhere.

Help?

it seems that you did not set up your cBLAS library. which c version of BLAS you are using? you should set up the path variables so the cake will find colas.h file.
thanks
junli

On Mar 5, 2016, at 10:18 PM, matthewbahr notifications@github.com wrote:

I get 3% of the way into building after cmake fires off correctly from a build directory using $ cmake ... Using make manually from Caffe http://caffe.berkeleyvision.org/installation.html#compilation just results in there being the same error:

fatal error:
'cblas.h' file not found
#include <cblas.h>
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/blob.cpp.o] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2
I've looked around and most of the results I've found talk about using CUDA and that's clearly not an option. I have tried reinstalling all of my dependencies via homebrew, I've tried using standard make passing in compile params like $ make all -L /usr/local/Cellar/openblas/0.2.15/lib -I /usr/local/Cellar/openblas/0.2.15/include and followed this suggestion:

The only changes I needed to make to the source code were to replace #include with #include <OpenCL/...> in these files:

include/caffe/common.hpp
include/caffe/util/math_functions.hpp
and to remove #include <malloc.h> from src/caffe/device.cpp

I haven't seen anyone else having these same issues but I'm assuming I'm just doing something stupid and failing to actually link correctly somewhere.

Help?


Reply to this email directly or view it on GitHub #36.

I was using OpenBLAS, is that not a c BLAS? I also set the BLAS attributes in the Makefile.config to be BLAS := open.

Should I be setting the BLAS somewhere other than Makefile.config?

brew install openblas to get the required includes in /usr/local/include

I installed openblas with Homebrew before all of this already. Like I said:

"I have tried reinstalling all of my dependencies via homebrew"

Brew list returns this:
boost gcc jpeg lmdb openexr boost-python gflags leveldb mpfr protobuf clblas gmp libmpc numpy snappy cmake ilmbase libpng openblas szip eigen isl libtiff opencv

You need to uncomment include and lib defines to add openblas from brew. It is just below where BLAS := open

Here's what it was when I opened it up just now:

BLAS choice:

atlas for ATLAS (default)

mkl for MKL

open for OpenBlas

BLAS := open

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

Shouldn't that already be including Homebrew OpenBLAS?

Thanks for walking through this step by step with me.

That should be all you need. The cblas.h file should be in/usr/local/opt/openblas/include/ as openblas must be installed away from /usr/local/include to avoid conflicts. make clean all may be required to remove any old dependencies generated from prior Makefiles.

Thanks Victor. It's still not compiling. I just made a fresh directory and reconfigured everything from scratch but I'm still getting the same error.

I've looked at my file structure and found cblas.h but for some reason the compilation isn't seeing it.

Is there a way to manually specify the dir of cblas.h in my Makefile besides the standard defining of OpenBLAS? Maybe in the # Whatever else you find you need goes here. section of the makefile?

Or could I bring it in to a root area for the actual make?

I'm grasping at straws here.

Same happened for me too on 10.11

@dendisuhubdy Did you ever fix it?

@matthewbahr it's been 5 days now. I tried changing

# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas

to include the BLAS include and library directories. It didn't work too. Is there any confirmation that the compilation works on Ubuntu 14.04?

What does brew --prefix openblas return?

My brew --prefix openblas returns /usr/local/opt/openblas

I just upgraded to OSX 10.11.5 and am trying again.

@dendisuhubdy Unsure if there is any confirmation. I'm trying it on 10.11.5 because I recently updated.

This solved the problem for me: cmake -DCMAKE_CXX_FLAGS=-I/usr/local/opt/openblas/include ..

@tpanum thanks!

@tpanum Do I need to add it to MakeFile.config ?

@ShivangiM No, just add the flag I mentioned to the cmake command in the shell.

@tpanum thank you. It works

@tpanum thanks a lot. It works very well.

The instruction below works for me.

  1. excute the command below to install blas
$ brew install openblas
  1. modify 'Makefile.config'
# set to open
BLAS := open
# uncomment below 2 lines
BLAS_INCLUDE := $(shell brew --prefix openblas)/include
BLAS_LIB := $(shell brew --prefix openblas)/lib

@navy-xie That is neat and works. Thank you.