OpenMathLib / OpenMathLib/OpenBLAS

ARMV7 (with hard float flag) did not run with correct result

Open
#1,145 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
7.6k
Forks
1.7k
Avg merge
1d 3h
Merged PRs (30d)
42

Description

hello,

Resently, we are using openblas to setup caffe env in our ARMv7 platform, but we got a problem when run openblas with hard float flag.
we compiled the openblas used following command:
       make CC=arm-linux-gnueabihf-gcc FC=arm-linux-gnueabihf-gfortran HOSTCC=gcc TARGET=ARMV7 libs

then we had a simple test used following code:
int main()

{

const enum CBLAS_ORDER Order=CblasRowMajor;
const enum CBLAS_TRANSPOSE TransA=CblasNoTrans;
const enum CBLAS_TRANSPOSE TransB=CblasNoTrans;
const int M=4;
const int N=2;
const int K=3;
const float alpha=1;
const float beta=0;
const int lda=K;
const int ldb=N;
const int ldc=N;
const float A[M*K]={1.123434543534,2.33234241365,3.4534545454,4.45435435345,5.454554545,6.45452345345,7.454545465,8.454545245,9.2345245625,8.45234545,7.423564545,6.425452454};
const float B[K*N]={5.4523452345,4.34526547,3.462354544,2.52436254,1.262565262,0.265364564565};
float C[M*N];

cblas_sgemm(Order, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc);
for (int i = 0; i < M; i++)
{
    for (int j = 0; j < N; j++)
    {
        cout << C[i*M + j] << " ";
    }
    cout << endl;
}
}    

return EXIT_SUCCESS;
}

testing code compling command:
arm-linux-gnueabihf-g++ -mfpu=vfpv3 -mfloat-abi=hard -o test testblas.cpp /usr/local/arm/openblas/lib/libopenblas_armv7p-r0.2.20.dev.a -I/usr/local/arm/boost/include/ -lpthread

but, when we run the test code in our ARMv7 platform, we got a strange result, as below:
1.4013e-45 1.4013e-45
1.4013e-45 1.4013e-45
1.4013e-45 1.4013e-45
1.4013e-45 1.4013e-45

it is not the correct result...

when we used the openblas lib in our caffe code, it caused coredump when called openblas APIs.

can you help for this? thank you very much.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported ARMv7 build with make CC=arm-linux-gnueabihf-gcc FC=arm-linux-gnueabihf-gfortran HOSTCC=gcc TARGET=ARMV7 libs, then compile and run the supplied cblas_sgemm test with the shown hard-float flags and static library. Compare its output with an independently calculated result and investigate the reported incorrect values and Caffe coredump; done means correct results and no crash on the target platform.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.