I am newbie to Eigen and hope to use OpenBLAS as a backend of Eigen 3.3.4 on Android/ARMv7. From the following site I tried a test to use them in one application (Compiling environment is ubuntu 16.04 + Android NDK r15c.),
http://eigen.tuxfamily.org/dox-devel/TopicUsingBlasLapack.html
gemm.cpp has code as follow,
#include <iostream>
#include <Eigen/Dense>
#include "cblas.h"
using namespace Eigen;
int main()
{
double A[6] = {1.0, 2.0, 1.0,-3.0, 4.0,-1.0};
double B[6] = {1.0, 2.0, 1.0,-3.0, 4.0,-1.0};
double C[9] = {.5 , .5 , .5 , .5 , .5 , .5 , .5 , .5 , .5};
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans, 3, 3, 2, 1, A, 3, B, 3, 2, C, 3);
return 0;
}
My Android.mk looks like this,
LOCAL_PATH := $(call my-dir)
#build a test executable
include $(CLEAR_VARS)
LOCAL_MODULE := gemm
LOCAL_C_INCLUDES := /home/yangfan/workspace/study/eigen-3.3.4
LOCAL_C_INCLUDES += /home/yangfan/workspace/study/openBLAS
LOCAL_SRC_FILES := $(LOCAL_PATH)/gemm.cpp
LOCAL_CFLAGS += -DEIGEN_USE_BLAS
LOCAL_CFLAGS += -fPIC -frtti -fexceptions -lz -O3
LOCAL_LDLIBS += -lm -llog -lz
LOCAL_LDLIBS += $(LOCAL_PATH)/openblas-libs/libopenblas.a
include $(BUILD_EXECUTABLE)
When trying to compile the project, I encountered errors as follow(I picked one to paste here),
In file included from ././gemm.cpp:4:
In file included from /home/yangfan/workspace/study/openBLAS/cblas.h:5:
In file included from /home/yangfan/workspace/study/openBLAS/common.h:751:
/home/yangfan/workspace/study/openBLAS/common_interface.h:105:9: error: functions that differ only in their return type cannot be overloaded
void BLASFUNC(dcopy) (blasint *, double *, blasint *, double *, blasint *);
/home/yangfan/workspace/study/eigen-3.3.4/Eigen/src/Core/util/../../misc/blas.h:44:8: note: previous declaration is here
int BLASFUNC(dcopy) (int *, double *, int *, double *, int *);
There are different return types for the same blas functions in openblas and eigen.
Q1. Why are there different return types for the same blas APIs in OpenBLAS and Eigen?
Q2. Is there something missing? Hope some guides to use OpenBLAS as a backend of Eigen.
Q3. Which version is higher, 3.3.4 or 3.3.90? ^-^
thanks so much for your help.