Re: porting ccm3 to linux


Subject: Re: porting ccm3 to linux
From: fei liu (feiliu@aa.eps.jhu.edu)
Date: Fri Sep 12 1997 - 17:07:31 MDT


On Fri, 12 Sep 1997, Jim Rosinski wrote:

> CCM-users:
>
> Regarding the issue of porting CCM3 to non-Cray platforms, the good news is
> that there are only 2 aspects of the code which do not comply with the
> Fortran 77 standard that need to be addressed. The bad news is that they're
> both whoppers.
>
> First, the use of run-time memory allocation via Cray pointers and "malloc"
> calls is very pervasive in CCM3. This is particularly true in the land
> model. If you don't have a compiler that supports Cray pointers you're
> pretty close to dead in the water. The reason CCM3 runs on a wide variety of
> platforms is that Sun, IBM, and SGI all support this non f77-compliant
> construct. Your best bet is to rewrite the Cray pointer syntax in Fortran 90
> if such a compiler is available.

The Programs I have mentioned in my last email is the getmem.F and
freemem.F which dynamically allocates and deallocates memory for the whole
ccm3 package, and the two functions widely used are,(SUN defined)
        subroutine getmem(calledby, nwords, address)
        subroutine freemem(address)

        character*(*) calledby
        integer nwords
        pointer(address, space)
        real space

        That's the program getdate.c and datetime.F which warm my heart up
that ccm3 could probably at least be ported to linux.
in datetime.F
        integer mon, day, yr, hr, min, sec
        call getdate(mon,day, yr, hr, min, sec)
in getdate.c
        void getdate_(int *mon, int*day,...);

such I suppose the corresponding codes which might play the same
functionality as getmem( ) and freemem( ) but written in a c version
could be
        void getmem_(char * calledby, int nwords, double * address);
        void freemem_(double * address);
This might be one way to encompass the memory allocation problem, I have
another possibility which now I haven't given too much thought though.
I will try to play around with this idea first and to see if it works.

>
> The second major porting issue has to do with promotion of default floating
> point precision to real*8. Many vendors provide such an auto-promotion flag
> with their f77 compiler (e.g. -r8 on SUN and SGI). Going into the CCM3
> code and changing all "real" declarations to "real*8" is an unpleasant task,
> though with good editors like emacs it may not be all that time consuming.
>
This replacement won't be a problem, actually I have written several 'sed'
and 'nawk' programs to replace all the include statements and the static
syntax to save syntax in all .F and .h codes to successfully compiled
around 100+ .F files until I got stuck in freemem.F and getmem.F which
might not be easily solved in the first thought. Hope we can do that!

Fei Liu
(1)+410 516-7047
Atmospheric Research Lab
The Johns Hopkins University



This archive was generated by hypermail 2b27 : Thu Jun 01 2000 - 09:11:32 MDT