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 @ 2529

Last change on this file since 2529 was 2040, checked in by clevy, 14 years ago

[NVTK scripts in INSTALL/JOBS update, see ticket:#697]

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