diff options
author | guohuijiang1234 <huijiangguo@openailab.com> | 2017-11-07 21:59:15 +0800 |
---|---|---|
committer | guohuijiang1234 <huijiangguo@openailab.com> | 2017-11-07 21:59:15 +0800 |
commit | 698a0a52203d5c652d6514d06407b8e7a9024d08 (patch) | |
tree | 29d2bf2ec768b3e772eb1bc942069806177159b7 | |
parent | 53709c985b38ad0a441c31f9dbeb77568d87ba95 (diff) | |
download | caffeonacl-698a0a52203d5c652d6514d06407b8e7a9024d08.tar.gz caffeonacl-698a0a52203d5c652d6514d06407b8e7a9024d08.tar.bz2 caffeonacl-698a0a52203d5c652d6514d06407b8e7a9024d08.zip |
modify makefile
-rw-r--r-- | Makefile | 28 | ||||
-rw-r--r-- | Makefile.config.acl | 14 | ||||
-rw-r--r-- | unit_tests/Makefile | 32 |
3 files changed, 46 insertions, 28 deletions
@@ -1,6 +1,9 @@ PROJECT := caffe -CONFIG_FILE := Makefile.config +AIDDIR=/usr/local/AID +export PKG_CONFIG_PATH=${AIDDIR}/opencv3.3.0/lib/pkgconfig + +CONFIG_FILE := Makefile.config.acl # Explicitly check for the config file, otherwise make -k will proceed anyway. ifeq ($(wildcard $(CONFIG_FILE)),) $(error $(CONFIG_FILE) not found. See $(CONFIG_FILE).example.) @@ -450,20 +453,24 @@ LIBRARY_DIRS += $(LIB_BUILD_DIR) # Automatic dependency generation (nvcc is handled separately) CXXFLAGS += -MMD -MP +USE_PKG_CONFIG ?= 0 +ifeq ($(USE_PKG_CONFIG), 1) + PKG_INCLUDE_DIRS := `pkg-config opencv --cflags` + PKG_CONFIG := `pkg-config opencv --libs` +else + PKG_CONFIG := + PKG_INCLUDE_DIRS := +endif + # Complete build flags. COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) +COMMON_FLAGS += $(PKG_INCLUDE_DIRS) CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) # mex may invoke an older gcc that is too liberal with -Wuninitalized MATLAB_CXXFLAGS := $(CXXFLAGS) -Wno-uninitialized LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -USE_PKG_CONFIG ?= 0 -ifeq ($(USE_PKG_CONFIG), 1) - PKG_CONFIG := $(shell pkg-config opencv --libs) -else - PKG_CONFIG := -endif LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(PKG_CONFIG) \ $(foreach library,$(LIBRARIES),-l$(library)) PYTHON_LDFLAGS := $(LDFLAGS) $(foreach library,$(PYTHON_LIBRARIES),-l$(library)) @@ -491,10 +498,15 @@ endif ############################## .PHONY: all lib test clean docs linecount lint lintclean tools examples $(DIST_ALIASES) \ py mat py$(PROJECT) mat$(PROJECT) proto runtest \ - superclean supercleanlist supercleanfiles warn everything + superclean supercleanlist supercleanfiles warn everything install all: lib tools examples +install: + install -d $(AIDDIR)/CaffeOnACL + cp -rfp ./distribute/* $(AIDDIR)/CaffeOnACL + chown -R root:root $(AIDDIR)/CaffeOnACL + lib: $(STATIC_NAME) $(DYNAMIC_NAME) everything: $(EVERYTHING_TARGETS) diff --git a/Makefile.config.acl b/Makefile.config.acl index 30669c2d..6dcc7cdf 100644 --- a/Makefile.config.acl +++ b/Makefile.config.acl @@ -10,13 +10,14 @@ CPU_ONLY := 1 USE_PROFILING := 0 USE_ACL :=1 -ACL_ROOT :=/home/firefly/ComputeLibrary +ACL_ROOT :=$(AIDDIR)/ComputeLibrary ACL_INCS :=$(ACL_ROOT)/include ACL_INCS +=$(ACL_ROOT) -ACL_LIBS_DIR :=$(ACL_ROOT)/build -ACL_LIBS_DIR +=$(ACL_ROOT)/build/arm_compute +ACL_LIBS_DIR :=$(ACL_ROOT)/lib +ACL_LIBS_DIR +=$(ACL_ROOT)/arm_compute ACL_LIBS :=arm_compute arm_compute_core OpenCL + # uncomment to disable IO dependencies and corresponding data layers # USE_OPENCV := 0 # USE_LEVELDB := 0 @@ -28,7 +29,7 @@ ACL_LIBS :=arm_compute arm_compute_core OpenCL # ALLOW_LMDB_NOLOCK := 1 # Uncomment if you're using OpenCV 3 -# OPENCV_VERSION := 3 +OPENCV_VERSION := 3 # To customize your choice of compiler, uncomment and set the following. # N.B. the default for Linux is g++ and the default for OSX is clang++ @@ -38,7 +39,7 @@ ACL_LIBS :=arm_compute arm_compute_core OpenCL #arch :=arm64-v8a # CUDA directory contains bin/ and lib/ directories that we need. -CUDA_DIR := /usr/local/cuda +CUDA_DIR := ${AIDDIR}/cuda # On Ubuntu 14.04, if cuda tools are installed via # "sudo apt-get install nvidia-cuda-toolkit" then use this instead: # CUDA_DIR := /usr @@ -118,7 +119,8 @@ LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib # Uncomment to use `pkg-config` to specify OpenCV library paths. # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.) -# USE_PKG_CONFIG := 1 +USE_PKG_CONFIG := 1 + # N.B. both build and distribute dirs are cleared on `make clean` BUILD_DIR := build diff --git a/unit_tests/Makefile b/unit_tests/Makefile index 4e64c0cb..2e42d956 100644 --- a/unit_tests/Makefile +++ b/unit_tests/Makefile @@ -1,5 +1,5 @@ -include ../Makefile.config +include ../Makefile.config.acl CXX_SRCS+=test_pooling_layer.cpp CXX_SRCS+=test_softmax_layer.cpp @@ -11,33 +11,42 @@ CXX_SRCS+= test_convolution_layer.cpp #CXX_SRCS= test_fail.cpp BIN_SRCS=test_caffe_main.cpp test.cpp -HOME=/home/firefly +HOME=$(AIDDIR) # # caffe related stuff # CAFFE_ROOT=$(HOME)/CaffeOnACL -CAFFE_INCS = -I$(CAFFE_ROOT)/include -I$(CAFFE_ROOT)/distribute/include/ -CAFFE_LIBS = -L$(CAFFE_ROOT)/distribute/lib -lcaffe -lglog -lgflags -lprotobuf -lboost_system -lboost_filesystem -CAFFE_RPATH =$(CAFFE_ROOT)/distribute/lib + +CAFFE_INCS = -I$(CAFFE_ROOT)/include -I$(CAFFE_ROOT)/include/ +CAFFE_LIBS = -L$(CAFFE_ROOT)/lib -lcaffe -lglog -lgflags -lprotobuf -lboost_system -lboost_filesystem + + +CAFFE_RPATH =$(CAFFE_ROOT)/lib + +# +# opncv3.3.0 related sutff +# + +OPENCV_ROOT=$(HOME)/opencv3.3.0 +OPENCV_RPATH =$(OPENCV_ROOT)/lib # # google test related stuff # -GTEST_ROOT=/usr/local +GTEST_ROOT=$(HOME)/googletest GTEST_LIBS=$(GTEST_ROOT)/lib/libgtest_main.a $(GTEST_ROOT)/lib/libgtest.a GTEST_INCS=-I$(GTEST_ROOT)/include/ - # # arm compute # ACL_ROOT=$(HOME)/ComputeLibrary -ACL_LIBS=-L$(ACL_ROOT)/build -L$(ACL_ROOT)/build/arm_compute -larm_compute -lOpenCL -ACL_RPATH=$(ACL_ROOT)/build:$(ACL_ROOT)/build/arm_compute +ACL_LIBS=-L$(ACL_ROOT)/lib -L$(ACL_ROOT)/arm_compute -larm_compute -lOpenCL +ACL_RPATH=$(ACL_ROOT)/lib:$(ACL_ROOT)/arm_compute COMM_CFLAGS=$(GTEST_INCS) $(CAFFE_INCS) -Wall -g -DCPU_ONLY -DUSE_ACL #USE_PROFILING -- get profiling informations, is controled by LOGACL @@ -58,11 +67,6 @@ BIN_EXES=$(BIN_OBJS:.o=) LIBS+=$(CAFFE_LIBS) $(GTEST_LIBS) -lpthread -lopenblas $(ACL_LIBS) -RT_PATH=-Wl,-rpath,$(CAFFE_RPATH):$(ACL_RPATH) - -LDFLAGS+=$(RT_PATH) - - all : $(BIN_EXES) $(BIN_EXES):%:%.o |