yangao07 / abPOA

abPOA: an SIMD-based C library for fast partial order alignment using adaptive band
MIT License
118 stars 18 forks source link

pyabpoa: segmentation fault with version 1.5.2 #75

Open shokrof opened 1 month ago

shokrof commented 1 month ago

Hi, I am encountering a segmentation fault when using version 1.5.2. Please find the attached code. I installed pyabopa using pip install pyabopa on a Linux machine. I can successfully print the sequence before running msa function. Additionally, I have tested version 1.5.1, which works as expected on my machine.

import pyabpoa as pa
seqs= ['CTGACTACAGCGCGCACACGCGCTATATATATCATCATCATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA', 
       'CTGACTACAGCGCGCACACGCGCTATATATATATATATGTATAGTAGAGACGTCACGTGTAGCA'
       ]
max_n_cons=2
aligner = pa.msa_aligner(aln_mode='g')
#print(seqs)
result = aligner.msa(
        seqs, out_cons=True, out_msa=False, max_n_cons=2,
        min_freq=0.3)
print(result.cons_seq[0])
yangao07 commented 3 weeks ago

Hi, for the seg fault, I assume it is a known issue caused by running it on an old machine. Are you able to re-produce it on other machines?

shokrof commented 3 weeks ago

I could replicate it on a macOS m2 machine.

yangao07 commented 3 weeks ago

I am not sure about macOS/m chips, our experience is primarily based on Linux.

shokrof commented 3 weeks ago

I faced the problem while working on a Linux machine and I am just saying it is reproducible on other machines. I am wondering if the following code runs on your machine.

yangao07 commented 3 weeks ago

I see, I can not reproduce it on my machine. For your linux, can you show your /proc/cpuinfo ?

shokrof commented 3 weeks ago

processor is "Intel(R) Xeon(R) Platinum 8168"

yangao07 commented 3 weeks ago

OK, but please try this "cat /proc/cpuinfo | grep flag".

shokrof commented 3 weeks ago
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d arch_capabilities
vmx flags       : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs pml ept_mode_based_exec tsc_scaling
yangao07 commented 3 weeks ago

The machine looks good to me. Have you tried installing pyabpoa from source on your linux?

shokrof commented 3 weeks ago

I tried to install the python library using python3 -m pip install . from the source code and it is still giving segmentation fault. However, when I run the binary using fasta file it works fine

yangao07 commented 3 weeks ago

Hi, I just re-produce your error on my machine, and confirmed that this is a pypi building issue. Currently, you can try this to use v1.5.2:

pip install --no-binary pyabpoa pyabpoa

I will try to fix this pypi building issue in the next version.

shenker commented 2 weeks ago

I ran into what is presumably the same issue with the conda packages. mamba install pyabpoa=1.5.2=py312he57d009_1 gives an pyabpoa install that triggers a signal 132 illegal instruction error with my test script (run on an academic HPC node with an outdated CPU), whereas a slightly older conda build of version 1.5.2 works (mamba install pyabpoa=1.5.2=py312he57d009_0, note the _0 build number).

cpu flags:

fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdseed adx smap xsaveopt cqm_llc cqm_occup_llc  
yangao07 commented 2 weeks ago

The conda/mamba could be the same, I am not sure. For pyabpoa, I suggest pip over conda/mamba.