Menu ▾ ▴

#6 Program freeze during compute pair (step 3)

open
nobody
None
5
2013-02-13
2013-02-13
No

Freeze, presumably infinite loop:

Compute pair: 116100
Compute pair: 116200
Compute pair: 116300
Compute pair: 116400
^C
Program received signal SIGINT, Interrupt.
TransInitialProb::Alpha_Beta_Compute_SinglePoint_IBDLD2 (this=this@entry=0x7fffffffcf70, iOrderNum=iOrderNum@entry=@0x7fffffffc360: 116480, Delta=...) at ./IBDFold/InitalLambda_class.h:209
209 temp1*=10;
(gdb) bt
#0 TransInitialProb::Alpha_Beta_Compute_SinglePoint_IBDLD2 (this=this@entry=0x7fffffffcf70, iOrderNum=iOrderNum@entry=@0x7fffffffc360: 116480, Delta=...)
at ./IBDFold/InitalLambda_class.h:209
#1 0x0000000000499e25 in MultiplyMethodsComputaionResultOutput (infileMarkerList=..., OutFile=..., lmdaFile=..., backgroundLDFile=..., inFile_StudyPair=..., iStudyPair=-506166768, iStep=0,
iPreviousLoci=20, ibcCheck=0, iHBDCheck=0, fMoveDistance=-nan(0x7fc440), iCheckIBD=1, iIBDType=3, iSegment=0, fMin=0.5, fMax=1.10000002, ilmda=0, ibackgroundLD=0, iSNP=1, fLength=0,
iMarkerFile=0, iMethod=3, sChromosome=..., fErrorRate=0.00999999978, LogFile=..., iTolerateMemory=@0x7fffffffda00: 1000, iPrint=@0x7fffffffd780: 1) at ./IBDFold/TriCoreProgram.cpp:2019
#2 0x0000000000406074 in main (argc=1008981770, argv=0x7fff00000003) at ./IBDFold/IBDEstimationMain.cpp:127

looking at the 'Alpha_Beta_Compute_SinglePoint_IBDLD2' function, I see a while loop which doesn't necessarily change the checked condition at each loop:

int MultiplyTimes=0;
double temp1=Alpha.matrix().row(iPos).maxCoeff();
while(temp1<0.5){
temp1*=10;
MultiplyTimes++;
}
Alpha.row(iPos)*=pow(10.0,MultiplyTimes);

I notice this same while loop in other parts of the code (e.g. lines 236, 276, 303, 341, 366, 412, 444). Such repetition would probably be better encapsulated in a separate function....

Anyway, if temp1 is zero, then multiplying by 10 isn't going to do anything. Working backwards:

temp1 == 0
=>Alpha.matrix().row(iPos).maxCoeff() == 0
=>all coefficients [?entries] of row(iPos) are less than or equal to zero

Zero rows are probably indicative of *a bad thing*, so it's probably not appropriate to fudge this by e.g. adding 1e-10. It *may* be suitable to skip over the while block entirely, keeping MultiplyTimes at 0 so that the row multiplication is not altered. For example:

int MultiplyTimes=0;
double temp1=Alpha.matrix().row(iPos).maxCoeff();
if(temp1 == 0){
cerr << "Warning: temp1 is zero\n";
}
while((temp1 != 0) && (temp1<0.5)){
temp1*=10;
MultiplyTimes++;
}
Alpha.row(iPos)*=pow(10.0,MultiplyTimes);

Such a fix will, however, change the function of the code. It is not clear to me at the moment what the intended function of this code is.

Discussion

  • David Eccles (gringer)

    Workaround patch to pass over code section causing freeze

     
  • Nobody/Anonymous

    This bug is still an issue in v3.004

     
  • Lide Han

    Lide Han - 2013-03-06

    This debug has been improved.

     
  • Lide Han

    Lide Han - 2013-03-06

    The debug has been removed.