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

migrating ifort ubuntu to cray

yairsuari
Beginner
1,302 Views
just for future viewers, i used formatted text files



I am trying to deploy my oceanic model currently runing on ubuntu linux and compiled with intel fortran on a cray sv1 machine with UNICOS operating system.
Itactuallywent quite well until i tried to read unformatted files. i am using the following code to export the data to the new machine:
file_name=trim(datafolder)//'basin'
open(21,file=file_name,status='old',
+ form='unformatted',convert='little_endian')
read(21)h,alat,alon,dx,dy
read(21)fsm,dum,dvm
read(21) z,zz
close(21)
file_name='~/Documents/temp/phys/data/basin'
open(21,file=file_name,status='new',
+ form='unformatted',convert='cray')
write(21)h,alat,alon,dx,dy
write(21)fsm,dum,dvm
write(21) z,zz
close(21)
When i copy the produced file to the new machine and try running the model i get the following error massage:
lib-5026 ./a.out: UNRECOVERABLE library error
The COS blocked file contains an invalid BCW (block control word).
Encountered during a sequential unformatted READ from unit 21
Fortran unit 21 is connected to a sequential unformatted COS blocked file:
"/users/negev1/biu/ysuari/prog/bfm_3dcode/phys/data/basin"
Error initiated at line 225 in routine '_rdunf'.
Abort
Beginning of Traceback:
Interrupt at address 377677a in routine '_lwp_killm'.
Called from line 32 (address 374366a) in routine 'raise'.
Called from line 127 (address 302611d) in routine 'abort'.
Called from line 59 (address 704047a) in routine '_ferr'.
Called from line 225 (address 735714c) in routine '_rdunf'.
Called from line 357 (address 676525a) in routine '_xfer_iolist'.
Called from line 147 (address 742423c) in routine '_FRU'.
Called from line 6347 (address 110006b) in routine 'BASIN'.
Called from line 789 (address 2575a) in routine 'POM2K'.
Called from line 350 (address 324455c) in routine '$START$'.
End of Traceback.
IOT trap (core dumped)
the error is explained as:
The COS blocked file contains an invalid BCW (block control word).
A Fortran I/O or positioning operation or an FFIO() operation on a COS
blocked file encountered a BCW (block control word) that is not valid. The
file may not be a COS blocked file, or it may be corrupted.
Ensure that the file is COS blocked; if it is not, use the appropriate
specification on the assign(1) or asgcmd(1) command. If the file is
corrupted, re-create it if possible.
even after reading the section about the assign command this error massage is likeChineseto me.

does anyone know how the file migration should be done?

thanksyair
0 Kudos
1 Solution
mecej4
Honored Contributor III
1,302 Views
Unformatted files are non-portable, especially between machines with different word sizes and floating-point representations. There may be utilities available to help with the conversion. Simply writing an unformatted file on an x-86 or x-64 PC and reading the file on an SV1, which AFAIK does not use IEEE floating-point, will not work.

View solution in original post

0 Kudos
5 Replies
mecej4
Honored Contributor III
1,303 Views
Unformatted files are non-portable, especially between machines with different word sizes and floating-point representations. There may be utilities available to help with the conversion. Simply writing an unformatted file on an x-86 or x-64 PC and reading the file on an SV1, which AFAIK does not use IEEE floating-point, will not work.
0 Kudos
yairsuari
Beginner
1,302 Views
mecej4thanks for your help
will text file work?
0 Kudos
Ron_Green
Moderator
1,302 Views
a plain text file is your best bet.

Or if you have time and are a proficient programmer you can try using NetCDF or HDF for IO. These libraries can be used to help migrate data between different platforms. But it will take time and effort to make these work.

Or you could try FORM='BINARY' on the OPEN on the PC. Then the Cray would need a raw or stream IO mode to read this data.

BUT I think the simpliest and most straightforward thing is to ask Cray what to do to read a IFORT/PC binary file on the Cray. With the number of PCs running ifort in the world, surely someone at Cray has written a note on how to read these files on the Cray.

ron
0 Kudos
mecej4
Honored Contributor III
1,302 Views
Ron's advice to look for Cray documentation is good. Seek out Cray manuals, local Cray expertise and, failing there, search the Web.

However, his advice to use FORM='BINARY' is not good for two reasons:

(i) FORM='BINARY' is a non-standard extension and is probably not available on the Cray, However, if your Cray has the Fortran 2003 stream access features available, you can use that instead. But, read on...

(ii) Crays have used integers of bit-sizes 8, 16, 32, 46, 51 and 64; some Crays were byte addressable, some not, some had IEEE floating point, some not; some had 32 and 64-bit reals, others had 64 and 128 bit reals. The architecture was very different from IBMPC architecture. Thus, even if FORM='BINARY' were available on the Cray, the same 32 bit real patterns stand for entirely different real numbers on a Cray and a PC. Simply using little-endian to big-endian conversions will not work, either.

If the amount of data is small, use text-files. If not, be prepared to find a conversion utility or be prepared to write your own.
0 Kudos
Steven_L_Intel1
Employee
1,302 Views
Have you tried CONVERT='CRAY'? This is an old Cray format but it might be supported. I don't know how that particular Cray compiler handles unformatted records - the problem is most likely the interpretation of record lengths. Have you looked in the documentation for that compiler to see what it wants?
0 Kudos
Reply