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.
lbc_lnk_multi_generic.h90 in NEMO/branches/2018/dev_r9759_HPC09_ESIWACE/src/OCE/LBC – NEMO

source: NEMO/branches/2018/dev_r9759_HPC09_ESIWACE/src/OCE/LBC/lbc_lnk_multi_generic.h90 @ 10136

Last change on this file since 10136 was 10136, checked in by dguibert, 6 years ago

bull: async/datatype

Experimental changes to enable/study/bench various mpi "optimisations":

  • BULL_ASYNC
  • BULL_DATATYPE_VECTOR/SUBARRAY

this has been applied to the nonosc subroutine (only for now).

  • Property svn:mime-type set to text/x-fortran
File size: 5.4 KB
Line 
1#if defined DIM_2d
2#   define ARRAY_TYPE(i,j,k,l)   REAL(wp), DIMENSION(i,j)
3#   define PTR_TYPE              TYPE(PTR_2D)
4#   define PTR_ptab              pt2d
5#endif
6#if defined DIM_3d
7#   define ARRAY_TYPE(i,j,k,l)   REAL(wp), DIMENSION(i,j,k)
8#   define PTR_TYPE              TYPE(PTR_3D)
9#   define PTR_ptab              pt3d
10#endif
11#if defined DIM_4d
12#   define ARRAY_TYPE(i,j,k,l)   REAL(wp), DIMENSION(i,j,k,l)
13#   define PTR_TYPE              TYPE(PTR_4D)
14#   define PTR_ptab              pt4d
15#endif
16#if defined ASYNC
17   SUBROUTINE ROUTINE_MULTI( rname, loop_fct &
18                           , pt1, cdna1, psgn1, pt2, cdna2, psgn2, pt3, cdna3, psgn3   &
19      &                    , pt4, cdna4, psgn4, pt5, cdna5, psgn5, pt6, cdna6, psgn6   &
20      &                    , pt7, cdna7, psgn7, pt8, cdna8, psgn8, pt9, cdna9, psgn9, cd_mpp, pval)
21#else
22   SUBROUTINE ROUTINE_MULTI( rname, pt1, cdna1, psgn1, pt2, cdna2, psgn2, pt3, cdna3, psgn3   &
23      &                    , pt4, cdna4, psgn4, pt5, cdna5, psgn5, pt6, cdna6, psgn6   &
24      &                    , pt7, cdna7, psgn7, pt8, cdna8, psgn8, pt9, cdna9, psgn9, cd_mpp, pval)
25#endif
26      !!---------------------------------------------------------------------
27      ARRAY_TYPE(:,:,:,:)          , TARGET, INTENT(inout) ::   pt1     ! arrays on which the lbc is applied
28      ARRAY_TYPE(:,:,:,:), OPTIONAL, TARGET, INTENT(inout) ::   pt2  ,  pt3  , pt4  , pt5  , pt6  , pt7  , pt8  , pt9
29      CHARACTER(len=1)                     , INTENT(in   ) ::   cdna1   ! nature of pt2D. array grid-points
30      CHARACTER(len=1)   , OPTIONAL        , INTENT(in   ) ::   cdna2,  cdna3, cdna4, cdna5, cdna6, cdna7, cdna8, cdna9
31      REAL(wp)                             , INTENT(in   ) ::   psgn1   ! sign used across the north fold
32      REAL(wp)           , OPTIONAL        , INTENT(in   ) ::   psgn2,  psgn3, psgn4, psgn5, psgn6, psgn7, psgn8, psgn9   
33      CHARACTER(len=3)   , OPTIONAL        , INTENT(in   ) ::   cd_mpp  ! fill the overlap area only
34      REAL(wp)           , OPTIONAL        , INTENT(in   ) ::   pval    ! background value (used at closed boundaries)
35#ifdef ASYNC
36      interface
37        subroutine loop_fct(i0, i1, j0, j1, k0, k1, buf)
38          integer, intent(in) :: i0, i1, j0, j1, k0, k1
39          REAL*8, dimension(:,:,:,:,:,:), optional, intent(out) :: buf
40        end subroutine loop_fct
41      end interface
42#endif
43      !!
44      INTEGER                         ::   kfld        ! number of elements that will be attributed
45      PTR_TYPE         , DIMENSION(9) ::   ptab_ptr    ! pointer array
46      CHARACTER(len=1) , DIMENSION(9) ::   cdna_ptr    ! nature of ptab_ptr grid-points
47      REAL(wp)         , DIMENSION(9) ::   psgn_ptr    ! sign used across the north fold boundary
48      CHARACTER(len=*),             INTENT(in   ) ::   rname       ! name of the calling subroutine
49      !!---------------------------------------------------------------------
50      !
51      kfld = 0          ! initial array of pointer size
52      !
53      !                 ! Load the first array
54      CALL ROUTINE_LOAD( pt1, cdna1, psgn1, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
55      !
56      !                 ! Look if more arrays are added
57      IF( PRESENT(psgn2) )   CALL ROUTINE_LOAD( pt2, cdna2, psgn2, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
58      IF( PRESENT(psgn3) )   CALL ROUTINE_LOAD( pt3, cdna3, psgn3, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
59      IF( PRESENT(psgn4) )   CALL ROUTINE_LOAD( pt4, cdna4, psgn4, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
60      IF( PRESENT(psgn5) )   CALL ROUTINE_LOAD( pt5, cdna5, psgn5, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
61      IF( PRESENT(psgn6) )   CALL ROUTINE_LOAD( pt6, cdna6, psgn6, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
62      IF( PRESENT(psgn7) )   CALL ROUTINE_LOAD( pt7, cdna7, psgn7, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
63      IF( PRESENT(psgn8) )   CALL ROUTINE_LOAD( pt8, cdna8, psgn8, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
64      IF( PRESENT(psgn9) )   CALL ROUTINE_LOAD( pt9, cdna9, psgn9, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
65      !
66#ifdef ASYNC
67      CALL lbc_lnk_ptr_async( rname, ptab_ptr, cdna_ptr, psgn_ptr, loop_fct, kfld, cd_mpp, pval )
68#else
69      CALL lbc_lnk_ptr( rname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, cd_mpp, pval )
70#endif
71      !
72   END SUBROUTINE ROUTINE_MULTI
73
74
75   SUBROUTINE ROUTINE_LOAD( ptab, cdna, psgn, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
76      !!---------------------------------------------------------------------
77      ARRAY_TYPE(:,:,:,:)   , TARGET, INTENT(inout) ::   ptab       ! arrays on which the lbc is applied
78      CHARACTER(len=1)              , INTENT(in   ) ::   cdna       ! nature of pt2d array grid-points
79      REAL(wp)                      , INTENT(in   ) ::   psgn       ! sign used across the north fold boundary
80      PTR_TYPE        , DIMENSION(:), INTENT(inout) ::   ptab_ptr   ! array of pointers
81      CHARACTER(len=1), DIMENSION(:), INTENT(inout) ::   cdna_ptr   ! nature of pt2d_array array grid-points
82      REAL(wp)        , DIMENSION(:), INTENT(inout) ::   psgn_ptr   ! sign used across the north fold boundary
83      INTEGER                       , INTENT(inout) ::   kfld       ! number of elements that has been attributed
84      !!---------------------------------------------------------------------
85      !
86      kfld                    =  kfld + 1
87      ptab_ptr(kfld)%PTR_ptab => ptab
88      cdna_ptr(kfld)          =  cdna
89      psgn_ptr(kfld)          =  psgn
90      !
91   END SUBROUTINE ROUTINE_LOAD
92#undef ARRAY_TYPE
93#undef PTR_TYPE
94#undef PTR_ptab
Note: See TracBrowser for help on using the repository browser.