/[MITgcm]/MITgcm_contrib/ESMF/mytools/mkmod.sh
ViewVC logotype

Diff of /MITgcm_contrib/ESMF/mytools/mkmod.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6 by cnh, Fri Feb 20 16:21:41 2004 UTC revision 1.12 by cnh, Fri Feb 27 17:51:57 2004 UTC
# Line 25  set mpref_s = ( atm ) Line 25  set mpref_s = ( atm )
25  endif  endif
26  set mpref_l = ( mitgcm_org_${mpref_s} )  set mpref_l = ( mitgcm_org_${mpref_s} )
27    
28  # Set output directory - this is the directory where the compile and link objects  # Set output directory - this is the directory where the compile and link
29  #                        that other builds (ESMF drivers etc..) use  #                        objects that other builds (ESMF drivers etc..) use
30  set outdir = ( mmout )  set outdir = ( mmout )
31    
32  # Get the genmake generated Makefile to create the .f files  # Get the genmake generated Makefile to create the .f files
# Line 71  echo "Putting END SUBROUTINE at end of s Line 71  echo "Putting END SUBROUTINE at end of s
71  cat ${mpref_l}_mod2.Ftmp | awk -f print_sub.awk  > ${mpref_l}_mod3.Ftmp  cat ${mpref_l}_mod2.Ftmp | awk -f print_sub.awk  > ${mpref_l}_mod3.Ftmp
72  cat ${mpref_l}_mod3.Ftmp >> ${mpref_l}_mod.Ftmp  cat ${mpref_l}_mod3.Ftmp >> ${mpref_l}_mod.Ftmp
73    
74  # Remove EXTERNAL refs for functions (some compilers say it is an error to have EXTERNAL )  # Remove EXTERNAL refs for functions (some compilers say it is an error
75  #                                    ( on these if they are in a module                  )  # to have EXTERNAL on these if they are in a module )
76  echo "Removing EXTERNAL refs for functions that are within the module"  echo "Removing EXTERNAL refs for functions that are within the module"
77  set extDel = ( DIFFERENT_MULTIPLE IFNBLNK ILNBLNK TIMER_INDEX \  set extDel = ( DIFFERENT_MULTIPLE IFNBLNK ILNBLNK TIMER_INDEX \
78                 IO_ERRCOUNT MDS_RECLEN PORT_RAND SBO_RHO NLATBND \                 IO_ERRCOUNT MDS_RECLEN PORT_RAND SBO_RHO NLATBND \
# Line 82  cat ${mpref_l}_mod.Ftmp | grep -iv " Line 82  cat ${mpref_l}_mod.Ftmp | grep -iv "
82  cp f1.Ftmp ${mpref_l}_mod.Ftmp  cp f1.Ftmp ${mpref_l}_mod.Ftmp
83  end  end
84    
85  # Remove type declaarations for functions (some compilers say it is an error to have TYPE in )  # Remove type declaarations for functions (some compilers say it is an error
86  #                                         (a routine for these if they are in a module       )  # to have TYPE in a routine for these if they are in a module )
87  echo "Removing type declarations for functions that are within the module"  echo "Removing type declarations for functions that are within the module"
88  cat ${mpref_l}_mod.Ftmp | grep -iv '      *LOGICAL *DIFFERENT_MULTIPLE' > f1.Ftmp  cat ${mpref_l}_mod.Ftmp | grep -iv '      *LOGICAL *DIFFERENT_MULTIPLE' \
89        > f1.Ftmp
90  cp f1.Ftmp ${mpref_l}_mod.Ftmp  cp f1.Ftmp ${mpref_l}_mod.Ftmp
91  cat ${mpref_l}_mod.Ftmp | grep -iv '      *INTEGER *ILNBLNK' > f1.Ftmp  cat ${mpref_l}_mod.Ftmp | grep -iv '      *INTEGER *ILNBLNK' > f1.Ftmp
92  cp f1.Ftmp ${mpref_l}_mod.Ftmp  cp f1.Ftmp ${mpref_l}_mod.Ftmp
# Line 110  cp f1.Ftmp ${mpref_l}_mod.Ftmp Line 111  cp f1.Ftmp ${mpref_l}_mod.Ftmp
111  cat ${mpref_l}_mod.Ftmp | grep -iv '      *REAL\*8 *EXF_BULKRHN' > f1.Ftmp  cat ${mpref_l}_mod.Ftmp | grep -iv '      *REAL\*8 *EXF_BULKRHN' > f1.Ftmp
112  cp f1.Ftmp ${mpref_l}_mod.Ftmp  cp f1.Ftmp ${mpref_l}_mod.Ftmp
113    
114    #
115  echo "Putting END FUNCTION at end of functions"  echo "Putting END FUNCTION at end of functions"
116  cat ${mpref_l}_mod2.Ftmp | awk -f print_func.awk > ${mpref_l}_mod4.Ftmp  cat ${mpref_l}_mod2.Ftmp | awk -f print_func.awk > ${mpref_l}_mod4.Ftmp
117  cat ${mpref_l}_mod4.Ftmp >> ${mpref_l}_mod.Ftmp  cat ${mpref_l}_mod4.Ftmp >> ${mpref_l}_mod.Ftmp
118    
119    #
120  echo "Write the end of the module"  echo "Write the end of the module"
121  cat ${mpref_l}_mod2.Ftmp | awk -f print_func.awk > ${mpref_l}_mod4.Ftmp  cat ${mpref_l}_mod2.Ftmp | awk -f print_func.awk > ${mpref_l}_mod4.Ftmp
122  cat <<EOF >> ${mpref_l}_mod.Ftmp  cat <<EOF >> ${mpref_l}_mod.Ftmp
# Line 121  cat <<EOF >> ${mpref_l}_mod.Ftmp Line 124  cat <<EOF >> ${mpref_l}_mod.Ftmp
124  EOF  EOF
125    
126  # Change all the common block names in the module to use the module prefix  # Change all the common block names in the module to use the module prefix
 # cat ${mpref_l}_mod.Ftmp | sed s'z\( *COMMON *[^/]*/ *\)\([^ ]*\)\( */.*\)z\1COMPOCEAN_\2\3z' >f1.Ftmp  
127  cat ${mpref_l}_mod.Ftmp | sed s'z\( *COMMON[^/]*\)/\(.*\)/\([^/]*\)z      COMMON/C_'${mpref_s}'_\2/\3z' > f1.Ftmp  cat ${mpref_l}_mod.Ftmp | sed s'z\( *COMMON[^/]*\)/\(.*\)/\([^/]*\)z      COMMON/C_'${mpref_s}'_\2/\3z' > f1.Ftmp
128  cp f1.Ftmp ${mpref_l}_mod.Ftmp  cp f1.Ftmp ${mpref_l}_mod.Ftmp
129    cat ${mpref_l}_mod.Ftmp | sed s'/C_'${mpref_s}'_MPIPRIV/MPIPRIV/' > f1.Ftmp
130  echo "Compiling code"  cp f1.Ftmp ${mpref_l}_mod.Ftmp
 set comp     = /s/local/1/cnh/usr/local/pkg/lammpi/lam-7.0.3/lahey/bin/mpif77  
 set compopts = ( --dbl -O0 --fix --lst --xref --wide -I/s/local/1/cnh/usr/local/src/ESMF_1_0_4_withlam/esmf/mod/modO/Linux.lahey.32.default )  
 set complibs = ( -L/s/local/1/cnh/usr/local/src/ESMF_1_0_4_withlam/esmf/lib/libO/Linux.lahey.32.default -lesmf )  
   
 set comp     = /usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif90  
 set compopts = ( -r8 -Mfixed -Mextend -byteswapio )  
 set complibs = ( )  
   
 set comp     = /usr/local/pkg/mpi/mpich-1.2.5..10/lahey/bin/mpif90  
 set compopts = ( --dbl --o2 --fix --lst --xref --wide --tp4 )  
 #set compopts = ( --dbl --o0 --fix --lst --xref --wide --sav )  
 set complibs = ( -L/usr/local/pkg/ESMF/ESMF_1_0_4/mpich-1.2.5..10/lahey/lib/libO/Linux.lahey.32.default -lesmf )  
 set compinc  = ( -I/usr/local/pkg/ESMF/ESMF_1_0_4/mpich-1.2.5..10/lahey/mod/modO/Linux.lahey.32.default )  
 set compinc  = ( ${compinc} -I${BUILDROOT}/esmf_top )  
   
 #set comp     = xlf95  
 #set compopts = ( -qfixed=132 -O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1 -bmaxdata:0x80000000 -q64 )  
 #set compopts = ( --dbl --o0 --fix --lst --xref --wide --sav )  
 #set complibs = ( -L/fs/cgd/data0/erik/esmf/lib/libO/AIX.default.64.default -lesmf )  
 #set compinc  = ( -I/fs/cgd/data0/erik/esmf/mod/modO/AIX.default.64.default         )  
131    
132    
133    echo "Compiling code"
134    source ${BUILDROOT}/mytools/comp_profile.BASE
135  source ${BUILDROOT}/mytools/comp_profile.${COMP_PROF}  source ${BUILDROOT}/mytools/comp_profile.${COMP_PROF}
136    
137  set compinc  = ( ${compinc} -I${BUILDROOT}/esmf_top )  set compinc  = ( ${compinc} -I${BUILDROOT}/esmf_top )
# Line 162  foreach f ( $mitgcmrtl ) Line 146  foreach f ( $mitgcmrtl )
146   echo " " | $comp $compopts -c ${f}   echo " " | $comp $compopts -c ${f}
147   set mitgcmrtlo = ( $mitgcmrtlo ${f:r}.o )   set mitgcmrtlo = ( $mitgcmrtlo ${f:r}.o )
148  end  end
149  cc -q64 -c tim.c  ${cccommand} ${ccopts} tim.c
150  set mitgcmrtlo = ( $mitgcmrtlo tim.o )  set mitgcmrtlo = ( $mitgcmrtlo tim.o )
151  \rm mmout/libmitgcmrtl.a  \rm mmout/libmitgcmrtl.a
152  ar -X64 -s -rc mmout/libmitgcmrtl.a $mitgcmrtlo  ${arcommand} ${aropts} mmout/libmitgcmrtl.a $mitgcmrtlo
153  #ranlib mmout/libmitgcmrtl.a  #ranlib mmout/libmitgcmrtl.a
154    
155  # Create component library archive  # Create component library archive
# Line 175  mv foo.F ${mpref_l}_mod.F Line 159  mv foo.F ${mpref_l}_mod.F
159  echo " " | $comp $compopts -c ${mpref_l}_mod.F ${complibs} ${compinc}  echo " " | $comp $compopts -c ${mpref_l}_mod.F ${complibs} ${compinc}
160  mv ${mpref_l}_mod.F ${mpref_l}_mod.Ftmp  mv ${mpref_l}_mod.F ${mpref_l}_mod.Ftmp
161  ./template_comp.sh ${mpref_s}  ./template_comp.sh ${mpref_s}
162  cc -q64 -c component_${mpref_s}_context.c  ${cccommand} ${ccopts} component_${mpref_s}_context.c
163  \rm mmout/lib${mpref_l}.a  \rm mmout/lib${mpref_l}.a
164  ar -X64 -s -rc mmout/lib${mpref_l}.a ${mpref_l}_mod.o component_${mpref_s}_context.o  ${arcommand} ${aropts} mmout/lib${mpref_l}.a ${mpref_l}_mod.o component_${mpref_s}_context.o
165  #ranlib mmout/lib${mpref_l}.a  #ranlib mmout/lib${mpref_l}.a
166  cp ${mpref_l}.mod mmout  set modname = `echo ${mpref_l} | ${mkmodname}`
167  \rm *mod  echo $modname
168    cp ${modname}.mod mmout
169  # Lahey compiler command line  #\rm *mod
 #  /usr/local/pkg/lammpi/lam-7.0.3/lahey/bin/mpif77  --dbl -O0 --fix --lst --xref --wide -I/s/local/1/cnh/usr/local/src/ESMF_1_0_4_withlam/esmf/mod/modO/Linux.lahey.32.default main.F90 ${mpref_l}_mod.o mdsio_byteswapr4.o mdsio_byteswapr8.o fool_the_compiler.o tim.o -L/home/cnh/src/ESMF_1_0_4_withlam/esmf/lib/libO/Linux.lahey.32.default -lesmf  
 # To run  
 #   /s/local/1/cnh/usr/local/pkg/lammpi/lam-7.0.3/lahey/bin/mpirun -np 4 -t -v  ../build/a.out  
 # To start lam daemon  
 #   /s/local/1/cnh/usr/local/pkg/lammpi/lam-7.0.3/lahey/bin/lamboot  -c /s/local/1/cnh/usr/local/pkg/lammpi/lam-7.0.3/lahey/etc/lam-conf.lamd -v -d  
 #  NB - for starting daemon you need "lamd" in your search path  

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.22