Hi,
Using this code as an example:
int main(int argc, char *argv[])
{
int i, j, k;
int nx=600, ny=800, nz=720;
float x;
FILE *file_in, *file_out;
file_in = fopen("input.sep", "rb");
file_out = fopen("a.sep", "wb");
for (i=0; i<nx; i++)
for (j=0; j<ny; j++)
for (k=0; k<nz; k++)
{
fread(&x, 1, sizeof(float), file_in);
fwrite(&x, 1, sizeof(float), file_out);
}
fclose(file_out);
fclose(file_in);
return(0);
}
takes 1 mn to dump the file.
Using this code to do the same thing:
integer :: i, j, k
integer :: nx, ny, nz
real :: x
nx = 600; ny = 800; nz = 720
!!! intel compilo
open(unit=20, file='input.sep', form='binary')
open(unit=21, file='a.sep', form='binary')
!!! GNU compilo
!!$ open(unit=20, file='input.sep', form='unformatted', access='stream')
!!$ open(unit=21, file='a.sep', form='unformatted', access='stream')
do i = 1, nx
do j = 1, ny
do k = 1, nz
read(20) x
write(21) x
end do
end do
end do
close(20)
close(21)
is... endless :-(
What's going on ?
What am I doing wrong in the fortran version ?
TIA.
Cheers,
--
Fred


|