mpimd-csc / flexiblas

FlexiBLAS - A BLAS and LAPACK wrapper library with runtime exchangeable backends. This is only a mirror of https://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-release
https://www.mpi-magdeburg.mpg.de/projects/flexiblas
GNU Lesser General Public License v3.0
37 stars 7 forks source link

segfault #1

Closed dschwoerer closed 4 years ago

dschwoerer commented 4 years ago

Hi,

I encountered a segfault on fedora rawhide with BOUT++:

Thread 1 "command-args" received signal SIGSEGV, Segmentation fault.
0x00007fffef4eafff in flexiblas_exit () at /usr/src/debug/flexiblas-3.0.2-2.fc33.x86_64/src/flexiblas.c:841
841         for ( k = __flexiblas_hooks->hooks_loaded-1; k>=0; k--){
(gdb) bt
#0  0x00007fffef4eafff in flexiblas_exit () at /usr/src/debug/flexiblas-3.0.2-2.fc33.x86_64/src/flexiblas.c:841
#1  0x00007ffff7fe1ce3 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
#2  0x00007ffff559c427 in __run_exit_handlers () from /lib64/libc.so.6
#3  0x00007ffff559c5d0 in exit () from /lib64/libc.so.6
#4  0x0000000000486dbf in bout::experimental::parseCommandLineArgs (argc=-10112, argv=<optimized out>) at bout++.cxx:303
#5  0x0000000000489ea5 in BoutInitialise (argc=@0x7fffffffdbdc: 2, argv=@0x7fffffffdbd0: 0x7fffffffdcd8) at bout++.cxx:138
#6  0x00000000004638f9 in main (argc=<optimized out>, argv=<optimized out>) at command-args.cxx:5
(gdb) 

This is while running this test with --help where it exits early, before the initialisation is fully finished.

Let me know if you need further infos.

dschwoerer commented 4 years ago

Ok, even easier to reproduce:

$ cat  test.cc
int main() { return 0; }
$ mpic++ test.cc -lpetsc
$ ./a.out

(edit) backtrace:

Thread 1 "a.out" received signal SIGSEGV, Segmentation fault.
0x00007ffff0bc9fff in flexiblas_exit () at /usr/src/debug/flexiblas-3.0.2-2.fc33.x86_64/src/flexiblas.c:841
841         for ( k = __flexiblas_hooks->hooks_loaded-1; k>=0; k--){
(gdb) bt
#0  0x00007ffff0bc9fff in flexiblas_exit () at /usr/src/debug/flexiblas-3.0.2-2.fc33.x86_64/src/flexiblas.c:841
#1  0x00007ffff7fe1ce3 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
#2  0x00007ffff668f427 in __run_exit_handlers () from /lib64/libc.so.6
#3  0x00007ffff668f5d0 in exit () from /lib64/libc.so.6
#4  0x00007ffff66771a9 in __libc_start_main () from /lib64/libc.so.6
#5  0x000000000040104e in _start ()
Enchufa2 commented 4 years ago

This is probably because petsc is not yet built against FlexiBLAS in F33, and that's because suitesparse needs to be built against FlexiBLAS in the first place (the PR is pending).

dschwoerer commented 4 years ago

After rebuilding suitesparse, I noticed suitesparse isn't even installed, so that cannot be the issue.

Does PETSc maybe need to be ajusted for flexiblas?

Enchufa2 commented 4 years ago

Ah, PETSc is built without suitesparse by default. Let me adapt PETSc then and I'll report back.

Enchufa2 commented 4 years ago

Please, try with this one: https://src.fedoraproject.org/rpms/petsc/pull-request/2. You'll find a scratch build in the PR, or you can wait for simple-koji-ci.

dschwoerer commented 4 years ago

Thanks, I rebuild in copr, and that fixes the issue.

Thanks for the quick fix

Enchufa2 commented 4 years ago

Antonio merged the PR and launched builds for PETSc in F33 and rawhide. I would appreciate if you could adapt BOUT++'s spec and build it against FlexiBLAS as soon as petsc-3.13.4-2 is available in Koji.