🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #6481

Re: Question on unformatted i/o - SOLUTION

#6481
From: Eric Jackson
Date: Mon, 12 Mar 1990 15:43
64 lines
3632 bytes
In article <14409@phoenix.Princeton.EDU> ej@acm.Princeton.EDU I wrote:
>When an unformatted write is done...two control words are written at the
>beginning and end of the write with the number of bytes written...
>...Does anyone know how to suppress the writing of these control words?

My thanks to those who replied to this posting. I am posting the
solution since it may be helpful to others and it raises another
interesting issue.

As pointed out by John Fisher and Dan Whipple, writing without record
separators can be accomplished using direct access i/o. A further
portability problem does arise here, however: a record length must be
given in the open statement, but whether the length is given in words
or bytes depends on the implementation (bytes on a sun, words on sgi).
Anyway, there is a code fragment at the end of this post illustrating
the solution on a Silicon Graphics.

The reason I was interested in this is that we have developed a set of
programs for data analysis and visualization on the Silicon Graphics;
for the most part these programs require a binary input file. Since
the floating point representations on Suns, SGIs and the Titan are the
same, there is no need for conversion filters to use files produced by
any of them, other than the record separator problem, which up to now
I've solved by using a filter in C that throws them out.

This all does raise a more general issue in the case when machines do
not share a single representation. Indeed, I actually do very little
computation on our local machines --- for the most part I work on
remote supercomputers like the Crays and the (soon-to-disappear-and-
about-time-too) ETA10 (sorry, I couldn't resist), while using the
local machines for post-analysis and visualization. I often need to
output large datasets for local analysis (large <= many Gigabytes) and
using ascii leads to enormous amounts of wasted space (and network
bandwidth). One person wrote me about a machine-independent
data format implementation that he developed that I will be looking
into (I am checking whether he is willing to have his address posted
for inquiries). My question for the net is what other solutions to this problem
have been developed? Our own requirements are that the routines be
implementable on a wide variety of machines (suns, SGIs, Crays,
Connection Machine, Intel Hypercube, etc) in both C and Fortran, and
that they be very fast. They should also probably include or be usable
with a data format library like netCDF to allow self-describing datasets. 
Any thoughts or suggestions?


Eric Jackson
ej@acm.princeton.edu
Princeton University

***********************************************************************
CODE FRAGMENT:

      open(unit=12,form='unformatted',access='direct',
     $     recl=100,status='new',file='fname')
      do 1 i=1,100
         arr1(i) = float(i)
 1    continue
c now write it out 10 times
      do 2 k=1,10
         write(12,rec=k)(arr1(i),i=1,100)
2     continue

***********************************************************************
EOT
Technical Details
Message-ID: <14439@phoenix.Princeton.EDU>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!wuarchive!udel!princeton!phoenix!gauss!ej
References: <14409@phoenix.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!wuarchive!udel!princeton!phoenix!gauss!ej
From: ej@gauss.Princeton.EDU (Eric Jackson)
Newsgroups: comp.lang.fortran
Subject: Re: Question on unformatted i/o - SOLUTION
Message-ID: <14439@phoenix.Princeton.EDU>
Date: 12 Mar 90 15:43:58 GMT
References: <14409@phoenix.Princeton.EDU>
Sender: news@phoenix.Princeton.EDU
Reply-To: ej@gauss.Princeton.EDU (Eric Jackson)
Distribution: comp.lang.fortran,comp.sys.super,comp.unix.cray
Organization: Princeton University
Lines: 64