[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: netcdf on a Stardent Titan



> Organization: Rutgers
> Keywords: 199412092042.AA21345

Hi Kate,

> Building netcdf on a Stardent Titan
> 
> Our colleagues at CSIRO have implemented netCDF I/O for our ocean
> model (SPEM) so I wanted to try it out.  We have some old Stardent
> Titans which I still run the model on.  I managed to compile the
> Fortran part of NCAR graphics and the HDF library on the Stardent so
> figured netCDF shouldn't be more trouble than I could handle.  Here
> is how far I got:
 ...
> 5. Everything compiles, but....
> 
> xdr make test:
> 
> > bildad% make test
> > ./xdrtest > xdrtest_out.new
> > diff xdrtest_out.new testout.sav
> > *** XDR passes formatted test ***
> > cmp test.xdr test_xdr.sav
> > test.xdr test_xdr.sav differ: char 16855, line 1
> > *** XDR fails binary test ***
> > gmake: *** [test] Error 1
> 
> Doing an xdump and then diff produces:
> 
> *** xdr.sav.dump        Fri Dec  9 14:02:06 1994
> - --- xdr.dump    Fri Dec  9 14:02:15 1994
> ***************
> *** 1051,1057 ****
>          000041a0   00000000 00000000 00000000 00000000 ................
>          000041b0   00000000 00000000 00000000 48697961 ............Hiya
>          000041c0   20736169 6c6f722e 204e6577 20696e20  sailor. New in 
> ! 000041d0   746f776e 3f000000 00000000 00000000   town?...........
>   000041e0   00000000 00000000 00000000 00000000   ................
>   000041f0   00000000 00000000 00000000 00000000   ................
>   00004200   00000000 00000000 00000000 00000000   ................
> - --- 1051,1057 ----
>          000041a0   00000000 00000000 00000000 00000000 ................
>          000041b0   00000000 00000000 00000000 48697961 ............Hiya
>          000041c0   20736169 6c6f722e 204e6577 20696e20  sailor. New in 
> ! 000041d0   746f776e 3f002f30 342f3238 00000000   town?./04/28....
>   000041e0   00000000 00000000 00000000 00000000   ................
>   000041f0   00000000 00000000 00000000 00000000   ................
>   00004200   00000000 00000000 00000000 00000000   ................

As it happens, address@hidden (Heinrich Billich) from
Institut fuer Geophysik, Universitaet Goettingen ran into similar problems
in porting netCDF to the Titan and provided some remarks on the port that I
have appended.  As far as this particular error, it turns out to be not
serious, and the result of a problem in the xdrtest program that only shows
up on the Titan.

It would never have appeared if we had just used the more conventional
declaration

        static char text[] ={ "Hiya sailor. New in town?" };

instead of

        static char text[32] ={ "Hiya sailor. New in town?" };

in xdrtest.c and similarly for a similar initialization of the variable
"sentence" in libsrc/cdftest.c.

Incidentally, you could also get access to these messages by searching on
the keyword "titan" in our support database using a WWW browser aimed at the
netCDF homepage at

    http://www.unidata.ucar.edu/packages/netcdf/

--
Russ Rew                                                UCAR Unidata Program
address@hidden                                          P.O. Box 3000
http://www.unidata.ucar.edu/                          Boulder, CO 80307-3000

Date: Fri, 10 Sep 1993 08:41:25 -0600
From: Russ Rew <address@hidden>
Message-Id: <address@hidden>
To: address@hidden
Subject: [address@hidden: netcdf .m4-File for Stardent Titan]

Organization: Institut fuer Geophysik, Universitaet Goettingen
Date: Fri, 10 Sep 1993 14:58:50 +0100
From: address@hidden (Heinrich Billich)
To: address@hidden
Subject:  netcdf .m4-File for Stardent Titan


Hi Russ,

Thank You for answering my questions to support@unidata.
Here is the m4 file for a Stardent Titan 3000 and some
additional remarks.You may post this or a edited version in     
unidata-support-netcdf.src or in any other place where
You think it's usefull.

Next line is the first line of TitanOS.m4:
divert(-1)
# Name of system platform (for use in comments)
define(`M4__SYSTEM', TitanOS)

# Includes needed at the top of a file of C to be called from FORTRAN
# for TitanOS: Just add two lines.
define(`M4__STRING_DESCRIPTOR_INCLUDES',
` /* descriptor for Fortran character variables */
  struct dscrptr { char *dsc_pointer; unsigned dsc_length; int dsc_tail;};')

# transformation from fortran name to name of C module: convert to uppercase
define(`NAMEF',
        `translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)')

# transformation from string name to corresponding argument name
define(`STRINGF',`$1d')

# extra arguments, if any, for string length
define(`STRINGX',`')  # no extra stringlen parameter

# declaration to be used for argument name descriptor
define(`STRINGD',`
    struct dscrptr  *$1d; ')

# declarations and initializations of canonical local variables
define(`STRINGL',`
 char *$1 = $1d->dsc_pointer;
 unsigned $1len = $1d->dsc_length;')

# C integral type equivalent to a FORTRAN INTEGER
define(`F_INTEGER',`int') 

# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
define(`LONG_INT',`integer')

# FORTRAN declaration for a short integer (e.g. intege.
r*2)
define(`SHORT_INT',`integer*2')

# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
define(`BYTE_INT',`byte')

# FORTRAN declaration for double precision (e.g. real for a Cray)
define(`DOUBLE_PRECISION',`double precision')

divert(0)dnl
# last line of TitanOS.m4
--------------------------------------------------------------------

Remarks:
There is no stdlib.h file on the Stardent Titan 3000 I use.
I changed the line
  # include <stdlib.h>
to
  #ifndef NO_STDLIB
  #include <stdlib.h>
  #else
  extern char *malloc();
  extern char *realloc();  /* not in all files necessary */
  #ifndef NULL             /* not in all files necessary */
  #define NULL  0
  #endif /* !NULL */
  #endif /* !NO_STDLIB */
in all files with this include-line.

In ./ncgen/generate.c and ./ncdump/ncdump.c  I also added
  #ifdef NO_STDLIB   /* */
   extern void free();
  #endif /* !NO_STDLIB */
.
In ./libsrc/local_nc.h I deleted the line13 
  #include        <stddef.h> /* size_t */.
( size_t is defined in sys/types.h. )

I run ./configure with "OS=TitanOS",
"CPPFLAGS='-DDEBUG -DNO_STDLIB -DNO_STDC_REMOVE'" and "FC=fc"
set in the CUSTOMIZE file.

I erased xdr/all and xdr/install in ./Makefile.

I run "make test" in all subdirectories. 
"make test" does not pass the binary test in ./xdr and ./libsrc,
but as long as all other tests are ok and the binary-files in
./xdr and ./libsrc differ only in few bytes following ascii-bytes,
everything is ok.
( Look at the binary-files with "od -c", differences will 
follow "Hiya sailor. New in town ?" and "country.".)

Maybe several "make all" are necessary until all files which
need a change are found.

That's all. I hope someone can use this.

Heinrich Billich                    Universitaet Goettingen
                                    Institut fuer Geophysik
address@hidden       Herzberger Landstr. 181
                                  D 37075 Goettingen/Germany

.