Changeset fb0d416 in flexpart.git for src/mpi_mod.f90
- Timestamp:
- Apr 20, 2015, 10:35:26 AM (9 years ago)
- Branches:
- master, 10.4.1_pesei, GFS_025, bugfixes+enhancements, dev, release-10, release-10.4.1, scaling-bug, univie
- Children:
- 5f42c27
- Parents:
- b5d0e7e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mpi_mod.f90
r5f9d14a rfb0d416 90 90 integer :: tm1 91 91 integer, parameter :: nvar_async=27 !29 :DBG: 92 92 !integer, dimension(:), allocatable :: tags 93 93 integer, dimension(:), allocatable :: reqs 94 94 … … 1243 1243 1244 1244 do dest=0,mp_np-1 ! mp_np-2 will also work if last proc reserved for reading 1245 1245 ! TODO: use mp_partgroup_np here 1246 1246 if (dest.eq.id_read) cycle 1247 1247 i=dest*nvar_async … … 1339 1339 &MPI_COMM_WORLD,reqs(i),mp_ierr) 1340 1340 if (mp_ierr /= 0) goto 600 1341 1342 1341 ! else 1342 ! i=i+2 1343 1343 end if 1344 1344 … … 1389 1389 1390 1390 ! :TODO: don't need these 1391 1392 1393 1394 1391 ! d3s1=d3_size1 1392 ! d3s2=d3_size2 1393 ! d2s1=d2_size1 1394 ! d2s2=d2_size2 1395 1395 1396 1396 ! At the time this immediate receive is posted, memstat is the state of … … 1593 1593 call MPI_Waitall(n_req,reqs,MPI_STATUSES_IGNORE,mp_ierr) 1594 1594 ! endif 1595 1596 1597 1598 1599 1600 1601 1602 1603 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 1604 1604 1605 1605 if (mp_ierr /= 0) goto 600 … … 1909 1909 !*********************************************************************** 1910 1910 1911 if (mp_measure_time) then1911 IF (mp_measure_time) THEN 1912 1912 do ip=0, mp_np-1 1913 1913 call MPI_BARRIER(MPI_COMM_WORLD, mp_ierr) … … 1962 1962 end if 1963 1963 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 1964 1975 ! j=mp_pid*nvar_async 1965 1976 ! In the implementation with 3 fields, the processes may have posted 1966 1977 ! MPI_Irecv requests that should be cancelled here 1967 1978 !! TODO: 1968 1969 1970 1971 1972 1973 1974 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 1975 1986 1976 1987 call MPI_FINALIZE(mp_ierr) … … 1981 1992 1982 1993 1983 end subroutine mpif_finalize1984 1985 1986 subroutine get_lun(my_lun)1994 end subroutine mpif_finalize 1995 1996 1997 subroutine get_lun(my_lun) 1987 1998 !*********************************************************************** 1988 1999 ! get_lun: … … 1990 2001 !*********************************************************************** 1991 2002 1992 implicit none1993 1994 integer, intent(inout) :: my_lun1995 integer, save :: free_lun=1001996 logical :: exists, iopen1997 1998 !*********************************************************************** 1999 2000 loop1: do2001 inquire(UNIT=free_lun, EXIST=exists, OPENED=iopen)2002 if (exists .and. .not.iopen) exit loop12003 free_lun = free_lun+12004 end do loop12005 my_lun = free_lun2006 2007 end subroutine get_lun2008 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) 2011 2022 !*********************************************************************** 2012 2023 ! Write one-dimensional arrays to disk (for debugging purposes) 2013 2024 !*********************************************************************** 2014 implicit none2015 2016 real, intent(in), dimension(:) :: array_in2017 integer, intent(in) :: tstep2018 integer :: lios2019 character(LEN=*), intent(in) :: ident, array_name2020 2021 character(LEN=8) :: c_ts2022 character(LEN=40) :: fn_1, fn_22023 2024 !*********************************************************************** 2025 2026 write(c_ts, FMT='(I8.8,BZ)') tstep2027 fn_1='-'//trim(adjustl(c_ts))//'-'//trim(ident)2028 write(c_ts, FMT='(I2.2,BZ)') mp_np2029 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_in2035 close(UNIT=dat_lun)2036 2037 end subroutine write_data_dbg2025 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 2038 2049 2039 2050
Note: See TracChangeset
for help on using the changeset viewer.