segmentation fault when upwelling test case

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
marinekame
Posts: 16
Joined: Tue Mar 22, 2016 5:21 pm
Location: Japan Weather Association

segmentation fault when upwelling test case

#1 Unread post by marinekame »

Hi all,

When I run oceanG for upwelling test case, segmentation fault occurs.
I set stacksize to unlimited by ulimit -s unlimited .
And I editted ocean_upwelling.in as follows:

Code: Select all

VARNAME = /home/mathuser/work/Roms/src/ROMS/External/varinfo.dat

Lm == 5

NtileI == 8
NtileJ == 8 

APARNAM =  /home/mathuser/work/Roms/src/ROMS/External/s4dvar.in      
SPOSNAM =  /home/mathuser/work/Roms/src/ROMS/External/stations.in    
FPOSNAM =  /home/mathuser/work/Roms/src/ROMS/External/floats.in      
BPARNAM =  /home/mathuser/work/Roms/src/ROMS/External/bio_Fennel.in  
SPARNAM =  /home/mathuser/work/Roms/src/ROMS/External/sediment.in    
USRNAME =  /home/mathuser/work/Roms/src/ROMS/External/MyFile.dat     
Then I ran oceanG, but segmentation fault occurred with the following error message:

Code: Select all

[mathuser@ENEG02 upwelling]$ ./oceanG < ocean_upwelling.in
forrtl: severe (174): SIGSEGV、segmentation fault occurred
Image              PC                Routine            Line        Source
libintlc.so.5      00002B113A213961  Unknown               Unknown  Unknown
libintlc.so.5      00002B113A2120B7  Unknown               Unknown  Unknown
libnetcdff.so.6    00002B11359CCA82  Unknown               Unknown  Unknown
libnetcdff.so.6    00002B11359CC8D6  Unknown               Unknown  Unknown
libnetcdff.so.6    00002B11359B332C  Unknown               Unknown  Unknown
libnetcdff.so.6    00002B11359B7398  Unknown               Unknown  Unknown
libpthread.so.0    000000396100F7E0  Unknown               Unknown  Unknown
oceanG             0000000001770314  Unknown               Unknown  Unknown
oceanG             00000000004113D7  get_date_                  91  get_date.f90
oceanG             0000000000414DC8  inp_par_                   53  inp_par.f90
oceanG             0000000000405875  ocean_control_mod          71  ocean_control.f90
oceanG             000000000040546E  MAIN__                     73  master.f90
oceanG             000000000040540C  Unknown               Unknown  Unknown
libc.so.6          0000003960C1ED1D  Unknown               Unknown  Unknown
oceanG             0000000000405309  Unknown               Unknown  Unknown
Would you please tell me a hint where I made mistakes and how to solve this error ?

Thanks.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: segmentation fault when upwelling test case

#2 Unread post by kate »

get_date_ 91 get_date.f90
What is on line 91 of the file get_date.f90? It should be in your Build directory, wherever you put that ($SCRATCHDIR).

marinekame
Posts: 16
Joined: Tue Mar 22, 2016 5:21 pm
Location: Japan Weather Association

Re: segmentation fault when upwelling test case

#3 Unread post by marinekame »

Hello, kate. Thank you for your reply.
The line 91 of the file get_date.f90 in /home/mathuser/work/kameya/RomsRutgers/Projects/upwelling/Build directory is

Code: Select all

      WRITE (fmt,10) lmonth(imonth), lday(iday)
Thanks.

marinekame
Posts: 16
Joined: Tue Mar 22, 2016 5:21 pm
Location: Japan Weather Association

Re: segmentation fault when upwelling test case

#4 Unread post by marinekame »

Code: Select all

oceanG             0000000000414DC8  inp_par_                   53  inp_par.f90
oceanG             0000000000405875  ocean_control_mod          71  ocean_control.f90
oceanG             000000000040546E  MAIN__                     73  master.f90
Here, I write also the lines in the other files in the above error message.

The line 53 of inp_par.f90 is

Code: Select all

      CALL get_date (date_str)
The line 71 of ocean_control.f90 is

Code: Select all

        CALL inp_par (iNLM)
The line 73 of master.f90 is

Code: Select all

        CALL ROMS_initialize (first)
Thanks.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: segmentation fault when upwelling test case

#5 Unread post by kate »

Hernan recently changed all the time and date stuff so this code:

Code: Select all

WRITE (fmt,10) lmonth(imonth), lday(iday)
is now in dateclock.F. lmonth has valid values for 1 through 12 and lday has values for 1 through 31. Next is to find out what values imonth and iday have when it fails (and why). The routine it's in now (I'm not going back) finds out the current real-world time and creates a string with that information in it.

marinekame
Posts: 16
Joined: Tue Mar 22, 2016 5:21 pm
Location: Japan Weather Association

Re: segmentation fault when upwelling test case

#6 Unread post by marinekame »

Hi, kate.

When the segmentation fault occurred, imonth had 5, iday had 9, lmonth(imonth) had 3, and lday(iday) had 1.
But I can not understand why the error occurred at

Code: Select all

     WRITE (fmt,10) lmonth(imonth), lday(iday)
10   FORMAT ('(a',i1,',1x,i',i1,',1h,,1x,i4)')
Thanks.

marinekame
Posts: 16
Joined: Tue Mar 22, 2016 5:21 pm
Location: Japan Weather Association

Re: segmentation fault when upwelling test case

#7 Unread post by marinekame »

Hi kate,

Even at the line where an integer is assigned to a character, like below,
write(character,'(i1)') integer
the segmentation error always occurs.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: segmentation fault when upwelling test case

#8 Unread post by kate »

Can you give us a short test program? Which compiler is this and what version?

marinekame
Posts: 16
Joined: Tue Mar 22, 2016 5:21 pm
Location: Japan Weather Association

Re: segmentation fault when upwelling test case

#9 Unread post by marinekame »

Hi kate,

Thank you for your reply.

The compilers I use on Linux are
Intel Fortran Compiler 11.1 20100806
and
Intel C Compiler 11.1 20100806.

For a test, I inserted the following code into the line 645 in dateclock.F

Code: Select all

!     
      integer :: intvar           ! marinekame added
      character (len=1) :: chavar ! marinekame added
      intvar=7                               ! marinekame added
      write(6,'(a7,1x,i1)') 'intvar=',intvar ! marinekame added
      write(chavar,'(i1)') intvar            ! marinekame added
      write(6,'(a7,1x,a1)') 'chavar=',chavar ! marinekame added
      stop                                   ! marinekame added
!      
I ran build.bash and ran

Code: Select all

oceanG < ocean_upwelling.in
Then the segmentation fault occurred with the following error messages:

Code: Select all

[mathuser@ENEG02 upwelling]$ ./oceanG < ocean_upwelling.in
intvar= 7
forrtl: severe (174): SIGSEGV、segmentation fault occurred
Image              PC                Routine            Line        Source                    
libintlc.so.5      00007FFBE0F85961  Unknown               Unknown  Unknown
libintlc.so.5      00007FFBE0F840B7  Unknown               Unknown  Unknown
libnetcdff.so.6    00007FFBE54EAA82  Unknown               Unknown  Unknown
libnetcdff.so.6    00007FFBE54EA8D6  Unknown               Unknown  Unknown
libnetcdff.so.6    00007FFBE54D132C  Unknown               Unknown  Unknown
libnetcdff.so.6    00007FFBE54D5398  Unknown               Unknown  Unknown
libpthread.so.0    000000396100F7E0  Unknown               Unknown  Unknown
oceanG             0000000001772924  Unknown               Unknown  Unknown
oceanG             00000000004138CE  dateclock_mod_mp_         653  dateclock.f90
oceanG             0000000000416F9C  inp_par_                   54  inp_par.f90
oceanG             0000000000405965  ocean_control_mod          71  ocean_control.f90
oceanG             000000000040555E  MAIN__                     73  master.f90
oceanG             00000000004054FC  Unknown               Unknown  Unknown
libc.so.6          0000003960C1ED1D  Unknown               Unknown  Unknown
oceanG             00000000004053F9  Unknown               Unknown  Unknown
The line 653 in dateclock.f90 is

Code: Select all

      write(chavar,'(i1)') intvar            ! marinekame added
Next, I made a short test program as follows:

Code: Select all

      
      integer :: intvar           ! marinekame added
      character (len=1) :: chavar ! marinekame added
      intvar=7                               ! marinekame added
      write(6,'(a7,1x,i1)') 'intvar=',intvar ! marinekame added
      write(chavar,'(i1)') intvar            ! marinekame added
      write(6,'(a7,1x,a1)') 'chavar=',chavar ! marinekame added
      stop   
      end

Then I compiled and ran this program. It ran normally, and showed the result on the display as follows:

Code: Select all

[mathuser@ENEG02 test]$ ./a.out
intvar= 7
chavar= 7
I can not understand why the results of these two programs are different...
Thanks.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: segmentation fault when upwelling test case

#10 Unread post by kate »

Is there any chance you can update your compiler? Or try gfortran instead?

marinekame
Posts: 16
Joined: Tue Mar 22, 2016 5:21 pm
Location: Japan Weather Association

Re: segmentation fault when upwelling test case

#11 Unread post by marinekame »

OK, I try it.
Thank you for your advice.

Post Reply