Skip to content

segmentation fault observed while executing lapack-test on ppc64le #1645

Closed

Description

@deepali-c

I executed LAPACK tests with OpenBLAS v0.2.20 on PPC and x86.
No issues were observed with on x86 - OpenBLAS_0_2_20_x86_lapacktest.txt
However, observed following seg faults on ppc64le: OpenBLAS_0_2_20_PPC64le_lapacktest.txt

Similar exceptions were seen with v0.3.0 on ppc64le - OpenBLAS_0_3_0_PPC64le_lapacktest.txt
To execute tests with v0.3.0 I have applied patch from #1579 and #1581.

Activity

  1. brada4 commented on Jun 29, 2018

    @brada4
    Contributor

    Is it same with single threaded version?

  2. deepali-c commented on Jun 29, 2018

    @deepali-c
    Author

    Yes I do see similar exceptions withOMP_NUM_THREADS=1as well.

  3. brada4 commented on Jun 29, 2018

    @brada4
    Contributor

    Can you run broken command (one near "did not work") separately?
    then (with single thread to keep backtraces short)

    $ script
    $ OPENBLAS_NUM_THREADS=1 gdb XXX/testprog
    gdb> run <input.in >output.out
    .... CRASH .... SEGV ....
    gdb> bt
    ...Here comes interesting stuff...
    gdb> q
    $ Ctrl-D
    ... file is typescript
    

    and attach "interesting" part from gdb output
    also if it does not crash every time roll through like 10x to see if backtrace content (call chain) does not change, which may indicate e.g. stack corruption
    start with one, probably it is some generic problem that single fix fixes rest of crashes

    Edit - I mean PPC only for now as no problem on x86

  4. hartb commented on Jun 29, 2018

    @hartb

    I work with @deepali-c

    The test I see segfaulting is several different runs of xeigtstz:

    /bin/sh: line 1: 83059 Segmentation fault      (core dumped) ./EIG/xeigtstz < nep.in > znep.out                                                                     /bin/sh: line 1: 83062 Segmentation fault      (core dumped) ./EIG/xeigtstz < sep.in > zsep.out                                                                     
    /bin/sh: line 1: 83065 Segmentation fault      (core dumped) ./EIG/xeigtstz < se2.in > zse2.out                                                                     
    /bin/sh: line 1: 83068 Segmentation fault      (core dumped) ./EIG/xeigtstz < svd.in > zsvd.out                                                                     
    /bin/sh: line 1: 83071 Segmentation fault      (core dumped) ./EIG/xeigtstz < zec.in > zec.out                                                                      
    /bin/sh: line 1: 83074 Segmentation fault      (core dumped) ./EIG/xeigtstz < zed.in > zed.out                                                                      
    /bin/sh: line 1: 83077 Segmentation fault      (core dumped) ./EIG/xeigtstz < zgg.in > zgg.out                                                                      
    /bin/sh: line 1: 83080 Segmentation fault      (core dumped) ./EIG/xeigtstz < zgd.in > zgd.out                                                                      
    /bin/sh: line 1: 83083 Segmentation fault      (core dumped) ./EIG/xeigtstz < zsb.in > zsb.out                                                                      
    /bin/sh: line 1: 83086 Segmentation fault      (core dumped) ./EIG/xeigtstz < zsg.in > zsg.out                                                                      
    /bin/sh: line 1: 83089 Segmentation fault      (core dumped) ./EIG/xeigtstz < zbb.in > zbb.out                                                                      
    /bin/sh: line 1: 83092 Segmentation fault      (core dumped) ./EIG/xeigtstz < glm.in > zglm.out                                                                     
    /bin/sh: line 1: 83095 Segmentation fault      (core dumped) ./EIG/xeigtstz < gqr.in > zgqr.out                                                                     
    /bin/sh: line 1: 83098 Segmentation fault      (core dumped) ./EIG/xeigtstz < gsv.in > zgsv.out                                                                     
    /bin/sh: line 1: 83101 Segmentation fault      (core dumped) ./EIG/xeigtstz < csd.in > zcsd.out                                                                     
    /bin/sh: line 1: 83104 Segmentation fault      (core dumped) ./EIG/xeigtstz < lse.in > zlse.out
    

    Looks like it fails right away when we hit the fortran code because the MAIN__ function tries to allocate a ~10MB stack frame:

    (gdb) where
    #0  0x0000000010001e34 in MAIN__ ()
    #1  0x00007ffff7995100 in generic_start_main.isra.0 () from /lib64/libc.so.6
    #2  0x00007ffff79952f4 in __libc_start_main () from /lib64/libc.so.6
    #3  0x0000000000000000 in ?? ()
    
    (gdb) x/20i MAIN__
    [...]
       0x10001e2c <MAIN__+24>:      lis     r0,-157
       0x10001e30 <MAIN__+28>:      ori     r0,r0,9056
    => 0x10001e34 <MAIN__+32>:      stdux   r1,r1,r0
    
    (gdb) info registers r0 r1
    r0             0xffffffffff632360       18446744073699271520
    r1             0x7fffffffed30   140737488350512
    

    (r1 is the stack frame pointer on ppc64le. The lis/ori is constructing the size of the frame in r0 (157 * 2^16 - 9056), and then the stdux would establish the new frame and linkage back to previous.)

    I think the PROGRAM level stuff in zchkee.f will be MAIN__ here. I quite a few local variables being defined there, but haven't walked them to see if they'd amount to ~10MB.

  5. martin-frbg commented on Jun 29, 2018

    @martin-frbg
    Collaborator

    That code is taken directly from the netlib reference implementation (https://github.com/Reference-LAPACK/lapack) so if the stack size is actually the source of the problem I think it would have been noticed elsewhere. (Or perhaps the default stack size limit is smaller on your ppc64le than on other
    platforms, can you check and/or adjust it with ulimit ?)

  6. hartb commented on Jun 29, 2018

    @hartb

    Ah; that's it! The default ulimit in the environment we're running in (ppc64le in a RHEL 7.5 docker container on RHEL 7.5 host) is 8MB:

    $ ulimit -s
    8192
    

    Setting $ ulimit -s unlimited allows the test to succeed.

    Thank you!

  7. brada4 commented on Jun 30, 2018

    @brada4
    Contributor

    Do you get same problem with:
    Fedora EPEL OpenBLAS 0.30.0 binary RPM?
    Using SCL compilers i.e gcc/gfortran 7.3.1?
    Somebody should have noticed the fact no gfortran produce ever worked....

  8. martin-frbg commented on Jun 30, 2018

    @martin-frbg
    Collaborator

    @brada4 I expect few people run the full lapack-test. Closing for now, please reopen if you encounter a test that still fails.

  9. martin-frbg commented on Jul 1, 2018

    @martin-frbg
    Collaborator

    Added to the FAQ now

  10. hartb commented on Jul 2, 2018

    @hartb

    It turns out I see this on x86 as well, at least in a CentOS 7 docker container on an Ubuntu 16.04 host.

    I installed OpenBLAS 0.3.0 from EPEL (including -devel) and tried to make lapack-test straight away using the example make.inc. That build failed due to lack of libtmglib.a, so I make; make lapack-test.

    So I'm not certain whether the lapack bits were built against the EPEL-provided OpenBLAS, or the one I'd just built.

    That build succeeded and then:

    # uname -a
    Linux 3bf1b1871461 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    
    # EIG/xeigtstz < nep.in > znep.out
    Segmentation fault (core dumped)
    
    # ulimit -s
    8192
    
    # ulimit -s unlimited
    
    # EIG/xeigtstz < nep.in > znep.out
    #
    

    And again it seems because MAIN__ is trying to create a ~10MB stack frame while the stack ulimit is only 8MB:

    (gdb) where
    #0  0x0000000000401fb3 in MAIN__ ()
    #1  0x0000000000401e3d in main ()
    
    (gdb) x/20i MAIN__
    ...
       0x401fa1 <MAIN__+17>:        sub    $0x9cdcd8,%rsp
       0x401fa8 <MAIN__+24>:        lea    0x614ed0(%rsp),%r15
       0x401fb0 <MAIN__+32>:        mov    %r15,%rdi
    => 0x401fb3 <MAIN__+35>:        callq  0x4018e0 <memset@plt>
    ...
    (gdb) print 0x9cdcd8
    $1 = 10280152
    

    (I assume the crash is delayed to the callq on x86 because that will want to write at the current stack pointer value, vs occuring at the stack-growing stdwu on Power which writes to the stack then.)

    At any rate, the problem isn't limited to Power, and the new suggestion in the FAQ works for both Power and x86 platforms:

    https://github.com/xianyi/OpenBLAS/wiki/Faq#xeigtst

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions