Changeset 2498

Timestamp:
2015-01-29T10:57:27+01:00 (9 years ago)
Author:
pascal.maugis
Message:

variables.awk
# . multi-line commands are gathered up-stream, and flushed downstream => we work on commmands instead of lines
# . Strings '\n' in input are replaced by '\_n' to protect them from being interpreted by `gawk' on output
# . switch hard-coded options to on-line optional variables "comm", "cppkeep" and "keepif"
# . handle "!$OMP THREADPRIVATE" directives with variable names, moving them to global also

subroutines.awk
# . Multi-line commands are gathered up-stream, and flushed downstream => work on commmands instead of lines
# . _subinit and _subnoni new routines get back their original name ; but new names are created and saved
# for future use.
# . Use a regexp to detect calls to known functions and sub.
# . Switch hard-coded options to on-line optional variables "comm", "cppkeep" and "keepif"
# . Allow nested subroutines (ex. histwrite_r2d_p() in ioipsl_para module) without accounting for them
# . Treat !$OMP directives as non-void lines (but not as commands)
# This allows otherwise void routines (i.e. routine barrier2_omp) to be eligible as init. and non-init.
# . Ignore nested sub.
# . Interpret "CALL ipslerr" and "CALL ipslerr_p" as ending a phase

calls.awk
# . Management of INTERFACEd procedures
# . Detect crossings between call chains
# . Detect calls to sub. belonging to the wrong init./non-init. sequence in the calling trees
# . Identify clearing call-trees, and check if autonomous or called during non-init.
# . Identify drivers and account for those prescribed
# . Replace routines and functions when necessary, and replace also their calls
# . Switch hard-coded options to on-line optional variables "comm", "cppkeep" and "keepif"
# . Manage drivers that have no explicit block
# . Allow exploring the calling tree without developping twice already explored sub-branches
# . Calls to multiple functions during tree exploration, be it after of before going deeper in the tree
# . Identify chains that have (de)allocation ;
# Calls to root init. routines that have no (de)allocation down-tree trigger no error anymore

*.f90 :
Respecter les contraintes liées à l'assimilation adjointe
---------------------------------------------------------
* hydrol

remplacer les usages 'first_call' de hydrol_waterbal() et hydrol_alma() par 'l_first_hydrol'

(global var.) dans hydrol_waterbal() et hydrol_alma(), les retirer des paramètres d'appel et
et en retirer les définitions ; mettre en cohérence avec leurs appels depuis hydrol_main()
N.B. les 'first_call' de hydrol_waterbal() and hydrol_alma() ne contrôlent pas des (DE)ALLOCATE
=> les blocs associés peuvent être ignorés de la phase init.

* hydrolc

renommer 'l_first_hydrol' en 'l_first_hydrolc' avec attribut SAVE
renommer 'firstcall' de hydrolc_hdiff() en 'l_first_hdiff'
remplacer les usages 'first_call' de hydrolc_waterbal() et hydrolc_alma() par 'l_first_hydrolc'

(global var.) dans hydrolc_waterbal() et hydrolc_alma(), les retirer des paramètres d'appel et
et en retirer les définitions ; mettre en cohérence avec leurs appels depuis hydrolc_main()
N.B. les 'first_call' de hydrolc_waterbal() and hydrolc_alma() ne contrôlent pas des (DE)ALLOCATE
=> les blocs associés peuvent être ignorées de la phase init.

Remettre le 'firstcall' de hydrolc_hdiff() à .TRUE. dans hydrolc_clear()

* intersurf

Appeler depuis les 3 intersurf() la watchout_init()

pour allouer les variables locales de watchout_write_p()

Créer une routine intersurf_clear() PUBLIC

y remettre le 'l_first_intersurf' à .TRUE. en cas de restart

* routing

renommer le 'firstcall' de routing_waterbal() 'l_first_waterbalr' avec attribut SAVE
routing_flow() : (DE)ALLOCATE hors phase init :

fast_flow_g, slow_flow_g, stream_flow_g
irrig_deficit_glo, stream_reservoir_glo, irrig_adduct_glo
=> mettre ces variables en global (THREADPRIVATE ?)

+ déplacer ALLOCATE dans routing_init() + déplacer DEALLOCATE dans _clear()

* slowproc

slowproc_update() fait des (DE)ALLOCATE hors phase non-init. (il est appellé après le RETURN de l_first_slowproc)

itau, lat_lu, lon-lu,vegmap, vegmap_1, lat_ful, lon_ful, sub_area, sub_index, mask
de dimensions (iml,jml,nvm,nbpt,nbvmax) et d'ordre variables en fonction de l'utilisation
de slowproc_interlai_OLD() ou de slowproc_interlai_NEW() -> impossible de les mettre toutes en global !
Fait un équivalent de REALLOCATE pour sub_area et sub_index
=> Renommer ces variables, dont le nom est utilisé en local par les autres routines

+ les mettre en global
+ Créer des petits blocs l_first 'l_first_slowproc' autour des ALLOCATE

(nécessaire plutôt que les déplacer dans slowproc_init(), car besoin des dimensions)

Déplacer hors boucle pour sub_area et sub_index, mais comme nbvmax*2 à chaque coup,

on limite à un nb d'itérations maximum et on produit une erreur si dépassée)

+ déplacer les DEALLOCATE dans _clear()

* thermosoil

thermosoil_diaglev() : elle est appelée aussi bien en init. par thermosoil_var_init()

qu'en non-init. par thermosoil_profile().
=> faire un bloc 'l_first_diaglev' (var. à créer en global SAVE)
=> y mettre les ALLOC/DEALLOC
=> remplacer "IF ( .NOT. ALLOCATED(intfact))" par "IF (l_first_diaglev)"
=> insérer un "l_first_diaglev = .TRUE." dans thermosoil_clear()

* watchout

Placer "IMPLICIT NONE" avant "PRIVATE"
renommer le 'is_first_time' global par 'l_first_watchout'
insérer un 'IMPLICIT NONE' avant les déclarations des variables globales
Créer une routine watchout_clear() PUBLIC avec "l_first_watchout = .TRUE."

et la faire appeler par intersurf_clear()

watchout_init() : (DE)ALLOCATE tmpdata(:,:)

=> mettre tmpdata en global (THREADPRIVATE ?)

+ ALLOCATE tmpdata
+ déplacer DEALLOCATE(tmpdata) dans _clear()

watchout_write() : (DE)ALLOCATE hors phase init

tmpdata(igmax)
=> mettre tmpdata (renommé en tmpdata2) en global

+ ALLOCATE dans un nouveau block l_first_watchout
+ déplacer DEALLOCATE(tmpdata) dans _clear()
+ mettre un premier appel à watchout_write() dans watchout_write_p() pour l'intégrer dans la phase
d'initialisation + clore la phase init. par un RETURN

* lpj_establish

renommer le 'firstcall' global en 'firstcall_establish'

* lpj_fire

renommer le 'firstcall' global en 'firstcall_fire'

* lpj_gap

renommer le 'firstcall' global en 'firstcall_gap'

* lpj_light

renommer le 'firstcall' global en 'firstcall_gap'

* lpj_pftinout

renommer le 'firstcall' global en 'firstcall_pftinout'

* stomate

stomate_main() : (DE/)ALLOCATE hors phase init :

soilcarbon_input_g, control_moist_g, control_temp_g, npp_equil_g
ok_equilibrium_g (DEALLOCATE déjà dans _clear())
=> mettre en global + déplacer les 4 premières en phase init. dans les bons tests

+ déplacer les Dealloc dans _clear()

Appeler depuis stomate_init() la nouvelle routine season_init()

pour allouer les variables locales de season()

* stomate_alloc

renommer le 'firstcall' global en 'firstcall_alloc'

* stomate_io

renommer le 'firstcall' global en 'firstcall_stomateio'

* stomate_litter

renommer 'firstcall' en 'firstcall_litter'

* stomate_lpj

Mettre "firstcall_lpj = .TRUE." dans StomateLpj_clear(), car il n'est réinitialisé nulle part.

(pas grave car pas de partie init.)

* stomate_npp

renommer le 'firstcall' global en 'firstcall_stomateio'

* stomate_phenology

renommer 'firstcall' en 'firstcall_pheno'

* stomate_prescribe

renommer 'firstcall' en 'firstcall_prescribe'
dans prescribe(), mettre "firstcall_prescribe=.FALSE." de façon inconditionnelle

* stomate_resp

renommer 'firstcall' en 'firstcall_resp'
maint_respiration_clear() n'est jamais appelée (!) => le faire depuis stomate_clear()

* stomate_season

renommer 'firstcall' en 'firstcall_season'
Créer une routine season_init() PUBLIC, appellée par stomate_init()

=> mettre cloud en global (THREADPRIVATE ?)

+ ALLOCATE cloud
+ déplacer DEALLOCATE(cloud) dans _clear()

* stomate_soilcarbon

renommer 'firstcall' en 'firstcall_soilcarbon'

* stomate_turnover

renommer 'firstcall' en 'firstcall_turnover'

* stomate_vmax

renommer 'firstcall' en 'firstcall_vmax'

(No files)

Note: See TracChangeset for help on using the changeset viewer.