SCALE-RM
Functions/Subroutines | Variables
scale_process Module Reference

module PROCESS More...

Functions/Subroutines

subroutine, public prc_mpistart (comm)
 Start MPI. More...
 
subroutine, public prc_local_mpistart (myrank, ismaster)
 Start MPI, without nesting, bulk job. More...
 
subroutine, public prc_universal_setup (comm, nprocs, ismaster)
 setup MPI in universal communicator More...
 
subroutine, public prc_global_setup (abortall, comm)
 setup MPI in global communicator More...
 
subroutine, public prc_local_setup (comm, myrank, ismaster)
 Setup MPI. More...
 
subroutine, public prc_mpistop
 Abort MPI. More...
 
subroutine, public prc_mpifinish
 Stop MPI peacefully. More...
 
subroutine, public prc_mpisplit (ORG_COMM, NUM_DOMAIN, PRC_DOMAINS, CONF_FILES, LOG_SPLIT, bulk_split, color_reorder, INTRA_COMM, inter_parent, inter_child, fname_local)
 MPI Communicator Split. More...
 
subroutine, public prc_mpisplit_letkf (ORG_COMM, mem_np, nitmax, nprocs, proc2mem, INTRA_COMM)
 MPI Communicator Split for SCALE-LETKF ensemble. More...
 
subroutine, public prc_mpibarrier
 Barrier MPI. More...
 
real(dp) function, public prc_mpitime ()
 Get MPI time. More...
 
subroutine, public prc_mpitimestat (avgvar, maxvar, minvar, maxidx, minidx, var)
 Calc global statistics for timer. More...
 

Variables

integer, parameter, public prc_masterrank = 0
 master process in each communicator More...
 
integer, parameter, public prc_domain_nlim = 10000
 max depth of domains More...
 
integer, public prc_universal_comm_world = -1
 original communicator More...
 
integer, public prc_universal_myrank = -1
 myrank in universal communicator More...
 
integer, public prc_universal_nprocs = -1
 process num in universal communicator More...
 
logical, public prc_universal_ismaster = .false.
 master process in universal communicator? More...
 
integer, public prc_universal_jobid = 0
 my job ID in universal communicator More...
 
integer, public prc_global_comm_world = -1
 global communicator More...
 
integer, public prc_global_myrank = -1
 myrank in global communicator More...
 
integer, public prc_global_nprocs = -1
 process num in global communicator More...
 
logical, public prc_global_ismaster = .false.
 master process in global communicator? More...
 
integer, public prc_global_domainid = 0
 my domain ID in global communicator More...
 
integer, public prc_local_comm_world = -1
 local communicator More...
 
integer, public prc_nprocs = 1
 myrank in local communicator More...
 
integer, public prc_myrank = 0
 process num in local communicator More...
 
logical, public prc_ismaster = .false.
 master process in local communicator? More...
 
logical, public prc_mpi_alive = .false.
 MPI is alive? More...
 
integer, public prc_universal_handler
 error handler in universal communicator More...
 
integer, public prc_abort_comm_world
 communicator for aborting More...
 
integer, public prc_abort_handler
 error handler communicator for aborting More...
 

Detailed Description

module PROCESS

Description
MPI/non-MPI management module
Author
Team SCALE
History
  • 2011-10-11 (R.Yoshida) [new]
  • 2011-11-11 (H.Yashiro) [mod] Integrate to SCALE-LES ver.3

Function/Subroutine Documentation

◆ prc_mpistart()

subroutine, public scale_process::prc_mpistart ( integer, intent(out)  comm)

Start MPI.

Definition at line 109 of file scale_process.F90.

References prc_mpi_alive, and prc_universal_handler.

Referenced by scalerm_launcher().

109  implicit none
110 
111  integer, intent(out) :: comm ! communicator
112 
113  integer :: ierr
114  !---------------------------------------------------------------------------
115 
116  call mpi_init(ierr)
117 
118  prc_mpi_alive = .true.
119  prc_universal_handler = mpi_errhandler_null
120  call mpi_comm_create_errhandler( prc_mpi_errorhandler, prc_universal_handler, ierr )
121 
122  comm = mpi_comm_world
123 
124  return
Here is the caller graph for this function:

◆ prc_local_mpistart()

subroutine, public scale_process::prc_local_mpistart ( integer, intent(out)  myrank,
logical, intent(out)  ismaster 
)

Start MPI, without nesting, bulk job.

Definition at line 132 of file scale_process.F90.

References prc_global_setup(), prc_local_setup(), prc_mpi_alive, prc_universal_handler, and prc_universal_setup().

132  implicit none
133 
134  integer, intent(out) :: myrank ! myrank in this communicator
135  logical, intent(out) :: ismaster ! master process in this communicator?
136 
137  integer :: comm ! communicator
138  integer :: nprocs ! number of procs in this communicator
139  logical :: abortall = .false. ! abort all jobs?
140 
141  integer :: ierr
142  !---------------------------------------------------------------------------
143 
144  call mpi_init(ierr)
145 
146  prc_mpi_alive = .true.
147  prc_universal_handler = mpi_errhandler_null
148  call mpi_comm_create_errhandler( prc_mpi_errorhandler, prc_universal_handler, ierr )
149 
150  comm = mpi_comm_world
151 
152  call prc_universal_setup( comm, nprocs, ismaster )
153  call prc_global_setup ( abortall, comm )
154  call prc_local_setup ( comm, myrank, ismaster )
155 
156  return
Here is the call graph for this function:

◆ prc_universal_setup()

subroutine, public scale_process::prc_universal_setup ( integer, intent(in)  comm,
integer, intent(out)  nprocs,
logical, intent(out)  ismaster 
)

setup MPI in universal communicator

Definition at line 165 of file scale_process.F90.

References prc_abort_comm_world, prc_abort_handler, prc_masterrank, prc_universal_comm_world, prc_universal_handler, prc_universal_ismaster, prc_universal_myrank, and prc_universal_nprocs.

Referenced by prc_local_mpistart(), and scalerm_launcher().

165  implicit none
166 
167  integer, intent(in) :: comm ! communicator
168  integer, intent(out) :: nprocs ! number of procs in this communicator
169  logical, intent(out) :: ismaster ! master process in this communicator?
170 
171  integer :: ierr
172  !---------------------------------------------------------------------------
173 
174  prc_universal_comm_world = comm
175 
176  call mpi_comm_size(prc_universal_comm_world,prc_universal_nprocs,ierr)
177  call mpi_comm_rank(prc_universal_comm_world,prc_universal_myrank,ierr)
178 
179  if ( prc_universal_myrank == prc_masterrank ) then
180  prc_universal_ismaster = .true.
181  else
182  prc_universal_ismaster = .false.
183  endif
184 
185  nprocs = prc_universal_nprocs
186  ismaster = prc_universal_ismaster
187 
188 
189 
190  prc_abort_comm_world = prc_universal_comm_world
191 
192  call mpi_comm_set_errhandler(prc_abort_comm_world,prc_universal_handler,ierr)
193  call mpi_comm_get_errhandler(prc_abort_comm_world,prc_abort_handler ,ierr)
194 
195  return
Here is the caller graph for this function:

◆ prc_global_setup()

subroutine, public scale_process::prc_global_setup ( logical, intent(in)  abortall,
integer, intent(in)  comm 
)

setup MPI in global communicator

Definition at line 203 of file scale_process.F90.

References prc_global_comm_world, prc_global_ismaster, prc_global_myrank, prc_global_nprocs, and prc_masterrank.

Referenced by prc_local_mpistart(), and scalerm_launcher().

203  implicit none
204 
205  logical, intent(in) :: abortall ! abort all jobs?
206  integer, intent(in) :: comm ! communicator
207 
208  integer :: ierr
209  !---------------------------------------------------------------------------
210 
211  prc_global_comm_world = comm
212 
213  call mpi_comm_size(prc_global_comm_world,prc_global_nprocs,ierr)
214  call mpi_comm_rank(prc_global_comm_world,prc_global_myrank,ierr)
215 
216  if ( prc_global_myrank == prc_masterrank ) then
217  prc_global_ismaster = .true.
218  else
219  prc_global_ismaster = .false.
220  endif
221 
222 ! if ( .NOT. abortall ) then
223 ! PRC_ABORT_COMM_WORLD = PRC_GLOBAL_COMM_WORLD
224 !
225 ! call MPI_COMM_SET_ERRHANDLER(PRC_ABORT_COMM_WORLD,PRC_UNIVERSAL_handler,ierr)
226 ! call MPI_COMM_GET_ERRHANDLER(PRC_ABORT_COMM_WORLD,PRC_ABORT_handler ,ierr)
227 ! endif
228 
229  return
Here is the caller graph for this function:

◆ prc_local_setup()

subroutine, public scale_process::prc_local_setup ( integer, intent(in)  comm,
integer, intent(out)  myrank,
logical, intent(out)  ismaster 
)

Setup MPI.

Definition at line 238 of file scale_process.F90.

References prc_ismaster, prc_local_comm_world, prc_masterrank, prc_myrank, and prc_nprocs.

Referenced by prc_local_mpistart(), mod_rm_driver::scalerm(), and mod_rm_prep::scalerm_prep().

238  implicit none
239 
240  integer, intent(in) :: comm ! communicator
241  integer, intent(out) :: myrank ! myrank in this communicator
242  logical, intent(out) :: ismaster ! master process in this communicator?
243 
244  integer :: ierr
245  !---------------------------------------------------------------------------
246 
247  prc_local_comm_world = comm
248 
249  call mpi_comm_rank(prc_local_comm_world,prc_myrank,ierr)
250  call mpi_comm_size(prc_local_comm_world,prc_nprocs,ierr)
251 
252  if ( prc_myrank == prc_masterrank ) then
253  prc_ismaster = .true.
254  else
255  prc_ismaster = .false.
256  endif
257 
258  myrank = prc_myrank
259  ismaster = prc_ismaster
260 
261  return
Here is the caller graph for this function:

◆ prc_mpistop()

subroutine, public scale_process::prc_mpistop ( )

Abort MPI.

Definition at line 267 of file scale_process.F90.

References prc_mpi_alive, and prc_universal_comm_world.

Referenced by mod_admin_restart::admin_restart_setup(), mod_admin_time::admin_time_setup(), scale_atmos_adiabat::atmos_adiabat_cape(), mod_atmos_admin::atmos_admin_getscheme(), mod_atmos_admin::atmos_admin_setup(), scale_atmos_boundary::atmos_boundary_resume(), scale_atmos_boundary::atmos_boundary_resume_file(), scale_atmos_boundary::atmos_boundary_resume_online(), scale_atmos_boundary::atmos_boundary_setup(), scale_atmos_boundary::atmos_boundary_update(), mod_atmos_dyn_driver::atmos_dyn_driver_setup(), scale_atmos_dyn_common::atmos_dyn_filter_setup(), scale_atmos_dyn_fvm_flux::atmos_dyn_fvm_flux_setup(), scale_atmos_dyn::atmos_dyn_setup(), scale_atmos_dyn_tinteg_large_euler::atmos_dyn_tinteg_large_euler_setup(), scale_atmos_dyn_tinteg_large_rk3::atmos_dyn_tinteg_large_rk3_setup(), scale_atmos_dyn_tinteg_large::atmos_dyn_tinteg_large_setup(), scale_atmos_dyn_tinteg_short_rk3::atmos_dyn_tinteg_short_rk3_setup(), scale_atmos_dyn_tinteg_short_rk4::atmos_dyn_tinteg_short_rk4_setup(), scale_atmos_dyn_tinteg_short::atmos_dyn_tinteg_short_setup(), scale_atmos_dyn_tinteg_tracer_euler::atmos_dyn_tinteg_tracer_euler_setup(), scale_atmos_dyn_tinteg_tracer_rk3::atmos_dyn_tinteg_tracer_rk3_setup(), scale_atmos_dyn_tinteg_tracer::atmos_dyn_tinteg_tracer_setup(), scale_atmos_dyn_tstep_large_fvm_heve::atmos_dyn_tstep_large_fvm_heve_setup(), scale_atmos_dyn_tstep_large::atmos_dyn_tstep_large_setup(), scale_atmos_dyn_tstep_short_fvm_heve::atmos_dyn_tstep_short_fvm_heve_regist(), scale_atmos_dyn_tstep_short_fvm_hevi::atmos_dyn_tstep_short_fvm_hevi_regist(), scale_atmos_dyn_tstep_short_fvm_hivi::atmos_dyn_tstep_short_fvm_hivi_regist(), scale_atmos_dyn_tstep_short_fvm_hivi::atmos_dyn_tstep_short_fvm_hivi_setup(), scale_atmos_dyn_tstep_short::atmos_dyn_tstep_short_regist(), scale_atmos_dyn_tstep_tracer_fvm_heve::atmos_dyn_tstep_tracer_fvm_heve_setup(), scale_atmos_dyn_tstep_tracer::atmos_dyn_tstep_tracer_setup(), mod_atmos_dyn_vars::atmos_dyn_vars_setup(), scale_atmos_hydrometeor::atmos_hydrometeor_regist(), scale_atmos_hydrometeor::atmos_hydrometeor_setup(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_1d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_3d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_atmos_0d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_atmos_1d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_atmos_3d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_atmos_rev_2d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_atmos_rev_3d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_bytemp_1d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_bytemp_3d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_bytemp_atmos_1d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_bytemp_atmos_3d(), scale_atmos_hydrostatic::atmos_hydrostatic_buildrho_real_3d(), scale_atmos_hydrostatic::atmos_hydrostatic_setup(), scale_atmos_phy_ae::atmos_phy_ae_config(), scale_atmos_phy_ae_dummy::atmos_phy_ae_dummy_config(), scale_atmos_phy_ae_kajino13::atmos_phy_ae_kajino13_config(), scale_atmos_phy_ae_kajino13::atmos_phy_ae_kajino13_setup(), mod_atmos_phy_ae_vars::atmos_phy_ae_vars_setup(), mod_atmos_phy_ch_vars::atmos_phy_ch_vars_setup(), scale_atmos_phy_cp_kf::atmos_phy_cp_kf_setup(), scale_atmos_phy_cp::atmos_phy_cp_setup(), mod_atmos_phy_cp_vars::atmos_phy_cp_vars_setup(), scale_atmos_phy_mp_convert::atmos_phy_mp_bulk2bin(), scale_atmos_phy_mp::atmos_phy_mp_config(), scale_atmos_phy_mp_dry::atmos_phy_mp_dry_config(), scale_atmos_phy_mp_kessler::atmos_phy_mp_kessler_config(), scale_atmos_phy_mp_kessler::atmos_phy_mp_kessler_setup(), scale_atmos_phy_mp_common::atmos_phy_mp_negative_fixer(), scale_atmos_phy_mp_common::atmos_phy_mp_saturation_adjustment(), scale_atmos_phy_mp_sdm::atmos_phy_mp_sdm(), scale_atmos_phy_mp_sdm::atmos_phy_mp_sdm_config(), scale_atmos_phy_mp_sdm::atmos_phy_mp_sdm_setup(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14_config(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14_setup(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_config(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_setup(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08_config(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08_setup(), mod_atmos_phy_mp_vars::atmos_phy_mp_vars_setup(), mod_atmos_phy_rd_driver::atmos_phy_rd_driver(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx_setup(), scale_atmos_phy_rd_offline::atmos_phy_rd_offline(), scale_atmos_phy_rd_offline::atmos_phy_rd_offline_setup(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_setup(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_setup_zgrid(), scale_atmos_phy_rd::atmos_phy_rd_setup(), mod_atmos_phy_rd_vars::atmos_phy_rd_vars_setup(), scale_atmos_phy_sf_bulk::atmos_phy_sf_bulk_setup(), scale_atmos_phy_sf_const::atmos_phy_sf_const_setup(), mod_atmos_phy_sf_driver::atmos_phy_sf_driver_setup(), scale_atmos_phy_sf::atmos_phy_sf_setup(), mod_atmos_phy_sf_vars::atmos_phy_sf_vars_setup(), scale_atmos_phy_tb::atmos_phy_tb_config(), scale_atmos_phy_tb_d1980::atmos_phy_tb_d1980_config(), scale_atmos_phy_tb_d1980::atmos_phy_tb_d1980_setup(), scale_atmos_phy_tb_dns::atmos_phy_tb_dns_config(), scale_atmos_phy_tb_dns::atmos_phy_tb_dns_setup(), scale_atmos_phy_tb_hybrid::atmos_phy_tb_hybrid_config(), scale_atmos_phy_tb_mynn::atmos_phy_tb_mynn_config(), scale_atmos_phy_tb_mynn::atmos_phy_tb_mynn_setup(), scale_atmos_phy_tb_smg::atmos_phy_tb_smg_config(), scale_atmos_phy_tb_smg::atmos_phy_tb_smg_setup(), mod_atmos_phy_tb_vars::atmos_phy_tb_vars_setup(), scale_atmos_refstate::atmos_refstate_read(), scale_atmos_refstate::atmos_refstate_resume(), scale_atmos_refstate::atmos_refstate_setup(), scale_atmos_saturation::atmos_saturation_setup(), scale_atmos_solarins::atmos_solarins_setup(), mod_atmos_vars::atmos_vars_restart_open(), mod_atmos_vars::atmos_vars_restart_read(), mod_atmos_vars::atmos_vars_setup(), scale_bulkflux::bulkflux_setup(), scale_calendar::calendar_cfunits2sec(), scale_calendar::calendar_unit2sec(), scale_debug::check(), mod_cnvlanduse::cnvlanduse(), mod_cnvlanduse::cnvlanduse_setup(), mod_cnvtopo::cnvtopo(), mod_cnvtopo::cnvtopo_setup(), scale_comm::comm_vars8_init(), scale_comm::comm_vars_init(), scale_const::const_setup(), scale_fileio::construct_derived_datatype(), mod_convert::convert(), mod_convert::convert_setup(), scale_external_io::convertarrayorderwrf2dsp(), mod_copytopo::copytopo(), scale_atmos_phy_cp_kf::cp_kf_main(), scale_atmos_phy_cp_kf::cp_kf_param(), mod_cpl_admin::cpl_admin_setup(), mod_cpl_vars::cpl_vars_setup(), scale_external_io::externalfilegetglobalattc(), scale_external_io::externalfilegetshape(), scale_external_io::externalfileread2drealdp(), scale_external_io::externalfileread2drealsp(), scale_external_io::externalfileread3drealdp(), scale_external_io::externalfileread3drealsp(), scale_external_io::externalfileread4drealdp(), scale_external_io::externalfileread4drealsp(), scale_external_io::externalfilereadoffset4drealdp(), scale_external_input::extin_regist(), scale_external_input_rm::extin_rm_get_dims_1d(), scale_external_input_rm::extin_rm_get_dims_2d(), scale_external_input_rm::extin_rm_get_dims_3d(), scale_external_input::extin_setup(), scale_external_input::extin_update_1d(), scale_external_input::extin_update_2d(), scale_external_input::extin_update_3d(), scale_fileio::fileio_create(), scale_fileio::fileio_def_var(), scale_fileio::fileio_read_1d(), scale_fileio::fileio_read_2d(), scale_fileio::fileio_read_3d(), scale_fileio::fileio_read_4d(), scale_fileio::fileio_read_var_1d(), scale_fileio::fileio_read_var_2d(), scale_fileio::fileio_read_var_3d(), scale_fileio::fileio_read_var_4d(), scale_fileio::fileio_setup(), scale_fileio::fileio_write_1d(), scale_fileio::fileio_write_2d(), scale_fileio::fileio_write_3d(), scale_fileio::fileio_write_3d_t(), scale_fileio::fileio_write_4d(), scale_fileio::fileio_write_var_1d(), scale_fileio::fileio_write_var_2d(), scale_fileio::fileio_write_var_3d(), scale_fileio::fileio_write_var_3d_t(), scale_fileio::fileio_write_var_4d(), mod_mkinit::flux_setup(), scale_grid::grid_generate(), scale_grid_index::grid_index_setup(), scale_grid::grid_setup(), scale_gridtrans::gtrans_rotcoef(), scale_gridtrans::gtrans_setup(), scale_history::hist_reg(), scale_history::hist_setup(), mod_mkinit::interporation_fact(), scale_interpolation_nest::intrpnest_domain_compatibility(), scale_interpolation_nest::intrpnest_interp_fact_latlon(), scale_interpolation_nest::intrpnest_interp_fact_llz(), scale_interpolation_nest::intrpnest_setup(), mod_land_admin::land_admin_getscheme(), mod_land_admin::land_admin_setup(), scale_land_grid_index::land_grid_index_setup(), scale_land_grid::land_grid_setup(), mod_realinput::land_interporation(), scale_land_phy_matsiro::land_phy_matsiro_setup(), scale_land_phy::land_phy_setup(), scale_land_phy_slab::land_phy_slab_setup(), mod_mkinit::land_setup(), scale_land_sfc_const::land_sfc_const(), scale_land_sfc::land_sfc_setup(), scale_land_sfc_thick_slab::land_sfc_thick_slab(), scale_land_sfc_thick_slab::land_sfc_thick_slab_setup(), scale_land_sfc_thin_slab::land_sfc_thin_slab(), scale_land_sfc_thin_slab::land_sfc_thin_slab_setup(), mod_land_vars::land_vars_external_in(), mod_land_vars::land_vars_setup(), scale_landuse::landuse_setup(), mod_mkinit::mkinit(), mod_mkinit::mkinit_setup(), mod_mktopo::mktopo(), mod_mktopo::mktopo_setup(), scale_monitor::monit_setup(), scale_monitor::monit_write(), scale_atmos_phy_mp_suzuki10::mp_suzuki10(), scale_mapproj::mprj_lonlat2xy(), scale_mapproj::mprj_mapfactor(), scale_mapproj::mprj_rotcoef_0d(), scale_mapproj::mprj_rotcoef_2d(), scale_mapproj::mprj_setup(), scale_mapproj::mprj_xy2lonlat(), scale_grid_nest::nest_comm_intercomm_nestdown_3d(), scale_grid_nest::nest_comm_issuer_of_receive_3d(), scale_grid_nest::nest_comm_issuer_of_wait_3d(), scale_grid_nest::nest_comm_nestdown(), scale_grid_nest::nest_comm_recv_cancel(), scale_grid_nest::nest_comm_recvwait_issue(), scale_grid_nest::nest_comm_test(), scale_grid_nest::nest_comm_waitall(), scale_grid_nest::nest_domain_relate(), scale_grid_nest::nest_domain_shape(), scale_grid_nest::nest_setup(), scale_atmos_phy_mp_sn14::nucleation_kij(), mod_ocean_admin::ocean_admin_getscheme(), mod_ocean_admin::ocean_admin_setup(), scale_ocean_phy_file::ocean_phy_file(), scale_ocean_phy_file::ocean_phy_file_setup(), scale_ocean_phy::ocean_phy_setup(), scale_ocean_phy_slab::ocean_phy_slab_setup(), mod_mkinit::ocean_setup(), scale_ocean_sfc_const::ocean_sfc_const(), scale_ocean_sfc::ocean_sfc_setup(), mod_ocean_vars::ocean_vars_setup(), mod_realinput_grads::parentatominputgrads(), mod_realinput::parentatomsetup(), mod_realinput_grads::parentatomsetupgrads(), mod_realinput_wrfarw::parentatomsetupwrfarw(), mod_realinput_grads::parentlandinputgrads(), mod_realinput_grads::parentlandsetupgrads(), mod_realinput_wrfarw::parentlandsetupwrfarw(), mod_realinput_grads::parentoceaninputgrads(), mod_realinput_grads::parentoceansetupgrads(), mod_realinput_wrfarw::parentoceansetupwrfarw(), prc_mpisplit(), scale_rm_process::prc_setup(), scale_prof::prof_setup(), scale_random::random_setup(), mod_realinput_grads::read_namelist(), mod_mkinit::read_sounding(), scale_grid_real::real_setup(), scale_grid_real::real_update_z(), mod_realinput::realinput_atmos(), mod_realinput::realinput_surface(), mod_mkinit::rect_setup(), mod_realinput::replace_misval_map(), scale_roughness::roughness_setup(), scalerm_launcher(), scale_atmos_refstate::smoothing(), scale_atmos_dyn_tstep_short_fvm_hivi::solve_bicgstab(), scale_atmos_dyn_tstep_short_fvm_hevi::solve_direct(), scale_rm_statistics::stat_setup(), scale_rm_statistics::stat_total_2d(), scale_rm_statistics::stat_total_3d(), mod_mkinit::tke_setup(), scale_topography::topo_fillhalo(), scale_topography::topo_setup(), scale_tracer::tracer_regist(), mod_urban_admin::urban_admin_getscheme(), mod_urban_admin::urban_admin_setup(), scale_urban_grid_index::urban_grid_index_setup(), scale_urban_grid::urban_grid_setup(), scale_urban_phy::urban_phy_setup(), scale_urban_phy_slc::urban_phy_slc(), scale_urban_phy_slc::urban_phy_slc_setup(), mod_mkinit::urban_setup(), mod_urban_vars::urban_vars_setup(), mod_user::user_setup(), mod_user::user_step(), scale_debug::valcheck_1d(), scale_debug::valcheck_2d(), scale_debug::valcheck_3d(), scale_comm::vars8_2d_mpi(), scale_comm::vars8_3d_mpi(), scale_comm::vars_2d_mpi(), scale_comm::vars_3d_mpi_pc(), and scale_comm::vars_init_mpi_pc().

267  implicit none
268 
269  integer :: ierr
270  !---------------------------------------------------------------------------
271 
272  if ( prc_mpi_alive ) then
273  ! tentative approach; input "PRC_UNIVERSAL_COMM_WORLD".
274  call mpi_comm_call_errhandler(prc_universal_comm_world,prc_abort_code,ierr)
275  endif
276 
277  stop

◆ prc_mpifinish()

subroutine, public scale_process::prc_mpifinish ( )

Stop MPI peacefully.

Definition at line 283 of file scale_process.F90.

References scale_stdio::io_fid_conf, scale_stdio::io_fid_log, scale_stdio::io_fid_stdout, scale_stdio::io_l, prc_abort_handler, prc_global_comm_world, prc_local_comm_world, prc_mpi_alive, prc_universal_comm_world, and prc_universal_handler.

Referenced by scalerm_launcher().

283  implicit none
284 
285  integer :: ierr
286  !---------------------------------------------------------------------------
287 
288  if (prc_universal_handler .NE. mpi_errhandler_null) then
289  call mpi_errhandler_free(prc_universal_handler, ierr)
290  endif
291  if (prc_abort_handler .NE. mpi_errhandler_null) then
292  call mpi_errhandler_free(prc_abort_handler, ierr)
293  endif
294 
295  ! Stop MPI
296  if ( prc_mpi_alive ) then
297  if ( io_l ) then
298  write(io_fid_log,*)
299  write(io_fid_log,*) '++++++ Finalize MPI...'
300  endif
301 
302  ! free splitted communicator
303  if ( prc_local_comm_world /= prc_global_comm_world ) then
304  call mpi_comm_free(prc_local_comm_world,ierr)
305  endif
306 
307  call mpi_barrier(prc_universal_comm_world,ierr)
308 
309  call mpi_finalize(ierr)
310  if( io_l ) write(io_fid_log,*) '++++++ MPI is peacefully finalized'
311  endif
312 
313  ! Close logfile, configfile
314  if ( io_l ) then
315  if( io_fid_log /= io_fid_stdout ) close(io_fid_log)
316  endif
317  close(io_fid_conf)
318 
319  return
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
Here is the caller graph for this function:

◆ prc_mpisplit()

subroutine, public scale_process::prc_mpisplit ( integer, intent(in)  ORG_COMM,
integer, intent(in)  NUM_DOMAIN,
integer, dimension(:), intent(in)  PRC_DOMAINS,
character(len=*), dimension(:), intent(in)  CONF_FILES,
logical, intent(in)  LOG_SPLIT,
logical, intent(in)  bulk_split,
logical, intent(in)  color_reorder,
integer, intent(out)  INTRA_COMM,
integer, intent(out)  inter_parent,
integer, intent(out)  inter_child,
character(len=h_long), intent(out)  fname_local 
)

MPI Communicator Split.

Definition at line 336 of file scale_process.F90.

References prc_masterrank, prc_mpistop(), prc_universal_ismaster, and prc_universal_jobid.

Referenced by scalerm_launcher().

336  implicit none
337 
338  integer, intent(in) :: ORG_COMM
339  integer, intent(in) :: NUM_DOMAIN
340  integer, intent(in) :: PRC_DOMAINS(:)
341  character(len=*), intent(in) :: CONF_FILES(:)
342  logical, intent(in) :: LOG_SPLIT
343  logical, intent(in) :: bulk_split
344  logical, intent(in) :: color_reorder
345  integer, intent(out) :: intra_comm
346  integer, intent(out) :: inter_parent
347  integer, intent(out) :: inter_child
348  character(len=H_LONG), intent(out) :: fname_local
349 
350  integer :: PARENT_COL(PRC_DOMAIN_nlim) ! parent color number
351  integer :: CHILD_COL(PRC_DOMAIN_nlim) ! child color number
352  integer :: PRC_ROOT(0:PRC_DOMAIN_nlim) ! root process in the color
353  integer, allocatable :: COLOR_LIST(:) ! member list in each color
354  integer, allocatable :: KEY_LIST(:) ! local process number in each color
355 
356  integer :: total_nmax
357  integer :: ORG_myrank ! my rank number in the original communicator
358  integer :: ORG_nmax ! total rank number in the original communicator
359 
360  logical :: do_create_p(PRC_DOMAIN_nlim)
361  logical :: do_create_c(PRC_DOMAIN_nlim)
362  logical :: reordering
363 
364  character(len=H_LONG) :: COL_FILE(0:PRC_DOMAIN_nlim)
365  character(len=4) :: col_num
366 
367  integer :: i
368  integer :: itag, ierr
369  !---------------------------------------------------------------------------
370 
371  intra_comm = org_comm
372  inter_parent = mpi_comm_null
373  inter_child = mpi_comm_null
374  fname_local = conf_files(1)
375 
376  if ( num_domain > 1 ) then ! multi domain run
377  call mpi_comm_rank(org_comm,org_myrank,ierr)
378  call mpi_comm_size(org_comm,org_nmax, ierr)
379  allocate( color_list(0:org_nmax-1) )
380  allocate( key_list(0:org_nmax-1) )
381 
382  total_nmax = 0
383  do i = 1, num_domain
384  total_nmax = total_nmax + prc_domains(i)
385  enddo
386  if ( total_nmax /= org_nmax ) then
387  if( prc_universal_ismaster ) write(*,*) ""
388  if( prc_universal_ismaster ) write(*,*) "ERROR: MPI PROCESS NUMBER is INCONSISTENT"
389  if( prc_universal_ismaster ) write(*,*) "REQUESTED NPROCS = ", total_nmax, " LAUNCHED NPROCS = ", org_nmax
390  call prc_mpistop
391  endif
392 
393  reordering = color_reorder
394  if ( bulk_split ) then
395  reordering = .false.
396  endif
397  call prc_mpicoloring( org_comm, & ! [IN]
398  num_domain, & ! [IN]
399  prc_domains, & ! [IN]
400  conf_files, & ! [IN]
401  reordering, & ! [IN]
402  log_split, & ! [IN]
403  color_list, & ! [OUT]
404  prc_root, & ! [OUT]
405  key_list, & ! [OUT]
406  parent_col, & ! [OUT]
407  child_col, & ! [OUT]
408  col_file ) ! [OUT]
409 
410 
411  ! split comm_world
412  call mpi_comm_split(org_comm, &
413  color_list(org_myrank), &
414  key_list(org_myrank), &
415  intra_comm, ierr)
416  if ( bulk_split ) then
417  write(col_num,'(I4.4)') color_list(org_myrank)
418  fname_local = col_num
419  prc_universal_jobid = color_list(org_myrank)
420  else
421  fname_local = col_file(color_list(org_myrank))
422  endif
423 
424  ! set parent-child relationship
425  do_create_p(:) = .false.
426  do_create_c(:) = .false.
427  if ( .NOT. bulk_split ) then
428  do i = 1, num_domain-1
429  if ( prc_universal_ismaster ) write ( *, '(1X,A,I4)' ) "relationship: ", i
430  if ( prc_universal_ismaster ) write ( *, '(1X,A,I4,A,I4)' ) &
431  "--- parent color = ", parent_col(i), " child color = ", child_col(i)
432  if ( color_list(org_myrank) == parent_col(i) ) then
433  do_create_p(i) = .true.
434  elseif ( color_list(org_myrank) == child_col(i) ) then
435  do_create_c(i) = .true.
436  endif
437  enddo
438  endif
439 
440  ! create inter-commnunicator
441  inter_parent = mpi_comm_null
442  inter_child = mpi_comm_null
443  if ( .NOT. bulk_split ) then
444  do i = 1, num_domain-1
445  itag = i*100
446  if ( do_create_p(i) ) then ! as a parent
447  call mpi_intercomm_create( intra_comm, prc_masterrank, &
448  org_comm, prc_root(child_col(i)), &
449  itag, inter_child, ierr )
450  elseif( do_create_c(i) ) then ! as a child
451  call mpi_intercomm_create( intra_comm, prc_masterrank, &
452  org_comm, prc_root(parent_col(i)), &
453  itag, inter_parent, ierr )
454  endif
455  call mpi_barrier(org_comm, ierr)
456  enddo
457  endif
458 
459  deallocate( color_list, key_list )
460 
461  elseif ( num_domain == 1 ) then ! single domain run
462  if ( prc_universal_ismaster ) write (*,*) "*** a single comunicator"
463  else
464  if ( prc_universal_ismaster ) write (*,*) "ERROR: REQUESTED DOMAIN NUMBER IS NOT ACCEPTABLE"
465  call prc_mpistop
466  endif
467 
468  return
subroutine, public prc_mpistop
Abort MPI.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prc_mpisplit_letkf()

subroutine, public scale_process::prc_mpisplit_letkf ( integer, intent(in)  ORG_COMM,
integer, intent(in)  mem_np,
integer, intent(in)  nitmax,
integer, intent(in)  nprocs,
integer, dimension(2,nitmax,nprocs), intent(in)  proc2mem,
integer, intent(out)  INTRA_COMM 
)

MPI Communicator Split for SCALE-LETKF ensemble.

Definition at line 480 of file scale_process.F90.

References prc_universal_ismaster.

480  implicit none
481 
482  integer, intent(in) :: ORG_COMM
483  integer, intent(in) :: mem_np
484  integer, intent(in) :: nitmax
485  integer, intent(in) :: nprocs
486  integer, intent(in) :: proc2mem(2,nitmax,nprocs)
487  integer, intent(out) :: intra_comm
488 
489  integer :: ORG_myrank ! my rank number in the original communicator
490  integer :: color, key
491  integer :: ierr
492  !---------------------------------------------------------------------------
493 
494  call mpi_comm_rank( org_comm, org_myrank, ierr )
495 
496  if ( proc2mem(1,1,org_myrank+1) >= 1 ) then
497  color = proc2mem(1,1,org_myrank+1) - 1
498  key = proc2mem(2,1,org_myrank+1)
499  else
500  color = mpi_undefined
501  key = mpi_undefined
502  endif
503 
504  call mpi_comm_split( org_comm, &
505  color, &
506  key, &
507  intra_comm, &
508  ierr )
509 
510  return

◆ prc_mpibarrier()

subroutine, public scale_process::prc_mpibarrier ( )

Barrier MPI.

Definition at line 732 of file scale_process.F90.

References prc_local_comm_world, and prc_mpi_alive.

Referenced by scale_prof::prof_rapend(), and scale_prof::prof_rapstart().

732  implicit none
733 
734  integer :: ierr
735  !---------------------------------------------------------------------------
736 
737  if ( prc_mpi_alive ) then
738  call mpi_barrier(prc_local_comm_world,ierr)
739  endif
740 
Here is the caller graph for this function:

◆ prc_mpitime()

real(dp) function, public scale_process::prc_mpitime ( )

Get MPI time.

Returns
time

Definition at line 747 of file scale_process.F90.

References prc_mpi_alive.

Referenced by mod_admin_time::admin_time_advance(), mod_admin_time::admin_time_checkstate(), mod_admin_time::admin_time_setup(), scale_prof::prof_rapend(), and scale_prof::prof_rapstart().

747  implicit none
748 
749  real(DP) :: time
750  !---------------------------------------------------------------------------
751 
752  if ( prc_mpi_alive ) then
753  time = real(MPI_WTIME(), kind=dp)
754  else
755  call cpu_time(time)
756  endif
757 
Here is the caller graph for this function:

◆ prc_mpitimestat()

subroutine, public scale_process::prc_mpitimestat ( real(dp), dimension(:), intent(out)  avgvar,
real(dp), dimension(:), intent(out)  maxvar,
real(dp), dimension(:), intent(out)  minvar,
integer, dimension(:), intent(out)  maxidx,
integer, dimension(:), intent(out)  minidx,
real(dp), dimension(:), intent(in)  var 
)

Calc global statistics for timer.

Parameters
[out]avgvaraverage
[out]maxvarmaximum
[out]minvarminimum
[out]maxidxindex of maximum
[out]minidxindex of minimum
[in]varvalues for statistics

Definition at line 769 of file scale_process.F90.

References gtool_file::filecloseall(), scale_stdio::io_fid_conf, scale_stdio::io_fid_log, scale_stdio::io_fid_stdout, scale_stdio::io_l, prc_abort_comm_world, prc_global_domainid, prc_global_myrank, prc_global_nprocs, prc_local_comm_world, prc_mpi_alive, prc_myrank, prc_nprocs, prc_universal_jobid, prc_universal_myrank, and prc_universal_nprocs.

Referenced by scale_prof::prof_rapreport().

769  implicit none
770 
771  real(DP), intent(out) :: avgvar(:)
772  real(DP), intent(out) :: maxvar(:)
773  real(DP), intent(out) :: minvar(:)
774  integer, intent(out) :: maxidx(:)
775  integer, intent(out) :: minidx(:)
776  real(DP), intent(in) :: var(:)
777 
778  real(DP), allocatable :: statval(:,:)
779  integer :: vsize
780 
781  real(DP) :: totalvar
782  integer :: ierr
783  integer :: v, p
784  !---------------------------------------------------------------------------
785 
786  vsize = size(var(:))
787 
788  allocate( statval(vsize,0:prc_nprocs-1) )
789  statval(:,:) = 0.0_dp
790 
791  do v = 1, vsize
792  statval(v,prc_myrank) = var(v)
793  enddo
794 
795  ! MPI broadcast
796  do p = 0, prc_nprocs-1
797  call mpi_bcast( statval(1,p), &
798  vsize, &
799  mpi_double_precision, &
800  p, &
801  prc_local_comm_world, &
802  ierr )
803  enddo
804 
805  do v = 1, vsize
806  totalvar = 0.0_dp
807  do p = 0, prc_nprocs-1
808  totalvar = totalvar + statval(v,p)
809  enddo
810  avgvar(v) = totalvar / prc_nprocs
811 
812  maxvar(v) = maxval(statval(v,:))
813  minvar(v) = minval(statval(v,:))
814  maxidx(v:v) = maxloc(statval(v,:))
815  minidx(v:v) = minloc(statval(v,:))
816  enddo
817 
818  deallocate( statval )
819 
820  return
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ prc_masterrank

integer, parameter, public scale_process::prc_masterrank = 0

◆ prc_domain_nlim

integer, parameter, public scale_process::prc_domain_nlim = 10000

max depth of domains

Definition at line 58 of file scale_process.F90.

Referenced by scalerm_launcher().

58  integer, public, parameter :: PRC_DOMAIN_nlim = 10000

◆ prc_universal_comm_world

integer, public scale_process::prc_universal_comm_world = -1

original communicator

Definition at line 61 of file scale_process.F90.

Referenced by prc_mpifinish(), prc_mpistop(), scale_rm_process::prc_setup(), and prc_universal_setup().

61  integer, public :: PRC_UNIVERSAL_COMM_WORLD = -1

◆ prc_universal_myrank

integer, public scale_process::prc_universal_myrank = -1

myrank in universal communicator

Definition at line 62 of file scale_process.F90.

Referenced by prc_mpitimestat(), scale_rm_process::prc_setup(), and prc_universal_setup().

62  integer, public :: PRC_UNIVERSAL_myrank = -1

◆ prc_universal_nprocs

integer, public scale_process::prc_universal_nprocs = -1

process num in universal communicator

Definition at line 63 of file scale_process.F90.

Referenced by prc_mpitimestat(), scale_rm_process::prc_setup(), and prc_universal_setup().

63  integer, public :: PRC_UNIVERSAL_nprocs = -1

◆ prc_universal_ismaster

logical, public scale_process::prc_universal_ismaster = .false.

master process in universal communicator?

Definition at line 64 of file scale_process.F90.

Referenced by mod_admin_time::admin_time_checkstate(), prc_mpisplit(), prc_mpisplit_letkf(), scale_rm_process::prc_setup(), and prc_universal_setup().

64  logical, public :: PRC_UNIVERSAL_IsMaster = .false.

◆ prc_universal_jobid

integer, public scale_process::prc_universal_jobid = 0

my job ID in universal communicator

Definition at line 66 of file scale_process.F90.

Referenced by prc_mpisplit(), and prc_mpitimestat().

66  integer, public :: PRC_UNIVERSAL_jobID = 0

◆ prc_global_comm_world

integer, public scale_process::prc_global_comm_world = -1

global communicator

Definition at line 69 of file scale_process.F90.

Referenced by scale_grid_nest::nest_comm_disconnect(), prc_global_setup(), prc_mpifinish(), and scale_rm_process::prc_setup().

69  integer, public :: PRC_GLOBAL_COMM_WORLD = -1

◆ prc_global_myrank

integer, public scale_process::prc_global_myrank = -1

myrank in global communicator

Definition at line 70 of file scale_process.F90.

Referenced by prc_global_setup(), prc_mpitimestat(), and scale_rm_process::prc_setup().

70  integer, public :: PRC_GLOBAL_myrank = -1

◆ prc_global_nprocs

integer, public scale_process::prc_global_nprocs = -1

process num in global communicator

Definition at line 71 of file scale_process.F90.

Referenced by prc_global_setup(), prc_mpitimestat(), and scale_rm_process::prc_setup().

71  integer, public :: PRC_GLOBAL_nprocs = -1

◆ prc_global_ismaster

logical, public scale_process::prc_global_ismaster = .false.

master process in global communicator?

Definition at line 72 of file scale_process.F90.

Referenced by prc_global_setup(), and scale_rm_process::prc_setup().

72  logical, public :: PRC_GLOBAL_IsMaster = .false.

◆ prc_global_domainid

integer, public scale_process::prc_global_domainid = 0

my domain ID in global communicator

Definition at line 74 of file scale_process.F90.

Referenced by scale_grid_nest::nest_setup(), and prc_mpitimestat().

74  integer, public :: PRC_GLOBAL_domainID = 0

◆ prc_local_comm_world

integer, public scale_process::prc_local_comm_world = -1

◆ prc_nprocs

integer, public scale_process::prc_nprocs = 1

◆ prc_myrank

integer, public scale_process::prc_myrank = 0

process num in local communicator

Definition at line 79 of file scale_process.F90.

Referenced by mod_admin_time::admin_time_setup(), scale_atmos_phy_mp_common::atmos_phy_mp_negative_fixer(), mod_atmos_vars::atmos_vars_monitor(), mod_atmos_vars::atmos_vars_restart_check(), mod_copytopo::copytopo(), scale_atmos_phy_mp_sn14::debug_tem_kij(), scale_external_input::extin_regist(), scale_fileio::fileio_create(), scale_fileio::fileio_open(), scale_fileio::fileio_setup(), scale_fileio::fileio_write_axes(), scale_fileio::fileio_write_var_1d(), scale_fileio::fileio_write_var_2d(), scale_fileio::fileio_write_var_3d(), scale_fileio::fileio_write_var_3d_t(), scale_fileio::fileio_write_var_4d(), scale_grid::grid_allocate(), scale_grid::grid_generate(), scale_grid_index::grid_index_setup(), scale_history::hist_reg(), scale_history::hist_setup(), scale_land_grid::land_grid_setup(), scale_land_sfc_thin_slab::land_sfc_thin_slab(), scale_monitor::monit_finalize(), scale_monitor::monit_write(), scale_grid_nest::nest_comm_issuer_of_receive_3d(), scale_grid_nest::nest_domain_relate(), scale_grid_nest::nest_domain_shape(), prc_local_setup(), prc_mpitimestat(), scale_rm_process::prc_setup(), scale_random::random_setup(), scale_rm_statistics::stat_detail(), scale_rm_statistics::stat_total_2d(), scale_rm_statistics::stat_total_3d(), scale_urban_grid::urban_grid_setup(), scale_urban_phy_slc::urban_phy_slc(), scale_debug::valcheck_1d(), scale_debug::valcheck_2d(), and scale_debug::valcheck_3d().

79  integer, public :: PRC_myrank = 0

◆ prc_ismaster

logical, public scale_process::prc_ismaster = .false.

◆ prc_mpi_alive

logical, public scale_process::prc_mpi_alive = .false.

MPI is alive?

Definition at line 83 of file scale_process.F90.

Referenced by prc_local_mpistart(), prc_mpibarrier(), prc_mpifinish(), prc_mpistart(), prc_mpistop(), prc_mpitime(), prc_mpitimestat(), and scale_rm_process::prc_setup().

83  logical, public :: PRC_mpi_alive = .false.

◆ prc_universal_handler

integer, public scale_process::prc_universal_handler

error handler in universal communicator

Definition at line 84 of file scale_process.F90.

Referenced by prc_local_mpistart(), prc_mpifinish(), prc_mpistart(), and prc_universal_setup().

84  integer, public :: PRC_UNIVERSAL_handler

◆ prc_abort_comm_world

integer, public scale_process::prc_abort_comm_world

communicator for aborting

Definition at line 85 of file scale_process.F90.

Referenced by prc_mpitimestat(), scale_rm_process::prc_setup(), and prc_universal_setup().

85  integer, public :: PRC_ABORT_COMM_WORLD

◆ prc_abort_handler

integer, public scale_process::prc_abort_handler

error handler communicator for aborting

Definition at line 86 of file scale_process.F90.

Referenced by prc_mpifinish(), and prc_universal_setup().

86  integer, public :: PRC_ABORT_handler