Update release_notes.md
[platform/upstream/caffeonacl.git] / Makefile
index 568d9c2..2d5d305 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,12 @@ $(error $(CONFIG_FILE) not found. See $(CONFIG_FILE).example.)
 endif
 include $(CONFIG_FILE)
 
+ifeq ($(CPU_ONLY),1)
+       USE_CUDA := 0
+endif
+ifeq ($(USE_ACL),1)
+       USE_CUDA := 0
+endif
 BUILD_DIR_LINK := $(BUILD_DIR)
 ifeq ($(RELEASE_BUILD_DIR),)
        RELEASE_BUILD_DIR := .$(BUILD_DIR)_release
@@ -34,7 +40,7 @@ LIB_BUILD_DIR := $(BUILD_DIR)/lib
 STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
 DYNAMIC_VERSION_MAJOR          := 1
 DYNAMIC_VERSION_MINOR          := 0
-DYNAMIC_VERSION_REVISION       := 0-rc3
+DYNAMIC_VERSION_REVISION       := 0-rc5
 DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
 #DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR)
 DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
@@ -172,13 +178,13 @@ endif
 CUDA_LIB_DIR += $(CUDA_DIR)/lib
 
 INCLUDE_DIRS += $(BUILD_INCLUDE_DIR) ./src ./include
-ifneq ($(CPU_ONLY), 1)
+ifeq ($(USE_CUDA), 1)
        INCLUDE_DIRS += $(CUDA_INCLUDE_DIR)
        LIBRARY_DIRS += $(CUDA_LIB_DIR)
        LIBRARIES := cudart cublas curand
 endif
 
-LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
+LIBRARIES += glog gflags protobuf boost_system boost_filesystem m 
 
 # handle IO dependencies
 USE_LEVELDB ?= 1
@@ -192,12 +198,12 @@ ifeq ($(USE_LMDB), 1)
        LIBRARIES += lmdb
 endif
 ifeq ($(USE_OPENCV), 1)
-       LIBRARIES += opencv_core opencv_highgui opencv_imgproc 
+       LIBRARIES += opencv_core opencv_highgui opencv_imgproc
 
        ifeq ($(OPENCV_VERSION), 3)
                LIBRARIES += opencv_imgcodecs
        endif
-               
+
 endif
 PYTHON_LIBRARIES ?= boost_python python2.7
 WARNINGS := -Wall -Wno-sign-compare
@@ -271,8 +277,8 @@ endif
 # libstdc++ for NVCC compatibility on OS X >= 10.9 with CUDA < 7.0
 ifeq ($(OSX), 1)
        CXX := /usr/bin/clang++
-       ifneq ($(CPU_ONLY), 1)
-               CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release [0-9.]*' | grep -o '[0-9.]*')
+       ifeq ($(USE_CUDA), 1)
+               CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release [0-9.]*' | tr -d '[a-z ]')
                ifeq ($(shell echo | awk '{exit $(CUDA_VERSION) < 7.0;}'), 1)
                        CXXFLAGS += -stdlib=libstdc++
                        LINKFLAGS += -stdlib=libstdc++
@@ -296,6 +302,10 @@ ifeq ($(OSX), 1)
        ORIGIN := @loader_path
        VERSIONFLAGS += -Wl,-install_name,@rpath/$(DYNAMIC_VERSIONED_NAME_SHORT) -Wl,-rpath,$(ORIGIN)/../../build/lib
 else
+       ifeq (${USE_OPENMP}, 1)
+               CXXFLAGS += -fopenmp
+               LINKFLAGS += -fopenmp
+       endif
        ORIGIN := \$$ORIGIN
 endif
 
@@ -328,6 +338,33 @@ ifeq ($(USE_CUDNN), 1)
        COMMON_FLAGS += -DUSE_CUDNN
 endif
 
+# NCCL acceleration configuration
+ifeq ($(USE_NCCL), 1)
+       LIBRARIES += nccl
+       COMMON_FLAGS += -DUSE_NCCL
+endif
+
+# ACL acceleration configuration
+ifeq ($(USE_ACL), 1)
+        LIBRARY_DIRS += $(ACL_LIBS_DIR)
+       LIBRARIES += $(ACL_LIBS)
+       INCLUDE_DIRS +=$(ACL_INCS)
+       COMMON_FLAGS += -DUSE_ACL -std=c++11
+endif
+
+#USE_PROFILING -- get profiling informations, is controled by LOGACL
+#LAYER_PERF_STAT -- haitao's net profiling information
+ifeq ($(USE_PROFILING), 1)
+       COMMON_FLAGS += -DUSE_PROFILING -DLAYER_PERF_STAT
+endif
+#HDF5
+ifeq ($(USE_HDF5), 1)
+        LIBRARY_DIRS += $(HDF5_LIBRARY_DIRS)
+       LIBRARIES += $(HDF5_LIBRARIES)
+       INCLUDE_DIRS +=$(HDF5_INCLUDE_DIRS)
+       COMMON_FLAGS += -DUSE_HDF5
+endif
+
 # configure IO libraries
 ifeq ($(USE_OPENCV), 1)
        COMMON_FLAGS += -DUSE_OPENCV
@@ -352,6 +389,15 @@ ifeq ($(CPU_ONLY), 1)
        COMMON_FLAGS += -DCPU_ONLY
 endif
 
+ifeq ($(USE_ACL), 1)
+       OBJS := $(PROTO_OBJS) $(CXX_OBJS)
+       TEST_OBJS := $(TEST_CXX_OBJS)
+       TEST_BINS := $(TEST_CXX_BINS)
+       ALL_WARNS := $(ALL_CXX_WARNS)
+       TEST_FILTER := --gtest_filter="-*GPU*"
+       COMMON_FLAGS += -DCPU_ONLY
+endif
+
 # Python layer support
 ifeq ($(WITH_PYTHON_LAYER), 1)
        COMMON_FLAGS += -DWITH_PYTHON_LAYER
@@ -359,7 +405,8 @@ ifeq ($(WITH_PYTHON_LAYER), 1)
 endif
 
 # BLAS configuration (default = ATLAS)
-BLAS ?= atlas
+#BLAS ?= atlas
+BLAS ?= open
 ifeq ($(BLAS), mkl)
        # MKL
        LIBRARIES += mkl_rt
@@ -382,8 +429,11 @@ else
                LIBRARIES += cblas
                # 10.10 has accelerate while 10.9 has veclib
                XCODE_CLT_VER := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep 'version' | sed 's/[^0-9]*\([0-9]\).*/\1/')
+               XCODE_CLT_GEQ_7 := $(shell [ $(XCODE_CLT_VER) -gt 6 ] && echo 1)
                XCODE_CLT_GEQ_6 := $(shell [ $(XCODE_CLT_VER) -gt 5 ] && echo 1)
-               ifeq ($(XCODE_CLT_GEQ_6), 1)
+               ifeq ($(XCODE_CLT_GEQ_7), 1)
+                       BLAS_INCLUDE ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$(shell ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ | sort | tail -1)/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/Headers
+               else ifeq ($(XCODE_CLT_GEQ_6), 1)
                        BLAS_INCLUDE ?= /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/
                        LDFLAGS += -framework Accelerate
                else