Ignore:
Timestamp:
Oct 25, 2013, 10:12:38 AM (11 years ago)
Author:
Ehouarn Millour
Message:

Getting XIOS to work in MPI, OpenMP and mixed MPI/OpenMP modes. Use "-io xios" option with makelmdz or makelmdz_fcm to enable XIOS (this doesn't deactivate IOIPSL outputs; to suppress IOIPSL outputs, add cpp flag CPP_NO_IOIPSL).
EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/bibio/wxios.F90

    r1852 r1897  
    121121        INTEGER :: xios_comm
    122122
    123         IF (prt_level >= 10) WRITE(lunout,*) "Xios. Initialization"
     123        IF (prt_level >= 10) WRITE(lunout,*) "wxios_init: Initialization"
    124124
    125125
    126126
    127127        IF (PRESENT(locom)) THEN
    128             IF (prt_level >= 10) WRITE(lunout,*) "Xios. ctx=",xios_ctx_name,"local_comm=",locom,",return_comm=",xios_comm
    129             CALL xios_initialize(xios_ctx_name, local_comm = locom, return_comm = xios_comm )
    130         ELSE
    131             IF (prt_level >= 10) WRITE(lunout,*) "Xios. ctx=",xios_ctx_name,"return_comm=",outcom
    132             CALL xios_initialize(xios_ctx_name, return_comm = xios_comm )
     128          CALL xios_initialize(xios_ctx_name, local_comm = locom, return_comm = xios_comm )
     129          IF (prt_level >= 10) WRITE(lunout,*) "wxios_init: ctx=",xios_ctx_name," local_comm=",locom,", return_comm=",xios_comm
     130        ELSE
     131          CALL xios_initialize(xios_ctx_name, return_comm = xios_comm )
     132          IF (prt_level >= 10) WRITE(lunout,*) "wxios_init: ctx=",xios_ctx_name," return_comm=",xios_comm
    133133        END IF
    134134       
    135135        IF (PRESENT(outcom)) THEN
    136              outcom = xios_comm
     136          outcom = xios_comm
     137          IF (prt_level >= 10) WRITE(lunout,*) "wxios_init: ctx=",xios_ctx_name," outcom=",outcom
    137138        END IF
    138139       
     
    157158        g_ctx = xios_ctx
    158159
    159         IF (prt_level >= 10) WRITE(lunout,*) "Xios. Current context is ", g_ctx_name
     160        IF (prt_level >= 10) WRITE(lunout,*) "wxios_context_init: Current context is ",trim(g_ctx_name)
    160161
    161162        !Une première analyse des héritages:
     
    191192            CASE('earth_360d')
    192193                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "D360")
    193                 IF (prt_level >= 10) WRITE(lunout,*) 'Xios. Calendrier terrestre a 360 jours/an'
     194                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 360 jours/an'
    194195            CASE('earth_365d')
    195196                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "NoLeap")
    196                 IF (prt_level >= 10) WRITE(lunout,*) 'Xios. Calendrier terrestre a 365 jours/an'
     197                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 365 jours/an'
    197198            CASE('earth_366d')
    198199                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "Gregorian")
    199                 IF (prt_level >= 10) WRITE(lunout,*) 'Xios. Calendrier gregorien'
     200                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier gregorien'
    200201            CASE DEFAULT
    201                 abort_message = 'Xios. Mauvais choix de calendrier'
     202                abort_message = 'wxios_set_cal: Mauvais choix de calendrier'
    202203                CALL abort_gcm('Gcm:Xios',abort_message,1)
    203204        END SELECT
     
    206207        WRITE(date, "(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") annee, mois, jour
    207208       
    208         IF (prt_level >= 10) WRITE(lunout,*) "Xios. Initial time: ", date
     209        IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Initial time: ", date
    209210       
    210211        CALL xios_set_context_attr_hdl(g_ctx, start_date= date)
     
    212213        !Et enfin,le pas de temps:
    213214        CALL xios_set_timestep(mdtime)
    214         IF (prt_level >= 10) WRITE(lunout,*) "Xios. ts=",mdtime
     215        IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: ts=",mdtime
    215216    END SUBROUTINE wxios_set_cal
    216217
     
    230231                                    ibegin, iend, ii_begin, ii_end, jbegin, jend,       &
    231232                                    data_ni, data_ibegin, data_iend,                    &
    232                                     io_lat, io_lon)
     233                                    io_lat, io_lon,is_south_pole,mpi_rank)
    233234         
    234         IMPLICIT NONE
    235         INCLUDE 'iniprint.h'
    236 
    237         CHARACTER (len=*), INTENT(IN) :: dom_id
    238         LOGICAL, INTENT(IN) :: is_sequential
    239         INTEGER, INTENT(IN) :: ni, nj, ni_glo, nj_glo, ibegin, iend, ii_begin, ii_end, jbegin, jend
    240         INTEGER, INTENT(IN) :: data_ni, data_ibegin, data_iend
    241         REAL, DIMENSION(:) :: io_lat, io_lon
    242        
     235
     236        IMPLICIT NONE
     237        INCLUDE 'iniprint.h'
     238
     239        CHARACTER(len=*),INTENT(IN) :: dom_id ! domain identifier
     240        LOGICAL,INTENT(IN) :: is_sequential ! flag
     241        INTEGER,INTENT(IN) :: ni ! local MPI domain number of longitudes
     242        INTEGER,INTENT(IN) :: nj ! local MPI domain number of latitudes
     243        INTEGER,INTENT(IN) :: ni_glo ! global grid number of longitudes
     244        INTEGER,INTENT(IN) :: nj_glo ! global grid number of latitudes
     245        INTEGER,INTENT(IN) :: ibegin ! start index, on global grid, of local MPI domain
     246        INTEGER,INTENT(IN) :: iend ! end index, on global grid, of local MPI domain
     247        INTEGER,INTENT(IN) :: ii_begin ! i index at which local data starts (first row)
     248        INTEGER,INTENT(IN) :: ii_end ! i index at which local data ends (last row)
     249        INTEGER,INTENT(IN) :: jbegin ! start index, on global grid, of local MPI domain
     250        INTEGER,INTENT(IN) :: jend ! end index, on global grid, of local MPI domain
     251        INTEGER,INTENT(IN) :: data_ni
     252        INTEGER,INTENT(IN) :: data_ibegin
     253        INTEGER,INTENT(IN) :: data_iend
     254        REAL,INTENT(IN) :: io_lat(:) ! latitudes (of global grid)
     255        REAL,INTENT(IN) :: io_lon(:) ! longitudes (of global grid)
     256        logical,intent(in) :: is_south_pole ! does this process include the south pole?
     257        integer,intent(in) :: mpi_rank ! rank of process
    243258       
    244259        TYPE(xios_domain) :: dom
     
    251266        CALL xios_get_domain_handle(dom_id, dom)
    252267       
    253         IF (prt_level >= 10) WRITE(lunout,*) "Xios. ni:",ni," ni_glo:", ni_glo, " nj:", nj, " nj_glo:", nj_glo
    254         IF (prt_level >= 10) WRITE(lunout,*) "Xios. ibegin:",ibegin," iend:", iend, " jbegin:", jbegin, " jend:", jend
    255         IF (prt_level >= 10) WRITE(lunout,*) "Xios. Size lon:", SIZE(io_lon(ibegin:iend)), " lat:", SIZE(io_lat(jbegin:jend))
     268        IF (prt_level >= 10) THEN
     269          WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ni:",ni," ni_glo:", ni_glo, " nj:", nj, " nj_glo:", nj_glo
     270          WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ibegin:",ibegin," iend:", iend, " jbegin:", jbegin, " jend:", jend
     271          WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ii_begin:",ii_begin," ii_end:", ii_end
     272          WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," Size io_lon:", SIZE(io_lon(ibegin:iend)), " io_lat:", SIZE(io_lat(jbegin:jend))
     273        ENDIF
    256274       
    257275        !On parametrise le domaine:
     
    262280        IF (.NOT.is_sequential) THEN
    263281            mask(:,:)=.TRUE.
    264             mask(1:ii_begin-1,1) = .FALSE.
    265             mask(ii_end+1:ni,nj) = .FALSE.
    266             IF (prt_level >= 10) WRITE(lunout,*) "Xios. mask"
    267             !CALL xios_set_domain_attr_hdl(dom, mask=mask)
     282            if (ii_begin>1) mask(1:ii_begin-1,1) = .FALSE.
     283            if (ii_end<ni) mask(ii_end+1:ni,nj) = .FALSE.
     284            ! special case for south pole
     285            if ((ii_end.eq.1).and.(is_south_pole)) mask(1:ni,nj)=.true.
     286            IF (prt_level >= 10) THEN
     287              WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,1)=",mask(:,1)
     288              WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,nj)=",mask(:,nj)
     289            ENDIF
     290            CALL xios_set_domain_attr_hdl(dom, mask=mask)
    268291        END IF
    269292
     
    271294        !Vérification:
    272295        IF (xios_is_valid_domain(dom_id)) THEN
    273             IF (prt_level >= 10) WRITE(lunout,*) "Xios. Domain initialized: ", dom_id, boool
    274         ELSE
    275             IF (prt_level >= 10) WRITE(lunout,*) "Xios. Invalid domain: ", dom_id
     296            IF (prt_level >= 10) WRITE(lunout,*) "wxios_domain_param: Domain initialized: ", trim(dom_id), boool
     297        ELSE
     298            IF (prt_level >= 10) WRITE(lunout,*) "wxios_domain_param: Invalid domain: ", trim(dom_id)
    276299        END IF
    277300    END SUBROUTINE wxios_domain_param
     
    307330        !Vérification:
    308331        IF (xios_is_valid_axis(TRIM(ADJUSTL(axis_id)))) THEN
    309             IF (prt_level >= 10) WRITE(lunout,*) "Xios. Axis created: ", TRIM(ADJUSTL(axis_id))
    310         ELSE
    311             WRITE(*,*) "Xios. Invalid axis: ", TRIM(ADJUSTL(axis_id))
     332            IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_vaxis: Axis created: ", TRIM(ADJUSTL(axis_id))
     333        ELSE
     334            WRITE(*,*) "wxios_add_vaxis: Invalid axis: ", TRIM(ADJUSTL(axis_id))
    312335        END IF
    313336
     
    344367       
    345368            IF (xios_is_valid_file("X"//fname)) THEN
    346                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. New file: ", "X"//fname
    347                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
     369                IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_file: New file: ", "X"//fname
     370                IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
    348371            ELSE
    349                 WRITE(*,*) "Xios. Error, invalid file: ", "X"//fname
    350                 WRITE(*,*) "Xios. output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
     372                WRITE(*,*) "wxios_add_file: Error, invalid file: ", "X"//trim(fname)
     373                WRITE(*,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
    351374            END IF
    352375        ELSE
    353             IF (prt_level >= 10) WRITE(lunout,*) "Xios. Fichier ", fname, " défini par XML."
     376            IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_file: File ",trim(fname), " défined using XML."
    354377                CALL xios_set_file_attr(fname, enabled=.TRUE.)
    355378        END IF
     
    360383    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    361384    SUBROUTINE wxios_add_field(fieldname, fieldgroup, fieldlongname, fieldunit)
    362         USE netcdf
     385        USE netcdf, only: nf90_fill_real
    363386
    364387        IMPLICIT NONE
     
    385408        !On ajoute le champ:
    386409        CALL xios_add_field(fieldgroup, field, fieldname)
    387         !IF (prt_level >= 10) WRITE(lunout,*) "Xios. ",fieldname,fieldgroup, fieldlongname, fieldunit
     410        !IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_field: ",fieldname,fieldgroup, fieldlongname, fieldunit
    388411       
    389412        !On rentre ses paramètres:
    390413        CALL xios_set_field_attr_hdl(field, standard_name=fieldlongname, unit=newunit, default_value=def)
    391         IF (prt_level >= 10) WRITE(lunout,*) "Xios. Champ ", fieldname, "cree:"
    392         IF (prt_level >= 10) WRITE(lunout,*) "Xios. long_name=",fieldlongname,"; unit=",newunit,";  default_value=",nf90_fill_real
     414        IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_field: Field ",trim(fieldname), "cree:"
     415        IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_field: long_name=",trim(fieldlongname),"; unit=",trim(newunit),";  default_value=",nf90_fill_real
    393416
    394417    END SUBROUTINE wxios_add_field
     
    436459        IF (xios_is_valid_field(fieldname) .AND. .NOT. g_field_name == fieldname) THEN
    437460            !Si ce champ existe via XML (ie, dès le premier passage, ie g_field_name != fieldname) alors rien d'autre à faire
    438             IF (prt_level >= 10) WRITE(lunout,*) "Xios. Champ ", fieldname, "existe via XML"
     461            IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_field_to_file: Field ", trim(fieldname), "exists via XML"
    439462            g_flag_xml = .TRUE.
    440463            g_field_name = fieldname
     
    443466            !Si premier pssage et champ indéfini, alors on le créé
    444467
    445             IF (prt_level >= 10) WRITE(lunout,*) "Xios. Champ ", fieldname, "nexiste pas"
     468            IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_field_to_file: Field ", trim(fieldname), "does not exist"
    446469           
    447470            !On le créé:
    448471            CALL wxios_add_field(fieldname,  fieldgroup, fieldlongname, fieldunit)
    449472            IF (xios_is_valid_field(fieldname)) THEN
    450                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. Champ ", fieldname, "cree"
     473                IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_field_to_file: Field ", trim(fieldname), "created"
    451474            ENDIF
    452475
     
    472495            IF (fdim.EQ.2) THEN
    473496                !Si c'est un champ 2D:
    474                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. Champ 2D ", fieldname, " de ", "X"//fname ," configure:"
    475                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. op=", TRIM(ADJUSTL(operation))
    476                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. freq_op=1ts","; lvl=",field_level
     497                IF (prt_level >= 10) THEN
     498                  WRITE(lunout,*) "wxios_add_field_to_file: 2D Field ", trim(fieldname), " in ", "X"//trim(fname) ," configured with:"
     499                  WRITE(lunout,*) "wxios_add_field_to_file: op=", TRIM(ADJUSTL(operation))
     500                  WRITE(lunout,*) "wxios_add_field_to_file: freq_op=1ts","; lvl=",field_level
     501                ENDIF
    477502            ELSE
    478503                !Si 3D :
     
    480505                CALL xios_set_field_attr_hdl(field, axis_ref=TRIM(ADJUSTL(axis_id)))
    481506               
    482                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. Champ 3D ", fieldname, " de ", "X"//fname, "configure:"
    483                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. freq_op=1ts","; lvl=",field_level
    484                 IF (prt_level >= 10) WRITE(lunout,*) "Xios. axe=",TRIM(ADJUSTL(axis_id))
     507                IF (prt_level >= 10) THEN
     508                  WRITE(lunout,*) "wxios_add_field_to_file: 3D Field",trim(fieldname), " in ", "X"//trim(fname), "configured with:"
     509                  WRITE(lunout,*) "wxios_add_field_to_file: freq_op=1ts","; lvl=",field_level
     510                  WRITE(lunout,*) "wxios_add_field_to_file: axis=",TRIM(ADJUSTL(axis_id))
     511                ENDIF
    485512            END IF
    486513       
Note: See TracChangeset for help on using the changeset viewer.