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

Difference between ifort on win32 and linux ?

donkarnage
Beginner
1,433 Views
Hello everyone !

In the process of writing a code, i have a subroutine that reads a binary data file. the snippet of the code is...

---------
open(unit=11,file=fname,status="old",form='binary',iostat=nerr,access="direct",recl=1)
do 5 i=1,i_tn
read(11,rec=i,iostat=nerr) tmpchar

if(nerr .gt. 0) then
write(*,*) 'End of file reached'
write(*,*) 'total elements read -->',icount
goto 100
elseif(nerr .lt. 0) then
write(*,*) 'unusual bad read'
write(*,*) 'total elements read -->',icount
goto 100
elseif(nerr .eq. 0) then
icount=icount+1;
itissueid=ichar(tmpchar)+1;
endif

5 end do

100 close(unit=11)

-----------------------------------


This snippets works great on the win32 platform, however, the moment I transferred the code and the data file to the Linux platform, it went bonkers. It reaches the end of the file immediately and in short...had me screwed !

Help ! ! !

-A
0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,433 Views
I don't know of any difference between the platforms for code such as this. You should do a binary dump of the file (od) to make sure it got transferred the way you wanted.
0 Kudos
donkarnage
Beginner
1,433 Views
Hi there...thanks for the response. I did think that may be a point to consider and did look at the data file. It's identical.

Just to give some more info.

The raw data file (binary contains) N 1 byte values. They can be read as characters and then converted.

There doesn't seem to be any header info/record indicating that the data was not written by FORTRAN (in all probability).

Will await some more input...

Cheers
0 Kudos
Steven_L_Intel1
Employee
1,433 Views
Try adding STATUS="OLD" to the OPEN. I'm guessing that will give you a clue.
0 Kudos
Steven_L_Intel1
Employee
1,433 Views
I would add some debugging code to see if it reads any bytes at all. Also make sure that the filename being specified is correct, noting that Linux is case-sensitive, and that there isn't an empty file of the exact name being referenced (which could happen if you had run the program without status='old' at one time.)
0 Kudos
donkarnage
Beginner
1,433 Views
Hello again...

Sorry for the delayed response (i was busy slapping myself silly) as the problem was that for some wierd reason, the filename as being passed to the subroutine was being duplicated in the character string.

Works great now !

Cheers..
0 Kudos
Reply