Skip to content

Commit

Permalink
Add experimental support for OpenBLAS library
Browse files Browse the repository at this point in the history
* Add 'openblas' as mathlib option in configure. Not added to auto-search so
must be specified using --with-openblas

* configure script searches empty tail so that libraries located at default_path_list
roots (ie /usr/local/ + include/openblas_config.h) are found

* Treat ACML as the odd library out in ifdefs since it doesn't conform to typical
BLAS standard. Other libraries like ATLAS should be able to share
OpenBLAS/MKL variants. Add default USE_ACML define in VS projects to match

* Fix 'max' macro define colliding with C++ std::max once openblas headers are included

Usage Notes:

* For best performance, build OpenBLAS with USE_OPENMP=1. When running CNTK, set
OPENBLAS_NUM_THREADS environment var or set numCPUThreads CNTK config variable to the
physical core count or performance will suffer

* OpenBLAS 2.16 (git HEAD) tested in Linux with GCC 4.8.4 and in Windows with
OpenBLAS 2.15 (pre-built binary release + MingGW 64-bit support dlls)

* For Windows, in Math.vcxproj, replace libacml_mp_dll.lib with libopenblas.dll.a and change
USE_ACML define to USE_OPENBLAS. Change ACML_PATH environment variable to your OpenBLAS path.
Modify openblas_config.h as per OpenMathLib/OpenBLAS#708

* On current generation Intel processors, OpenBLAS measures a little faster than
AMD ACML and slower than Intel MKL on MNIST and other examples
  • Loading branch information
rwightman committed Feb 11, 2016
1 parent 9386b8d commit f0d8a23
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 74 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ ifeq ("$(MATHLIB)","mkl")
CPPFLAGS += -DUSE_MKL
endif
ifeq ("$(MATHLIB)","openblas")
INCLUDEPATH += $(OPENBLAS_PATH)/include
LIBPATH += $(OPENBLAS_PATH)/lib
LIBS += -lopenblas -lm -lpthread
CPPFLAGS += -DUSE_OPENBLAS
endif
ifdef KALDI_PATH
########## Copy includes and defines from $(KALDI_PATH)/src/kaldi.mk ##########
Expand Down
Loading

0 comments on commit f0d8a23

Please sign in to comment.