COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
LINK_LIBRARIES ${BLAS_REQUIRED_LIBRARIES}
OUTPUT_VARIABLE SGEMM_ERR)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/saxpy.c" "
+#include <stddef.h>
+extern void cblas_saxpy(const int __N,
+ const float __alpha, const float *__X, const int __incX, float *__Y, const int __incY);
+int main(int argc, char **argv)
+{
+ cblas_saxpy(0, 0, NULL, 0, NULL, 0);
+ return 0;
+}
+")
+ try_compile(HAVE_CBLAS_SAXPY
+ ${CMAKE_CURRENT_BINARY_DIR}
+ "${CMAKE_CURRENT_BINARY_DIR}/saxpy.c"
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${BLAS_REQUIRED_LIBRARIES}
+ OUTPUT_VARIABLE SAXPY_ERR)
# Cmake is just brain damaged
#CHECK_LIBRARY_EXISTS(${BLAS_REQUIRED_LIBRARIES} cblas_sgemm "" HAVE_CBLAS_SGEMM)
else()
MESSAGE(STATUS "Blas has -NOT- CBLAS sgemm, use internal workaround: ${SGEMM_ERR}")
endif()
+ if(HAVE_CBLAS_SAXPY)
+ MESSAGE(STATUS "Blas has CBLAS saxpy")
+ ADD_COMPILE_OPTIONS(-DHAVE_CBLAS_SAXPY)
+ else()
+ MESSAGE(STATUS "Blas has -NOT- CBLAS saxpy, use internal workaround: ${SAXPY_ERR}")
+ endif()
ADD_COMPILE_OPTIONS(-DHAVE_CBLAS)
ENDIF(WITH_BLAS)
\ No newline at end of file
for (i = 0; i < n; ++i) a[i] += b[i] * c[i];
}
-void kad_saxpy(int n, float a, const float *x, float *y) { kad_saxpy_inlined(n, a, x, y); }
-
/* This is actually lapack not cblas, but this definition is used */
#ifdef HAVE_CBLAS
#ifndef __APPLE__
}
#endif
+#ifdef HAVE_CBLAS_SAXPY
+#ifndef HAVE_CBLAS_H
+extern void cblas_saxpy(const int __N,
+ const float __alpha, const float *__X, const int __incX, float *__Y, const int __incY);
+#endif
+
+void kad_saxpy(int n, float a, const float *x, float *y) { cblas_saxpy(n, a, x, 1, y, 1); }
+#else
+void kad_saxpy(int n, float a, const float *x, float *y) { kad_saxpy_inlined(n, a, x, y); }
+#endif
+
bool kad_ssyev_simple(int N, float *A, float *eigenvals)
{
#ifndef HAVE_CBLAS