I have tranferred the code from visual fortran in windows to pg fortran in unix. The program used to run fine in windows. But when I tried to run the program using pgi in unix, I am getting the following error
PGFIO-F-219/unformatted write/unit=56/attempt to read/write past end of record.
File name = /home/mark/GEMSS/Apps/BP-DeepwaterHorizon/Output/Run002.shr unformatted, direct access record = 1
In source file /home/mark/GEMSS/Srcs/COSIM/COS/Shoreline_v1.f90, at line number 321
I opened a direct access file with correct number of bytes per record.
I even increased the number of bytes per record and I still get the above error.
Is there any special way direct access file has to be handled in pgi in unix?
Just in case. Any of the source files or text files
transferred from the Windows system, like foo.f,
should be converted via dos2unix to correct any
end of line stuff.
% dos2unix foo.f
and then use the files.
If that is not the problem, perhaps you have uninitialized local data.
Try adding -Msave to your compiles and see if the behavior changes.
Thanks for your suggestion.
I tried all of your suggstions. But I still have the problem.
But somewhere I read for PGI, you need to set up record size as 4 times the total size needed for the record. I did this. I don’t see the error message. But It does not write all the variables correctly. It writes only a section of the record and all other variables in the record are showing up unrealistic numbers.
I am not sure as how to handle this problem. I spent quite a bit of time fixing this problem but no luck. Without this, I cannot move on in my code.
Any new suggestions will be a greate help.
I’m not sure what’s wrong. Often when moving data files from Windows to Linux, the problem stems from the different way each OS handles carriage returns. Being direct access, it should matter.
But somewhere I read for PGI, you need to set up record size as 4 times the total size needed for the record.
The RECL is the number of bytes in the record. I’m not sure where you saw this note about the record size needing to be 4 times the total size, but my guess this meant to be 4 times the number of items in the record if the data size of each is 4 bytes.
What flags are you using? -Mbyteswapio will change the endian format and -i8 and -r8 change the default kind. Any of these flags would effect data size and format.
Can you provide an example of what you are doing? If large or uses a data file, please send the example to PGI Customer Service (email@example.com).
Dear Venkat and Dave,
I wonder if you have found a solution of the problem?
I`ve got the same problem when I tried to use pgi compiler in place of intel compiler.
For intel compiler with the next compiling options I didn’t have any problems
CFLAGS = -O3 -no-multibyte-chars
FFLAGS=-O3 -assume byterecl -convert big_endian
FFLAGS_OMP = $(FFLAGS) -openmp
But when I use next options for pgi compiler I get error
CFLAGS = -O3
CFLAGS_OMP = $(CFLAGS) -wapiopenmp
FFLAGS=-O3 -Msave -Mbyteswapio
FFLAGS_OMP = $(FFLAGS) -openmp
PGFIO-F-219/unformatted read/unit=7/attempt to read/write past end of record.
File name = init/H.rgn00000 unformatted, direct access record = 1
In source file mod_gtl.f90, at line number 1735
I will appreciate your help very much.
[quote="Kolluru"But somewhere I read for PGI, you need to set up record size as 4 times the total size needed for the record. [/quote]
A better way of stating that is that PGI measures RECL of unformatted files in bytes, whereas other compilers use other units, as the Fortran standard allows.
In other words, the quantity is the same, but is expressed in different units.
For example, in Intel Fortran the value is expressed in 4-byte units (longwords).
Thank you for reply.
I have solved my problem and everything is working without any errors now