kaist-ina / BWA-MEME

BWA-MEME: Faster BWA-MEM2 using learned-index
https://ina.kaist.ac.kr/projects/bwa-meme/
MIT License
110 stars 14 forks source link

bwa-mem2 mem Segmentation fault (core dumped) #3

Closed HuangDeneil closed 3 years ago

HuangDeneil commented 3 years ago

Hi,

I had installed bwa-meme, but failed at the bwa-mem2 mem

My index building commands :

./bwa-mem2 index -a meme -t 32 human.fna ; 
./build_rmis_dna.sh human.fna

All index file :

$ ls human.fna* -hal
lrwxrwxrwx 1 hudeneil hudeneil   45 Oct  4 10:37 human.fna
-rw-rw-r-- 1 hudeneil hudeneil 5.8G Oct  4 12:16 human.fna.0123
-rw-rw-r-- 1 hudeneil hudeneil 1.1K Oct  4 11:56 human.fna.amb
-rw-rw-r-- 1 hudeneil hudeneil 1.9K Oct  4 11:56 human.fna.ann
-rw-rw-r-- 1 hudeneil hudeneil 2.9G Oct  4 11:55 human.fna.bwt
-rw-rw-r-- 1 hudeneil hudeneil 742M Oct  4 11:56 human.fna.pac
-rw-rw-r-- 1 hudeneil hudeneil  29G Oct  4 15:05 human.fna.pos_packed
-rw-rw-r-- 1 hudeneil hudeneil  76G Oct  4 15:05 human.fna.possa_packed
-rw-rw-r-- 1 hudeneil hudeneil  29G Oct  4 15:05 human.fna.ref2sa_packed
-rw-rw-r-- 1 hudeneil hudeneil 1.5G Oct  4 12:13 human.fna.sa
-rw-rw-r-- 1 hudeneil hudeneil  47G Oct  4 15:05 human.fna.suffixarray_uint64
-rw-rw-r-- 1 hudeneil hudeneil  122 Oct  4 15:23 human.fna.suffixarray_uint64_data.h
-rw-rw-r-- 1 hudeneil hudeneil    8 Oct  4 15:23 human.fna.suffixarray_uint64_L0_PARAMETERS
-rw-rw-r-- 1 hudeneil hudeneil 1.2G Oct  4 15:24 human.fna.suffixarray_uint64_L1_PARAMETERS
-rw-rw-r-- 1 hudeneil hudeneil 6.0G Oct  4 15:24 human.fna.suffixarray_uint64_L2_PARAMETERS
drwxrwxr-x  5 hudeneil hudeneil  244 Oct  4 10:14 RMI
drwxrwxr-x  2 hudeneil hudeneil  258 Oct  4 15:24 rmi_data

bwa-mem2 mem occured Segmentation fault (core dumped)

There is the following message :

$ time ~/tools/BWA-MEME/bwa-mem2 mem -Y -K 100000000 -t 32 -7 ~/tools/BWA-MEME/human.fna S461.trim.fq -o S461.trim.fq.mem.sam
-----------------------------
Executing in AVX512 mode!!
-----------------------------
* SA compression enabled with xfactor: 8
* Ref file: /home/hudeneil/tools/BWA-MEME/human.fna
* Entering FMI_search
Reading other elements of the index from files /home/hudeneil/tools/BWA-MEME/human.fna
* Index prefix: /home/hudeneil/tools/BWA-MEME/human.fna
* Read 0 ALT contigs
* Reading reference genome..
* Binary seq file = /home/hudeneil/tools/BWA-MEME/human.fna.0123
* Reference genome size: 6224193392 bp
* Done reading reference genome !!

------------------------------------------
1. Memory pre-allocation for Chaining: 1419.8876 MB
2. Memory pre-allocation for BSW: 7667.7448 MB
Segmentation fault (core dumped)

How to solve this problem? Thank you.

quito418 commented 3 years ago

Hi, thank you for your interest in BWA-MEME.

Can you share your reference file (human.fna) to me.

I think the Segmentation fault error occurs during the index loading step.

You can send me by email (tom418@kaist.ac.kr) or link_share(dropbox, or others).

Thank you

HuangDeneil commented 3 years ago

This is my reference file (human.fna) & log files of ./bwa-mem2 index -a meme -t 32 human.fna and ./build_rmis_dna.sh human.fna My google drive link

quito418 commented 3 years ago

Thank you for sharing!

I’ll let you know after I fix the bug.

Thank you

2021년 10월 7일 (목) 10:16, Yang-Zhan Huang @.***>님이 작성:

This is my reference file (human.fna) & log files of ./bwa-mem2 index -a meme -t 32 human.fna and ./build_rmis_dna.sh human.fna

[ https://drive.google.com/drive/folders/1wqr6OHOwGoHt87S4HSVi5RQ1vKr5dA9Z?usp=sharing]( My google drive link )

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/kaist-ina/BWA-MEME/issues/3#issuecomment-937367129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLJGFSVEX6BT5D66O2JVSTUFTYFZANCNFSM5FI63TUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

quito418 commented 3 years ago

I downloaded your reference file and tested with the reference.

However, I wasn't able to reproduce the error.

Below images are the results I obtained during index building and running BWA-MEME.

So, can you run BWA-MEME with GDB to check where the segmentation fault happens? (I attached the explanation below) Also, please make sure your server has enough memory (with default setting, BWA-MEME requires ~150GB depending on the number of threads)

P-RMI trained Run BWA-MEME

Running GDB

Below commands are the instruction to run gdb. I also attached the image which describes the process of running gdb.

# Run GDB with bwa-meme executable file
gdb ./bwa-mem2.avx512bw

# Run bwa-meme with arguments
# ex) r mem -t 48  -7 ~/human_ref/human.fna /ssd/ERR194147_1.fastq.gz
r mem -t <Thread Num>  -7 <Reference Path> <Short Read data path>

running gdb

If BWA-MEME stops with segmentation fault, gdb will show logs about the segmentation fault.

It would be helpful if you share the log!

Also, if you meet any problem while running GDB, feel free to contact me.

Thank you

HuangDeneil commented 3 years ago

There is the following message after gdb:

$ gdb  ~/tools/BWA-MEME/bwa-mem2
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-11.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/hudeneil/tools/BWA-MEME/bwa-mem2...done.

(gdb) r mem -t 32 -7 ~/tools/BWA-MEME/human.fna S461.trim.fq -o S461.trim.fq.mem.sam

Starting program: /home/hudeneil/tools/BWA-MEME/bwa-mem2 mem -t 32 -7 ~/tools/BWA-MEME/human.fna S461.trim.fq -o S461.trim.fq.mem.sam
Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-127.el8.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: File "/home/hudeneil/localhost/gcc-9.3.0/lib64/libstdc++.so.6.0.28-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/lib/golang/src/pkg/runtime/runtime-gdb.py".
To enable execution of this file add
        add-auto-load-safe-path /home/hudeneil/localhost/gcc-9.3.0/lib64/libstdc++.so.6.0.28-gdb.py
line to your configuration file "/home/hudeneil/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/hudeneil/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
-----------------------------
Executing in AVX512 mode!!
-----------------------------
* SA compression enabled with xfactor: 8
* Ref file: /home/hudeneil/tools/BWA-MEME/human.fna
* Entering FMI_search
Reading other elements of the index from files /home/hudeneil/tools/BWA-MEME/human.fna
* Index prefix: /home/hudeneil/tools/BWA-MEME/human.fna
* Read 0 ALT contigs
* Reading reference genome..
* Binary seq file = /home/hudeneil/tools/BWA-MEME/human.fna.0123
* Reference genome size: 6418572210 bp
* Done reading reference genome !!

------------------------------------------
1. Memory pre-allocation for Chaining: 4543.5970 MB
2. Memory pre-allocation for BSW: 7667.7448 MB

Program received signal SIGSEGV, Segmentation fault.
0x0000000000448a57 in std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::~vector (this=0x393031330a4e2050, __in_chrg=<optimized out>)
    at /usr/include/c++/8/bits/stl_vector.h:565
565           ~vector() _GLIBCXX_NOEXCEPT
Missing separate debuginfos, use: yum debuginfo-install zlib-1.2.11-16.2.el8_3.x86_64
(gdb)

The problem seems is mv gcc version but I had upgrade gcc version from 8.3.1 to 9.3.0 under my user environment.

quito418 commented 3 years ago

Great,

I recently removed the requirement for filesystem library.

Can you update the code (git pull) and recompile BWA-MEME. (You don’t need to rebuild index or train RMI).

If filesystem library is the problem, I believe it can be resolved.

Thank you

HuangDeneil commented 3 years ago

Thanks for your comment! It works now.