summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Shelhamer <shelhamer@imaginarynumber.net>2014-02-14 21:27:20 -0800
committerEvan Shelhamer <shelhamer@imaginarynumber.net>2014-03-21 13:52:36 -0700
commitc028d09ca6e923f38beea3ba0877f31ff784191f (patch)
treec9679875f36c9ddcb825a334e4b607248e17cfa8
parenta8c9b66b7f62610d71a18c798d5eb7157d49420c (diff)
downloadcaffeonacl-c028d09ca6e923f38beea3ba0877f31ff784191f.tar.gz
caffeonacl-c028d09ca6e923f38beea3ba0877f31ff784191f.tar.bz2
caffeonacl-c028d09ca6e923f38beea3ba0877f31ff784191f.zip
rewrite MKL flag note, polish makefile
add MKL dirs conditioned on USE_MKL include libraries before making LD_FLAGS
-rw-r--r--Makefile25
-rw-r--r--Makefile.config.example4
2 files changed, 15 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 488acb42..743a55f2 100644
--- a/Makefile
+++ b/Makefile
@@ -86,34 +86,35 @@ CUDA_LIB_DIR := $(CUDA_DIR)/lib64 $(CUDA_DIR)/lib
MKL_INCLUDE_DIR := $(MKL_DIR)/include
MKL_LIB_DIR := $(MKL_DIR)/lib $(MKL_DIR)/lib/intel64
-INCLUDE_DIRS += ./src ./include $(CUDA_INCLUDE_DIR) $(MKL_INCLUDE_DIR)
-LIBRARY_DIRS += $(CUDA_LIB_DIR) $(MKL_LIB_DIR)
+INCLUDE_DIRS += ./src ./include $(CUDA_INCLUDE_DIR)
+LIBRARY_DIRS += $(CUDA_LIB_DIR)
LIBRARIES := cudart cublas curand \
- openblas \
pthread \
- glog protobuf \
- leveldb snappy \
+ glog protobuf leveldb snappy \
boost_system \
hdf5_hl hdf5 \
opencv_core opencv_highgui opencv_imgproc
PYTHON_LIBRARIES := boost_python python2.7
WARNINGS := -Wall
-COMMON_FLAGS := -DNDEBUG -O2 $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
-CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS)
-NVCCFLAGS := -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
-LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) \
- $(foreach library,$(LIBRARIES),-l$(library))
-PYTHON_LDFLAGS := $(LDFLAGS) $(foreach library,$(PYTHON_LIBRARIES),-l$(library))
+COMMON_FLAGS := -DNDEBUG -O2
-# MKL options
+# MKL switch
ifdef USE_MKL
LIBRARIES += mkl_rt
COMMON_FLAGS += -DUSE_MKL
+ INCLUDE_DIRS += $(MKL_INCLUDE_DIR)
+ LIBRARY_DIRS += $(MKL_LIB_DIR)
else
LIBRARIES += atlas cblas
endif
+COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
+CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS)
+NVCCFLAGS := -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
+LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) \
+ $(foreach library,$(LIBRARIES),-l$(library))
+PYTHON_LDFLAGS := $(LDFLAGS) $(foreach library,$(PYTHON_LIBRARIES),-l$(library))
##############################
# Define build targets
diff --git a/Makefile.config.example b/Makefile.config.example
index 0ec2eead..38af560b 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -10,8 +10,8 @@ CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35
-# If not using MKL, comment out the following line.
-# USE_MKL=1
+# If using MKL, uncomment the following line
+# USE_MKL := 1
# MKL directory contains include/ and lib/ directions that we need.
MKL_DIR := /opt/intel/mkl