cnettel/cnF2freq

Segfault

ttbek opened this issue · 4 comments

ttbek commented

While I did get it to compile with g++, I am seeing segfaults. E.g. with the demo.sh example inputs the output is attached. Also an strace.
demo_output.txt
demo_strace.txt

I am sorry for all the trouble.

Could you verify whether it works for you when disabling OpenMP, either by excluding -fopenmp in the compile command, or by setting the environment variable OMP_NUM_THREADS to 1?

I seem to get a segfault in some gcc versions with OpenMP enabled. I intend to fix it, but disabling it would serve two purposes for me. Foremost, it would let you use the code at all, and it would also indicate that the error I am getting is a proper reproduction of what you see.

I found the problem, there was a typo in the environment variable used to change the default OpenMP stack size. gcc (or rather libgomp aided by gcc) puts thread-private data on the stack, while the Intel software stack puts it on the heap.

ttbek commented

I was still getting a segfault, but output was different and said it could not locate toulbar2:

Reading map file demoplantimpute.map
Reading pedigree file demoplantimpute.ped
Creating 1
Creating 2
Creating 3
Creating 4
Creating 5
Creating 6
Creating 7
Creating 8
Creating 9
Creating 10
Creating 11
Reading genotype file demoplantimpute.gen
Creating 12
1/0 2
1/0 turned into 1 1 with 0.000000;0.500000
5/1 2
5/1 turned into 1 1 with 0.002121;0.474640
1/0 2
1/0 turned into 1 1 with 0.000000;0.500000
Number of corrected genotypes: 0
Fixing point: 2 1 3
Fixing point: 3 1 1
Fixing point: 6 1 1
1 A
0.500000 2 2 0.000000 0.020000 0.020000 0.500000
0.500000 2 2 0.000000 0.020000 0.020000 0.500000
........................................................................................................
0.500000 9 9 0.000000 0.000000 0.000000 0.500000
0.500000 9 9 0.000000 0.000000 0.000000 0.500000
6,018,000: -16.027183 -13.947742 8
10,112,004: -5.058089 -3.671795 8
3,018,000: -16.357735 -14.278293 8
LAST: 10 F
LAST: 3 C
LAST: 6 D
sh: 1: toulbar2: not found
sh: 1: toulbar2: not found
Segmentation fault (core dumped)

I guess Toulbar2 is a prerequisite then..... doesn't seem to be in my 16.04 repos, found a .deb from their site: https://mulcyber.toulouse.inra.fr/frs/?group_id=29&release_id=657#file-:-toulbar2-release-0.9.8.0-title-content
Main page here: https://mulcyber.toulouse.inra.fr/projects/toulbar2/
Linked to from here: http://www7.inra.fr/mia/T/toulbar2/

Now the demo runs without anything that looks like an error to me, it is a bit different from the included demooutput file though, I am attaching it here, could you please take a quick look to confirm it seems correct?
my_demo_output.txt

The toulbar support is now made optional with the flag DOTOULBAR in settings.h. It is an experimental result of a student's master thesis and I strongly believe in it, going forward. The old logic is fine, though.

I belive your results are reasonable. The main difference is that the current version of the code attempts to do a maximum entropy approximation, meaning that the eventual skewness and sureness values should truly be the expected probability of the phase and genotype, respectively, rather than just converged parameters in the model. I can add a flag to turn that back as well.

The reason for all these changes is that the previous main branch, plantimpute_modern got so stale that it didn't make much sense to keep fixing it. It uses a much slower algorithm and has other minor issues. I appreciate all the feedback.