fortran runtime error with inp_par.f90

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
winterbellgirl
Posts: 14
Joined: Wed Jun 30, 2010 2:58 pm
Location: Texas A&M University

fortran runtime error with inp_par.f90

#1 Unread post by winterbellgirl »

Hi, I tried to submit a job and found the following error in the .err file.

At line 2033 of file inp_par.f90
Fortran runtime error: Bad real number in item 1 of list input

I looked at line 2033 of the inp_par.f90 file and the statements are as follows:

2031 string=Vstring(is:ie)
2032 LenS=LEN_TRIM(string)
2033 READ (string(1:LenS),*) Rval(Nval)
2034 END IF

Could anybody tell me what the errors are associated with? Thanks!

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

Re: fortran runtime error with inp_par.f90

#2 Unread post by kate »

It's complaining inside the routine decode_line, but I don't know which line it's having trouble decoding. This is a time for print statements, running in a debugger, or inspecting your input files with extra care. What exactly changed in your ocean.in?

User avatar
arango
Site Admin
Posts: 1350
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: fortran runtime error with inp_par.f90

#3 Unread post by arango »

It is possible that you have entered illegal characters in your input script ocean.in. Like illegal letters in a numerical entry. This code has been very robust for several years.

User avatar
shchepet
Posts: 188
Joined: Fri Nov 14, 2003 4:57 pm

Re: fortran runtime error with inp_par.f90

#4 Unread post by shchepet »

What is the input entry in your "ocean.in" file you are attempting to read when
the error occurs?

What compiler/version do you use?

The problem with the code

Code: Select all

        string=Vstring(is:ie)
        LenS=LEN_TRIM(string)
        READ (string(1:LenS),*) Rval(Nval)
is that the READ statement is not IOSTAT-protected, so if there "string(1:LenS)"
cannot be read/interpreted as a real number, the code crashes instead of writing
error message and exiting in a controllable way (e.g., if the above happens in
MPI code, a possible outcome is MPI-deadlock and, possibly, a huge computer time
bill charged against someone's allocation account).

The above should be changed into

Code: Select all

        READ (string(1:LenS),*,IOSTAT=ierr) Rval(Nval)
        if (ierr.ne.0) then
          write(*,*) ### ERROR :: Cannot interpret string ''', string(1:LenS), &
                                         ''' as a REAL number.'
          do appropriate action
        endif
which, of course, would be too cumbersome and bulky to put in after each read
statement. And may even not work after all because of compiler bug.


About one year ago I reported compiler bug to Intel, which they acknowledged
and eventually fixed. This may or may not be related to what you observe. Read
viewtopic.php?f=31&t=1334 for more detail.

In principle, it is possible and not very difficult to redesign the code to avoid
internal read altogether by replacing it with fail-safe function of our own design.

winterbellgirl
Posts: 14
Joined: Wed Jun 30, 2010 2:58 pm
Location: Texas A&M University

Re: fortran runtime error with inp_par.f90

#5 Unread post by winterbellgirl »

Hi Kate, Arango and Shchepet,

Thanks for your replies! Previously the model was working fine, and after I changed the values of some parameters in the ocean.in file, such as NTIMES, NHIS, and DSTART, that error occurred. I'm using gfortran for the compilation and openmpi to do the parallel computing. Actually when I copied everything to another cluster, this problem never occurred. So I guess it's related to the machine configuration.

Post Reply