sriramlab/SCOPE

Unitialised value detected by valgrind

dramanica opened this issue · 0 comments

I run the example through valgrind, and it caught a use of unitialised variables in MatMult from line 490 in ALStructure::run():

andrea@laptopX1:~/git/scope/examples$ valgrind --leak-check=full --track-origins=yes ../debug/scope -g ./source_files/example_1k -seed 12345 -m 10
==91512== Memcheck, a memory error detector
==91512== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==91512== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==91512== Command: ../debug/scope -g ./source_files/example_1k -seed 12345 -m 10
==91512== 
done reading
Running on Dataset of 1000 SNPs and 1000 Individuals
==91512== Conditional jump or move depends on uninitialised value(s)
==91512==    at 0x48CD8F5: __ieee754_pow_fma (e_pow.c:292)
==91512==    by 0x488EE47: pow@@GLIBC_2.29 (w_pow_template.c:32)
==91512==    by 0x147B57: MatMult::MatMult(Genotype&, Eigen::Matrix<double, -1, -1, 1, -1, -1>&, bool, bool, bool, bool, bool, int, int) (in /home/andrea/git/scope/debug/scope)
==91512==    by 0x128DCC: ALStructure::run() (in /home/andrea/git/scope/debug/scope)
==91512==    by 0x114E18: main (in /home/andrea/git/scope/debug/scope)
==91512==  Uninitialised value was created by a stack allocation
==91512==    at 0x114DEC: main (in /home/andrea/git/scope/debug/scope)
==91512== 
==91512== Conditional jump or move depends on uninitialised value(s)
==91512==    at 0x48CDAED: __ieee754_pow_fma (e_pow.c:299)
==91512==    by 0x488EE47: pow@@GLIBC_2.29 (w_pow_template.c:32)
==91512==    by 0x147B57: MatMult::MatMult(Genotype&, Eigen::Matrix<double, -1, -1, 1, -1, -1>&, bool, bool, bool, bool, bool, int, int) (in /home/andrea/git/scope/debug/scope)
==91512==    by 0x128DCC: ALStructure::run() (in /home/andrea/git/scope/debug/scope)
==91512==    by 0x114E18: main (in /home/andrea/git/scope/debug/scope)
==91512==  Uninitialised value was created by a stack allocation
==91512==    at 0x114DEC: main (in /home/andrea/git/scope/debug/scope)
==91512== 
==91512== Conditional jump or move depends on uninitialised value(s)
==91512==    at 0x48CDD63: __ieee754_pow_fma (e_pow.c:301)
==91512==    by 0x488EE47: pow@@GLIBC_2.29 (w_pow_template.c:32)
==91512==    by 0x147B57: MatMult::MatMult(Genotype&, Eigen::Matrix<double, -1, -1, 1, -1, -1>&, bool, bool, bool, bool, bool, int, int) (in /home/andrea/git/scope/debug/scope)
==91512==    by 0x128DCC: ALStructure::run() (in /home/andrea/git/scope/debug/scope)
==91512==    by 0x114E18: main (in /home/andrea/git/scope/debug/scope)
==91512==  Uninitialised value was created by a stack allocation
==91512==    at 0x114DEC: main (in /home/andrea/git/scope/debug/scope)
==91512== 
Performing latent subspace estimation
Latent subspace esimation completed after 19 iterations
Initializing Phat using seed 12345
Iteration 2  -- RMSE 0.104633192581442

I had a quick go at feeding scope with a text input of the example dataset, to see whether the problem was related with the conversion from .bed. The text input did not raise any issue in MatMult, so I suspect something goes wrong when parsing the binary genotype codes (as a note, to get the txt option to work, I had to comment out the line computing pj, as it didn't like the text line, but that is not an issue with the example as there are no missing values; as the txt option is not exposed to the user, I presume that part of the code is deprecated in any case, I just used it as a quick test).