Changeset 2809 for palm/trunk


Ignore:
Timestamp:
Feb 15, 2018 9:55:58 AM (7 years ago)
Author:
schwenkel
Message:

Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE

Location:
palm/trunk/SOURCE
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/lpm_exchange_horiz.f90

    r2801 r2809  
    2525! -----------------
    2626! $Id$
     27! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE.
     28! Preprocessor directive(__gfortran) for c_sizeof removed.
     29!
     30! 2801 2018-02-14 16:01:55Z thiele
    2731! Introduce particle transfer in nested models.
    2832!
     
    446450    ENDDO
    447451
    448 #if defined( __gfortran )
    449 !
    450 !--    For the gfortran compiler the function c_sizeof produces strange erros
    451 !--    which can probably be attributed to an error in the gfortran compiler.
    452 !--    Therefore the particle size in bytes is set manually. Attention: A
    453 !--    change of the size of the particle type requires an adjustment of
    454 !--    this value
    455        par_size = 184
    456 #else
    457 !     
    458 !--    This MPI_SENDRECV should work even with odd mixture on 32 and 64 Bit
    459 !--    variables in structure particle_type (due to the calculation of par_size).
    460 !--    Please note, in case of 1D decomposition ( only 1 core along
    461 !--    x dimension), array trlp is not allocated, leading to program crash.
    462 !--    Hence, check if array is allocated and allocate it temporarily if
    463 !--    if required.
    464        IF ( .NOT. ALLOCATED( trlp ) )  ALLOCATE( trlp(1:1) )
    465 
    466        par_size = c_sizeof(trlp(1))
    467 #endif
     452!
     453!-- STORAGE_SIZE returns the storage size of argument A in bits. However , it
     454!-- is needed in bytes. The function C_SIZEOF which produces this value directly
     455!-- causes problems with gfortran. For this reason the use of C_SIZEOF is avoided
     456    par_size = STORAGE_SIZE(trlp(1))/8
    468457
    469458
  • palm/trunk/SOURCE/pmc_child_mod.f90

    r2801 r2809  
    2626! -----------------
    2727! $Id$
     28! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
     29!
     30! 2801 2018-02-14 16:01:55Z thiele
    2831! Introduce particle transfer in nested models.
    2932!
     
    314317
    315318
    316     win_size = C_SIZEOF( dummy )
     319    win_size = STORAGE_SIZE( dummy )/8
    317320    CALL MPI_WIN_CREATE( dummy, win_size, iwp, MPI_INFO_NULL, me%intra_comm,   &
    318321                         indwin, ierr )
  • palm/trunk/SOURCE/pmc_interface_mod.f90

    r2806 r2809  
    2525! -----------------
    2626! $Id$
     27! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
     28!
     29! 2806 2018-02-14 17:10:37Z thiele
    2730! Bugfixing Write statements
    2831!
     
    223226!       routine
    224227! @todo Data transfer of qc and nc is prepared but not activated
    225 ! @todo determine c_sizeof(childgrid(1)) for gfortran
    226228!------------------------------------------------------------------------------!
    227229 MODULE pmc_interface
     
    928930     
    929931       CALL MPI_BCAST( nz_cl, 1, MPI_INTEGER, 0, comm2d, ierr )
    930 #if defined( __gfortran )
    931 !
    932 !--    For the gfortran compiler the function c_sizeof produces strange erros
    933 !--    which can probably be attributed to an error in the gfortran compiler.
    934 !--    Therefore the particle size in bytes is set manually. Attention: A
    935 !--    change of the size of the particle type requires an adjustment of
    936 !--    this value
    937 !--    TODO: determine c_sizeof(childgrid(1)) as gfortran can not handle the
    938 !--    function
    939 #else
    940 !     
    941 !--    This MPI_SENDRECV should work even with odd mixture on 32 and 64 Bit
    942 !--    variables in structure particle_type (due to the calculation of par_size).
    943 !--    Please note, in case of 1D decomposition ( only 1 core along
    944 !--    x dimension), array trlp is not allocated, leading to program crash.
    945 !--    Hence, check if array is allocated and allocate it temporarily if
    946 !--    if required.
    947        CALL MPI_BCAST( childgrid(m), c_sizeof(childgrid(1)), MPI_BYTE, 0, comm2d, ierr )
    948 #endif
    949 
     932
     933       CALL MPI_BCAST( childgrid(m), STORAGE_SIZE(childgrid(1))/8, MPI_BYTE, 0, comm2d, ierr )
    950934!
    951935!--    TO_DO: Klaus: please give a comment what is done here
  • palm/trunk/SOURCE/pmc_mpi_wrapper_mod.f90

    r2718 r2809  
    2626! -----------------
    2727! $Id$
     28! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
     29!
     30! 2718 2018-01-02 08:49:38Z maronga
    2831! Corrected "Former revisions" section
    2932!
     
    609612
    610613   
    611     winsize = idim1 * C_SIZEOF( ierr )
     614    winsize = idim1 * STORAGE_SIZE( ierr )/8
    612615
    613616    CALL MPI_ALLOC_MEM( winsize, MPI_INFO_NULL, p_myind, ierr )
  • palm/trunk/SOURCE/pmc_parent_mod.f90

    r2801 r2809  
    2626! -----------------
    2727! $Id$
     28! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
     29!
     30! 2801 2018-02-14 16:01:55Z thiele
    2831! Introduce particle transfer in nested models.
    2932!
     
    10101013!
    10111014!-- Number of child processes * size of INTEGER (i just arbitrary INTEGER)
    1012     winsize = mychild%inter_npes*c_sizeof(i)*2
     1015    winsize = mychild%inter_npes*STORAGE_SIZE(i)/8*2
    10131016
    10141017    CALL MPI_WIN_CREATE( rldef, winsize, iwp, MPI_INFO_NULL,                   &
     
    10431046
    10441047    CALL MPI_BARRIER( m_model_comm, ierr )
    1045     CALL MPI_WIN_CREATE( remindw, winsize*c_sizeof(i), iwp, MPI_INFO_NULL,     &
     1048    CALL MPI_WIN_CREATE( remindw, winsize*STORAGE_SIZE(i)/8, iwp, MPI_INFO_NULL,     &
    10461049                         mychild%intra_comm, indwin2, ierr )
    10471050!
  • palm/trunk/SOURCE/pmc_particle_interface.f90

    r2808 r2809  
    2424!
    2525! Former revisions:
    26 ! -----------------
    27 !
    28 ! Bugfixes gfortran C_SIZEOF(zero_particle)
    29 !
    30 !
    31 !
    32 !
     26! -----------------!
     27! $Id$
     28! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE.
     29
     30!
    3331! Initial Version (by Klaus Ketelsen)
    3432!
     
    235233!-- If the model has a parent model prepare the structures for transfer
    236234    IF ( cpl_id > 1 )  THEN
    237 #if defined( __gfortran )
    238 !
    239 !--    For the gfortran compiler the function c_sizeof produces strange erros
    240 !--    which can probably be attributed to an error in the gfortran compiler.
    241 !--    Therefore the particle size in bytes is set manually. Attention: A
    242 !--    change of the size of the particle type requires an adjustment of
    243 !--    this value
    244        parsize = 184
    245 #else
    246        parsize = C_SIZEOF (zero_particle)
    247 #endif
     235
     236       parsize = STORAGE_SIZE(zero_particle)/8
     237
    248238       CALL MPI_ALLOC_MEM( parsize , MPI_INFO_NULL, ptr, ierr )
    249239       buf_shape(1) = 1
     
    273263       DO  m = 1, nr_childs
    274264          child_id = get_childid(m)
    275 #if defined( __gfortran )
    276 !
    277 !--       For the gfortran compiler the function c_sizeof produces strange erros
    278 !--       which can probably be attributed to an error in the gfortran compiler.
    279 !--       Therefore the particle size in bytes is set manually. Attention: A
    280 !--       change of the size of the particle type requires an adjustment of
    281 !--       this value
    282           parsize = 184
    283 #else
    284           parsize = C_SIZEOF (zero_particle)
    285 #endif
     265          parsize = STORAGE_SIZE(zero_particle)/8
     266
    286267          winsize = max_nr_particle_in_rma_win * parsize
    287268          CALL MPI_ALLOC_MEM( winsize , MPI_INFO_NULL, buf_ptr(m), ierr )
     
    345326
    346327                 CALL check_and_alloc_coarse_particle (i, j, nr)
    347 #if defined( __gfortran )
    348 !
    349 !--       For the gfortran compiler the function c_sizeof produces strange erros
    350 !--       which can probably be attributed to an error in the gfortran compiler.
    351 !--       Therefore the particle size in bytes is set manually. Attention: A
    352 !--       change of the size of the particle type requires an adjustment of
    353 !--       this value
    354           parsize = 184
    355 #else
    356           parsize = C_SIZEOF (zero_particle)
    357 #endif
     328                 parsize = STORAGE_SIZE(zero_particle)/8
    358329                 target_disp = part_adrc(j,i) - 1
    359330                 CALL MPI_WIN_LOCK( MPI_LOCK_SHARED , ip - 1, 0, particle_win_child, ierr )
     
    447418       max_nr_particle_per_pe = max_nr_particle_in_rma_win / ( n * n )
    448419       disp_offset            = pe_offset * max_nr_particle_per_pe
    449 #if defined( __gfortran )
    450 !
    451 !--       For the gfortran compiler the function c_sizeof produces strange erros
    452 !--       which can probably be attributed to an error in the gfortran compiler.
    453 !--       Therefore the particle size in bytes is set manually. Attention: A
    454 !--       change of the size of the particle type requires an adjustment of
    455 !--       this value
    456           parsize = 184
    457 #else
    458           parsize = C_SIZEOF (zero_particle)
    459 #endif
     420       parsize = STORAGE_SIZE(zero_particle)/8
    460421       DO  ip = 1, me%inter_npes
    461422
  • palm/trunk/SOURCE/radiation_model_mod.f90

    r2753 r2809  
    2525! -----------------
    2626! $Id$
     27! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
     28!
     29! 2753 2018-01-16 14:16:49Z suehring
    2730! Tile approach for spectral albedo implemented.
    2831!
     
    59015904!--             must be in accordance with allocation of lad_s in plant_canopy_model
    59025905!--             optimization of memory should be done
    5903 !--             Argument X of function c_sizeof(X) needs arbitrary REAL(wp) value, set to 1.0_wp for now
    5904                 size_lad_rma = c_sizeof(1.0_wp)*nnx*nny*nzu
    5905                 CALL MPI_Win_allocate(size_lad_rma, c_sizeof(1.0_wp), minfo, comm2d, &
     5906!--             Argument X of function STORAGE_SIZE(X) needs arbitrary REAL(wp) value, set to 1.0_wp for now
     5907                size_lad_rma = STORAGE_SIZE(1.0_wp)/8*nnx*nny*nzu
     5908                CALL MPI_Win_allocate(size_lad_rma, STORAGE_SIZE(1.0_wp)/8, minfo, comm2d, &
    59065909                                        lad_s_rma_p, win_lad, ierr)
    59075910                CALL c_f_pointer(lad_s_rma_p, lad_s_rma, (/ nzu, nny, nnx /))
Note: See TracChangeset for help on using the changeset viewer.