I have found that if I do a soft link on Linux to /dev/null then the data
vanishes into /dev/null. However it
makes very little difference to the time some programs take to run, as the
time to convert the data
to external representation may dominate the program. The library does this
regardless of the nature of the file.
For example, the following is very IO intensive:
program simple
implicit none
integer :: n = 10
integer :: i, j, k, l
real, dimension(:,:,:), allocatable :: block
read *, n
allocate (block(n,n,n))
do i = 1, n
do j = 1, n
do k = 1, n
block(i,j,k) = i*1000*1000 + j*1000 + k
end do
end do
end do
do l = 1, n
block = block + 10*1000*1000
do i = 1, n
do j = 1, n
do k = 1, n
write(10,100) l, i, j, k, block(i,j,k)
end do
end do
end do
end do
100 format(4i10,1x,1pe20.8)
end
You can do the following:
time echo 30 | ./a.out # this creates a 50 MB file
you can then do:
rm fort.10
ln -s /dev/null fort.10
time echo 30 | ./a.out # now fort.10 goes to /dev/null
but it still takes the same (almost) time
Alistair Mills
Tel: 0118 989 2925
Mobile: 07764 308563
[log in to unmask]
----- Original Message -----
From: "Van Snyder" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Monday, January 07, 2002 8:05 PM
Subject: Re: /dev/null and scope of UNITs
> Alexander Donev asked:
>
> > I gather the scope of UNIT numbers is global per process, meaning once I
> > OPEN unit #100 in a process, this unit is available globally (without
> > regard to any scope like for variables) inside a program (a process
> > under UNIX, even if multithreaded), so that one needs to be careful
> > about finding available unit numbers. Is this correct? Can someone at
> > least briefly explain to me why this system was made, instead of the
> > OPEN or other statements explicitly returning a UNIT without the user
> > having to enter one (like FILE pointers in C).
>
> Fortran pre-standardization and Fortran 66 had units, but no OPEN
> statements. OPEN statements (and asterisk units) arrived in 1977.
>
> > Also, is there a way to write to something like /dev/null under
> > UNIX (i.e. fake IO)? With scratch files the actual IO still happens--I
> > want to ignore all WRITEs to a given UNIT.
>
> Have you tried opening the unit with FILE="/dev/null"?
>
> --
> What fraction of Americans believe | Van Snyder
> Wrestling is real and NASA is fake? | [log in to unmask]
> Any alleged opinions are my own and have not been approved or disapproved
> by JPL, CalTech, NASA, Dan Goldin, George Bush, the Pope, or anybody else.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 1/2/2002
|