gui11aume / starcode

All pairs search and sequence clustering
GNU General Public License v3.0
90 stars 21 forks source link

Fix thread issue with some old compilers #5

Closed gui11aume closed 10 years ago

gui11aume commented 10 years ago

After compiling wigh gcc 4.4.6 on RedHat, running starcode on the test_file in the test directory gives variable results, none of them being correct. This was done on the cluster of the UPF. When recompiling with gcc 4.8.2 the problem was solved and starcode gave the expected result.

gui11aume commented 10 years ago

No problem when compiling with gcc-4.7 (the oldest on my machine).

gui11aume commented 10 years ago

I could not reproduce the issue when compiling with gcc 4.4.6 and gcc 3.4.6 on the cluster of the CRG. Not sure that the issue is really due to the version of gcc.

gui11aume commented 10 years ago

Looking at the architecture-dependent parts of the code, I realized that the content of the file getline.c is not linked properly. This may be the source of the trouble.

gui11aume commented 10 years ago

It seems the bug has nothing to do with getline.c. Using binaries compiled by Lucas on the cluster of the UPF I could reproduce the bug. However, running the binaries in gdb makes the bug disappear completely. This is most likely a thread issue, which for some reason arises only when compiled with older versions of gcc.

ezorita commented 10 years ago

This is 99% an issue that has to do with the version of glibc rather than the compiler version. From pthreads manpage:

NPTL (Native POSIX Threads Library) This is the modern Pthreads implementation. By comparison with LinuxThreads, NPTL provides closer conformance to the requirements of the POSIX.1 specification and better performance when creating large numbers of threads. NPTL is available since glibc 2.3.2, and requires features that are present in the Linux 2.6 kernel.

Did you check the version of glibc?

Eduard

2014-09-08 23:26 GMT+02:00 Guillaume Filion notifications@github.com:

Assigned #5 https://github.com/gui11aume/starcode/issues/5 to @ezorita https://github.com/ezorita.

— Reply to this email directly or view it on GitHub https://github.com/gui11aume/starcode/issues/5#event-162751763.

gui11aume commented 10 years ago

The bug is in pad_useq(), on line 745 of starcode.c in commit 2655576302...