🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.super
Article #448

Re: CRAY-YMP Fortran-to-C question

#448
From: Roger Glover
Date: Tue, 11 Jun 1991 01:19
52 lines
3330 bytes
figuei@arakis.rutgers.edu (Francisco Figueirido) writes:
:> I am trying to write a program (in C) which needs to read data from a
:> file which was created by a Fortran-written program. The file in
:> question consists of unformatted (i.e., binary) data. I know that the
:> CRAY (I am using the one at PSC) writes, as most Fortran compilers,
:> some sort of count (word count?) before the records, but cannot make
:> sense of everything I see in the octal dump. Can someone direct me to
:> where can I get more information about the format of unformatted (no
:> pun intended!) files? Thanks for the help.

In article <1991Jun06.133409.125@convex.com> gstiehl@convex.com responds:
:>I would just write a small fortran function to read in the file, then link
:>the fortran funtion into your C program.  You will have to worry about
:>differences in argument passing, but that seems much easier than decoding
:>the fortran file format.  Why re-invent the wheel?

Writing a C-callable Fortran function to accomplish this would not be too
hard for someone fairly conversant with both languages, but there is an
easier way.

The CRI-specific "ff" functions allow you to do Fortran-like record-based
I/O in C.  To take advantage of these functions you must use the command
"asgcmd" before you run your executable.  To handle a COS-blocked file,
such as the one you described you should a UNICOS command sequence
something like this:

$ eval `asgcmd -F cos datafile`
$ a.out

The "asgcmd" command line looks so weird because it is actually setting an
"environment variable" which the "ff" routines loaded into "a.out" will
interpret.  The man page for "asgcmd" suggests alias/function settings to
make the command line more UNIXy.  Those of you who run X windows should
find this familiar, since the "resize" command uses a similar technique.

"datafile" should be the filename you use with the "ffopen" routine.

I would suggest, as a first step, that Mr. Figueirido read the man pages
on "asgcmd", "ffopen", "ffread" and "ffclose".  After that, if you still
have questions, feel free to e-mail me.


PS:  I would have responded to the original posting, but I have been too
busy lately to follow newsgroups.

------------------------------------------------------------------
Roger Glover           DISCLAIMER:  CRI does not necessarily share my
Cray Research, Inc.    opinions, but that is not my fault.
glover@earth.cray.com  TECHNICAL DISCLAIMER:  The command sequence shown
		       was not taken from any verifiable working example.
		       It is based only on my experience with the commands
		       and functions described.
Technical Details
Message-ID: <172731.22841@timbuk.cray.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!cs.umn.edu!uc!shamash!timbuk!sequoia!glover
References: <Jun.4.16.30.17.1991.306@arakis.rutgers.edu> <1991Jun06.133409.125@convex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!cs.umn.edu!uc!shamash!timbuk!sequoia!glover
From: glover@sequoia.cray.com (Roger Glover)
Newsgroups: comp.sys.super
Subject: Re: CRAY-YMP Fortran-to-C question
Summary: Use "asgcmd" and the Cray C Library calls "ffopen/ffread/..."
Keywords: Fortran, C, CRAY, I/O
Message-ID: <172731.22841@timbuk.cray.com>
Date: 11 Jun 91 01:19:22 GMT
Article-I.D.: timbuk.172731.22841
References: <Jun.4.16.30.17.1991.306@arakis.rutgers.edu> <1991Jun06.133409.125@convex.com>
Sender: Roger Glover
Organization: Cray Research, Inc., Eagan, MN
Lines: 52