Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake build system #442

Closed
wants to merge 21 commits into from
Closed

CMake build system #442

wants to merge 21 commits into from

Conversation

akosiorek
Copy link
Contributor

CMake build system for Caffe as suggest in #215

Changes:

  1. Tests are managed by CTest, but can be run as individual gtests or a batch gtest (test.test)
  2. Building shared libs is controlled by BUILD_SHARED_LIBS flag set at configuration time (default is off)
  3. Have yet to add Matlab wrapper
  4. Changed source tree in order to facilitate out-of-source build
  5. Compiler must be specified before the first invokation of cmake (if default is other then gcc-4.6).
  6. Test data location is dependent on the CMAKE_SOURCE_DIR variable; It is automatically set at make time.

Building tips:

mkdir build
cd build
CC=gcc-4.6 cmake ..
make -j8
ctest -v

(Not sure if CC=gcc-4.6 is neccesary, but no other version works for me)

Options are specified at cmake invokation with -D flag. Example: -DPYTHON=ON

  • PYTHON BUILD_PYTHON [default OFF]
  • MATLAB BUILD_MATLAB [default OFF]
  • EXAMPLES BUILD_EXAMPLES [default ON]
  • TOOLS [ON] Not anymore, tools are built by defualt
  • BLAS [atlas, open, mkl; default atlas]
  • BUILD_SHARED_LIBS [default OFF]
  • CUDA_TEST_DEVICE [default 0]

Remarks:

  • Tested only under Linux Mint 16
  • Have yet to figure out why tools require recompilation of Blob.cpp

@@ -153,7 +153,7 @@ else ifeq ($(UNAME), Darwin)
endif

ifeq ($(LINUX), 1)
CXX := /usr/bin/g++
CXX := /usr/bin/g++-4.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all users use the same version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved in df2322c

@kloudkl
Copy link
Contributor

kloudkl commented May 24, 2014

This is a great PR. @akosiorek, thank you very much! Besides the line notes, I am curious about a few more questions.

  1. Why do you use CTest to manage the tests? Can gtest manage them?
  2. Why the out-of-source building requires moving all the modules into the src directory?
  3. The majority of the added lines are the source files of gtest. Are they necessary to build successfully?

Also, please consider organizing the CMake scripts in platform specific directories as OpenCV does.

@akosiorek
Copy link
Contributor Author

  1. CTest enables running all tests from the top build directory. You can still run individual tests by going to build/caffe/tests and running executables there. There is also an aggregate test (test_all.test) that runs all tests without ctest. To sum up: just for convenience. Should I drop it?
  2. That's just how it is usually done with CMake. At first I tried to keep the original source tree structure. There was a problem with Eclipse, however. After importing the project as a Makefile project the source directory was invisible/unreachable from Eclipse. Moving everything to src solved the issue.
  3. I'll have to check it. I put the whole gtest project there just to use their CMakeLists.txt for building. I can try to remove some source files and see if it is going to work. Or I can try to write custom CMakeLists to compile just those 3 files. Work in progress.

For now there aren't any platform specific scripts.

I've got a few question, too.
4. Should I add any license text or the author in the files I add?
5. Can I count on any help with testing it under different platforms? I have access to Linux workstations only. Also, I don't have MKL and can't test with it.

@kloudkl
Copy link
Contributor

kloudkl commented May 24, 2014

Just hub checkouted and tried this on Ubuntu 14.04. I guess that the out-of-source building problem is because that the CMakeLists.txt is not in the top level directory as often seen in projects built by CMake.

The default BLAS option Atlas was found correctly and the objects files were compiled successfully but libcaffe.so was not generated. The script src/CMakeScripts/FindOpenBLAS.cmake
cannot find OpenBLAS installed with sudo apt-get install libopenblas-base libopenblas-dev. MKL was not found neither. It is not clear how to set the related environment variables.

@akosiorek
Copy link
Contributor Author

You have to specify -DBUILD_SHARED_LIBS=ON at configuration to get libcaffe.so. A static library is built otherwise. I'll work on all your comments and try to solve the issues next week (from tuesday on I guess)

@kloudkl
Copy link
Contributor

kloudkl commented May 24, 2014

After adding the flag, building failed with the errors:

../util/libutil.so: undefined reference to `cblas_sgemv'
......
collect2: ld returned 1 exit status
make[2]: *** [caffe/test/test_common.test] Error 1
make[1]: *** [caffe/test/CMakeFiles/test_common.test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

@akosiorek
Copy link
Contributor Author

I've got the same error with BUILD_SHARED_LIBS=ON. I'll try to address it. In the meantime, I restored gtest dir to contain only the 3 original source files in 3de9118.

As of 6073ff0, manual file listing is no longer necessary. There is a catch, however. After adding a file CMake has no way of knowing that any file was added and will not include it in the next build. You have to "touch" a CMakeLists.txt file in order to refresh it. By touching I mean adding and deleting an empty space for instance. From file section in CMake documentation:

We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake to regenerate

@akosiorek
Copy link
Contributor Author

As for the OpenBLAS:
By purge-removing libopenblas-dev and libopenblas-base and explicitly removing all remaining libopenblas* libs I could find (I had 6 of them besides symlinks) I managed to brake cmake. Unfortnately, installing openblas with sudo apt-get install libopenblas-base libopenblas-dev made it work again.

I'll try on other workstations later, but for now I can't nail the problem

@akosiorek
Copy link
Contributor Author

I restored original source tree structure in 23a0cea. Both CMake and Makefile build systems now work. Git does not complain about generated header files anymore.

I'm afraid I can't work on Matlab build, nor the Intel MKL find scripts. We're not using them here and I'm running out of time.

EDIT:
After all the changes BUILD_SHARED_LIBS=ON appears to work with both Atlas and OpenBLAS. Could you please try it?

@akosiorek
Copy link
Contributor Author

rebased

@kloudkl
Copy link
Contributor

kloudkl commented May 29, 2014

@akosiorek, your expertise in CMake is really amazing, thanks again!

I have tested four flag combinations -DBLAS=atlas(in fact default and don't have to be set explicitly), -DBLAS=atlas -DBUILD_SHARED_LIBS=ON, -DBLAS=open and -DBLAS=open -DBUILD_SHARED_LIBS=ON. The building processes work quite smoothly after all the changes. I don't use MATLAB and MKL very often either. The most essential requirements have all been satisfied. If someone else interested in the less frequent use cases test themselves and find some new issues, we can solve them then.

Just as a minor reminder, when building with atlas make -j4 encounters an error but works again after make at the stopped place.

[  3%] Building CXX object src/caffe/proto/CMakeFiles/proto.dir/caffe.pb.cc.o
/home/user/Codes/caffe-fork/include/caffe/vision_layers.hpp(136): error: identifier "EltwiseParameter_EltwiseOp" is undefined
1 error detected in the compilation of "/tmp/tmpxft_00000b25_00000000-12_hdf5_data_layer.compute_35.cpp1.ii".
CMake Error at caffe_cu_generated_hdf5_data_layer.cu.o.cmake:264 (message):
  Error generating file
  /home/user/Codes/caffe-fork/build/src/caffe/CMakeFiles/caffe_cu.dir/layers/./caffe_cu_generated_hdf5_data_layer.cu.o
make[2]: *** [src/caffe/CMakeFiles/caffe_cu.dir/layers/./caffe_cu_generated_hdf5_data_layer.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....

With BUILD_SHARED_LIBS=ON, the static library is not generated together.

The output of the make and cmake are in different directory layouts. Many users may have hard coded dependencies on the original layout. Can you adjust the outcomes of cmake to be as close as possible to those of make?

Some of the original files are still mixed after rebase. If you clean them up, I think this PR will be ready to be reviewed by others.

Adam Kosiorek added 8 commits June 23, 2014 09:28
*rebase required moving some files around
*I've made a mistake with generated file extension in cmake; corrected
*makefile can now deal with changed include in caffe_pretty_print
*added dependencies in CMake
@akosiorek
Copy link
Contributor Author

@kloudkl I'm on it.

Edit: Conflicts resolved.
Edit2: I added checks on PROTOBUF_PROTOC_EXECUTABLE. CMake generation now throws an error if this cmake variable is empty. The FindProtobuf.cmake tries to find the protoc executable with find_program CMake's built-in function, which is the same way used in find script mentioned by @bhack. Could you guys test it on Ubuntu 14.04?

@bhack
Copy link
Contributor

bhack commented Jun 23, 2014

I've tested on Debian testing and works for me. We need to choice if we want default BUILD_SHARED_LIBS=off or BUILD_SHARED_LIBS=on

@bhack bhack mentioned this pull request Jun 24, 2014
@@ -0,0 +1,79 @@
# Copyright: (C) 2010 RobotCub Consortium
# Authors: Arjan Gijsberts
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is inclusion of an LGPL source file a concern here? I'd think this would not be compatible with the BSD license, but I'm not an expert in these things.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a concern, but I believe replacing this script with BSD code is on
the PR authors' TODO list.

All licensing must be BSD-compatible for merge.

On Wed, Jun 25, 2014 at 6:07 AM, Rob Hess notifications@github.com wrote:

In CMakeScripts/FindAtlas.cmake:

@@ -0,0 +1,79 @@
+# Copyright: (C) 2010 RobotCub Consortium
+# Authors: Arjan Gijsberts
+# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

Is inclusion of an LGPL source file a concern here? I'd think this would
not be compatible with the BSD license, but I'm not an expert in these
things.


Reply to this email directly or view it on GitHub
https://github.com/BVLC/caffe/pull/442/files#r14158833.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the default FindBlas distributed with cmake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robwhess It'd be great if you could provide another script for finding Atlas. I've no experience in writing Find* scripts. I re-write this one, but I'm not sure if it'll be sufficient for droping the license.

@bhack It was the very first one I've tried but it didn't work for me.

@bhack
Copy link
Contributor

bhack commented Jun 25, 2014

Probably tools must be installed in /usr/local/bin and set_target_properties needs also caffe_cu and ../src/caffe/proto/libproto.so

@jyegerlehner
Copy link
Contributor

Gods of the write access, we beseach you. Please merge! I need CMake for support in my IDE.

@jeffdonahue
Copy link
Contributor

Ok, I took a look at this. (I'll reiterate that I know absolutely nothing about CMake.)

I tried following the instructions currently in the OP on this thread from @akosiorek:

[/home/jdonahue/dev/caffe 3378]$ make superclean # remove the Makefile build
No generated files found.
[/home/jdonahue/dev/caffe 3379]$ mkdir build
[/home/jdonahue/dev/caffe 3380]$ cd build
[/home/jdonahue/dev/caffe/build 3381]$ CC=gcc-4.6 cmake ../src
CMake Error: The source directory "/home/jdonahue/dev/caffe/src" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Is the ../src argument out of date? I retried with just ../ and got a bit further:

[/home/jdonahue/dev/caffe/build 3387]$ CC=gcc-4.6 cmake ../
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc-4.6
-- Check for working C compiler: /usr/bin/gcc-4.6 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found CUDA: /usr/local/cuda (found suitable version "5.5", required is "5.5")
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found GLOG: /usr/local/include
-- Found Atlas libraries: /usr/lib/liblapack_atlas.so;/usr/lib/atlas-base/libptcblas.a;/usr/lib/libatlas.so
-- Found Atlas include: /usr/include;/usr/include/atlas
-- Found HDF5: /usr/lib/libhdf5_hl.so;/usr/lib/libhdf5.so
-- Found leveldb in /usr/include /usr/lib/libleveldb.a
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1202 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.46.1

  Boost include path: /usr/include

  Detected version of Boost is too old.  Requested version was 1.49 (or
  newer).

  The following Boost libraries could not be found:

          boost_system

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  src/caffe/CMakeLists.txt:52 (find_package)


-- Found PROTOBUF: /usr/lib/libprotobuf.so
-- Found PROTOBUF Compiler: /usr/bin/protoc
-- Examples enabled
-- Configuring incomplete, errors occurred!

Apparently I have boost 1.46...this should probably be allowed as it's apparently the version that Ubuntu installs by default. So I did:

[/home/jdonahue/dev/caffe/build 3389]$ cd ..
[/home/jdonahue/dev/caffe 3390]$ git grep "Boost 1.49"
python/CMakeLists.txt:find_package(Boost 1.49 COMPONENTS python REQUIRED)
src/caffe/CMakeLists.txt:find_package(Boost 1.49 COMPONENTS system REQUIRED)

And then changed the 1.49 to 1.46 in both those places. Then I tried again:

[/home/jdonahue/dev/caffe 3396]$ cd build
[/home/jdonahue/dev/caffe/build 3397]$ cmake ..
-- Found Atlas libraries: /usr/lib/liblapack_atlas.so;/usr/lib/atlas-base/libptcblas.a;/usr/lib/libatlas.so
-- Found Atlas include: /usr/include;/usr/include/atlas
-- Found leveldb in /usr/include /usr/lib/libleveldb.a
-- Boost version: 1.46.1
-- Found the following Boost libraries:
--   system
-- Found PROTOBUF Compiler: /usr/bin/protoc
-- Examples enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jdonahue/dev/caffe/build

I then do make -j 8. It seems to go ok for a while, but then I start getting things like:

[...]
[ 33%] Building CXX object src/caffe/test/CMakeFiles/test_concat_layer.test.dir/test_caffe_main.cpp.o
[ 33%] Building CXX object src/caffe/test/CMakeFiles/test_caffe_main.test.dir/test_caffe_main.cpp.o
[ 33%] Building CXX object src/caffe/test/CMakeFiles/test_all.test.dir/test_concat_layer.cpp.o
[ 33%] [ 33%] Building CXX object src/caffe/test/CMakeFiles/test_blob.test.dir/test_blob.cpp.o
Building CXX object src/caffe/test/CMakeFiles/test_argmax_layer.test.dir/test_argmax_layer.cpp.o
[ 34%] Building CXX object src/caffe/test/CMakeFiles/test_concat_layer.test.dir/test_concat_layer.cpp.o
[ 34%] [ 35%] Building CXX object src/caffe/test/CMakeFiles/test_common.test.dir/test_common.cpp.o
Building CXX object src/caffe/test/CMakeFiles/test_convolution_layer.test.dir/test_convolution_layer.cpp.o
[ 36%] [ 36%] Building CXX object src/caffe/test/CMakeFiles/test_caffe_main.test.dir/__/blob.cpp.o
Building CXX object src/caffe/test/CMakeFiles/test_benchmark.test.dir/test_benchmark.cpp.o
[ 37%] Building CXX object src/caffe/test/CMakeFiles/test_common.test.dir/__/blob.cpp.o
Linking CXX executable ../../../test/test_caffe_main.test
[ 38%] Building CXX object src/caffe/test/CMakeFiles/test_all.test.dir/test_softmax_layer.cpp.o
[ 39%] Building CXX object src/caffe/test/CMakeFiles/test_blob.test.dir/__/blob.cpp.o
../../../lib/libcaffe.a(common.cpp.o): In function `caffe::Caffe::Caffe()':
common.cpp:(.text+0x150): undefined reference to `curandCreateGenerator'
common.cpp:(.text+0x16f): undefined reference to `curandSetPseudoRandomGeneratorSeed'
../../../lib/libcaffe.a(common.cpp.o): In function `caffe::Caffe::~Caffe()':
common.cpp:(.text+0x316): undefined reference to `curandDestroyGenerator'
../../../lib/libcaffe.a(common.cpp.o): In function `caffe::Caffe::set_random_seed(unsigned int)':
common.cpp:(.text+0x44e): undefined reference to `curandDestroyGenerator'
common.cpp:(.text+0x520): undefined reference to `curandCreateGenerator'
common.cpp:(.text+0x5f2): undefined reference to `curandSetPseudoRandomGeneratorSeed'
../../../lib/libcaffe.a(common.cpp.o): In function `caffe::Caffe::SetDevice(int)':
common.cpp:(.text+0x98b): undefined reference to `curandDestroyGenerator'
common.cpp:(.text+0xc0d): undefined reference to `curandCreateGenerator'
common.cpp:(.text+0xcef): undefined reference to `curandSetPseudoRandomGeneratorSeed'
collect2: ld returned 1 exit status
make[2]: *** [test/test_caffe_main.test] Error 1
make[1]: *** [src/caffe/test/CMakeFiles/test_caffe_main.test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 40%] Building CXX object src/caffe/test/CMakeFiles/test_benchmark.test.dir/__/blob.cpp.o
Linking CXX executable ../../../test/test_common.test
[ 40%] Building CXX object src/caffe/test/CMakeFiles/test_argmax_layer.test.dir/__/blob.cpp.o
[ 40%] Building CXX object src/caffe/test/CMakeFiles/test_concat_layer.test.dir/__/blob.cpp.o
CMakeFiles/test_common.test.dir/test_common.cpp.o: In function `caffe::CommonTest_TestRandSeedGPU_Test::TestBody()':
test_common.cpp:(.text+0x8b4): undefined reference to `curandGenerate'
test_common.cpp:(.text+0x9a1): undefined reference to `curandGenerate'
../../../lib/libcaffe.a(common.cpp.o): In function `caffe::Caffe::Caffe()':
common.cpp:(.text+0x150): undefined reference to `curandCreateGenerator'
[...]

It seems like it may have not located CUDA correctly?

Since there is demand for this and presumably it's working for somebody, I've pushed it (with my one change of Boost 1.49 requirement to Boost 1.46) to a branch in the BVLC repo for easier checkout.

I tried to rebase on the latest dev, but I ran into many problems -- many example files have been deleted, and there seem to be EOL whitespace issues all over the place that git complains about:

[/home/jdonahue/dev/caffe 3407]$ git rebase dev
First, rewinding head to replay your work on top of it...
Applying: CMake build system
Using index info to reconstruct a base tree...
<stdin>:429: trailing whitespace.
        CXX := /usr/bin/g++-4.6
<stdin>:438: trailing whitespace.
LIBRARY_DIRS += $(BLAS_LIB)
<stdin>:34849: trailing whitespace.
  /usr/lib/atlas-base
<stdin>:34921: trailing whitespace.
# The following are set after configuration is done:
<stdin>:35013: trailing whitespace.
# - Find Intel MKL
warning: squelched 166 whitespace errors
warning: 171 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging Makefile
CONFLICT (content): Merge conflict in Makefile
Failed to merge in the changes.
Patch failed at 0001 CMake build system

The trailing whitespace issues should be fixed.

The first merge conflict in Makefile is requiring g++ exactly 4.6:

[/home/jdonahue/dev/caffe 3408]$ git diff Makefile
diff --cc Makefile
index 77e2ff5,3d6d94e..0000000
--- a/Makefile
+++ b/Makefile
@@@ -167,12 -166,7 +167,16 @@@ else ifeq ($(UNAME), Darwin
  endif

  ifeq ($(LINUX), 1)
++<<<<<<< HEAD
 +      CXX := /usr/bin/g++
 +      GCCVERSION := $(shell $(CXX) -dumpversion | cut -f1,2 -d.)
 +      # older versions of gcc are too dumb to build boost with -Wuninitalized
 +      ifeq ($(shell echo $(GCCVERSION) \< 4.6 | bc), 1)
 +              WARNINGS += -Wno-uninitialized
 +      endif
++=======
+       CXX := /usr/bin/g++-4.6
++>>>>>>> CMake build system
  endif

  # OS X:

I don't know about this...why would we not want to support future versions of GCC? Anyway, I accept the modification for now with git checkout --theirs Makefile and press on...

[/home/jdonahue/dev/caffe 3412]$ g rebase --continue
Applying: CMake build system
Applying: python + ctest
Applying: Enabled choosing test device at configuration time
Applying: Fixed tests
Applying: Enabled Installing
Applying: gtest compiles with 3 files only, minor cmake changes
Applying: manual file listing is no longer necessary
Applying: Reverting Makefiles changes and some test_caffe_main.cpp changes
Applying: setup of test include files
Applying: Makefile works
Using index info to reconstruct a base tree...
<stdin>:13042: trailing whitespace.
% Data coming in from matlab needs to be in the order
<stdin>:13059: trailing whitespace.
% input and outputs a cell array.
<stdin>:13185: trailing whitespace.
    IMAGE_MEAN = d.image_mean;
<stdin>:62653: trailing whitespace.
    get_filename_component(name ${source} NAME_WE)
<stdin>:62656: trailing whitespace.

warning: squelched 15 whitespace errors
warning: 20 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Removing src/examples/selective_search_demo.ipynb
CONFLICT (modify/delete): src/examples/pascal-finetuning/pascal_finetune_val.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/pascal-finetuning/pascal_finetune_val.pro
totxt left in tree.
Removing src/examples/pascal-finetuning/pascal_finetune_train.prototxt
Removing src/examples/pascal-finetuning/pascal_finetune_solver.prototxt
Removing src/examples/mnist/train_mnist_autoencoder.sh
Removing src/examples/mnist/train_lenet.sh
Removing src/examples/mnist/mnist_autoencoder_train.prototxt
CONFLICT (modify/delete): src/examples/mnist/mnist_autoencoder_test.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/mnist/mnist_autoencoder_test.prototxt left in tree
.
Removing src/examples/mnist/mnist_autoencoder_solver.prototxt
Removing src/examples/mnist/lenet_train.prototxt
CONFLICT (modify/delete): src/examples/mnist/lenet_test.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/mnist/lenet_test.prototxt left in tree.
Removing src/examples/mnist/lenet_solver.prototxt
Removing src/examples/mnist/lenet.prototxt
Removing src/examples/mnist/create_mnist.sh
Removing src/examples/mnist/convert_mnist_data.cpp
Removing src/examples/imagenet_pretrained.ipynb
Removing src/examples/imagenet/train_imagenet.sh
Removing src/examples/imagenet/resume_training.sh
Removing src/examples/imagenet/make_imagenet_mean.sh
CONFLICT (modify/delete): src/examples/imagenet/imagenet_val.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/imagenet/imagenet_val.prototxt left in tree.
Removing src/examples/imagenet/imagenet_train.prototxt
Removing src/examples/imagenet/imagenet_solver.prototxt
CONFLICT (modify/delete): src/examples/imagenet/imagenet_deploy.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/imagenet/imagenet_deploy.prototxt left in tree.
CONFLICT (modify/delete): src/examples/feature_extraction/imagenet_val.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/feature_extraction/imagenet_val.prototxt left i
n tree.
Removing src/examples/cifar10/train_quick.sh
Removing src/examples/cifar10/train_full.sh
Removing src/examples/cifar10/create_cifar10.sh
Removing src/examples/cifar10/convert_cifar_data.cpp
Removing src/examples/cifar10/cifar10_quick_train.prototxt
CONFLICT (modify/delete): src/examples/cifar10/cifar10_quick_test.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/cifar10/cifar10_quick_test.prototxt left in tree.
Removing src/examples/cifar10/cifar10_quick_solver_lr1.prototxt
Removing src/examples/cifar10/cifar10_quick_solver.prototxt
Removing src/examples/cifar10/cifar10_quick.prototxt
Removing src/examples/cifar10/cifar10_full_train.prototxt
CONFLICT (modify/delete): src/examples/cifar10/cifar10_full_test.prototxt deleted in Makefile works and modified in HEAD. Version HEAD of src/examples/cifar10/cifar10_full_test.prototxt left in tree.
Removing src/examples/cifar10/cifar10_full_solver_lr2.prototxt
Removing src/examples/cifar10/cifar10_full_solver_lr1.prototxt
Removing src/examples/cifar10/cifar10_full_solver.prototxt
Removing src/examples/cifar10/cifar10_full.prototxt
Removing src/examples/CMakeLists.txt
Auto-merging src/caffe/test/test_image_data_layer.cpp
Removing src/CMakeScripts/FindOpenBLAS.cmake
Removing src/CMakeScripts/FindMKL.cmake
Removing src/CMakeScripts/FindLevelDB.cmake
Removing src/CMakeScripts/FindGlog.cmake
Removing src/CMakeScripts/FindAtlas.cmake
Auto-merging CMakeLists.txt
Failed to merge in the changes.
Patch failed at 0010 Makefile works

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".

Huh...any idea what's going on here? Why are the examples being removed?

@akosiorek
Copy link
Contributor Author

@jeffdonahue Thanks for trying it out.

  1. ../src is out of date and should be replaced with ../ as you've already found out.
  2. I use Boost 1.55 and 1.49 and I haven't tested it with any older versions but 1.46 should be ok.
  3. The merge conflicts seem to be outdated. gcc-4.6 is the only one that works for me and I've pushed it by accident at some point. Originally, I wanted to change the directory tree a little and that's where the deleted examples come from. I've backed out from it.

Are you sure you are working with the newest version? There shouldn't be any merge conflicts as indicated by This pull request can be automatically merged by project collaborators just above the window I write the comment in. Also, the line count at the top of this page says that only 6 lines of code have been deleted.

@bhack
Copy link
Contributor

bhack commented Jun 30, 2014

(3.) Is related by cuda version found by cmake. Every cuda release_notes give you an hint of supported gcc versions.
Could we use official distributed FindBLAS.cmake so that we could remove some scripts in CMakeScripts?

@akosiorek
Copy link
Contributor Author

@bhack I tried the FindBLAS.cmake in the first place but it didn't work for me. I'd be great if you could make it work, but I find it easier to use the scripts.

@bhack
Copy link
Contributor

bhack commented Jun 30, 2014

@akosiorek I've tested now.. works for me on debian testing with debian openblas offical package using find_package(BLAS REQUIRED). What problem did you have when you have tested?

@akosiorek
Copy link
Contributor Author

@bhack find_package(BLAS REQUIRED) on Linux Mint 16 gives me the following:

-- Could NOT find MKL (missing:  MKL_LIBRARY MKL_MINIMAL_LIBRARY) 
-- Checking for [openblas - gfortran]
--   Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
-- Checking for [openblas - gfortran - pthread]
--   Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
-- Checking for [goto2 - gfortran]
--   Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
-- Checking for [goto2 - gfortran - pthread]
--   Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
-- Checking for [acml - gfortran]
--   Library acml: BLAS_acml_LIBRARY-NOTFOUND
-- Checking for [Accelerate]
--   Library Accelerate: BLAS_Accelerate_LIBRARY-NOTFOUND
-- Checking for [vecLib]
--   Library vecLib: BLAS_vecLib_LIBRARY-NOTFOUND
-- Checking for [ptf77blas - atlas - gfortran]
--   Library ptf77blas: BLAS_ptf77blas_LIBRARY-NOTFOUND
-- Checking for [blas]
--   Library blas: /usr/lib/libblas.so
CMake Error at CMakeScripts/FindBLAS.cmake:85 (check_function_exists):
  Unknown CMake command "check_function_exists".
Call Stack (most recent call first):
  CMakeScripts/FindBLAS.cmake:231 (check_fortran_libraries)
  src/caffe/CMakeLists.txt:39 (find_package)


-- Configuring incomplete, errors occurred!

@bhack
Copy link
Contributor

bhack commented Jun 30, 2014

@akosiorek I think you have still this problem because on saucy (and Mint 16) blas libraries file was still under named subdirectory as you can see (i've tested on ubuntu 14.04 LTS and works fine like in debian):
Saucy:
http://packages.ubuntu.com/saucy/amd64/libopenblas-base/filelist
Trusty:
http://packages.ubuntu.com/trusty/amd64/libopenblas-base/filelist

@akosiorek
Copy link
Contributor Author

@bhack I see. But isn't the script supposed to work on Mint as well? What do you suggest? Mint is my OS of choice and I need Caffe to be compatible with it.

@bhack
Copy link
Contributor

bhack commented Jun 30, 2014

@akosiorek Can you try this on Mint?
cmake . -DBLA_VENDOR=ATLAS -DCMAKE_PREFIX_PATH=/usr/lib/atlas-base

@akosiorek
Copy link
Contributor Author

@bhack I have Atlas located under /usr/lib/atlas and /usr/include/atlas. I've tried setting the prefix path to both atlas and atlas-base and vendor to ATLAS and atlas; None worked.

EDIT:
I managed to run the script but now Caffe gives me lots of undefined reference errors

@bhack
Copy link
Contributor

bhack commented Jun 30, 2014

@akosiorek It is strange but i have no other platform to test other then debian testing and ubuntu 14.04

EDIT:
are you sure that values are not cached? can you print ${BLAS_LIBRARIES}?

@akosiorek
Copy link
Contributor Author

I created a cleaned version of this PR in 'CMake build system - cleaned' or #573. Please continue the discussion under the new PR.

@akosiorek akosiorek closed this Jul 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants