OSX 10.10 (and more) use Accelerate Framework instead of veclib
authorixartz <contact@ixartz.com>
Tue, 3 Nov 2015 04:07:45 +0000 (23:07 -0500)
committerixartz <contact@ixartz.com>
Wed, 11 Nov 2015 03:29:38 +0000 (22:29 -0500)
cmake/Dependencies.cmake
include/caffe/util/mkl_alternate.hpp

index 51a803c..64e6500 100644 (file)
@@ -102,6 +102,12 @@ elseif(APPLE)
   find_package(vecLib REQUIRED)
   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
   list(APPEND Caffe_LINKER_LIBS ${vecLib_LINKER_LIBS})
+
+  if(VECLIB_FOUND)
+    if(NOT vecLib_INCLUDE_DIR MATCHES "^/System/Library/Frameworks/vecLib.framework.*")
+      add_definitions(-DUSE_ACCELERATE)
+    endif()
+  endif()
 endif()
 
 # ---[ Python
index 3355b66..95df0f9 100644 (file)
@@ -7,9 +7,14 @@
 
 #else  // If use MKL, simply include the MKL header
 
+#ifdef USE_ACCELERATE
+#include <Accelerate/Accelerate.h>
+#else
 extern "C" {
 #include <cblas.h>
 }
+#endif  // USE_ACCELERATE
+
 #include <math.h>
 
 // Functions that caffe uses but are not present if MKL is not linked.