ARSC T3D Users' Newsletter 5, September 23, 1994

CRI Documentation on the T3D

From various sources, I have made a list of known documentation from CRI on the T3D. If any user knows of additional publications I'd be happy to hear about them. Hardcopy documentation from Cray Research can be purchased from:


  Cray Research, Inc          Order desk 612-681-5907
  Distribution Center         Fax number 612-681-5920
  2360 Pilot Knob Road
  Mendota Heights MN 55120

  CRI Number Version      Date     Title

  *HR-04033  original    9/ 1/93    Cray T3D Systems Architecture Overview
   HR-04038                         Cray T3D Multiple Cabinet Mainframe
   HR-04039                         Cray T3D Single Cabinet Mainframe
   HR-05058                         Cray T3D Multiple System Overview
   HR-05059                         Cray T3D Single System Overview
 
  *IN-2502        1.1    5/ 1/94    Introducing the Cray TotalView Debugger
  *IN-2511        1.1    5/ 1/94    Introducing the MPP Apprentice Tool 
  *SG-2500        1.0    5/ 1/94    Cray T3D Emulator User's Guide
  *SG-2503        3.0    5/ 1/94    Cray MPP Simulator User's Guide 
  *SG-2507  draft 1.0   12/ 1/93    Cray T3D Administrator's Guide
  *SG-2508        1.1   11/ //93    Cray Research MPP Software Guide 
  *SG-2509  draft        2/ 1/93    Programming the Cray T3D with Fortran
   SG-5216                          UNICOS MAX Installation Guide
  *SG-5217  draft 1.0   11/15/94    MPP Programming Environment Installation Guide
  *SG-2514        1.1    6/ 1/94    Cray MPP Loader User's Guide
  *SN-2513               2/ 1/94    MPP Fortran Programming Model
   SQ-2512                          Parallel Virtual Machine(PVM) Reference Card
  *SR-2501        3.0   11/ 1/94    PVM and HeNCE Programmers Manual
  *SR-2502        1.0   11/15/94    Cray TotalView Debugger Reference Manual 
  *SR-2504        6.1    6/ 1/94    Cray MPP Fortran Reference Manual 
  *SR-2506        4.0    6/ 1/94    Cray Standard C Reference Manual for MPP
  *SR-2510        2.0    6/ 1/94    Cray Assembler for MPP(CAM) Reference Manual 
  (SR-2003?)
  *TPD-007  draft 1.1   11/15/93    Alpha Architecture Handbook + T3D Differences7
  *TR-T3DAPPL   B 1.0    1/ 1/94    Cray T3D Applications Programming
  *TR-MPPOV     A 1.0   10/ 1/93    MPP Overview
* indicates ARSC has a copy

Useful Examples of C Calling Fortran (or Assembly Language)

Example 1 - Cray to IEEE Format Conversion

It is sometimes natural to code using the master/slave paradigm with the master on denali and the slaves on the T3D. Because of the differences in formats between the two processors, PVM messages are converted from one format to the other as part of the overhead of passing messages. But sometimes a user may want the IEEE formated number on the Y-MP, for graphics display on a workstation. For this case there are routines callable from Fortran that convert the Cray mainframe format to IEEE format. (Checkout the man pages for CRAY2IEG and IEG2CRAY).

One user in the T3D Summer Class had exactly this problem. After writing a binary file on the Y-MP, we needed to convert that binary file to a binary file of IEEE formated numbers. The code below shows how to do it.

  1. write.c, a program that writes a binary file on the Y-MP (a part of a master program)
  2. read.c, a C program that rewrites the binary file with IEEE numbers
  3. a sample of the output from read.c
The call of the routine CRAY2IEG uses the typical C calling Fortran conventions that we talked about in earlier newsletters.

source for write.c:


  #include <stdio.h>
  main()
  {
    double a[ 10 ];
    FILE *fp;
    int i;

    for( i = 0; i < 10; i++ ) a[ i ] = (double)i;
    fp = fopen( "CRAY", "w+b" );
    if( fp != NULL ) {
    printf( "writing binary file\n" );
    fwrite( a, 8, 10, fp );
    fclose( fp );
    }
  }
source for read.c:

  #include <stdio.h>
  main()
  {
    FILE *fp;
    int eight, zero, one, i, ier;
    double a[ 10 ];
    double b[ 10 ];
    eight = 8;
    one = 1;
    zero = 0;

    fp = fopen( "CRAY", "r+b" );
    for( i = 0; i < 10; i++ ) {
      fread( &a[ i ], 8, 1, fp );
      ier = CRAY2IEG( &eight, &one, &b[ i ], &zero, &a[ i ], &one );
      if( ier != 0 ) {
         printf( " %d\n", ier );
      } else {
         printf( " %4d %10.1f %8o %8o\n", i, a[i], a[i], b[ i ] );
      }
    }
  }
output from write.c:

  0        0.0        0        0
  1        1.0 400014000000000000000 377600000000000000000
  2        2.0 400024000000000000000 400000000000000000000
  3        3.0 400026000000000000000 400100000000000000000
  4        4.0 400034000000000000000 400200000000000000000
  5        5.0 400035000000000000000 400240000000000000000
  6        6.0 400036000000000000000 400300000000000000000
  7        7.0 400037000000000000000 400340000000000000000
  8        8.0 400044000000000000000 400400000000000000000
  9        9.0 400044400000000000000 400420000000000000000

Example 2 - Fortran Calling C and then C Calling Assembler

In this example, we have a look of some of the different packing/unpacking routines on denali and the T3D. There are at least four man pages of interest:

  man PACK                     libu routine
  man UNPACK                   libu routine
  man _pack and man _unpack    different libu routines        
  man pack                     unix commands
As part of the DoD's MIL-STD-1753 standard added to Fortran 77, there is flexible bit manipulation routine called "mvbits". In the Fortran program below, 16 small integers are packed into 2 64 bit words using the mvbits intrinsic. Then a C routine is called, which in turn calls the assembly language routine UNPACK to unpack the 2 64 bit words back into 16 small integers. (It's interesting that the order of the bytes has been swapped because mvbits and UNPACK have different ideas about what is the first bit of the 64 bit word.)

source code for write.f:


        integer ia( 2 ), ib( 16 )
        integer csub
        ia( 1 ) = 0
        ia( 2 ) = 0
        do 10 i =1, 16
           iword = (i-1) / 8 + 1
           j = i
        call mvbits( j, 0, 8, ia(iword), (i-1)*8-(iword-1)*64  )
        write( 6, 600 ) i, iword, j, ia( 1 ), ia( 2 )
    10  continue
        ier = csub( ia, ib, 16 )
        print *, "ier = ", ier
        do 20 i = 1, 16
          write( 6, 601 ) i, ib( i ) 
    20  continue
   600  format( 2i4, 1x, z8, 1x, z8, 1x, z8 )
   601  format( i4, 1x, z8 )
        end
source code for csub.c:

  int CSUB( ia, ib, nw )
  int ia( );
  int ib( );
  int *nw;
  {
    int eight = 8;

    if( ( *nw*eight ) % 64 ) {
    return -1;
    } else {
      UNPACK( ia, &eight, ib, nw );
      return *nw;
    }
  }
output from makefile:

  /mpp/bin/cf77 -c main.f
  /mpp/bin/cc -c csub.c
  mppldr main.o csub.o
  a.out
   1   1 00000001 00000001 00000000
   2   1 00000002 00000201 00000000
   3   1 00000003 00030201 00000000
   4   1 00000004 04030201 00000000
   5   1 00000005 04030201 00000000
   6   1 00000006 04030201 00000000
   7   1 00000007 04030201 00000000
   8   1 00000008 04030201 00000000
   9   2 00000009 04030201 00000009
  10   2 0000000A 04030201 00000A09
  11   2 0000000B 04030201 000B0A09
  12   2 0000000C 04030201 0C0B0A09
  13   2 0000000D 04030201 0C0B0A09
  14   2 0000000E 04030201 0C0B0A09
  15   2 0000000F 04030201 0C0B0A09
  16   2 00000010 04030201 0C0B0A09
  ier = 16
   1 00000008
   2 00000007
   3 00000006
   4 00000005
   5 00000004
   6 00000003
   7 00000002
   8 00000001
   9 00000010
  10 0000000F
  11 0000000E
  12 0000000D
  13 0000000C
  14 0000000B
  15 0000000A
  16 00000009
Next week we'll look at program sizes on the T3D.
Current Editors:
Ed Kornkven ARSC HPC Specialist ph: 907-450-8669
Kate Hedstrom ARSC Oceanographic Specialist ph: 907-450-8678
Arctic Region Supercomputing Center
University of Alaska Fairbanks
PO Box 756020
Fairbanks AK 99775-6020
E-mail Subscriptions: Archives:
    Back issues of the ASCII e-mail edition of the ARSC T3D/T3E/HPC Users' Newsletter are available by request. Please contact the editors.
Back to Top