git clone https://github.com/weiliu89/caffe.git
% cd caffe
% mkdir BUILD
% cd BUILD
まず、ソースを変更する。
/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h
#define _GLIBCXX_USE_C99_MATH 1
次に、必要なライブラリをインストールする。足らないとビルドの最中にエラーが出るので、そこに表示されるキーワードxxxを使って、
% apt search xxx
して、必要と思われるライブラリ(あらかた libxxx-dev)を見つけて、
% sudo apt-get install livxxx-dev
する。私の環境では(既に数値解析関係はインストールされている)
sudo apt-get install libprotobuf-dev
sudo apt-get install libgflags-dev
sudo apt-get install libgoogle-glog-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-100
sudo apt-get install opencv-dev
sudo apt-get install libopencv-dev
sudo apt-get install libleveldb-dev liblmdb-dev
sudo apt-get install libboost1.62-all-dev
sudo apt-get install libsnappy-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libcudnn6-dev
sudo apt-get install gcc-5
最後のgcc-5はCUDA nvccのホストコンパイラとして必要らしい。
この後、
この後、
ccmake ..
として、必要な設定を行っていく。ちなみに、私の設定は、
ALLOW_LMDB_NOLOCK OFF
Atlas_BLAS_LIBRARY /usr/lib/x86_64-linux-gnu/libatlas.so
Atlas_CBLAS_INCLUDE_DIR /usr/include/x86_64-linux-gnu
Atlas_CBLAS_LIBRARY /usr/lib/x86_64-linux-gnu/libcblas.so
Atlas_CLAPACK_INCLUDE_DIR /usr/include/x86_64-linux-gnu
Atlas_LAPACK_LIBRARY /usr/lib/x86_64-linux-gnu/liblapack.so
BLAS Atlas
BOOST_THREAD_LIBRARY /usr/lib/x86_64-linux-gnu/libpthread.so
BUILD_SHARED_LIBS ON
BUILD_docs ON
BUILD_matlab OFF
BUILD_only_tests
BUILD_python ON
BUILD_python_layer ON
Boost_ATOMIC_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libboost_atomic.so
Boost_ATOMIC_LIBRARY_RELEASE /usr/lib/x86_64-linux-gnu/libboost_atomic.so
Boost_CHRONO_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libboost_chrono.so
Boost_CHRONO_LIBRARY_RELEASE /usr/lib/x86_64-linux-gnu/libboost_chrono.so
Boost_DATE_TIME_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libboost_date_time.so
Boost_DATE_TIME_LIBRARY_RELEAS /usr/lib/x86_64-linux-gnu/libboost_date_time.so
Boost_DIR Boost_DIR-NOTFOUND
Boost_FILESYSTEM_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libboost_filesystem.so
Boost_FILESYSTEM_LIBRARY_RELEA /usr/lib/x86_64-linux-gnu/libboost_filesystem.so
Boost_INCLUDE_DIR /usr/include
Boost_LIBRARY_DIR_DEBUG /usr/lib/x86_64-linux-gnu
Boost_LIBRARY_DIR_RELEASE /usr/lib/x86_64-linux-gnu
Boost_PYTHON_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libboost_python.so
Boost_PYTHON_LIBRARY_RELEASE /usr/lib/x86_64-linux-gnu/libboost_python.so
Boost_SYSTEM_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libboost_system.so
Boost_SYSTEM_LIBRARY_RELEASE /usr/lib/x86_64-linux-gnu/libboost_system.so
Boost_THREAD_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libboost_thread.so
Boost_THREAD_LIBRARY_RELEASE /usr/lib/x86_64-linux-gnu/libboost_thread.so
CAFFE_TARGET_SOVERSION 1.0.0
CAFFE_TARGET_VERSION 1.0.0
CMAKE_AR /usr/bin/ar
CMAKE_BUILD_TYPE
CMAKE_COLOR_MAKEFILE ON
CMAKE_CONFIGURATION_TYPES Debug;Release
CMAKE_CXX_COMPILER /usr/bin/g++-5
CMAKE_CXX_COMPILER_AR /usr/bin/gcc-ar-5
CMAKE_CXX_COMPILER_RANLIB /usr/bin/gcc-ranlib-5
CMAKE_CXX_FLAGS -std=c++11
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_COMPILER /usr/bin/gcc-5
CMAKE_C_COMPILER_AR /usr/bin/gcc-ar-5
CMAKE_C_COMPILER_RANLIB /usr/bin/gcc-ranlib-5
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_EXE_LINKER_FLAGS_MINSIZE
CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELWITH
CMAKE_EXPORT_COMPILE_COMMANDS OFF
CMAKE_INSTALL_BINDIR bin
CMAKE_INSTALL_DATADIR
CMAKE_INSTALL_DATAROOTDIR share
CMAKE_INSTALL_DOCDIR
CMAKE_INSTALL_INCLUDEDIR include
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LIBDIR lib
CMAKE_INSTALL_LIBEXECDIR libexec
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_LOCALSTATEDIR var
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_OLDINCLUDEDIR /usr/include
CMAKE_INSTALL_PREFIX /usr/local
CMAKE_INSTALL_RPATH_USE_LINK_P TRUE
CMAKE_INSTALL_RUNSTATEDIR
CMAKE_INSTALL_SBINDIR sbin
CMAKE_INSTALL_SHAREDSTATEDIR com
CMAKE_INSTALL_SYSCONFDIR etc
CMAKE_LINKER /usr/bin/ld
CMAKE_MAKE_PROGRAM /usr/bin/make
CMAKE_MODULE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS_DEBU
CMAKE_MODULE_LINKER_FLAGS_MINS
CMAKE_MODULE_LINKER_FLAGS_RELE
CMAKE_MODULE_LINKER_FLAGS_RELW
CMAKE_NM /usr/bin/nm
CMAKE_OBJCOPY /usr/bin/objcopy
CMAKE_OBJDUMP /usr/bin/objdump
CMAKE_RANLIB /usr/bin/ranlib
CMAKE_SHARED_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS_DEBU
CMAKE_SHARED_LINKER_FLAGS_MINS
CMAKE_SHARED_LINKER_FLAGS_RELE
CMAKE_SHARED_LINKER_FLAGS_RELW
CMAKE_SKIP_INSTALL_RPATH OFF
CMAKE_SKIP_RPATH OFF
CMAKE_STATIC_LINKER_FLAGS
CMAKE_STATIC_LINKER_FLAGS_DEBU
CMAKE_STATIC_LINKER_FLAGS_MINS
CMAKE_STATIC_LINKER_FLAGS_RELE
CMAKE_STATIC_LINKER_FLAGS_RELW
CMAKE_STRIP /usr/bin/strip
CMAKE_VERBOSE_MAKEFILE OFF
CPU_ONLY OFF
CUDA_64_BIT_DEVICE_CODE ON
CUDA_ARCH_NAME Auto
CUDA_ATTACH_VS_BUILD_RULE_TO_C ON
CUDA_BUILD_CUBIN OFF
CUDA_BUILD_EMULATION OFF
CUDA_CUDART_LIBRARY /usr/lib/x86_64-linux-gnu/libcudart.so
CUDA_CUDA_LIBRARY /usr/lib/x86_64-linux-gnu/libcuda.so
CUDA_GENERATED_OUTPUT_DIR
CUDA_HOST_COMPILATION_CPP ON
CUDA_HOST_COMPILER /usr/bin/g++-5
CUDA_NVCC_EXECUTABLE /usr/bin/nvcc
CUDA_NVCC_FLAGS
CUDA_NVCC_FLAGS_DEBUG
CUDA_NVCC_FLAGS_MINSIZEREL
CUDA_NVCC_FLAGS_RELEASE
CUDA_NVCC_FLAGS_RELWITHDEBINFO
CUDA_PROPAGATE_HOST_FLAGS ON
CUDA_SDK_ROOT_DIR CUDA_SDK_ROOT_DIR-NOTFOUND
CUDA_SEPARABLE_COMPILATION OFF
CUDA_TOOLKIT_INCLUDE /usr/include
CUDA_TOOLKIT_ROOT_DIR /usr
CUDA_USE_STATIC_CUDA_RUNTIME ON
CUDA_VERBOSE_BUILD OFF
CUDA_VERSION 8.0
CUDA_cublas_LIBRARY /usr/lib/x86_64-linux-gnu/libcublas.so
CUDA_cublas_device_LIBRARY /usr/lib/x86_64-linux-gnu/libcublas_device.a
CUDA_cudadevrt_LIBRARY /usr/lib/x86_64-linux-gnu/libcudadevrt.a
CUDA_cudart_static_LIBRARY /usr/lib/x86_64-linux-gnu/libcudart_static.a
CUDA_cufft_LIBRARY /usr/lib/x86_64-linux-gnu/libcufft.so
CUDA_cupti_LIBRARY CUDA_cupti_LIBRARY-NOTFOUND
CUDA_curand_LIBRARY /usr/lib/x86_64-linux-gnu/libcurand.so
CUDA_cusolver_LIBRARY /usr/lib/x86_64-linux-gnu/libcusolver.so
CUDA_cusparse_LIBRARY /usr/lib/x86_64-linux-gnu/libcusparse.so
CUDA_nppc_LIBRARY /usr/lib/x86_64-linux-gnu/libnppc.so
CUDA_nppi_LIBRARY /usr/lib/x86_64-linux-gnu/libnppi.so
CUDA_npps_LIBRARY /usr/lib/x86_64-linux-gnu/libnpps.so
CUDA_rt_LIBRARY /usr/lib/x86_64-linux-gnu/librt.so
CUDNN_INCLUDE /usr/include
CUDNN_LIBRARY /usr/lib/x86_64-linux-gnu/libcudnn.so
CUDNN_ROOT
DOXYGEN_DOT_EXECUTABLE /usr/bin/dot
DOXYGEN_EXECUTABLE DOXYGEN_EXECUTABLE-NOTFOUND
GFLAGS_INCLUDE_DIR /usr/include
GFLAGS_LIBRARY /usr/lib/x86_64-linux-gnu/libgflags.so
GFLAGS_ROOT_DIR
GIT_EXECUTABLE /usr/bin/git
GLOG_INCLUDE_DIR /usr/include
GLOG_LIBRARY /usr/lib/x86_64-linux-gnu/libglog.so
GLOG_ROOT_DIR
HDF5_CXX_COMPILER_EXECUTABLE /usr/bin/h5c++
HDF5_CXX_LIBRARY_dl /usr/lib/x86_64-linux-gnu/libdl.so
HDF5_CXX_LIBRARY_hdf5 /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so
HDF5_CXX_LIBRARY_hdf5_cpp /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so
HDF5_CXX_LIBRARY_hdf5_hl /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.so
HDF5_CXX_LIBRARY_hdf5_hl_cpp /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl_cpp.so
HDF5_CXX_LIBRARY_m /usr/lib/x86_64-linux-gnu/libm.so
HDF5_CXX_LIBRARY_pthread /usr/lib/x86_64-linux-gnu/libpthread.so
HDF5_CXX_LIBRARY_sz /usr/lib/x86_64-linux-gnu/libsz.so
HDF5_CXX_LIBRARY_z /usr/lib/x86_64-linux-gnu/libz.so
HDF5_C_COMPILER_EXECUTABLE /usr/bin/h5cc
HDF5_C_LIBRARY_dl /usr/lib/x86_64-linux-gnu/libdl.so
HDF5_C_LIBRARY_hdf5 /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so
HDF5_C_LIBRARY_hdf5_hl /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.so
HDF5_C_LIBRARY_m /usr/lib/x86_64-linux-gnu/libm.so
HDF5_C_LIBRARY_pthread /usr/lib/x86_64-linux-gnu/libpthread.so
HDF5_C_LIBRARY_sz /usr/lib/x86_64-linux-gnu/libsz.so
HDF5_C_LIBRARY_z /usr/lib/x86_64-linux-gnu/libz.so
HDF5_DIFF_EXECUTABLE /usr/bin/h5diff
HDF5_DIR HDF5_DIR-NOTFOUND
LMDB_INCLUDE_DIR /usr/include
LMDB_LIBRARIES /usr/lib/x86_64-linux-gnu/liblmdb.so
LevelDB_INCLUDE /usr/include
LevelDB_LIBRARY /usr/lib/x86_64-linux-gnu/libleveldb.so
OpenCV_3RDPARTY_LIB_DIR_DBG /usr/share/OpenCV/3rdparty/lib/x86_64-linux-gnu
OpenCV_3RDPARTY_LIB_DIR_OPT /usr/share/OpenCV/3rdparty/lib/x86_64-linux-gnu
OpenCV_CONFIG_PATH /usr/share/OpenCV
OpenCV_DIR /usr/share/OpenCV
OpenCV_LIB_DIR_DBG
OpenCV_LIB_DIR_OPT
PYTHON_EXECUTABLE /usr/bin/python2.7
PYTHON_INCLUDE_DIR /usr/include/python2.7
PYTHON_LIBRARY /usr/lib/x86_64-linux-gnu/libpython2.7.so
PYTHON_LIBRARY_DEBUG PYTHON_LIBRARY_DEBUG-NOTFOUND
Protobuf_INCLUDE_DIR /usr/include
Protobuf_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libprotobuf.so
Protobuf_LIBRARY_RELEASE /usr/lib/x86_64-linux-gnu/libprotobuf.so
Protobuf_LITE_LIBRARY_DEBUG /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so
Protobuf_LITE_LIBRARY_RELEASE /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so
Protobuf_PROTOC_EXECUTABLE /usr/bin/protoc
Protobuf_PROTOC_LIBRARY_DEBUG Protobuf_PROTOC_LIBRARY_DEBUG-NOTFOUND
Protobuf_PROTOC_LIBRARY_RELEAS Protobuf_PROTOC_LIBRARY_RELEASE-NOTFOUND
Snappy_INCLUDE_DIR /usr/include
Snappy_LIBRARIES /usr/lib/x86_64-linux-gnu/libsnappy.so
USE_CUDNN ON
USE_LEVELDB ON
USE_LMDB ON
USE_NCCL OFF
USE_OPENCV ON
USE_OPENMP OFF
USE_PROJECT_FOLDERS OFF
python_version 2
である。
この後、Makefileを生成して、makeすると、Caffeバイナリが作成される。このまま、make installすると、おなじみの /usr/local 以下にインストールされる。
0 件のコメント:
コメントを投稿