🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

5 total messages Started by Mark R. Ludwig Wed, 16 Dec 1992 09:49
Storage of Fortran character strings on Cray
#274
Author: Mark R. Ludwig
Date: Wed, 16 Dec 1992 09:49
17 lines
1280 bytes
I'd appreciate information or pointers to information about how
Fortran character strings are stored on Cray machines.  I have the
impression that sometimes they are word-aligned, but I don't know how
they then honor the X3.9-1978 standard which requires adjacency of
elements of a character array.  Perhaps only the first element of the
array is mandatorily aligned, and rest are also aligned only if the
length of each element is an integer multiple of 8?

Hopefully related enough to not need a separate post, can someone tell
me what the addressability is of data on Cray machines?  What does the
machine have to do to extract an arbitrary character from a string?

Thanks in advance.$$
-- 
INET: mrl@uai.com           NIC: ML255           ICBM: USA; Lower Left Coast
"A computer is one of life's joys; it follows simple rules.  Just like
 children, adults need toys, only we like to call them 'tools.'" -- Dave Ross
Re: Storage of Fortran character strings on Cray
#275
Author: Robert Hyatt
Date: Thu, 17 Dec 1992 03:35
39 lines
2289 bytes
In article <MRL.92Dec16094950@sun4.uai.com> mrl@uai.com (Mark R. Ludwig) writes:
>I'd appreciate information or pointers to information about how
>Fortran character strings are stored on Cray machines.  I have the
>impression that sometimes they are word-aligned, but I don't know how
>they then honor the X3.9-1978 standard which requires adjacency of
>elements of a character array.  Perhaps only the first element of the
>array is mandatorily aligned, and rest are also aligned only if the
>length of each element is an integer multiple of 8?
>

Every character variable I have used was aligned on a word boundary
since it usually follows some other data type.  I haven't tried
defining a bunch of char variables but would suspect that they are
separated by word alignment.  However, the characters within a char
variable are simply consecutive characters and not individually
aligned.  they are NOT reversed in order or anything silly like a
vax.

>Hopefully related enough to not need a separate post, can someone tell
>me what the addressability is of data on Cray machines?  What does the
>machine have to do to extract an arbitrary character from a string?
>

It has to load a word (64 bits), shift the character to the right end
and AND off the leftmost unwanted stuff.  There are no byte loads,
halfword loads, etc.  same for indexing.  Its all words.  you can
actually slow your code down by packing data like this.


>Thanks in advance.$$
>-- 
>INET: mrl@uai.com           NIC: ML255           ICBM: USA; Lower Left Coast
>"A computer is one of life's joys; it follows simple rules.  Just like
> children, adults need toys, only we like to call them 'tools.'" -- Dave Ross


-- 
!Robert Hyatt                    Computer and Information Sciences   !
!hyatt@cis.uab.edu               University of Alabama at Birmingham !
Re: Storage of Fortran character strings on Cray
#276
Author: Bakayaroo Banzai
Date: Thu, 17 Dec 1992 11:59
28 lines
1985 bytes
In article <MRL.92Dec16094950@sun4.uai.com> mrl@uai.com (Mark R. Ludwig) writes:
>I'd appreciate information or pointers to information about how
>Fortran character strings are stored on Cray machines.  I have the
>impression that sometimes they are word-aligned, but I don't know how
>they then honor the X3.9-1978 standard which requires adjacency of
>elements of a character array.  Perhaps only the first element of the
>array is mandatorily aligned, and rest are also aligned only if the
>length of each element is an integer multiple of 8?
>
>Hopefully related enough to not need a separate post, can someone tell
>me what the addressability is of data on Cray machines?  What does the
>machine have to do to extract an arbitrary character from a string?
>
I'm not a Fortran expert so I can't answer the first part of your
question. 

The smallest addressable chunk of data on a Cray machine is one word
(8 Bytes). You can use system subroutines to do a pattern 
search within a retrieved word. You must first compile a regular
expression to produce a pointer to the area to be searched and then use
the system calls regcmp and regex to match it. This can be written as
a C subprogram which should be callable from Fortran. If you don't know
precisely what you're trying to extract you would need to apply some
shift and bitwise operations to the word you retrieved in order to
separate out the desired character.

Matt Marchese
matt@cray.com
Re: Storage of Fortran character strings on Cray
#277
Author: James Davies
Date: Thu, 17 Dec 1992 16:48
38 lines
2530 bytes
In article <MRL.92Dec16094950@sun4.uai.com> mrl@uai.com (Mark R. Ludwig) writes:
>I'd appreciate information or pointers to information about how
>Fortran character strings are stored on Cray machines.  I have the
>impression that sometimes they are word-aligned, but I don't know how
>they then honor the X3.9-1978 standard which requires adjacency of
>elements of a character array.  Perhaps only the first element of the
>array is mandatorily aligned, and rest are also aligned only if the
>length of each element is an integer multiple of 8?

They're packed 8 to a word, and aligned when possible.  The need to
make common blocks, equivalenced variables, and arrays conform to the
standard make it necessary to start things on non-word boundaries at times.
For example, Fortran 77 allows passing an array declared
	character*3 a(4)
to a subroutine and declaring it in the subroutine as
	character*4 a(3)
and both arrays have to reference the same 12 characters.  Similar
tricks can be played by equivalencing variables together or varying the
declarations in common blocks between routines.

>Hopefully related enough to not need a separate post, can someone tell
>me what the addressability is of data on Cray machines?  What does the
>machine have to do to extract an arbitrary character from a string?

Character variables are passed by descriptor.  The descriptor contains
the address of the first word, the starting offset in that word,
and the length of the variable in bytes, all packed into a 64-bit word.
The format of the descriptors varies by model, but the Cray-2 and 3 have 
the starting bit offset in the upper 6 bits of the word, the length in the
next 26 bits, and the word address in the lower 32 bits.  C character pointers
have the same format, except that the length field isn't used.

To reference an arbitrary character, you basically have to work real hard :-).
Shift and mask to extract the fields from the descriptor, load the word with
the character you want, and shift and mask some more to extract the character.

						Jim Davies
						jrbd@craycos.com
Re: Storage of Fortran character strings on Cray
#278
Author: Dik T. Winter
Date: Sat, 19 Dec 1992 01:11
24 lines
1794 bytes
In article <1992Dec17.164818.2198@craycos.com> jrbd@craycos.com (James Davies) writes:
 >Character variables are passed by descriptor.  The descriptor contains
 >the address of the first word, the starting offset in that word,
 >and the length of the variable in bytes, all packed into a 64-bit word.
 >The format of the descriptors varies by model, but the Cray-2 and 3 have 
 >the starting bit offset in the upper 6 bits of the word, the length in the
 >next 26 bits, and the word address in the lower 32 bits.  C character pointers
 >have the same format, except that the length field isn't used.
 > 
Right.  Which makes me wonder.  Could you publish a list of standard Unix
programs that were broken and revealed such by this particular character
pointer implementation?  (Like /bin/sh which is really awful.)  It ought
to be more common knowledge that:
1.  type1 pointers have not necessarily the same format as type2 pointers,
and:
2.  the low order bit(s) of a word aligned pointer can not be freely used as
    a marker.
(On the other hand, one of the Cray C compilers had a bug where in some
cases the upper bits of a char pointer were cleared when it was passed as
a parameter, so apparently Cray did not know this all at that time
either :-).)
-- 
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
home: bovenover 215, 1025 jn  amsterdam, nederland; e-mail: dik@cwi.nl
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads