Changeset 4226 for dynamico_lmdz


Ignore:
Timestamp:
Jan 10, 2020, 5:15:21 PM (5 years ago)
Author:
dubos
Message:

simple_physics : ensure F2003 compatibility (PGI Fortran)

Location:
dynamico_lmdz/simple_physics/phyparam
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • dynamico_lmdz/simple_physics/phyparam/Makefile

    r4225 r4226  
    1 # Examples (bash) :
     1# known to compile with gfortran version 7, ifort version 17, pgfortran version 18
     2# Examples
    23# clear ; make clean ;
    3 # F90=ifort FFLAGS=-fast time make -j
    4 # F90=gfortran F90FLAGS=-ffree-line-length-none gmake
    5 # known to compile with gfortran version 7, ifort version 17
     4# F90=ifort FFLAGS=-fast make
     5# F90=gfortran F90FLAGS=-ffree-line-length-none make
     6# F90=pgfortran F90FLAGS="-fast -Minfo=loop" make
    67
    78# if XCodeML F_Front is installed, set FFRONT=F_Front to parse code into XML
     
    1920clean :
    2021        rm -f obj/* include/* lib/* xml/*
     22        rmdir obj include lib xml
    2123
    2224%.so : $(OBJECTS)
    2325        $(F90) -shared $^ -o $@
    2426
     27obj/read_param_mod.o   : logging.o
     28obj/write_field_mod.o  : logging.o
    2529obj/convection.o       : logging.o
    2630obj/surface.o          : logging.o
  • dynamico_lmdz/simple_physics/phyparam/physics/logging.F90

    r4225 r4226  
    2424  END INTERFACE
    2525
    26 #ifdef XCODEML
    27   ! XCodeML cannot parse procedure pointers                                                                                                                                             
    2826
    29 #define default_flush_plugin flush_plugin
    30 #define default_log_gridpoint log_gridpoint_plugin
    31 
    32 #else
    33 
    34   ! This module provides a default implementation of flush_plugin but the top-level driver is welcome to override it.                                                                   
    35   PROCEDURE(plugin), POINTER :: flush_plugin => default_flush_plugin
    36 
    37   ! The top-level driver MUST provide an implementation for log_gridpoint_plugin                                                                                                         
     27  ! This module provides a default implementations of plugins but the top-level driver is welcome to override them. 
     28  ! Note F2003/F2008: pgfortran (F2003) accepts to initialize pointers only to NULL()
     29  ! => plugins are initialzed to NULL() and set to default values in flush_log and log_gridpoint
     30#ifndef XCODEML
     31  ! Note F2003/F2008: XCodeML cannot parse procedure pointers
     32  PROCEDURE(plugin), POINTER :: flush_plugin => NULL()
    3833  PROCEDURE(plugin_log_gridpoint), POINTER :: log_gridpoint_plugin => NULL()
    39 
    4034#endif
    4135
     
    5044
    5145  PUBLIC :: logging_buf, logging_bufsize, logging_lineno, flush_log, log_gridpoint, &
    52        flush_plugin, log_gridpoint_plugin
     46       flush_plugin, log_gridpoint_plugin, default_flush_plugin, &
     47       missing_plugin
    5348
    5449CONTAINS
     50
     51  SUBROUTINE missing_plugin(name, mod)
     52    CHARACTER(*), INTENT(IN) :: name, mod
     53    PRINT *, 'FATAL : plugin ', name, ' not provided by the driver program'
     54    PRINT *, '        see ', mod
     55    STOP
     56  END SUBROUTINE missing_plugin
    5557
    5658  SUBROUTINE flush_log(lev,tag)
    5759    INTEGER, INTENT(IN) :: lev
    5860    CHARACTER(*), INTENT(IN) :: tag
     61#ifndef XCODEML
     62    IF(.NOT.ASSOCIATED(flush_plugin)) flush_plugin => default_flush_plugin
    5963    IF(logging_lineno>0 .AND. lev<=max_log_level) CALL flush_plugin(lev, TRIM(tag), logging_buf(1:logging_lineno))
    6064    logging_lineno=0
     65#endif
    6166  END SUBROUTINE flush_log
    6267
     
    7681    INTEGER, INTENT(IN) :: index
    7782    logging_lineno = logging_lineno+1
     83#ifndef XCODEML
     84    IF(.NOT.ASSOCIATED(log_gridpoint_plugin)) log_gridpoint_plugin => default_log_gridpoint
    7885    CALL log_gridpoint_plugin(index, logging_buf(logging_lineno))
     86#endif
    7987  END SUBROUTINE log_gridpoint
    8088
  • dynamico_lmdz/simple_physics/phyparam/physics/read_param_mod.F90

    r4223 r4226  
    11MODULE read_param_mod
     2  USE logging, ONLY : missing_plugin
    23  IMPLICIT NONE
    34  PRIVATE
     
    3132  END INTERFACE
    3233
    33   PROCEDURE(plugin_read_paramr), POINTER :: read_paramr_plugin => read_paramr_unset
    34   PROCEDURE(plugin_read_parami), POINTER :: read_parami_plugin => read_parami_unset
    35   PROCEDURE(plugin_read_paramb), POINTER :: read_paramb_plugin => read_paramb_unset
     34#ifndef XCODEML
     35  ! Note compiler compatibility : see logging.F90
     36  PROCEDURE(plugin_read_paramr), POINTER :: read_paramr_plugin => NULL()
     37  PROCEDURE(plugin_read_parami), POINTER :: read_parami_plugin => NULL()
     38  PROCEDURE(plugin_read_paramb), POINTER :: read_paramb_plugin => NULL()
     39#endif
    3640
    3741  INTERFACE read_param
    38      PROCEDURE read_paramr_plugin, read_parami_plugin, read_paramb_plugin
     42     PROCEDURE read_paramr, read_parami, read_paramb
    3943  END INTERFACE read_param
    4044
     
    4347CONTAINS
    4448
    45   SUBROUTINE abort_unset(name)
    46     CHARACTER(*), INTENT(IN) :: name
    47     PRINT *, 'FATAL : plugin ', name, ' not provided by the driver program'
    48     PRINT *, '        see read_param_mod'
    49     STOP
    50   END SUBROUTINE abort_unset
    51 
    52   SUBROUTINE read_paramr_unset(name, defval, val, comment)
     49  SUBROUTINE read_paramr(name, defval, val, comment)
    5350    CHARACTER(*), INTENT(IN) :: name, comment
    5451    REAL, INTENT(IN)         :: defval
    5552    REAL, INTENT(OUT)        :: val
    56     CALL abort_unset('read_paramr')
    57   END SUBROUTINE read_paramr_unset
     53#ifndef XCODEML
     54    IF(.NOT.ASSOCIATED(read_paramr_plugin)) CALL missing_plugin('read_paramr','read_param_mod')
     55    CALL read_paramr_plugin(name, defval, val, comment)
     56#endif
     57  END SUBROUTINE read_paramr
    5858
    59   SUBROUTINE read_parami_unset(name, defval, val, comment)
     59  SUBROUTINE read_parami(name, defval, val, comment)
    6060    CHARACTER(*), INTENT(IN) :: name, comment
    6161    INTEGER, INTENT(IN)      :: defval
    6262    INTEGER, INTENT(OUT)     :: val
    63     CALL abort_unset('read_parami')
    64   END SUBROUTINE read_parami_unset
     63#ifndef XCODEML
     64    IF(.NOT.ASSOCIATED(read_parami_plugin)) CALL missing_plugin('read_parami','read_param_mod')
     65    CALL read_parami_plugin(name, defval, val, comment)
     66#endif
     67  END SUBROUTINE read_parami
    6568 
    66   SUBROUTINE read_paramb_unset(name, defval, val, comment)
     69  SUBROUTINE read_paramb(name, defval, val, comment)
    6770    CHARACTER(*), INTENT(IN) :: name, comment
    6871    LOGICAL, INTENT(IN)      :: defval
    6972    LOGICAL, INTENT(OUT)     :: val
    70     CALL abort_unset('read_paramb')
    71   END SUBROUTINE read_paramb_unset
     73#ifndef XCODEML
     74    IF(.NOT.ASSOCIATED(read_paramr_plugin)) CALL missing_plugin('read_paramb','read_param_mod')
     75    CALL read_paramb_plugin(name, defval, val, comment)
     76#endif
     77  END SUBROUTINE read_paramb
    7278 
    7379END MODULE read_param_mod
  • dynamico_lmdz/simple_physics/phyparam/physics/writefield_mod.F90

    r4223 r4226  
    11MODULE writefield_mod
     2  USE logging, ONLY : missing_plugin
    23  IMPLICIT NONE
    34  PRIVATE
     
    1516  END INTERFACE
    1617
    17   PROCEDURE(plugin_writefield1), POINTER :: writefield1_plugin => writefield1_unset
    18   PROCEDURE(plugin_writefield2), POINTER :: writefield2_plugin => writefield2_unset
    19 
     18#ifndef XCODEML
     19  PROCEDURE(plugin_writefield1), POINTER :: writefield1_plugin => NULL()
     20  PROCEDURE(plugin_writefield2), POINTER :: writefield2_plugin => NULL()
     21#endif
    2022  INTERFACE writefield
    21      PROCEDURE writefield1_plugin, writefield2_plugin
     23     PROCEDURE writefield1, writefield2
    2224  END INTERFACE writefield
    2325
     
    2628CONTAINS
    2729
    28   SUBROUTINE writefield2_unset(name, longname, unit, var)
     30  SUBROUTINE writefield2(name, longname, unit, var)
    2931    CHARACTER(*), INTENT(IN) :: name, longname, unit
    3032    REAL, INTENT(IN)         :: var(:,:)
    31     PRINT *, 'FATAL : plugin writefield2 not provided by the driver program'
    32     PRINT *, '        see writefield.F90'
    33     STOP
    34   END SUBROUTINE writefield2_unset
     33#ifndef XCODEML
     34    IF(ASSOCIATED(writefield2_plugin)) THEN
     35       CALL writefield2_plugin(name, longname, unit, var)
     36    ELSE
     37       CALL missing_plugin('writefield2','writefield_mod')
     38    END IF
     39#endif
     40  END SUBROUTINE writefield2
    3541
    36   SUBROUTINE writefield1_unset(name, longname, unit, var)
     42  SUBROUTINE writefield1(name, longname, unit, var)
    3743    CHARACTER(*), INTENT(IN) :: name, longname, unit
    3844    REAL, INTENT(IN)         :: var(:)
    39     PRINT *, 'FATAL : plugin writefield1 not provided by the driver program'
    40     PRINT *, '        see writefield.F90'
    41     STOP
    42   END SUBROUTINE writefield1_unset
     45#ifndef XCODEML
     46    IF(ASSOCIATED(writefield1_plugin)) THEN
     47       CALL writefield1_plugin(name, longname, unit, var)
     48    ELSE
     49       CALL missing_plugin('writefield1','writefield_mod')
     50    END IF
     51#endif
     52  END SUBROUTINE writefield1
    4353 
    4454END MODULE writefield_mod
Note: See TracChangeset for help on using the changeset viewer.