diff options
author | Evan Shelhamer <shelhamer@imaginarynumber.net> | 2014-04-15 01:37:06 -0600 |
---|---|---|
committer | Evan Shelhamer <shelhamer@imaginarynumber.net> | 2014-04-15 01:49:08 -0600 |
commit | ed38827284e27d6af3b48b21a95f4094433d632e (patch) | |
tree | 30f355487d09b404ff23ee93f808d68ef526a361 /Makefile | |
parent | 426f089df4563de9ef2c69e90ec6c66131663a8a (diff) | |
download | caffe-ed38827284e27d6af3b48b21a95f4094433d632e.tar.gz caffe-ed38827284e27d6af3b48b21a95f4094433d632e.tar.bz2 caffe-ed38827284e27d6af3b48b21a95f4094433d632e.zip |
Give choice of ATLAS, MKL, and OpenBLAS (with option to override paths)
- configure build for ATLAS, MKL, or OpenBLAS on Linux and OSX
- allow overriding of the include or lib dirs
- replace magic numbers with BLAS names (atlas, mkl, open)
Follow-up from #305 and #325.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 19 insertions, 16 deletions
@@ -109,8 +109,6 @@ TEST_ALL_BIN := $(TEST_BIN_DIR)/test_all.testbin ############################## CUDA_INCLUDE_DIR := $(CUDA_DIR)/include CUDA_LIB_DIR := $(CUDA_DIR)/lib64 $(CUDA_DIR)/lib -BLAS_INCLUDE_DIR := $(BLAS_DIR)/include -BLAS_LIB_DIR := $(BLAS_DIR)/lib INCLUDE_DIRS += $(BUILD_INCLUDE_DIR) INCLUDE_DIRS += ./src ./include $(CUDA_INCLUDE_DIR) @@ -176,31 +174,36 @@ else COMMON_FLAGS := -DNDEBUG -O2 endif -# MKL switch (default = ATLAS) -BLAS ?= 0 -ifeq ($(BLAS), 1) +# BLAS configuration (default = ATLAS) +BLAS ?= atlas +ifeq ($(BLAS), mkl) + # MKL LIBRARIES += mkl_rt COMMON_FLAGS += -DUSE_MKL - INCLUDE_DIRS += $(BLAS_INCLUDE_DIR) - LIBRARY_DIRS += $(BLAS_LIB_DIR) $(BLAS_DIR)/lib/intel64 + MKL_DIR = /opt/intel/mkl + BLAS_INCLUDE ?= $(MKL_DIR)/include + BLAS_LIB ?= $(MKL_DIR)/lib $(MKL_DIR)/lib/intel64 +else ifeq ($(BLAS), open) + # OpenBLAS + LIBRARIES += openblas else + # ATLAS ifeq ($(LINUX), 1) - ifeq ($(BLAS), 0) - # Linux simply has cblas and atlas - LIBRARIES += cblas atlas - else ifeq ($(BLAS), 2) - LIBRARIES += openblas - endif - INCLUDE_DIRS += $(BLAS_INCLUDE_DIR) - LIBRARY_DIRS += $(BLAS_LIB_DIR) + ifeq ($(BLAS), atlas) + # Linux simply has cblas and atlas + LIBRARIES += cblas atlas + endif else ifeq ($(OSX), 1) # OS X packages atlas as the vecLib framework - INCLUDE_DIRS += /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/ + BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/ LIBRARIES += cblas LDFLAGS += -framework vecLib endif endif +INCLUDE_DIRS += $(BLAS_INCLUDE) +LIBRARY_DIRS += $(BLAS_LIB) +# Complete build flags. COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) NVCCFLAGS := -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) |