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!
fortran runtime error with inp_par.f90
-
- Posts: 14
- Joined: Wed Jun 30, 2010 2:58 pm
- Location: Texas A&M University
Re: fortran runtime error with inp_par.f90
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?
- arango
- Site Admin
- Posts: 1356
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: fortran runtime error with inp_par.f90
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.
Re: fortran runtime error with inp_par.f90
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
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
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.
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)
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
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.
-
- Posts: 14
- Joined: Wed Jun 30, 2010 2:58 pm
- Location: Texas A&M University
Re: fortran runtime error with inp_par.f90
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.
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.