Changeset fb0d416 in flexpart.git


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

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • README_PARALLEL.md

    rf9ce123 rfb0d416  
    11
    2                 FLEXPART VERSION 9.2.0 (MPI)
     2                FLEXPART VERSION 10.0 beta (MPI)
    33
    44Description
     
    6262  'numpart' are complemented by variables 'maxpart_mpi' and 'numpart_mpi'
    6363  which are the run-time determined number of particles per process, i.e,
    64   maxpart_mpi = maxpart/[number of processes]. The variable 'numpart'
     64  maxpart_mpi = maxpart/np, where np are the number of processes. The variable 'numpart'
    6565  is still used in the code, but redefined to mean 'number of particles
    6666  per MPI process'
     
    7979  But it is also possible that the
    8080  program will run even faster if the 4th process is participating in
    81   the calculation of particle trajectories. This will largely depend on
     81  the calculation of particle trajectories instead. This will largely depend on
    8282  the problem size (total number of particles in the simulation, resolution
    8383  of grids etc) and hardware being used (disk speed/buffering, memory
     
    173173    * Nested wind fields
    174174
    175  -The following will probably/possibly not work (untested/under developement):
     175 -The following will most probably not work (untested/under developement):
    176176
    177177    * Backward runs
  • options/RELEASES

    r5f9d14a rfb0d416  
    1616 ZKIND=     1,
    1717 MASS=  2.0000E8    ,
    18  PARTS=   2000000
     18 PARTS=   20000000
    1919 COMMENT="TEST1                          ",
    2020 /
     
    3232 ZKIND=     1,
    3333 MASS=  2.0000E8    ,
    34  PARTS=   2000000
     34 PARTS=   20000000
    3535 COMMENT="TEST2                          ",
    3636 /
  • src/FLEXPART_MPI.f90

    r2f8635b rfb0d416  
    336336  !******************************************************************
    337337
     338  if (mp_measure_time) call mpif_mtime('iotime',0)
     339! :DEV: was a bug here (all processes writing)?
     340  if (lroot) then ! MPI: this part root process only
     341
    338342  if (lnetcdfout.eq.1) then
    339343    call writeheader_netcdf(lnest=.false.)
     
    350354  endif
    351355
    352   if (lroot) then ! MPI: this part root process only
     356!
    353357    if (verbosity.gt.0) then
    354358      print*,'call writeheader'
     
    364368  end if ! (mpif_pid == 0)
    365369
     370  if (mp_measure_time) call mpif_mtime('iotime',0)
     371
    366372  !open(unitdates,file=path(2)(1:length(2))//'dates')
    367 
    368 !open(unitdates,file=path(2)(1:length(2))//'dates')
    369373
    370374  if (verbosity.gt.0 .and. lroot) then
  • src/getfields_mpi.f90

    r5f9d14a rfb0d416  
    4343!
    4444!  eso 2014:
    45 !    MPI version. 3 fields instead of 2, to allow reading the newest in
    46 !    the background.
    47 !    Only one process (lmpreader=.true.) does the actual reading, while the
    48 !    rest call this routine only to update memind, memstat etc.
     45!    MPI version.
     46!    If running with number of processes >= mpi_mod::read_grp_min,
     47!    only one process (mpi_mod::lmpreader=.true.) does the actual reading, while
     48!    the rest call this routine only to update memind, memstat etc.
     49!
     50!    If mpi_mod::lmp_sync=.true., uses 3 fields instead of 2, to allow reading
     51!    the newest in the background.
    4952!
    5053!    Return memstat, which is the sum of
     
    6164! indj                 indicates the number of the wind field to be read in  *
    6265! indmin               remembers the number of wind fields already treated   *
    63 ! memind(2)            pointer, on which place the wind fields are stored    *
    64 ! memtime(2) [s]       times of the wind fields, which are kept in memory    *
     66! memind(2[3])         pointer, on which place the wind fields are stored    *
     67! memtime(2[3]) [s]    times of the wind fields, which are kept in memory    *
    6568! itime [s]            current time since start date of trajectory calcu-    *
    6669!                      lation                                                *
  • src/gethourlyOH.f90

    r5f9d14a rfb0d416  
    120120    memOHtime(1)=0.
    121121
    122     jul2=bdate+real(1./24.,kind=dp)  ! date for next hour
     122    jul2=bdate+ldirect*real(1./24.,kind=dp)  ! date for next hour
    123123    call caldate(jul2,jjjjmmdd,hhmmss)
    124124    m2=(jjjjmmdd-(jjjjmmdd/10000)*10000)/100
  • src/makefile

    rb5d0e7e rfb0d416  
    3636
    3737## COMPILERS
    38 F90       = /usr/bin/gfortran
    39 #F90      = ${HOME}/gcc-4.9.1/bin/gfortran
     38#F90       = /usr/bin/gfortran
     39F90       = ${HOME}/gcc-4.9.1/bin/gfortran
    4040#MPIF90    = ${HOME}/opt/bin/mpifort
    4141#MPIF90    = mpif90.mpich
    42 MPIF90    = mpif90.openmpi
    43 #MPIF90    = mpifort
     42#MPIF90    = mpif90.openmpi
     43MPIF90    = mpifort
    4444
    4545## OPTIMIZATION LEVEL
     
    5151
    5252## 1) System libraries at NILU
    53 INCPATH1 = /usr/include
    54 INCPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/include
    55 LIBPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/lib
    56 LIBPATH2 = /usr/lib/x86_64-linux-gnu
     53# INCPATH1 = /usr/include
     54# INCPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/include
     55# LIBPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/lib
     56# LIBPATH2 = /usr/lib/x86_64-linux-gnu
    5757
    5858## 2) Home-made libraries
    59 #INCPATH1  = ${HOME}/include
    60 #INCPATH2  = /homevip/flexpart/include/
    61 #LIBPATH2 = /homevip/flexpart/lib/
    62 #LIBPATH1 = ${HOME}/lib
     59INCPATH1  = ${HOME}/include
     60INCPATH2  = /homevip/flexpart/include/
     61LIBPATH2 = /homevip/flexpart/lib/
     62LIBPATH1 = ${HOME}/lib
    6363#LIBPATH2 = ${HOME}/lib
    6464
    6565FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) -mtune=native -fuse-linker-plugin $(FUSER) # -march=native
    6666
    67 DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) -fbacktrace -Warray-bounds  -Wall -fcheck=all $(FUSER)  # -ffpe-trap=invalid,overflow,denormal,underflow,zero -fdump-core
     67DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) -fbacktrace -Warray-bounds  -Wall -fcheck=all $(FUSER)  #  -ffpe-trap=invalid,overflow,denormal,underflow,zero -fdump-core
    6868
    6969LDFLAGS  = $(FFLAGS) -L$(LIBPATH1) -L$(LIBPATH2) $(LIBS)
  • 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
  • src/readOHfield.f90

    r8a65cb0 rfb0d416  
    4545  use par_mod
    4646  use com_mod
    47 
    4847
    4948  implicit none
  • src/readspecies.f90

    rf9ce123 rfb0d416  
    211211    ohcconst(pos_spec)=pohcconst
    212212    ohdconst(pos_spec)=pohdconst
    213     ohdconst(pos_spec)=pohnconst
     213    ohnconst(pos_spec)=pohnconst
    214214    spec_ass(pos_spec)=pspec_ass
    215215    kao(pos_spec)=pkao
  • src/timemanager_mpi.f90

    r5f9d14a rfb0d416  
    208208    endif
    209209
     210! This time measure includes reading/MPI communication (for the reader process),
     211! or MPI communication time only (for other processes)
    210212    if (mp_measure_time) call mpif_mtime('getfields',0)
    211213
     
    213215
    214216    if (mp_measure_time) call mpif_mtime('getfields',1)
     217
     218
    215219
    216220! Broadcast fields to all MPI processes
    217221! Skip if all processes have called getfields or if no new fields
    218222!*****************************************************************
     223
     224    if (mp_measure_time.and..not.(lmpreader.and.lmp_use_reader)) call mpif_mtime('getfields',0)
    219225
    220226! Version 1 (lmp_sync=.true.) uses a read-ahead process where send/recv is done
     
    258264
    259265    end if
     266
     267    if (mp_measure_time.and..not.(lmpreader.and.lmp_use_reader)) call mpif_mtime('getfields',1)
     268
    260269
    261270!*******************************************************************************
     
    446455          call mpif_tm_reduce_grid
    447456
     457          if (mp_measure_time) call mpif_mtime('iotime',0)
    448458          if (surf_only.ne.1) then
    449459            if (lroot) then
     
    470480            endif
    471481          endif
     482          if (mp_measure_time) call mpif_mtime('iotime',1)
    472483
    473484! :TODO: Correct calling of conc_surf above?
     
    481492!*********************************************
    482493            call mpif_tm_reduce_grid_nest
     494 
     495           if (mp_measure_time) call mpif_mtime('iotime',0)
    483496
    484497            if (lnetcdfout.eq.0) then
     
    515528            end if
    516529          end if
     530         
    517531
    518532          outnum=0.
     
    520534        if ((iout.eq.4).or.(iout.eq.5)) call plumetraj(itime)
    521535        if (iflux.eq.1) call fluxoutput(itime)
     536        if (mp_measure_time) call mpif_mtime('iotime',1)
     537
    522538        if (lroot) write(*,45) itime,numpart*mp_partgroup_np,gridtotalunc,&
    523539             &wetgridtotalunc,drygridtotalunc
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG