Changeset fb0d416 in flexpart.git for src/mpi_mod.f90


Ignore:
Timestamp:
Apr 20, 2015, 10:35:26 AM (9 years ago)
Author:
Espen Sollum ATMOS <eso@…>
Branches:
master, 10.4.1_pesei, GFS_025, bugfixes+enhancements, dev, release-10, release-10.4.1, scaling-bug, univie
Children:
5f42c27
Parents:
b5d0e7e
Message:

OH change suggested by Xuekun

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mpi_mod.f90

    r5f9d14a rfb0d416  
    9090  integer :: tm1
    9191  integer, parameter :: nvar_async=27 !29 :DBG:
    92   !integer, dimension(:), allocatable :: tags
     92!integer, dimension(:), allocatable :: tags
    9393  integer, dimension(:), allocatable :: reqs
    9494
     
    12431243
    12441244    do dest=0,mp_np-1 ! mp_np-2 will also work if last proc reserved for reading
    1245                       ! TODO: use mp_partgroup_np here
     1245! TODO: use mp_partgroup_np here
    12461246      if (dest.eq.id_read) cycle
    12471247      i=dest*nvar_async
     
    13391339             &MPI_COMM_WORLD,reqs(i),mp_ierr)
    13401340        if (mp_ierr /= 0) goto 600
    1341       ! else
    1342       !   i=i+2
     1341! else
     1342!   i=i+2
    13431343      end if
    13441344
     
    13891389
    13901390! :TODO: don't need these
    1391     ! d3s1=d3_size1
    1392     ! d3s2=d3_size2
    1393     ! d2s1=d2_size1
    1394     ! d2s2=d2_size2
     1391! d3s1=d3_size1
     1392! d3s2=d3_size2
     1393! d2s1=d2_size1
     1394! d2s2=d2_size2
    13951395
    13961396! At the time this immediate receive is posted, memstat is the state of
     
    15931593    call MPI_Waitall(n_req,reqs,MPI_STATUSES_IGNORE,mp_ierr)
    15941594!    endif
    1595     ! else
    1596     !   do i = 0, nvar_async*mp_np-1
    1597     !     if (mod(i,27).eq.0 .or. mod(i,28).eq.0) then
    1598     !       call MPI_Cancel(reqs(i),mp_ierr)
    1599     !       cycle
    1600     !     end if
    1601     !     call MPI_Wait(reqs(i),MPI_STATUS_IGNORE,mp_ierr)
    1602     !   end do
    1603     ! end if
     1595! else
     1596!   do i = 0, nvar_async*mp_np-1
     1597!     if (mod(i,27).eq.0 .or. mod(i,28).eq.0) then
     1598!       call MPI_Cancel(reqs(i),mp_ierr)
     1599!       cycle
     1600!     end if
     1601!     call MPI_Wait(reqs(i),MPI_STATUS_IGNORE,mp_ierr)
     1602!   end do
     1603! end if
    16041604
    16051605    if (mp_ierr /= 0) goto 600
     
    19091909!***********************************************************************
    19101910
    1911     if (mp_measure_time) then
     1911    IF (mp_measure_time) THEN
    19121912      do ip=0, mp_np-1
    19131913        call MPI_BARRIER(MPI_COMM_WORLD, mp_ierr)
     
    19621962    end if
    19631963
     1964! This call to barrier is for correctly formatting output
     1965    call MPI_BARRIER(MPI_COMM_WORLD, mp_ierr)
     1966
     1967    if (lroot) then
     1968      write(*,FMT='(72("#"))')
     1969      WRITE(*,*) "To turn off output of time measurements, set "
     1970      WRITE(*,*) "    mp_measure_time=.false."
     1971      WRITE(*,*) "in file mpi_mod.f90"
     1972      write(*,FMT='(72("#"))')
     1973    end if
     1974
    19641975! j=mp_pid*nvar_async
    19651976! In the implementation with 3 fields, the processes may have posted
    19661977! MPI_Irecv requests that should be cancelled here
    19671978!! TODO:
    1968     ! if (.not.lmp_sync) then
    1969     !   r=mp_pid*nvar_async
    1970     !   do j=r,r+nvar_async-1
    1971     !     call MPI_Cancel(j,mp_ierr)
    1972     !     if (mp_ierr /= 0) write(*,*) '#### mpif_finalize::MPI_Cancel> ERROR ####'
    1973     !   end do
    1974     ! end if
     1979! if (.not.lmp_sync) then
     1980!   r=mp_pid*nvar_async
     1981!   do j=r,r+nvar_async-1
     1982!     call MPI_Cancel(j,mp_ierr)
     1983!     if (mp_ierr /= 0) write(*,*) '#### mpif_finalize::MPI_Cancel> ERROR ####'
     1984!   end do
     1985! end if
    19751986
    19761987    call MPI_FINALIZE(mp_ierr)
     
    19811992
    19821993
    1983   end subroutine mpif_finalize
    1984 
    1985 
    1986   subroutine get_lun(my_lun)
     1994    end subroutine mpif_finalize
     1995
     1996
     1997    subroutine get_lun(my_lun)
    19871998!***********************************************************************
    19881999! get_lun:
     
    19902001!***********************************************************************
    19912002
    1992     implicit none
    1993 
    1994     integer, intent(inout) :: my_lun
    1995     integer, save :: free_lun=100
    1996     logical :: exists, iopen
    1997 
    1998 !***********************************************************************
    1999 
    2000     loop1: do
    2001       inquire(UNIT=free_lun, EXIST=exists, OPENED=iopen)
    2002       if (exists .and. .not.iopen) exit loop1
    2003       free_lun = free_lun+1
    2004     end do loop1
    2005     my_lun = free_lun
    2006 
    2007   end subroutine get_lun
    2008 
    2009 
    2010   subroutine write_data_dbg(array_in, array_name, tstep, ident)
     2003      implicit none
     2004
     2005      integer, intent(inout) :: my_lun
     2006      integer, save :: free_lun=100
     2007      logical :: exists, iopen
     2008
     2009!***********************************************************************
     2010
     2011      loop1: do
     2012        inquire(UNIT=free_lun, EXIST=exists, OPENED=iopen)
     2013        if (exists .and. .not.iopen) exit loop1
     2014        free_lun = free_lun+1
     2015      end do loop1
     2016      my_lun = free_lun
     2017
     2018    end subroutine get_lun
     2019
     2020
     2021    subroutine write_data_dbg(array_in, array_name, tstep, ident)
    20112022!***********************************************************************
    20122023! Write one-dimensional arrays to disk (for debugging purposes)
    20132024!***********************************************************************
    2014     implicit none
    2015 
    2016     real, intent(in), dimension(:) :: array_in
    2017     integer, intent(in) :: tstep
    2018     integer :: lios
    2019     character(LEN=*), intent(in) :: ident, array_name
    2020 
    2021     character(LEN=8) :: c_ts
    2022     character(LEN=40) :: fn_1, fn_2
    2023 
    2024 !***********************************************************************
    2025 
    2026     write(c_ts, FMT='(I8.8,BZ)') tstep
    2027     fn_1='-'//trim(adjustl(c_ts))//'-'//trim(ident)
    2028     write(c_ts, FMT='(I2.2,BZ)') mp_np
    2029     fn_2= trim(adjustl(array_name))//trim(adjustl(fn_1))//'-np'//trim(adjustl(c_ts))//'.dat'
    2030 
    2031     call get_lun(dat_lun)
    2032     open(UNIT=dat_lun, FILE=fn_2, IOSTAT=lios, ACTION='WRITE', &
    2033          FORM='UNFORMATTED', STATUS='REPLACE')
    2034     write(UNIT=dat_lun, IOSTAT=lios) array_in
    2035     close(UNIT=dat_lun)
    2036 
    2037   end subroutine write_data_dbg
     2025      implicit none
     2026
     2027      real, intent(in), dimension(:) :: array_in
     2028      integer, intent(in) :: tstep
     2029      integer :: lios
     2030      character(LEN=*), intent(in) :: ident, array_name
     2031
     2032      character(LEN=8) :: c_ts
     2033      character(LEN=40) :: fn_1, fn_2
     2034
     2035!***********************************************************************
     2036
     2037      write(c_ts, FMT='(I8.8,BZ)') tstep
     2038      fn_1='-'//trim(adjustl(c_ts))//'-'//trim(ident)
     2039      write(c_ts, FMT='(I2.2,BZ)') mp_np
     2040      fn_2= trim(adjustl(array_name))//trim(adjustl(fn_1))//'-np'//trim(adjustl(c_ts))//'.dat'
     2041
     2042      call get_lun(dat_lun)
     2043      open(UNIT=dat_lun, FILE=fn_2, IOSTAT=lios, ACTION='WRITE', &
     2044           FORM='UNFORMATTED', STATUS='REPLACE')
     2045      write(UNIT=dat_lun, IOSTAT=lios) array_in
     2046      close(UNIT=dat_lun)
     2047
     2048    end subroutine write_data_dbg
    20382049
    20392050
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG