Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How to debug this code?

milenko1976
Beginner
1,859 Views

Makefile

FC = ifort
FCFLAGS= -O0 -debug -traceback -check -ftrapuv

TARGETS= clean birrp

OBJSOC= strlen.f diagnostic.f math.f rtpss.f zlinpack.f coherence.f fft.f rarfilt.f utils.f dataft.f filter.f response.f weight.f  birrp.f
all:  $(TARGETS)    

clean:$
        rm -f *.o *.mod
        rm -f birrp
        
birrp:$(OBJSOC)
        $(FC) $(FCFLAGS) -o $@ $(OBJSOC)

# General compile rules

.SUFFIXES: .f .o

.f .o:    
    $(FC) $(FCFLAGS) -c -o $@ $<

I compile the code

./birrp < n128.in
 select the input level (0=basic,1=advanced): input the number of output time series: input the number of input time series: select tbw for prolate data window (1 to 4): input the data sample interval: input the initial section length and maximum number of sections:  table of output periods by section length
   125.0000       83.33334    
   62.50000       41.66667    
   31.25000       20.83333    
   15.62500       10.41667    
   7.812500       5.208333    
   3.906250       2.604167    
   1.953125       1.302083    
  0.9765625      0.6510417    
 are these values acceptable (y or n)? input the robustness and leverage parameters (0 and >0.99 are recommended): input the 2nd stage coherence threshold: input the output filename root: input the output level (-3 to 3): input the number of data pieces: input the length of the ar filter (0 for none, <0 for filename): select the file mode (0=separate ascii files, 1=separate binary files 2=all component ascii files 3=ts ascii file: select the input mode (0=by points, 1=by date/time): input the number of points to read: input the number of filter parameters (<0 for filename): input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip:forrtl: error (182): floating invalid - possible uninitialized real/complex variable.
Image              PC                Routine            Line        Source             
birrp              0000000000656D55  Unknown               Unknown  Unknown
birrp              0000000000654977  Unknown               Unknown  Unknown
birrp              00000000006077D4  Unknown               Unknown  Unknown
birrp              00000000006075E6  Unknown               Unknown  Unknown
birrp              00000000005BF7F6  Unknown               Unknown  Unknown
birrp              00000000005C30B7  Unknown               Unknown  Unknown
libpthread.so.0    00007FD7D61433D0  Unknown               Unknown  Unknown
birrp              0000000000431396  xmedian_                 2078  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00007FD7D5B85830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown
Aborted (core dumped)


I am attaching the folder.526217

 

0 Kudos
12 Replies
milenko1976
Beginner
1,859 Views

This is when I run with valgrind

valgrind --leak-check=summary ./birrp < n128.in
==6690== Memcheck, a memory error detector
==6690== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==6690== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==6690== Command: ./birrp
==6690==
==6690== Warning: set address range perms: large range [0x8d9000, 0x31f32000) (defined)
==6690== Conditional jump or move depends on uninitialised value(s)
==6690==    at 0x65CC9D: __intel_sse2_strcpy (in /home/milenko/birrp/birrp)
==6690==    by 0x60E770: for__open_proc (in /home/milenko/birrp/birrp)
==6690==    by 0x5D047C: for__open_default (in /home/milenko/birrp/birrp)
==6690==    by 0x5F6648: for_write_seq_fmt (in /home/milenko/birrp/birrp)
==6690==    by 0x553832: MAIN__ (birrp.f:156)
==6690==    by 0x40292D: main (in /home/milenko/birrp/birrp)
==6690==
==6690== Conditional jump or move depends on uninitialised value(s)
==6690==    at 0x65CC9D: __intel_sse2_strcpy (in /home/milenko/birrp/birrp)
==6690==    by 0x5C92B5: for__add_to_lf_table (in /home/milenko/birrp/birrp)
==6690==    by 0x60FFC3: for__open_proc (in /home/milenko/birrp/birrp)
==6690==    by 0x5D047C: for__open_default (in /home/milenko/birrp/birrp)
==6690==    by 0x5F6648: for_write_seq_fmt (in /home/milenko/birrp/birrp)
==6690==    by 0x553832: MAIN__ (birrp.f:156)
==6690==    by 0x40292D: main (in /home/milenko/birrp/birrp)
==6690==
 select the input level (0=basic,1=advanced): input the number of output time series: input the number of input time series: select tbw for prolate data window (1 to 4): input the data sample interval: input the initial section length and maximum number of sections:  table of output periods by section length
   125.0000       83.33334    
   62.50000       41.66667    
   31.25000       20.83333    
   15.62500       10.41667    
   7.812500       5.208333    
   3.906250       2.604167    
   1.953125       1.302083    
  0.9765625      0.6510417    
 are these values acceptable (y or n)? input the robustness and leverage parameters (0 and >0.99 are recommended): input the 2nd stage coherence threshold: input the output filename root: input the output level (-3 to 3): input the number of data pieces: input the length of the ar filter (0 for none, <0 for filename): select the file mode (0=separate ascii files, 1=separate binary files 2=all component ascii files 3=ts ascii file: select the input mode (0=by points, 1=by date/time): input the number of points to read: input the number of filter parameters (<0 for filename): input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip:==6690== Warning: bad signal number 0 in sigaction()
==6690== Warning: ignored attempt to set SIGKILL handler in sigaction();
==6690==          the SIGKILL signal is uncatchable
==6690== Warning: ignored attempt to set SIGSTOP handler in sigaction();
==6690==          the SIGSTOP signal is uncatchable
==6690== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6690==          the SIGRT32 signal is used internally by Valgrind
==6690== Warning: bad signal number 0 in sigaction()
forrtl: warning (406): fort: (1): In call to FZERO, an array temporary was created for argument #9

Image              PC                Routine            Line        Source             
birrp              00000000005BFEB6  Unknown               Unknown  Unknown
birrp              0000000000431646  xmedian_                 2082  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00000000334B6830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown
==6690== Warning: bad signal number 0 in sigaction()
==6690== Warning: ignored attempt to set SIGKILL handler in sigaction();
==6690==          the SIGKILL signal is uncatchable
==6690== Warning: ignored attempt to set SIGSTOP handler in sigaction();
==6690==          the SIGSTOP signal is uncatchable
==6690== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6690==          the SIGRT32 signal is used internally by Valgrind
==6690== Warning: bad signal number 0 in sigaction()
forrtl: warning (406): fort: (1): In call to FZERO, an array temporary was created for argument #9

Image              PC                Routine            Line        Source             
birrp              00000000005BFEB6  Unknown               Unknown  Unknown
birrp              0000000000431646  xmedian_                 2082  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00000000334B6830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown
==6690== Warning: bad signal number 0 in sigaction()
==6690== Warning: ignored attempt to set SIGKILL handler in sigaction();
==6690==          the SIGKILL signal is uncatchable
==6690== Warning: ignored attempt to set SIGSTOP handler in sigaction();
==6690==          the SIGSTOP signal is uncatchable
==6690== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6690==          the SIGRT32 signal is used internally by Valgrind
==6690== Warning: bad signal number 0 in sigaction()
forrtl: warning (406): fort: (1): In call to FZERO, an array temporary was created for argument #9

Image              PC                Routine            Line        Source             
birrp              00000000005BFEB6  Unknown               Unknown  Unknown
birrp              0000000000431646  xmedian_                 2082  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00000000334B6830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown
==6690== Warning: bad signal number 0 in sigaction()
==6690== Warning: ignored attempt to set SIGKILL handler in sigaction();
==6690==          the SIGKILL signal is uncatchable
==6690== Warning: ignored attempt to set SIGSTOP handler in sigaction();
==6690==          the SIGSTOP signal is uncatchable
==6690== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6690==          the SIGRT32 signal is used internally by Valgrind
==6690== Warning: bad signal number 0 in sigaction()
forrtl: warning (406): fort: (1): In call to FZERO, an array temporary was created for argument #9

Image              PC                Routine            Line        Source             
birrp              00000000005BFEB6  Unknown               Unknown  Unknown
birrp              0000000000431646  xmedian_                 2082  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00000000334B6830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown
==6690== Warning: bad signal number 0 in sigaction()
==6690== Warning: ignored attempt to set SIGKILL handler in sigaction();
==6690==          the SIGKILL signal is uncatchable
==6690== Warning: ignored attempt to set SIGSTOP handler in sigaction();
==6690==          the SIGSTOP signal is uncatchable
==6690== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6690==          the SIGRT32 signal is used internally by Valgrind
==6690== Warning: bad signal number 0 in sigaction()
forrtl: warning (406): fort: (1): In call to FZERO, an array temporary was created for argument #9

Image              PC                Routine            Line        Source             
birrp              00000000005BFEB6  Unknown               Unknown  Unknown
birrp              0000000000431646  xmedian_                 2082  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00000000334B6830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown
==6690== Warning: bad signal number 0 in sigaction()
==6690== Warning: ignored attempt to set SIGKILL handler in sigaction();
==6690==          the SIGKILL signal is uncatchable
==6690== Warning: ignored attempt to set SIGSTOP handler in sigaction();
==6690==          the SIGSTOP signal is uncatchable
==6690== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6690==          the SIGRT32 signal is used internally by Valgrind
==6690== Warning: bad signal number 0 in sigaction()
forrtl: warning (406): fort: (1): In call to FZERO, an array temporary was created for argument #9

Image              PC                Routine            Line        Source             
birrp              00000000005BFEB6  Unknown               Unknown  Unknown
birrp              0000000000431646  xmedian_                 2082  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00000000334B6830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown
 input the rotation angles (cw=+)
==6690== Conditional jump or move depends on uninitialised value(s)
==6690==    at 0x65CC9D: __intel_sse2_strcpy (in /home/milenko/birrp/birrp)
==6690==    by 0x60E770: for__open_proc (in /home/milenko/birrp/birrp)
==6690==    by 0x5D047C: for__open_default (in /home/milenko/birrp/birrp)
==6690==    by 0x5FD12D: for_write_seq_lis (in /home/milenko/birrp/birrp)
==6690==    by 0x54302E: dataft_ (dataft.f:47)
==6690==    by 0x571787: MAIN__ (birrp.f:916)
==6690==    by 0x40292D: main (in /home/milenko/birrp/birrp)
==6690==
 
 
 
 


What does this conditional jump mean?

0 Kudos
Lorri_M_Intel
Employee
1,859 Views

The command line switch -ftrapuv  initializes some variables to a specific signaling NaN value.

The runtime library detected that specific bit pattern, and issued the message to let you know that an uninitialized variable was referenced.

If you look at the traceback, you see these two areas in your code:

birrp              0000000000431396  xmedian_                 2078  math.f
birrp              000000000056B85A  MAIN__                    782  birrp.f

One option is to set a break at line 2078 in math.f and look up the call chain to see what variable might not be initialized.

I looked very briefly at birrp.f, and there are possibly some code paths where the local array called "npts" is not initialized to any value.

        Hopefully this helps --

                               --Lorri

0 Kudos
milenko1976
Beginner
1,859 Views

I have tried this with gdb

(gdb) r < n128.in
Starting program: /home/milenko/birrp/birrp < n128.in
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
 select the input level (0=basic,1=advanced): input the number of output time series: input the number of input time series: select tbw for prolate data window (1 to 4): input the data sample interval: input the initial section length and maximum number of sections:  table of output periods by section length
   125.0000       83.33334    
   62.50000       41.66667    
   31.25000       20.83333    
   15.62500       10.41667    
   7.812500       5.208333    
   3.906250       2.604167    
   1.953125       1.302083    
  0.9765625      0.6510417    
 are these values acceptable (y or n)? input the robustness and leverage parameters (0 and >0.99 are recommended): input the 2nd stage coherence threshold: input the output filename root: input the output level (-3 to 3): input the number of data pieces: input the length of the ar filter (0 for none, <0 for filename): select the file mode (0=separate ascii files, 1=separate binary files 2=all component ascii files 3=ts ascii file: select the input mode (0=by points, 1=by date/time): input the number of points to read: input the number of filter parameters (<0 for filename): input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip: input the number of filter parameters (<0 for filename): input the filter filename: input the data filename: input the number of points to skip:
Breakpoint 1, birrp () at birrp.f:782
782                xmed=xmedian(rdata(nstart(nn),n),npts(nn))
(gdb) info breakpoints
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x000000000056b248 in birrp at birrp.f:782
    breakpoint already hit 1 time
(gdb) p n
$1 = 1
(gdb) p nn
$2 = 1
(gdb) p nstart
$3 = (1, 8755201, 0)
(gdb) p rdata
value requires 295360000 bytes, which is more than max-value-size
(gdb)

 

What should I try next?

 

0 Kudos
mecej4
Honored Contributor III
1,859 Views

Intel Forum Managers:

      It is a problem that huge attachments such as the one in #1 are present with no indication of their size. It is a bit unreasonable, and in this case entirely unnecessary, to expect me to download a 200 MB compressed file that may have to be expanded to, say, 1 GB, even when it may suffice just to extract the source code, which may only be a few hundred bytes or a few kilobytes in size. It is a bit of a nuisance to have to use the View Page Source feature of the browser to find the attachment size.

Milenko:

      Please do not combine short source codes and big data files into a single archive. Put the source files into a separate archive.

Seeing the error messages regarding Xmedian and undefined variables being used, I was reminded of your post two weeks ago --   https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/685235#comment-1884599 , to which I had responded by pointing out that the variable b and c were being used without having been defined. If you have not fixed that problem, there is nothing useful to expect from  running the program in the debugger.

The relevant lines of code are as follows:

!
      real function xmedian(x,n)
      double precision sum
      dimension x(*)
      external fmedian
      sum=0.d0
      do 10 i=1,n
        sum=sum+x(i)
        b=min(b,x(i))     ! <<<===  b is not initialized
        c=max(c,x(i))     ! <<<===  c is not initialized
  10    continue
      r=sum/n
      call fzero(fmedian,b,c,r,1.e-6,1.e-32,iflag,x,n)
      xmedian=b
      return
      end

 

0 Kudos
Steven_L_Intel1
Employee
1,859 Views

mecej4, thanks for the alert about attachment sizes. These are given if one uses the "Attach files to post" dialog below the text box, but not if one inserts the "media" inline as was done here. I'll pass that on.

0 Kudos
milenko1976
Beginner
1,859 Views

Mecej4 ,thanks for your help.I have changed this function.

      real function xmedian(x,n)
      double precision sum,b,c
      dimension x(n)
      external fmedian
      sum=0.d0
      b = highreal()
      c = -highreal()
      do 10 i=1,n
        sum=sum+x(i)
        b=min(b,x(i))
        c=max(c,x(i))
  10    continue
      r=sum/n
      call fzero(fmedian,b,c,r,1.e-6,1.e-32,iflag,x,)
      xmedian=b
      return
      end

But I still get the same problems.WIth gdb I try to debug

 

Image              PC                Routine            Line        Source             
birrp              00000000005BFE86  Unknown               Unknown  Unknown
birrp              0000000000431744  xmedian_                 2091  math.f
birrp              000000000056B82A  MAIN__                    782  birrp.f
birrp              000000000040292E  Unknown               Unknown  Unknown
libc.so.6          00007FFFF7304830  Unknown               Unknown  Unknown
birrp              0000000000402829  Unknown               Unknown  Unknown

Program received signal SIGFPE, Arithmetic exception.
0x0000000000411547 in fzero (b=-0, c=0, r=70.6503983, re=9.99999997e-07, ae=1.00000002e-32, iflag=-858993460, rpar=..., ipar=...) at math.f:674
674          fx=max(abs(fb),abs(fc))
(gdb) disp fb
1: fb = 8755200
(gdb) disp fc
2: fc = nan(0x3addad)
(gdb)

Set break xmedian

(gdb) explore x
'x' is an array of 'REAL(4)'.
Enter the index of the element you want to explore in 'x': 1       
'x[1]' is a scalar value of type 'REAL(4)'.
x[1] = 51.9305573

Press enter to return to parent value:

Returning to parent value...

'x' is an array of 'REAL(4)'.
Enter the index of the element you want to explore in 'x':
(gdb) explore n
'n' is a scalar value of type 'INTEGER(4)'.
n = 8755200
(gdb) n
2082          sum=0.d0
(gdb) n
2083          b = highreal()
(gdb) explore b
'b' is a scalar value of type 'REAL(8)'.
b = nan(0x7baddadbaddad)
(gdb) n
2084          c = -highreal()
(gdb) explore c
'c' is a scalar value of type 'REAL(8)'.
c = nan(0x7baddadbaddad)

Why are b and c nan's?

 

 

 

 

0 Kudos
mecej4
Honored Contributor III
1,859 Views

What is highreal() ? Is it a function that you wrote and included in your program? Or did you have linker error messages saying that highreal was an unsatisfied external symbol? 

The tracebacks that you provided are of little use because the line numbers in them do not apply to the code that you showed in #7. Such loosely correlated error reports make it less likely that someone can help you.

You are applying ad hoc fixes that are unnecessary and, possibly, incorrect. The routine FZERO requires that b < c. The following is a much simpler fix for function xmedian:

!
      r=sum(x)/n
      b=minval(x)
      c=maxval(x)
!

Note, as I cautioned you in your earlier thread, that using FZERO in this way may give you a calculated "median" that does not satisfy the standard definition of the median of an integer, real or double array.

These ideas are to be understood by reading texts and articles on mathematics and statistics. A debugger is a poor substitute for those.

0 Kudos
milenko1976
Beginner
1,859 Views

Thank mecej4.Will try and post latter.Regarding the maths and statistics,the code is written by one of the best experts in the world(he works in one of national laboratories in USA),I do not deny that it has potential errors.

0 Kudos
mecej4
Honored Contributor III
1,859 Views

The reputation of the original author of the code is not of much use as a shield against bugs after the code has been modified by others.

I ask again: what is highreal?

0 Kudos
milenko1976
Beginner
1,859 Views

Highreal was my friend's solution in the firstplace.Latter i ahve opted for minval maxval.

0 Kudos
Abraham_R_
Beginner
1,859 Views

Hello, milenko1976, I need some help to build the code of BIRRP. I'd like to use it for my thesis work. What i mean i'ts, if you could tell me where i can start in orded to achieve it. 

 

 

0 Kudos
Abraham_R_
Beginner
1,859 Views

my email is : areta1692@yahoo.com, Help me please.

0 Kudos
Reply