New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Makefile in trunk/NVTK – NEMO

source: trunk/NVTK/Makefile @ 1574

Last change on this file since 1574 was 1568, checked in by ctlod, 15 years ago

NVTK: improve it with new functionnality mainly for the developpers, see ticket: #506

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 10.0 KB
Line 
1# $Id$
2#####################################################################
3# Author : Claude Talandier for NEMO team
4# Contact : nemo_st@locean-ipsl.upmc.fr
5#
6# VARS TO SET: 9 + 1 (optional)
7#     - NAM_V             : name of the current test (associated to the same directory name)
8#     - LISTE_CONF        : configurations name (ORCA2_LIM, GYRE ...)
9#     - JOBS_2LAUN        : jobs to launch (nojob, all, long, short or gtime)
10#     - BUILD_MAKE        : run type (mon, mpi ... )
11#     - MAK_TIME          : to perform a CPU time check use keyword: 'timing' or 'notiming'
12#     - USE_IOMPUT        : use or not the new I/O interface
13#     - USE_IOSERVER      : use the I/O interface using the server possibility
14#     - NB_PROCS_IOSERVER : number of processors dedicated to the I/O server
15#     - MAK_MEMO          : to perform a memory check use keyword: 'memo' or 'nomemo'
16#     - REF_TAGV          : (optional) tag/experience name. If specified,
17#                           current results will be compare to the results
18#                           of this tag/experience (for a given configuration and run type)
19#
20# WORK: Allows to launch all the validation process, i.e.
21#     I.   to build dependencies use: > gmake -s dep
22#     II.  to launch compilation,simulation,final report use: > gmake
23#     III. to remove NetCDF output files of the NAM_V experience use: > gmake delf
24#
25#####################################################################
26SHELL = /bin/ksh
27#####################################################################
28##### Begin Users modifications
29#####################################################################
30#-
31#- Name of the test
32NAM_V = 2TEST
33#-
34#- Configurations list which must be tested
35LISTE_CONF = GYRE GYRE_LOBSTER ORCA2_LIM ORCA2_LIM3 ORCA2_LIM_PISCES ORCA2_OFF_PISCES
36#-
37#- Jobs to launch use keyword: nojob, all, long, short or gtime
38JOBS_2LAUN = all
39#-
40#- Compilation list type to perform, mon (mono) &/or mpi &/or omp (Open-MP)
41BUILD_MAKE = mon mpi
42#-
43#- Do we use the new io interface (iom_put)? With the io_server? On how many procs?
44USE_IOMPUT = false
45USE_IOSERVER = false
46NB_PROCS_IOSERVER = 1
47#-
48#- Proceed to a timing, use keyword: 'timing' or 'notiming'
49MAK_TIME = notiming
50#-
51#- Proceed to a memory check, use keyword: 'memo' or 'nomemo'
52MAK_MEMO = memo
53#-
54#- Experience name or reference Tag name (nemo_v2, nemo_v2_3 or nemo_v3)
55REF_TAGV = nemo_v3
56#-
57#####################################################################
58##### End Users modifications
59#####################################################################
60
61##
62all: $(LISTE_CONF)
63   @echo '      '
64   @echo '             ----->>>>>>>>>   Compilation process ended for configuration(s) :' $(LISTE_CONF)
65   @echo '      '
66
67#- Make good links & launch the compilation process
68$(LISTE_CONF):
69   @echo
70   @echo "CONFIGURATION :" $@
71   @( if [ ! -d ${NAM_V} ] ; then mkdir ${NAM_V} ;  fi ; )
72   @( cd ${NAM_V} ; MYREP_LIST=`( ls *.[Ffh]90 )` ; cd ../../$@/MY_SRC ; rm -rf *.[Ffh]90 ; \
73        if [ -n "$$MYREP_LIST" ] ; then ln -sf ../../NVTK/${NAM_V}/*.[Ffh]90 . ; fi ; )
74   @echo "test=" $(NAM_V) > ../$@/specifs.txt
75   @echo "runs=" $(BUILD_MAKE) >> ../$@/specifs.txt
76   @echo "time=" $(MAK_TIME) >> ../$@/specifs.txt
77   @echo "memo=" $(MAK_MEMO) >> ../$@/specifs.txt
78   @echo "tagname=" $(REF_TAGV) >> ../$@/specifs.txt
79   @echo `svn info ../../modeles/NEMO | grep URL` >> ../$@/specifs.txt
80   @echo `svn info ../../modeles/NEMO | grep Revision ` >> ../$@/specifs.txt
81   @( cd ${NAM_V} ; LSFILES=`( ls *.[Ffh]90 )` ; if [ -n "$$LSFILES" ] ; \
82     then echo $$LSFILES > ../../$@/f2test.txt ; else rm -f ../../$@/f2test.txt ; \
83          echo "  " >../../$@/f2test.txt ; fi ; )
84   @echo
85   @echo '             ----->>>>>>>>>   Links from NVTK/'${NAM_V} ' to '$@/MY_SRC 'done'
86   @echo
87   @echo '                              Build the Makefile for' $@ 'configuration'
88   @../../util/ins_make -w $@
89ifeq ($(USE_IOMPUT),true)
90   @../../util/ins_make -w XMLF90
91   @../../util/ins_make -w XMLIO_SERVER
92endif
93   @( cd ../$@/WORK ; grep P_P Makefile | head -1 > $$ ; LSCPPKEY=`( cut -c,6- $$ )` ; \
94          rm -f $$ ; if [ -n "$$LSCPPKEY" ] ; then echo $$LSCPPKEY >> ../f2test.txt ; fi ; )
95   @echo
96   @echo
97   @gmake -C ../$@ RUN='$(BUILD_MAKE)' JOB=$(JOBS_2LAUN) RTG=$(REF_TAGV) MKTE=$(MAK_TIME) MKMO=$(MAK_MEMO) REXP=$(NAM_V) USE_IOMPUT=$(USE_IOMPUT) USE_IOSERVER=$(USE_IOSERVER) NB_PROCS_IOSERVER=$(NB_PROCS_IOSERVER) -j 2 > $@_step.txt
98
99#- Rebuild dependencies when new cpp key and/or new module used
100dep: clear
101   @for conf in ${LISTE_CONF}; do \
102       echo ; \
103       echo ; \
104       echo ; \
105       echo '             ----->>>>>>>>> Rebuild dependencies for the' $$conf 'configuration' ; \
106       echo ; \
107       echo '                          > Build links from NVTK/'${NAM_V} ' to '$$conf'/MY_SRC directory :' ; \
108       echo ; \
109       cd ${NAM_V} ; \
110       MYREP_LIST=`( ls *.[Ffh]90 )` ; \
111            cd ../../$$conf/MY_SRC ; rm -rf *.[Ffh]90 ; \
112            if [ -n "$$MYREP_LIST" ] ; \
113            then for F in $$MYREP_LIST; do \
114            echo "                             # link from NVTK/"${NAM_V} "to "$$conf"/MY_SRC/$$F" ; \
115                   ln -sf  ../../NVTK/${NAM_V}/$$F . ; \
116                done ; fi ; \
117       echo ; \
118       echo ; \
119       echo '                          > Rebuild links in the '$$conf'/WORK directory:' ; \
120       echo ; \
121            cd ../WORK ; \
122       rm -rf `ls | fgrep -v -f .patron` ; \
123       check=`grep OPA_SRC .config`              ; \
124       if [ -n "$$check" ] ; then                   \
125           echo "                             # use OPA_SRC component files"                ; \
126           ln -sf ../../../modeles/NEMO/OPA_SRC/*.[Ffh]90          . ; \
127           ln -sf ../../../modeles/NEMO/OPA_SRC/*/*.[Ffh]90      . ; \
128            fi ; \
129       check=`grep LIM_SRC_2 .config`              ; \
130       if [ -n "$$check" ] ; then                   \
131           echo "                             # use LIM_SRC_2 component files"                ; \
132                ln -sf ../../../modeles/NEMO/LIM_SRC_2/*.[Ffh]90          . ; \
133            fi ; \
134       check=`grep LIM_SRC_3 .config`              ; \
135       if [ -n "$$check" ] ; then                   \
136           echo "                             # use LIM_SRC_3 component files"                ; \
137                ln -sf ../../../modeles/NEMO/LIM_SRC_3/*.[Ffh]90          . ; \
138            fi ; \
139       check=`grep NST_SRC .config`              ; \
140       if [ -n "$$check" ] ; then                   \
141           echo "                             # use NST_SRC component files"                ; \
142                \rm -rf agrif_opa_interp.F90           ; \
143                \rm -rf agrif_opa_sponge.F90           ; \
144                \rm -rf agrif_opa_update.F90           ; \
145                \rm -rf agrif_top_interp.F90           ; \
146                \rm -rf agrif_top_sponge.F90           ; \
147                \rm -rf agrif_top_update.F90           ; \
148                ln -sf ../../../modeles/NEMO/NST_SRC/*.[Ffh]90      .     ; \
149            fi ; \
150       check=`grep C1D_SRC .config`              ; \
151       if [ -n "$$check" ] ; then                   \
152           echo "                             # use C1D_SRC component files"                ; \
153                ln -sf ../../../modeles/NEMO/C1D_SRC/*.[Ffh]90          . ; \
154            fi ; \
155       check=`grep TOP_SRC .config`              ; \
156       if [ -n "$$check" ] ; then  \
157           echo "                             # use TOP_SRC component files"                ; \
158                \rm -rf trcstp.F90                      ; \
159                \rm -rf sms.F90                         ; \
160                \rm -rf trcini.F90                      ; \
161                ln -sf ../../../modeles/NEMO/TOP_SRC/*.[Ffh]90          . ; \
162                ln -sf ../../../modeles/NEMO/TOP_SRC/*/*.[Ffh]90      . ; \
163            fi ; \
164       check=`grep OFF_SRC .config`              ; \
165       if [ -n "$$check" ] ; then                   \
166           echo "                             # use OFF_SRC component files"                ; \
167                ln -sf ../../../modeles/NEMO/OFF_SRC/*.[Ffh]90          . ; \
168                ln -sf ../../../modeles/NEMO/OFF_SRC/*/*.[Ffh]90        . ; \
169            fi ; \
170       mn=`awk '{ print $$1 }' .config `  ; \
171            myrep=../../../config/$$mn/MY_SRC ; \
172       echo "                             # use MY_SRC component files"                ; \
173            for i in `ls $$myrep` ; do \
174              [ -f $$i ] && \rm -rf $$i ;\
175            done ; \
176            cd $$myrep ; \
177            myrep_list=`( ls *.[Ffh]90 )` ; \
178            cd ../WORK ; \
179            if [ -n "$$myrep_list" ] ; then \
180                for F in $$myrep_list; do \
181                   ln -sf  $$myrep/$$F . ; \
182                done ; \
183            fi ; \
184            cd .. ; ../NVTK/fait_AA_make ; \
185            cd WORK ; \
186            ls -1 | fgrep -v -f .patron >tmplist ; \
187            cp tmplist SRC_FILE_LIST.temp ; \
188       echo ; \
189       echo "                             #################################" ;\
190       echo "                             Dependencies for" $$conf "ready" ;\
191       echo "                             #################################" ;\
192       echo ;\
193            cd ../../NVTK ; \
194        done 
195   @echo
196   @echo "                             ##################################################" 
197   @echo "                             Launch the compilation and job process using gmake" 
198   @echo "                             ##################################################"
199   @echo
200
201clear :
202   @echo
203   @echo
204   @clear
205
206#- Delete NetCDF files for a given experience to save memory
207delf:
208   @for conf in ${LISTE_CONF}; do \
209       echo ; \
210       echo ; \
211       echo ; \
212       echo '             ----->>>>>>>>> Remove all' $$conf '*.nc output files for the' ${NAM_V} 'experience' ; \
213       echo ; \
214       echo ; \
215       for typer in ${BUILD_MAKE}; do \
216           rm -f DELFIL/NEMO_VALID/W$$conf/$$typer/LONG/${NAM_V}/*.nc     ; \
217           rm -f DELFIL/NEMO_VALID/W$$conf/$$typer/1_SHORT/${NAM_V}/*.nc  ; \
218           rm -f DELFIL/NEMO_VALID/W$$conf/$$typer/2_SHORT/${NAM_V}/*.nc  ; \
219      rm -f DELFIL/NEMO_VALID/W$$conf/$$typer/GTIME/${NAM_V}/*.nc    ; \
220       done ; \
221   done 
Note: See TracBrowser for help on using the repository browser.