1
votes

I have a tricky problem and I have no idea were the error is coming from.

I write out data couple of times during my calcualtions, always appending the current data to the existing file, using:

OPEN(UFO_FU,FILE=FNAME,STATUS="OLD",POSITION='APPEND',              &
       FORM='UNFORMATTED',access='STREAM')

This works quite well on my computer and our CLUSTER, but on my colleague's computer, the data doesn't get appended but the file gets overwritten.

I checked this by inquiring the current file position just after the open statement:

INQUIRE(UNIT=UFO_FU, POS=I)
WRITE(*,*) "BLOCK", BN,"POS",I

So we did some tests and the results were very confusing:

It works on my computer with both ifort(13.1.1) and gfortran(4.3.4).

My colleague has the same compiler versions but if he compiles with gfortran the code doesn't append correctly, ifort still works.

So far it looks like a gfortran config issue on his computer, but the program, compiled on his computer, works correctly on my computer and the program compiled on my computer doesn't work correctly on his computer (again only gfortran).

It seems to me there is a runtime issue for gfortran only, but I am clueless where to look.

We are both using SUSE-Linux:

Linux version 3.0.13-0.27-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP Wed Feb 15 13:33:49 UTC 2012 (d73692b)

SUSE Linux Enterprise Desktop 11 (x86_64)

ldd- for the ifort version:

linux-vdso.so.1 =>  (0x00007fffdd9ff000)
libm.so.6 => /lib64/libm.so.6 (0x00007f33af57f000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f33af361000)
libc.so.6 => /lib64/libc.so.6 (0x00007f33aefe9000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f33aedd3000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f33aebce000)
/lib64/ld-linux-x86-64.so.2 (0x00007f33af848000)

Version information:
bin/tascom3d:
    libdl.so.2 (GLIBC_2.2.5) => /lib64/libdl.so.2
    libpthread.so.0 (GLIBC_2.2.5) => /lib64/libpthread.so.0
    libgcc_s.so.1 (GCC_3.0) => /lib64/libgcc_s.so.1
    libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libm.so.6:
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libpthread.so.0:
    ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
    ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /lib64/ld-linux-x86-64.so.2
    ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
    libc.so.6 (GLIBC_2.3.2) => /lib64/libc.so.6
    libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libc.so.6:
    ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
    ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
/lib64/libgcc_s.so.1:
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libdl.so.2:
    ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
    libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6

and the gfortran version:

linux-vdso.so.1 =>  (0x00007fff4d9ff000)
libgfortran.so.3 => /usr/lib64/libgfortran.so.3 (0x00007f69375d0000)
libm.so.6 => /lib64/libm.so.6 (0x00007f6937356000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f6937140000)
libc.so.6 => /lib64/libc.so.6 (0x00007f6936dc8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6937905000)

Version information:
bin/tascom3d:
    libgcc_s.so.1 (GCC_4.0.0) => /lib64/libgcc_s.so.1
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
    libgfortran.so.3 (GFORTRAN_1.0) => /usr/lib64/libgfortran.so.3
    libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6
/usr/lib64/libgfortran.so.3:
    libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6
    libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libm.so.6:
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libgcc_s.so.1:
    libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libc.so.6:
    ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
    ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2

I search for some similar issues but wasn't able to find anything.

I would really appreciate your ideas and help.

Kind regards,

Roman

@edit: Added the ldd info @edit2: Added the ldd -v info

1
can you run ldd on your executable to check the versions of used shared libraries? - Peter
gcc 4.3.4 is from August 2009. Its a fairly early version of gfortran. gfortran has many improvements since then. Try upgrading to a more recent version. - M. S. B.
@M.S.B. Thanks, I am aware of that and I installed 4.7 before but since our systems are managed by an external maintainer(no root access) and our real calculations are done on the cluster with recent compiler versions, I felt it wasn't worth the trouble. We use our local machines only for testing and so far we didn't have an problems. - Roman Keller
@RomanKeller Is the version of libraries exactly same for both computers? (mainly libc and libgcc_s) - Peter
a bit of an aside but it there a (standard) way to seek to the end after opening the file? - agentp

1 Answers

0
votes

as a possible work around you can try this:

 integer sz
 open(unit,file='..',access='stream')
 inquire(unit,size=sz)
 write(unit,pos=sz)

Assuming upgrading the compiler is not a good option for whatever reason.