Skip to content

Commit

Permalink
Add possibility to use OpenBlas
Browse files Browse the repository at this point in the history
  • Loading branch information
AlOa committed Apr 14, 2014
1 parent 588c8e5 commit 8fd9f8c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ TEST_ALL_BIN := $(TEST_BIN_DIR)/test_all.testbin
##############################
CUDA_INCLUDE_DIR := $(CUDA_DIR)/include
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
BLAS_INCLUDE_DIR := $(BLAS_DIR)/include
BLAS_LIB_DIR := $(BLAS_DIR)/lib

INCLUDE_DIRS += $(BUILD_INCLUDE_DIR)
INCLUDE_DIRS += ./src ./include $(CUDA_INCLUDE_DIR)
Expand Down Expand Up @@ -176,17 +176,23 @@ else
COMMON_FLAGS := -DNDEBUG -O2
endif

# MKL switch (default = non-MKL = ATLAS)
USE_MKL ?= 0
ifeq ($(USE_MKL), 1)
# MKL switch (default = ATLAS)
BLAS ?= 0
ifeq ($(BLAS), 1)
LIBRARIES += mkl_rt
COMMON_FLAGS += -DUSE_MKL
INCLUDE_DIRS += $(MKL_INCLUDE_DIR)
LIBRARY_DIRS += $(MKL_LIB_DIR)
INCLUDE_DIRS += $(BLAS_INCLUDE_DIR)
LIBRARY_DIRS += $(BLAS_LIB_DIR) $(BLAS_DIR)/lib/intel64
else
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)
else ifeq ($(OSX), 1)
# OS X packages atlas as the vecLib framework
INCLUDE_DIRS += /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
Expand Down
9 changes: 5 additions & 4 deletions Makefile.config.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35

# MKL switch:
# BLAS switch:
# 0 for ATLAS BLAS (default)
# 1 for MKL BLAS
USE_MKL := 0
# MKL directory contains include/ and lib/ directions that we need.
MKL_DIR := /opt/intel/mkl
# 2 for OpenBlas
BLAS := 0
# (MKL/ATLAS/OpenBlas) directory contains include/ and lib/ directions that we need.
#BLAS_DIR := /opt/intel/mkl

# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
Expand Down

0 comments on commit 8fd9f8c

Please sign in to comment.