Skip to content

Commit

Permalink
Changed MPI_BCAST() for character arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Dec 9, 2019
1 parent 7209345 commit a25d714
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
21 changes: 6 additions & 15 deletions physics/rrtmgp_lw_gas_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -370,21 +370,12 @@ subroutine rrtmgp_lw_gas_optics_init(Model, mpicomm, mpirank, mpiroot, lw_gas_pr
call MPI_BCAST(planck_frac, size(planck_frac), MPI_REAL, mpiroot, mpicomm, ierr)
#endif
! Character arrays
do ij=1,nabsorbers
call MPI_BCAST(gas_names(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
do ij=1,nminorabsorbers
call MPI_BCAST(gas_minor(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(identifier_minor(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
do ij=1,nminor_absorber_intervals_lower
call MPI_BCAST(minor_gases_lower(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
do ij=1,nminor_absorber_intervals_upper
call MPI_BCAST(minor_gases_upper(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
! Logical arrays (First convert to integer-array, then broadcast)
!
call MPI_BCAST(gas_names, size(gas_names), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(gas_minor, size(gas_minor), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(identifier_minor, size(identifier_minor), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(minor_gases_lower, size(minor_gases_lower), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(minor_gases_upper, size(minor_gases_upper), MPI_CHAR, mpiroot, mpicomm, ierr)
! Logical arrays
call MPI_BCAST(minor_scales_with_density_lower, nminor_absorber_intervals_lower, MPI_LOGICAL, mpiroot, mpicomm, ierr)
call MPI_BCAST(scale_by_complement_lower, nminor_absorber_intervals_lower, MPI_LOGICAL, mpiroot, mpicomm, ierr)
call MPI_BCAST(minor_scales_with_density_upper, nminor_absorber_intervals_upper, MPI_LOGICAL, mpiroot, mpicomm, ierr)
Expand Down
23 changes: 7 additions & 16 deletions physics/rrtmgp_sw_gas_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -370,22 +370,13 @@ subroutine rrtmgp_sw_gas_optics_init(Model, mpicomm, mpirank, mpiroot, sw_gas_p
call MPI_BCAST(rayl_lower_sw, size(rayl_lower_sw), MPI_REAL, mpiroot, mpicomm, ierr)
call MPI_BCAST(rayl_upper_sw, size(rayl_upper_sw), MPI_REAL, mpiroot, mpicomm, ierr)
#endif
! Character arrays
do ij=1,nabsorbers_sw
call MPI_BCAST(gas_names_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
do ij=1,nminorabsorbers_sw
call MPI_BCAST(gas_minor_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(identifier_minor_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
do ij=1,nminor_absorber_intervals_lower_sw
call MPI_BCAST(minor_gases_lower_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
do ij=1,nminor_absorber_intervals_upper_sw
call MPI_BCAST(minor_gases_upper_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr)
enddo
! Logical arrays (First convert to integer-array, then broadcast)
!
! Character arrays
call MPI_BCAST(gas_names_sw, size(gas_names_sw), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(gas_minor_sw, size(gas_minor_sw), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(identifier_minor_sw, size(identifier_minor_sw), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(minor_gases_lower_sw, size(minor_gases_lower_sw), MPI_CHAR, mpiroot, mpicomm, ierr)
call MPI_BCAST(minor_gases_upper_sw, size(minor_gases_upper_sw), MPI_CHAR, mpiroot, mpicomm, ierr)
! Logical arrays
call MPI_BCAST(minor_scales_with_density_lower_sw, nminor_absorber_intervals_lower_sw, MPI_LOGICAL, mpiroot, mpicomm, ierr)
call MPI_BCAST(scale_by_complement_lower_sw, nminor_absorber_intervals_lower_sw, MPI_LOGICAL, mpiroot, mpicomm, ierr)
call MPI_BCAST(minor_scales_with_density_upper_sw, nminor_absorber_intervals_upper_sw, MPI_LOGICAL, mpiroot, mpicomm, ierr)
Expand Down

0 comments on commit a25d714

Please sign in to comment.