splatlab / squeakr

Squeakr: An Exact and Approximate k -mer Counting System
BSD 3-Clause "New" or "Revised" License
85 stars 23 forks source link

Illegal hardware instruction #2

Closed johnlees closed 7 years ago

johnlees commented 7 years ago

Hi,

I have compiled from source, but I get the following error when running

$ ./main 0 20 1 test.fastq
Reading from the fastq file and inserting in the QF
[1]    28352 illegal hardware instruction  ./main 0 20 1 test.fastq

I compiled with gcc-4.9. The following is the result of ldd main

    linux-vdso.so.1 =>  (0x00007ffe8a8f8000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fed2eee8000)
    libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fed2ec88000)
    libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fed2e8a8000)
    libboost_system.so.1.57.0 => /nfs/users/nfs_j/jl11/software/lib/libboost_system.so.1.57.0 (0x00007fed2e6a0000)
    libboost_thread.so.1.57.0 => /nfs/users/nfs_j/jl11/software/lib/libboost_thread.so.1.57.0 (0x00007fed2e480000)
    libstdc++.so.6 => /software/hgi/pkglocal/gcc-4.9.1/lib64/libstdc++.so.6 (0x00007fed2e170000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fed2de70000)
    libgcc_s.so.1 => /software/hgi/pkglocal/gcc-4.9.1/lib64/libgcc_s.so.1 (0x00007fed2dc58000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed2d890000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fed2f108000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fed2d688000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fed2d470000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fed2d268000)

Any ideas why this is happening?

prashantpandey commented 7 years ago

Hey John,

Squeakr uses a CQF as the underlying data structure to count kmers. The CQF code uses two new instructions that were introduced in Intel Haswell (4th generation) line of CPUs. I guess the machine you are using doesn't have a Haswell or newer CPU. That's why you are getting an "illegal hardware instruction" issue.

prashantpandey commented 7 years ago

I will try to release a patch so that the code can use the C implementation of the new instructions if the underlying hardware doesn't support them.

johnlees commented 7 years ago

Ah, thanks for the explanation. I'd appreciate the patch, if you're able to make it!

prashantpandey commented 7 years ago

Hey John,

I have pushed a new commit for the code to work on older-than-Haswell CPUs. The REAMDE is also updated with instructions on how to build.

Thanks Prashant

johnlees commented 7 years ago

Thanks for that! I'm now getting a compile error, which I guess is due to missing zlib includes?

In file included from main.cc:49:0:
reader.h:35:21: error: ‘gzFile_s’ has not been declared
    reader(FILE *in, gzFile_s *in_gzip, BZFILE *in_bzip2, int bzerror);
                     ^
reader.h:38:4: error: ‘gzFile_s’ does not name a type
    gzFile_s *in_gzip = nullptr;
    ^

I've got zlib.h in /usr/include which should be ok? I noticed some of the zlib stuff changed with the recent commit

prashantpandey commented 7 years ago

Can you check the version of zlib and bzip2 on your machine? Here is what I have: $ apt-cache policy zlib1g-dev zlib1g-dev: Installed: 1:1.2.8.dfsg-2ubuntu4 Candidate: 1:1.2.8.dfsg-2ubuntu4 Version table: 1:1.2.8.dfsg-2ubuntu4 500 500 http://ca.archive.ubuntu.com/ubuntu xenial/main amd64 Packages 100 /var/lib/dpkg/status $ apt-cache policy bzip2 bzip2: Installed: 1.0.6-8 Candidate: 1.0.6-8 Version table: 1.0.6-8 500 500 http://ca.archive.ubuntu.com/ubuntu xenial/main amd64 Packages 100 /var/lib/dpkg/status

johnlees commented 7 years ago
$ apt-cache policy zlib1g-dev
zlib1g-dev:
  Installed: 1:1.2.3.4.dfsg-3ubuntu4
  Candidate: 1:1.2.3.4.dfsg-3ubuntu4
  Version table:
 *** 1:1.2.3.4.dfsg-3ubuntu4 0
        500 http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status
$ apt-cache policy bzip2
bzip2:
  Installed: 1.0.6-1
  Candidate: 1.0.6-1
  Version table:
 *** 1.0.6-1 0
        500 http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

Do you think the zlib version is too low?

prashantpandey commented 7 years ago

Can you check if "gzFile_s" is declared in your "/usr/include/zlib.h"? If not you should upgrade your zlib package.

Thanks Prashant

johnlees commented 7 years ago

Hi Prashant, I have installed zlib 1.2.11, and now squeakr has compiled and runs correctly. Thanks so much for your help! I look forward to using the tool. John