Skip to content

segmentation fault when use cblas_sgemm. #1206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ctgushiwei opened this issue Jun 15, 2017 · 12 comments
Closed

segmentation fault when use cblas_sgemm. #1206

ctgushiwei opened this issue Jun 15, 2017 · 12 comments

Comments

@ctgushiwei
Copy link

cpuinfo: processors:4 ARMv7 rev1 cpu arch:7 Hardware:hi3536
make:TARGET=ARMV7 NOFORTRAN=1 HOSTCC=gcc NO_LAPACK=1 ONLY_CBLAS=1

my openblas is 0.2.19.when i use cblas_sgemm, backtrace from crash:blas_server.c and the fault is segmentation fault

how can i solve this problem

@brada4
Copy link
Contributor

brada4 commented Jun 15, 2017

Could you close previous issue on same subject?

  • does it crash with single-threaded OpenBLAS
  • can you generate backtrace: run your program in gdb, then when it catches fault run 't a a bt' in gdb, and attach resulting output (do not copy/paste)
  • does same code work on any x86_64

@martin-frbg
Copy link
Collaborator

Can you show a simple example of your cblas_sgemm usage ? It could be that you got some calling parameter wrong, in particular if you used the documentation for the regular blas function sgemm, as array handling differs between c (cblas) and fortran (blas).

@ctgushiwei
Copy link
Author

ctgushiwei commented Jun 16, 2017

@martin-frbg @brada4 both single-threaded OpenBLAS or multi-threaded OpenBLAS crash at the same function. blas_sever.c when use exec_blas function.. and my test code is sample,it is ok when test at PC.

@ctgushiwei
Copy link
Author

ctgushiwei commented Jun 16, 2017

@brada4 @martin-frbg my test code is

float Aa[23]={1,2,3,4,5,6};
float Bb[3
4]={1,2,3,4,5,6,7,8,9,10,11,12};
float y1[2*4]={1,2,3,4,5,6,7,8};

cblas_sgemm(CblasRowMajor,CblasNoTrans,CblasNoTrans,2,4,3,1.0,Aa,3,Bb,4,1.0,4);
printf("%f",y1[0]);
the same code can work on any x86_64 normal.

when use single-threaded OpenBLAS it crashed at the int exec_blas(BLASLONG num,blas_queue_t*queue) when call (routine)(queue->args,queue->range_m,queue->range_n,queue->sa,queue->sb,0)

when use multi-threaded OpenBLAS ,it can not call the blas_sever.c,i do not know what function it use?because it only generate blas_server.o

how can i solve this problem

@brada4
Copy link
Contributor

brada4 commented Jun 16, 2017

Are you compiling/linking OpenBLAS and your program with 'hardfp' ?
Does it stop crashing when using ARMV5 target instead (which is C-only and works with softfp)?

@ctgushiwei
Copy link
Author

sorry,i have not a ARMV5 target.both softfp and hardfp can not work normly. when I test the cblas_sgemv, it output bus error..i do not kown the reason

@brada4
Copy link
Contributor

brada4 commented Jun 16, 2017

You need to run 'make clean' between rebuilds. I suspect your gcc somehow defaults to softfp and built library is not usable. gdb backtrace would show that in no time.
ARMV5 kernels will run on ARMV7, slower, but run in any floating point ABI.

@martin-frbg
Copy link
Collaborator

As an alternative to building for ARMV5, you could try the arm_soft_fp_api branch of the current development version - while this is still incomplete, it appears to include an implementation of sgemm that should work in your environment. (On the "Code" tab of this webpage, there is a "Branch:" selector between the table heading and the latest commit line. Switch this from "develop" to "arm_soft_fp_api" (a couple of lines above "develop" in the menu), the green "Clone or download" button will offer you a download of this branch as a zip archive.)

@ctgushiwei
Copy link
Author

@martin-frbg @brada4 @notaz @JohannesBuchner @IvanUkhov
I have known the reason. the function at /kernel/ did not compiled, when i exect the code from kernel/generic/gemmkernel_2x2.c the code can work..

i do not konw how to complie code at /kernel/arm/ .could you help me

@brada4
Copy link
Contributor

brada4 commented Jun 20, 2017

Please refer to #1206 (comment)

@ctgushiwei
Copy link
Author

@martin-frbg could you share the "arm_soft_fp_api" to me?I can not download normly

@brada4
Copy link
Contributor

brada4 commented Jun 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants