So I have a snippet of code writing 9 variables to a file:
if (rank == 0) then
write (filehandle,*) a,b,c,d,e,f,g,h,i
endif
But the code gives me different results on different machines / compilers: If I use a PathScale compiler on a Cray cluster, I get:
5.444445 0.0000000E+00 0.0000000E+00 1.5010493E-04
1.4887122E-04 2.5604754E-09 0.0000000E+00 -4.7524699E-07
0.0000000E+00
(newline after every x columns)
But if I use a GNU compiler on a different cluster, I get:
5.444445 0.0000000E+00 0.0000000E+00 1.5010493E-04 1.4887122E-04 2.5604754E-09 0.0000000E+00 -4.7524699E-07 0.0000000E+00
(no newline and the code works as expected)
My makefile for both the compilers looks as such:
# PathScale
FC = ftn
OPTFC = -Ofast -cpp
CC = cc
CFLAGS = -O3
# GNU
FC = mpif90
OPTFC = -O3 -funroll-loops -ftree-vectorize -fcray-pointer -cpp
CC = mpicc
CFLAGS = -O3
I need the file write to work as it does in the second case. Because of system admin constraints, I cannot install different compilers on the Cray. Has anyone seen this before / know what the problem might be? Any help would be appreciated!