[MITgcm-support] Compile MITgcm with gfortran+MPI

Yuan Lian lian at email.arizona.edu
Thu May 24 20:17:05 EDT 2007


This problem is actually similar the one discussed on this thread:
http://forge.csail.mit.edu/pipermail/mitgcm-support/2006-October/004374.html

This is pretty much a gfortran and g77 compatibility issue. I need 
gfortran compiler because I added a
user defined package to MITgcm which reads 32 bit binary input.

After adding -ff2c flag to gfortran compiler and -ignoretime to genmake2 
or changing "system_time" and "user_time"
in timers.F and timer_stats.c to "systematime" and "useratime", I can 
compile the codes now. However, I am not sure if
the run time error exists due to these changes. I will post the test 
results later.

I think it will be helpful to post the build_option file here for those 
who has the same problems. The
"-frecord-marker=4" flag is used to read and write 32bit binary record.

 FC=gfortran
CC=gcc
DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4 -DNML_TERMINATOR'
INCLUDES='-I/usr/include'
LIBS='-L/usr/lib64 -lfmpich -lmpich'
# CPP='gcc -E -traditional -P -'
CPP='cpp  -traditional -P'
NOOPTFLAGS='-O0'

if test "x$IEEE" = x ; then
    #  No need for IEEE-754
    #  "warning: -Wuninitialized is not supported without -O"
    FFLAGS='-Wunused -ff2c -frecord-marker=4'
    FOPTIM='-O3 -funroll-loops'
else
    #  Try to follow IEEE-754
    has_sse2=f
    grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1  &&  has_sse2=t
    if test "x$has_sse2" = xt ; then
        FFLAGS='-Wunused -mfpmath=sse -msse -msse2 -ff2c -frecord-marker=4'
    else
        FFLAGS='-Wunused -ffloat-store -ff2c -frecord-marker=4'
    fi
    #  echo 'FFLAGS="'$FFLAGS'"'
    FOPTIM='-O0 -malign-double'
fi


Yuan

Yuan Lian wrote:
> I just figured out I compiled mpich with g77. I am now compiling mpich 
> with gfortran. I will report my results here.
>
> Thanks for all your help!
>
> Yuan
>
> Haferman, Jeffrey (Jeff) (CIV) wrote:
>>
>> Are you sure that the mpich was also compiled with 64 bit gfortran?
>>
>>  
>>
>>  
>>
>>  
>>
>> ------------------------------------------------------------------------
>>
>> *From:* mitgcm-support-bounces at mitgcm.org 
>> [mailto:mitgcm-support-bounces at mitgcm.org] *On Behalf Of *Mark Hadfield
>> *Sent:* Thursday, May 24, 2007 2:32 PM
>> *To:* mitgcm-support at mitgcm.org
>> *Subject:* Re: [MITgcm-support] Compile MITgcm with gfortran+MPI
>>
>>  
>>
>> Yuan Lian wrote:
>>
>> Hi,
>>
>> Does anyone successfully compile MITgcm with 64 bit gfortran and 
>> mpich. gfortran version I am using is 4.3.x.
>> I could compile most of the code but failed at the last step when the 
>> compiler tried to link mpich library. It gave
>> bunch of errors complaining about undefined mpi functions. Any help 
>> will be appreciated.
>>
>> It could well be a mismatch in the name mangling or calling 
>> conventions. This paper has some useful info:
>>
>> http://www.redbooks.ibm.com/redpapers/pdfs/redp4183.pdf
>>
>>
>>
>> -- 
>> Mark Hadfield          "Ka puwaha te tai nei, Hoea tahi tatou"
>> m.hadfield at niwa.co.nz <mailto:m.hadfield at niwa.co.nz>
>> National Institute for Water and Atmospheric Research (NIWA)
>>  
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> MITgcm-support mailing list
>> MITgcm-support at mitgcm.org
>> http://mitgcm.org/mailman/listinfo/mitgcm-support
>>   
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
>




More information about the MITgcm-support mailing list