Ignore:
Timestamp:
Jul 5, 2007, 2:11:45 PM (17 years ago)
Author:
lsce
Message:

ACo + YM : amelioration de la gestion du buffer mpi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ4/trunk/libf/dyn3dpar/mod_hallo.F90

    r792 r807  
    22USE parallel
    33implicit none
    4 !  include 'mpif.h'
     4
    55  integer, parameter :: MaxRequest=200
    66  integer, parameter :: MaxProc=80
     
    1111 
    1212    real,save,pointer,dimension(:) :: Buffer
    13 !   pointer (Pbuffer,Buffer)
    14 !   real,dimension(:) :: Buffer
     13
    1514   integer,dimension(Listsize) :: Buffer_Pos
    1615   integer :: Index_Pos
     
    2625  type request_SR
    2726    integer :: NbRequest=0
    28 !    real,dimension(:),allocatable :: Buffer
    29 !    real,dimension(:),pointer :: Buffer
    3027    integer :: Pos
    3128    integer :: Index
     
    4340  contains
    4441
    45   subroutine Init_mod_hallo(MPI_Buffer)
     42  subroutine Init_mod_hallo
    4643    implicit none
    47     real,dimension(:),target :: MPI_BUFFER   
    48     integer i
     44
    4945    Index_Pos=1
    5046    Buffer_Pos(Index_Pos)=1
    51    
    52     Buffer=>MPI_Buffer
    5347    MaxBufferSize_Used=0
     48
     49    CALL create_global_mpi_buffer
     50   
    5451  end subroutine init_mod_hallo
     52
     53
     54  SUBROUTINE create_standard_mpi_buffer
     55  IMPLICIT NONE
     56   
     57    ALLOCATE(Buffer(MaxBufferSize))
     58   
     59  END SUBROUTINE create_standard_mpi_buffer
     60 
     61
     62  SUBROUTINE create_global_mpi_buffer
     63  IMPLICIT NONE
     64  INCLUDE 'mpif.h' 
     65    POINTER (Pbuffer,MPI_Buffer(MaxBufferSize))
     66    REAL :: MPI_Buffer
     67    INTEGER(KIND=MPI_ADDRESS_KIND) :: BS
     68    INTEGER :: i,ierr
     69
     70
     71      Bs=8*MaxBufferSize
     72      CALL MPI_ALLOC_MEM(BS,MPI_INFO_NULL,Pbuffer,ierr)
     73      DO i=1,MaxBufferSize
     74        MPI_Buffer(i)=i
     75      ENDDO
     76     
     77      CALL  Associate_buffer(MPI_Buffer)
     78     
     79  CONTAINS
     80     
     81     SUBROUTINE Associate_buffer(MPI_Buffer)
     82     IMPLICIT NONE
     83       REAL,DIMENSION(:),target :: MPI_Buffer 
     84
     85         Buffer=>MPI_Buffer
     86 
     87      END SUBROUTINE  Associate_buffer
     88                                     
     89  END SUBROUTINE create_global_mpi_buffer
     90
     91
    5592     
    5693  subroutine allocate_buffer(Size,Index,Pos)
Note: See TracChangeset for help on using the changeset viewer.