[MITgcm-support] Optim.x build problems under OS X gfortran, gcc and GotoBLAS2

Patrick Heimbach heimbach at MIT.EDU
Thu Sep 16 12:14:51 EDT 2010


Hi,

haven't had problems with this in a while,
but also never tried on Mac so far.

Very(!) quick look suggests a "simple"(?) CPP preprocessor problem
("Illegal preprocessor directive")
which may result in CPP not doing anything
(therefore you keep the _RL in .f).

I'd check if the "-P -traditional" flags are available,
and/or how to modify?

-p.



On Sep 16, 2010, at 11:54 AM, Chris Wilson wrote:

> Hi,
>
> I'm trying to build optim.x for use with the adjoint  
> tutorial_global_oce_optim.   I've successfully built the associated  
> lsopt and GotoBLAS2 libraries on OS X with gfortran, gcc.
>
> My guess would be that the problem lies with the order of  
> processing of my Makefile, but I don't understand enough to know/ 
> fix this.  _RL should be predefined as a name with the preprocessor  
> via -D_RL='double precision' in the Makefile, but the Fortran stuff  
> is being processed first.
>
> I'd be very grateful of any help please.  Makefile and error  
> messages are below:
>
> uname -a
> Darwin Chris-Wilsons-MacBook-Pro.local 10.4.0 Darwin Kernel Version  
> 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/ 
> RELEASE_I386 i386
>
> gfortran -v
> Using built-in specs.
> Target: x86_64-apple-darwin10
> Configured with: ../gcc-4.5-20090910/configure --enable- 
> languages=fortran --host=x86_64-apple-darwin10 --build=x86_64-apple- 
> darwin10
> Thread model: posix
> gcc version 4.5.0 20090910 (experimental) (GCC)
>
> gcc -v
> Using built-in specs.
> Target: i686-apple-darwin10
> Configured with: /var/tmp/gcc/gcc-5664~38/src/configure --disable- 
> checking --enable-werror --prefix=/usr --mandir=/share/man --enable- 
> languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/ 
> s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 -- 
> program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 -- 
> target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
> Thread model: posix
> gcc version 4.2.1 (Apple Inc. build 5664)
>
> #********************************************************************* 
> **
> # Makefile for the ECCO off-line large scale optimization.
> #
> # started: Patrick Heimbach heimbach at mit.edu 19-Jun-2000
> #
> # changed:
> #
> #********************************************************************* 
> **
>
> # The optimization routines.
> SRC             =       optim_main.F                    \
>                         optim_sub.F                     \
>                         optim_numbmod.F                 \
>                         optim_initmod.F                 \
>                         optim_readdata.F                \
>                         optim_writedata.F               \
>                         optim_write_control.F           \
>                         xerbla.F                        \
>                         simul.F
>
> EXEDIR     = ./
>
> # Location of cpp preprocessor
> # OS X
> CPP             = cat $< | /usr/bin/gcc -P -traditional
>
>
> INCLUDEDIRS     = -I.                           \
>                   -I/Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/
>
>
> LIBDIRS         = -L.                           \
>                   -L../lsopt/                   \
>                   -L/Users/cwi/Work/utilities/GotoBLAS2
>
> LIBS            = -llsopt_ecco                  \
>                   -lgoto2
> #                 -lblas1
>
> # OPTMODE is either equal to OFFLINE or ONLINE
> OPTMODE         = OFFLINE
> EXECUTABLE      = $(EXEDIR)optim.x
>
> # The cpp flags.
> CPPFLAGS = -DREAL_BYTE=4                \
>         -DMAX_INDEPEND=1000000          \
>         -D_RL='double precision'        \
>         -D_RS='double precision'        \
>         -D$(OPTMODE)
>
> #                -DMAX_INDEPEND=293570968        \
> # FORTRAN compiler and its flags.
> # default is (Linux)
> FC              = gfortran
>
> FFLAGS= -m64  -fconvert=big-endian -mcmodel=medium  -O2
>
>
> # File removal.
> RM              = rm -f
>
> SMALLF      = $(SRC:.F=.f)
> OBJECTS     = $(SRC:.F=.o)
>
> .SUFFIXES: .o .f .F
>
> all: $(EXECUTABLE)
> $(EXECUTABLE): $(OBJECTS)
>         $(FC) -o $@ $(FFLAGS) $(OBJECTS) $(LIBDIRS) $(LIBS)
>
> depend:
>         makedepend -o .f $(INCLUDEDIRS) $(SRC)
>
> # The normal chain of rules is (  .F - .f - .o  )
> .F.f:
>         $(CPP) $(CPPFLAGS) $(INCLUDEDIRS) > $@
> xerbla.f: xerbla.F
>         $(CPP) $(INCLUDEDIRS) > $@
> .f.o:
>         $(FC) $(FFLAGS) -c $<
>
> # Cleaning options.
> clean:
>         $(RM) $(EXEDIR)optim.x *.o *.f
>
> scratch:
>         $(RM) OPWARMD OPWARMI $(EXEDIR)optim.x $(OBJ)
>
> # DO NOT DELETE THIS LINE -- make depend depends on it.
>
> optim_main.f: blas1.h
> optim_sub.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/EEPARAMS.h
> optim_sub.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/SIZE.h
> optim_sub.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ctrl.h
> optim_sub.f: optim.h
> optim_numbmod.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/EEPARAMS.h
> optim_numbmod.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/SIZE.h
> optim_numbmod.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ctrl.h
> optim_numbmod.f: optim.h minimization.h
> optim_initmod.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/EEPARAMS.h
> optim_initmod.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/SIZE.h
> optim_initmod.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ctrl.h
> optim_initmod.f: optim.h
> optim_readdata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/EEPARAMS.h
> optim_readdata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/SIZE.h
> optim_readdata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ECCO_CPPOPTIONS.h
> optim_readdata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ctrl.h
> optim_readdata.f: optim.h minimization.h
> optim_writedata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/EEPARAMS.h
> optim_writedata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/SIZE.h
> optim_writedata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ECCO_CPPOPTIONS.h
> optim_writedata.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ctrl.h
> optim_writedata.f: optim.h minimization.h
> optim_write_control.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/EEPARAMS.h
> optim_write_control.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/SIZE.h
> optim_write_control.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ctrl.h
> optim_write_control.f: optim.h
> simul.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/EEPARAMS.h
> simul.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/SIZE.h
> simul.f: /Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ctrl.h
>
> --------------------
>
>
> Chris-Wilsons-MacBook-Pro:~/Work/models/MITgcm/MITgcm_c61v/optim/ >  
> make clean
> rm -f ./optim.x *.o *.f
> Chris-Wilsons-MacBook-Pro:~/Work/models/MITgcm/MITgcm_c61v/optim/ >  
> make depend
> makedepend -o .f -I. -I/Users/cwi/scratch/MITgcm_scratch/ 
> tutorial_global_oce_optim/ optim_main.F optim_sub.F optim_numbmod.F  
> optim_initmod.F optim_readdata.F optim_writedata.F  
> optim_write_control.F xerbla.F simul.F
> Chris-Wilsons-MacBook-Pro:~/Work/models/MITgcm/MITgcm_c61v/optim/ >  
> make
> gfortran -m64  -fconvert=big-endian -mcmodel=medium  -O2 -c  
> optim_main.f
> Warning: optim_main.f:71: Illegal preprocessor directive
> gfortran -m64  -fconvert=big-endian -mcmodel=medium  -O2 -c  
> optim_sub.f
> Warning: optim_sub.f:30: Illegal preprocessor directive
> Warning: optim_sub.f:31: Illegal preprocessor directive
> Warning: optim_sub.f:33: Illegal preprocessor directive
> Warning: optim_sub.f:34: Illegal preprocessor directive
> Warning: optim_sub.f:44: Illegal preprocessor directive
> Warning: optim_sub.f:50: Illegal preprocessor directive
> Warning: optim_sub.f:61: Illegal preprocessor directive
> Warning: optim_sub.f:69: Illegal preprocessor directive
> Warning: optim_sub.f:72: Illegal preprocessor directive
> Warning: optim_sub.f:73: Illegal preprocessor directive
> Warning: optim_sub.f:79: Illegal preprocessor directive
> Warning: optim_sub.f:96: Illegal preprocessor directive
> Warning: optim_sub.f:97: Illegal preprocessor directive
> Warning: optim_sub.f:98: Illegal preprocessor directive
> Warning: optim_sub.f:108: Illegal preprocessor directive
> optim_sub.f:42.7:
>
>       _RL   objf
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:45.7:
>
>       _RL   xx(nn)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:46.7:
>
>       _RL   adxx(nn)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:47.7:
>
>       _RL   dd(nn)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:48.7:
>
>       _RL   gold(nn)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:49.7:
>
>       _RL   xdiff(nn)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:51.7:
>
>       _RL   xx
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:52.7:
>
>       _RL   adxx
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:53.7:
>
>       _RL   dd(1)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:54.7:
>
>       _RL   gold(1)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:55.7:
>
>       _RL   xdiff(1)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:56.14:
>
>       pointer (pxx,xx(1))
>               1
> Error: Cray pointer declaration at (1) requires -fcray-pointer flag
> optim_sub.f:57.14:
>
>       pointer (padxx,adxx(1))
>               1
> Error: Cray pointer declaration at (1) requires -fcray-pointer flag
> optim_sub.f:58.14:
>
>       pointer (pdd,dd)
>               1
> Error: Cray pointer declaration at (1) requires -fcray-pointer flag
> optim_sub.f:59.14:
>
>       pointer (pgold,gold)
>               1
> Error: Cray pointer declaration at (1) requires -fcray-pointer flag
> optim_sub.f:60.14:
>
>       pointer (pxdiff,xdiff)
>               1
> Error: Cray pointer declaration at (1) requires -fcray-pointer flag
> optim_sub.f:63.36:
>
>       parameter( nmax = MAX_INDEPEND )
>                                     1
> Error: Symbol 'max_independ' at (1) has no IMPLICIT type
> optim_sub.f:64.7:
>
>       _RL   xx(nmax)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:65.7:
>
>       _RL   adxx(nmax)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:66.7:
>
>       _RL   dd(nmax)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:67.7:
>
>       _RL   gold(nmax)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:68.7:
>
>       _RL   xdiff(nmax)
>        1
> Error: Invalid character in name at (1)
> optim_sub.f:81.72:
>
>       integer ifail
>                                                                        
>   1
> Error: Unexpected data declaration statement at (1)
> optim_sub.f:82.72:
>
>       integer itmax
>                                                                        
>   1
> Error: Unexpected data declaration statement at (1)
> optim_sub.f:83.72:
>
>       logical loffline
>                                                                        
>   1
> Error: Unexpected data declaration statement at (1)
> Fatal Error: Error count reached limit of 25.
> make: *** [optim_sub.o] Error 1
>
>
> Chris
>
> . . .. ... ..... ........ .............
> Dr Chris Wilson +(0)151 7954806 http://bit.ly/mesoscale
> National Oceanography Centre, Liverpool L3 5DA, U.K.
> ... . .... . ..... ......... .. .......
>
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support

---
Patrick Heimbach | heimbach at mit.edu | http://www.mit.edu/~heimbach
MIT | EAPS 54-1518 | 77 Massachusetts Ave | Cambridge MA 02139 USA
FON +1-617-253-5259 | FAX +1-617-253-4464 | SKYPE patrick.heimbach


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20100916/25ccf1e6/attachment-0001.htm>


More information about the MITgcm-support mailing list