- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi have installed and run the intel compiler, but i have experienced quite a lot of weird behaviours..
I have to run a program writte in fortran90 (red.f) to which are linked some subroutines (*.sub) and some numerical libraries (Numerical Recipes, written in F77).
Firstly, I was using it on a remote machine but the compiler didin't like some syntax, like the simbol '&' to continue into a new line, or the 'c' to comment.
Well, I have installed the ifort on my desktop and it's now able to compile the program. Why? I have installed a better version? Are there problem by working on a remote machine? By the way, the main program is written in f90, but it has *.f extension. Is it fine, considering I'm linking some f77 numerical libraries?
Anyway, It compiles without errors and warning, but still it doesn't run....
I'm quite a newby, but here is what I do :
1) I declare the arrays to be dynamically allocated:
integer n
real, dimension(:), allocatable :: cz,apm
real*8, dimension(:), allocatable :: al8,del8
2) I read a file (input.in) where I set a lot of parameters and also
the name of the file I want to open
open(20,file='input.in',status='old',form='formatted')
read(20,'(a)') slicein ! input file
read(20,*) ah1,am1,as1 ! various parameter I set
....
where the file input.in has the following form
table.ascii
8 0 0
....
3) Then I read the file table.ascii where the data are stored
open (20,file=slicein,status='old',form='unformatted')
read (20) n
allocate (cz(ngal),apm(ngal))
allocate (al8(ngal),del8(ngal)
read (20) al8, del8, cz, apm
close(20)
However, the program encounter a problem exactly before the point
read (20) n above and return me this strange list
forrtl: severe (39): error during read, unit 20, file
/home/myfold/table.ascii
Image PC Routine Line Source
red 080A6F18 Unknown Unknown Unknown
red 080A6A10 Unknown Unknown Unknown
red 0807B081 Unknown Unknown Unknown
red 0805AE20 Unknown Unknown Unknown
red 0805B2C3 Unknown Unknown Unknown
red 08067F98 Unknown Unknown Unknown
red 0804B317 Unknown Unknown Unknown
red 0804A3C8 Unknown Unknown Unknown
Unknown 40090D17 Unknown Unknown Unknown
red 0804A281 Unknown Unknown Unknown
(red is the name of the executable file)
I'm quite sure the error is something very obvious, but I cannot figure it out. Any help?
The file table.ascii as some thousands of line like this
2.0983223328946807 0.7039494427780372 12360. 15.0
2.0991947844677910 0.7042403265481010 12330. 14.6
2.1026853897085576 0.6562437721182570 10016. 15.3
2.1035582407558313 0.6579891413176676 10024. 15.2
2.1087940154589266 0.6847508476377104 12558. 15.5
Thanks a lot!
S.
I have to run a program writte in fortran90 (red.f) to which are linked some subroutines (*.sub) and some numerical libraries (Numerical Recipes, written in F77).
Firstly, I was using it on a remote machine but the compiler didin't like some syntax, like the simbol '&' to continue into a new line, or the 'c' to comment.
Well, I have installed the ifort on my desktop and it's now able to compile the program. Why? I have installed a better version? Are there problem by working on a remote machine? By the way, the main program is written in f90, but it has *.f extension. Is it fine, considering I'm linking some f77 numerical libraries?
Anyway, It compiles without errors and warning, but still it doesn't run....
I'm quite a newby, but here is what I do :
1) I declare the arrays to be dynamically allocated:
integer n
real, dimension(:), allocatable :: cz,apm
real*8, dimension(:), allocatable :: al8,del8
2) I read a file (input.in) where I set a lot of parameters and also
the name of the file I want to open
open(20,file='input.in',status='old',form='formatted')
read(20,'(a)') slicein ! input file
read(20,*) ah1,am1,as1 ! various parameter I set
....
where the file input.in has the following form
table.ascii
8 0 0
....
3) Then I read the file table.ascii where the data are stored
open (20,file=slicein,status='old',form='unformatted')
read (20) n
allocate (cz(ngal),apm(ngal))
allocate (al8(ngal),del8(ngal)
read (20) al8, del8, cz, apm
close(20)
However, the program encounter a problem exactly before the point
read (20) n above and return me this strange list
forrtl: severe (39): error during read, unit 20, file
/home/myfold/table.ascii
Image PC Routine Line Source
red 080A6F18 Unknown Unknown Unknown
red 080A6A10 Unknown Unknown Unknown
red 0807B081 Unknown Unknown Unknown
red 0805AE20 Unknown Unknown Unknown
red 0805B2C3 Unknown Unknown Unknown
red 08067F98 Unknown Unknown Unknown
red 0804B317 Unknown Unknown Unknown
red 0804A3C8 Unknown Unknown Unknown
Unknown 40090D17 Unknown Unknown Unknown
red 0804A281 Unknown Unknown Unknown
(red is the name of the executable file)
I'm quite sure the error is something very obvious, but I cannot figure it out. Any help?
The file table.ascii as some thousands of line like this
2.0983223328946807 0.7039494427780372 12360. 15.0
2.0991947844677910 0.7042403265481010 12330. 14.6
2.1026853897085576 0.6562437721182570 10016. 15.3
2.1035582407558313 0.6579891413176676 10024. 15.2
2.1087940154589266 0.6847508476377104 12558. 15.5
Thanks a lot!
S.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're opening the file form='unformatted'. This assumes that it was written with 32-bit record lengths preceding and following each record of data, but the actual file was written formatted. From the information you have provided, it seems to me that you should be opening the file for formatted access and using formatted reads. Is there some aspect of this I'm missing?
As for the .f file type, you're confusing two different matters. The file type determines the source form that the compiler expects, NOT the version of the language standard the code is written for. As it happens, all Fortran 77 code is also Fortran 90 code, and you can write Fortran 90/95 code in fixed-form source. All that matters is that the file type be consistent with the source form of the file being compiled.
As for the .f file type, you're confusing two different matters. The file type determines the source form that the compiler expects, NOT the version of the language standard the code is written for. As it happens, all Fortran 77 code is also Fortran 90 code, and you can write Fortran 90/95 code in fixed-form source. All that matters is that the file type be consistent with the source form of the file being compiled.
Message Edited by sblionel on 07-15-2005 11:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok, thanks a lot!
But still, I feel quite a dummy :((
I have tried to write a short program in order to just read the file. Here is what I do:
program hello
integer ngal
real, dimension(:), allocatable :: cz,apm
real*8, dimension(:), allocatable :: al8,del8
open(unit=20,file='table.ascii',status='old',action='read')
read (20) ngal
allocate (al8(ngal),del8(ngal),cz(ngal),apm(ngal))
read (20) al8, del8, cz, apm
end
The compiler do its job, but the when I run it I get that long list of errors as I told before
forrtl: No such file or directory
forrtl: severe (29): file not found, unit 20, file /home/mydir/table.ascii
Image PC Routine Line Source
a.out 080859D4 Unknown Unknown Unknown
a.out 080854CC Unknown Unknown Unknown
a.out 08067659 Unknown Unknown Unknown
a.out 0805D5F8 Unknown Unknown Unknown
a.out 0805DA9B Unknown Unknown Unknown
a.out 0804D559 Unknown Unknown Unknown
a.out 0804A1E2 Unknown Unknown Unknown
a.out 0804A168 Unknown Unknown Unknown
Unknown 40090D17 Unknown Unknown Unknown
a.out 0804A021 Unknown Unknown Unknown
How can I open and read a file?? I really feel stupid...
Thanks!
But still, I feel quite a dummy :((
I have tried to write a short program in order to just read the file. Here is what I do:
program hello
integer ngal
real, dimension(:), allocatable :: cz,apm
real*8, dimension(:), allocatable :: al8,del8
open(unit=20,file='table.ascii',status='old',action='read')
read (20) ngal
allocate (al8(ngal),del8(ngal),cz(ngal),apm(ngal))
read (20) al8, del8, cz, apm
end
The compiler do its job, but the when I run it I get that long list of errors as I told before
forrtl: No such file or directory
forrtl: severe (29): file not found, unit 20, file /home/mydir/table.ascii
Image PC Routine Line Source
a.out 080859D4 Unknown Unknown Unknown
a.out 080854CC Unknown Unknown Unknown
a.out 08067659 Unknown Unknown Unknown
a.out 0805D5F8 Unknown Unknown Unknown
a.out 0805DA9B Unknown Unknown Unknown
a.out 0804D559 Unknown Unknown Unknown
a.out 0804A1E2 Unknown Unknown Unknown
a.out 0804A168 Unknown Unknown Unknown
Unknown 40090D17 Unknown Unknown Unknown
a.out 0804A021 Unknown Unknown Unknown
How can I open and read a file?? I really feel stupid...
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While you're learning by trial and error, it may be helpful to turn on more diagnostics, such as by ifort -C -g.
If you intended list-directed read, that could be accomplished by
read(unit=20,fmt=*)
If you intended list-directed read, that could be accomplished by
read(unit=20,fmt=*)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, if you're getting a "file not found" error, that's easy to deal with. The error message gives the full path for the file the program is looking for. Make sure that the name of the file is exactly what you say - case matters on Linux.
Now for the reads, you can't read the whole arrays at once because each record of the file has one element of each array. So you need a loop. This should work:
program hello
integer ngal
real, dimension(:), allocatable :: cz,apm
real*8, dimension(:), allocatable :: al8,del8
integer i
open(unit=20,file='table.ascii',status='old',action='read')
read (20) ngal
allocate (al8(ngal),del8(ngal),cz(ngal),apm(ngal))
do i=1,ngal
read (20,*) al8(i), del8(i), cz(*), apm(*)
end do
end
Now for the reads, you can't read the whole arrays at once because each record of the file has one element of each array. So you need a loop. This should work:
program hello
integer ngal
real, dimension(:), allocatable :: cz,apm
real*8, dimension(:), allocatable :: al8,del8
integer i
open(unit=20,file='table.ascii',status='old',action='read')
read (20) ngal
allocate (al8(ngal),del8(ngal),cz(ngal),apm(ngal))
do i=1,ngal
read (20,*) al8(i), del8(i), cz(*), apm(*)
end do
end

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page