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_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 108 of file scale_process.F90.

References prc_mpi_alive, and prc_universal_handler.

Referenced by scalerm_launcher().

108  implicit none
109 
110  integer, intent(out) :: comm ! communicator
111 
112  integer :: ierr
113  !---------------------------------------------------------------------------
114 
115  call mpi_init(ierr)
116 
117  prc_mpi_alive = .true.
118  prc_universal_handler = mpi_errhandler_null
119  call mpi_comm_create_errhandler( prc_mpi_errorhandler, prc_universal_handler, ierr )
120 
121  comm = mpi_comm_world
122 
123  return
Here is the caller 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 132 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 scalerm_launcher().

132  implicit none
133 
134  integer, intent(in) :: comm ! communicator
135  integer, intent(out) :: nprocs ! number of procs in this communicator
136  logical, intent(out) :: ismaster ! master process in this communicator?
137 
138  integer :: ierr
139  !---------------------------------------------------------------------------
140 
141  prc_universal_comm_world = comm
142 
143  call mpi_comm_size(prc_universal_comm_world,prc_universal_nprocs,ierr)
144  call mpi_comm_rank(prc_universal_comm_world,prc_universal_myrank,ierr)
145 
146  if ( prc_universal_myrank == prc_masterrank ) then
147  prc_universal_ismaster = .true.
148  else
149  prc_universal_ismaster = .false.
150  endif
151 
152  nprocs = prc_universal_nprocs
153  ismaster = prc_universal_ismaster
154 
155 
156 
157  prc_abort_comm_world = prc_universal_comm_world
158 
159  call mpi_comm_set_errhandler(prc_abort_comm_world,prc_universal_handler,ierr)
160  call mpi_comm_get_errhandler(prc_abort_comm_world,prc_abort_handler ,ierr)
161 
162  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 170 of file scale_process.F90.

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

Referenced by scalerm_launcher().

170  implicit none
171 
172  logical, intent(in) :: abortall ! abort all jobs?
173  integer, intent(in) :: comm ! communicator
174 
175  integer :: ierr
176  !---------------------------------------------------------------------------
177 
178  prc_global_comm_world = comm
179 
180  call mpi_comm_size(prc_global_comm_world,prc_global_nprocs,ierr)
181  call mpi_comm_rank(prc_global_comm_world,prc_global_myrank,ierr)
182 
183  if ( prc_global_myrank == prc_masterrank ) then
184  prc_global_ismaster = .true.
185  else
186  prc_global_ismaster = .false.
187  endif
188 
189 ! if ( .NOT. abortall ) then
190 ! PRC_ABORT_COMM_WORLD = PRC_GLOBAL_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 ! endif
195 
196  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 205 of file scale_process.F90.

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

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

205  implicit none
206 
207  integer, intent(in) :: comm ! communicator
208  integer, intent(out) :: myrank ! myrank in this communicator
209  logical, intent(out) :: ismaster ! master process in this communicator?
210 
211  integer :: ierr
212  !---------------------------------------------------------------------------
213 
214  prc_local_comm_world = comm
215 
216  call mpi_comm_rank(prc_local_comm_world,prc_myrank,ierr)
217  call mpi_comm_size(prc_local_comm_world,prc_nprocs,ierr)
218 
219  if ( prc_myrank == prc_masterrank ) then
220  prc_ismaster = .true.
221  else
222  prc_ismaster = .false.
223  endif
224 
225  myrank = prc_myrank
226  ismaster = prc_ismaster
227 
228  return
Here is the caller graph for this function:

◆ prc_mpistop()

subroutine, public scale_process::prc_mpistop ( )

Abort MPI.

Definition at line 234 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_aetracer_kajino13::aetracer_kajino13_setup(), scale_aetracer_none::aetracer_none_setup(), 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(), 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_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_dummy::atmos_phy_ae_dummy_setup(), scale_atmos_phy_ae_kajino13::atmos_phy_ae_kajino13_setup(), scale_atmos_phy_ae::atmos_phy_ae_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_dry::atmos_phy_mp_dry_setup(), scale_atmos_phy_mp_kessler::atmos_phy_mp_kessler_setup(), 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_setup(), scale_atmos_phy_mp::atmos_phy_mp_setup(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14_setup(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_setup(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08_setup(), mod_atmos_phy_mp_vars::atmos_phy_mp_vars_setup(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx_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_bulkcoef::atmos_phy_sf_bulkcoef_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_d1980::atmos_phy_tb_d1980_setup(), scale_atmos_phy_tb_dns::atmos_phy_tb_dns_setup(), mod_atmos_phy_tb_driver::atmos_phy_tb_driver_setup(), scale_atmos_phy_tb_dummy::atmos_phy_tb_dummy_setup(), scale_atmos_phy_tb_hybrid::atmos_phy_tb_hybrid_setup(), scale_atmos_phy_tb_mynn::atmos_phy_tb_mynn_setup(), scale_atmos_phy_tb::atmos_phy_tb_setup(), 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(), scale_atmos_thermodyn::atmos_thermodyn_setup(), 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(), 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_mkinit::diag_ds(), 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_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_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_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::land_sfc_setup(), scale_land_sfc_slab::land_sfc_slab(), scale_land_sfc_slab::land_sfc_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::ocean_sfc_setup(), scale_ocean_sfc_slab::ocean_sfc_slab(), scale_ocean_sfc_slab::ocean_sfc_slab_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(), scale_topography::topo_fillhalo(), scale_topography::topo_setup(), scale_tracer::tracer_setup(), scale_tracer_suzuki10::tracer_suzuki10_setup(), 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().

234  implicit none
235 
236  integer :: ierr
237  !---------------------------------------------------------------------------
238 
239  if ( prc_mpi_alive ) then
240  ! tentative approach; input "PRC_UNIVERSAL_COMM_WORLD".
241  call mpi_comm_call_errhandler(prc_universal_comm_world,prc_abort_code,ierr)
242  endif
243 
244  stop

◆ prc_mpifinish()

subroutine, public scale_process::prc_mpifinish ( )

Stop MPI peacefully.

Definition at line 250 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().

250  implicit none
251 
252  integer :: ierr
253  !---------------------------------------------------------------------------
254 
255  if (prc_universal_handler .NE. mpi_errhandler_null) then
256  call mpi_errhandler_free(prc_universal_handler, ierr)
257  endif
258  if (prc_abort_handler .NE. mpi_errhandler_null) then
259  call mpi_errhandler_free(prc_abort_handler, ierr)
260  endif
261 
262  ! Stop MPI
263  if ( prc_mpi_alive ) then
264  if ( io_l ) then
265  write(io_fid_log,*)
266  write(io_fid_log,*) '++++++ Finalize MPI...'
267  endif
268 
269  ! free splitted communicator
270  if ( prc_local_comm_world /= prc_global_comm_world ) then
271  call mpi_comm_free(prc_local_comm_world,ierr)
272  endif
273 
274  call mpi_barrier(prc_universal_comm_world,ierr)
275 
276  call mpi_finalize(ierr)
277  if( io_l ) write(io_fid_log,*) '++++++ MPI is peacefully finalized'
278  endif
279 
280  ! Close logfile, configfile
281  if ( io_l ) then
282  if( io_fid_log /= io_fid_stdout ) close(io_fid_log)
283  endif
284  close(io_fid_conf)
285 
286  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=h_long), 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 303 of file scale_process.F90.

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

Referenced by scalerm_launcher().

303  implicit none
304 
305  integer, intent(in) :: org_comm
306  integer, intent(in) :: num_domain
307  integer, intent(in) :: prc_domains(:)
308  character(len=H_LONG), intent(in) :: conf_files(:)
309  logical, intent(in) :: log_split
310  logical, intent(in) :: bulk_split
311  logical, intent(in) :: color_reorder
312 
313  integer, intent(out) :: intra_comm
314  integer, intent(out) :: inter_parent
315  integer, intent(out) :: inter_child
316  character(len=H_LONG), intent(out) :: fname_local
317 
318  integer :: parent_col(prc_domain_nlim) ! parent color number
319  integer :: child_col(prc_domain_nlim) ! child color number
320  integer :: prc_root(0:prc_domain_nlim) ! root process in the color
321  integer, allocatable :: color_list(:) ! member list in each color
322  integer, allocatable :: key_list(:) ! local process number in each color
323 
324  integer :: total_nmax
325  integer :: org_myrank ! my rank number in the original communicator
326  integer :: org_nmax ! total rank number in the original communicator
327 
328  logical :: do_create_p(prc_domain_nlim)
329  logical :: do_create_c(prc_domain_nlim)
330  logical :: reordering
331 
332  character(len=H_LONG) :: col_file(0:prc_domain_nlim)
333  character(len=4) :: col_num
334 
335  integer :: i
336  integer :: itag, ierr
337  !---------------------------------------------------------------------------
338 
339  intra_comm = org_comm
340  inter_parent = mpi_comm_null
341  inter_child = mpi_comm_null
342  fname_local = conf_files(1)
343 
344  if ( num_domain > 1 ) then ! multi domain run
345  call mpi_comm_rank(org_comm,org_myrank,ierr)
346  call mpi_comm_size(org_comm,org_nmax, ierr)
347  allocate( color_list(0:org_nmax-1) )
348  allocate( key_list(0:org_nmax-1) )
349 
350  total_nmax = 0
351  do i = 1, num_domain
352  total_nmax = total_nmax + prc_domains(i)
353  enddo
354  if ( total_nmax /= org_nmax ) then
355  if( prc_universal_ismaster ) write(*,*) ""
356  if( prc_universal_ismaster ) write(*,*) "ERROR: MPI PROCESS NUMBER is INCONSISTENT"
357  if( prc_universal_ismaster ) write(*,*) "REQUESTED NPROCS = ", total_nmax, " LAUNCHED NPROCS = ", org_nmax
358  call prc_mpistop
359  endif
360 
361  reordering = color_reorder
362  if ( bulk_split ) then
363  reordering = .false.
364  endif
365  call prc_mpicoloring( org_comm, & ! [IN]
366  num_domain, & ! [IN]
367  prc_domains, & ! [IN]
368  conf_files, & ! [IN]
369  reordering, & ! [IN]
370  log_split, & ! [IN]
371  color_list, & ! [OUT]
372  prc_root, & ! [OUT]
373  key_list, & ! [OUT]
374  parent_col, & ! [OUT]
375  child_col, & ! [OUT]
376  col_file ) ! [OUT]
377 
378 
379  ! split comm_world
380  call mpi_comm_split(org_comm, &
381  color_list(org_myrank), &
382  key_list(org_myrank), &
383  intra_comm, ierr)
384  if ( bulk_split ) then
385  write(col_num,'(I4.4)') color_list(org_myrank)
386  fname_local = col_num
387  prc_universal_jobid = color_list(org_myrank)
388  else
389  fname_local = col_file(color_list(org_myrank))
390  endif
391 
392  ! set parent-child relationship
393  do_create_p(:) = .false.
394  do_create_c(:) = .false.
395  if ( .NOT. bulk_split ) then
396  do i = 1, num_domain-1
397  if ( prc_universal_ismaster ) write ( *, '(1X,A,I4)' ) "relationship: ", i
398  if ( prc_universal_ismaster ) write ( *, '(1X,A,I4,A,I4)' ) &
399  "--- parent color = ", parent_col(i), " child color = ", child_col(i)
400  if ( color_list(org_myrank) == parent_col(i) ) then
401  do_create_p(i) = .true.
402  elseif ( color_list(org_myrank) == child_col(i) ) then
403  do_create_c(i) = .true.
404  endif
405  enddo
406  endif
407 
408  ! create inter-commnunicator
409  inter_parent = mpi_comm_null
410  inter_child = mpi_comm_null
411  if ( .NOT. bulk_split ) then
412  do i = 1, num_domain-1
413  itag = i*100
414  if ( do_create_p(i) ) then ! as a parent
415  call mpi_intercomm_create( intra_comm, prc_masterrank, &
416  org_comm, prc_root(child_col(i)), &
417  itag, inter_child, ierr )
418  elseif( do_create_c(i) ) then ! as a child
419  call mpi_intercomm_create( intra_comm, prc_masterrank, &
420  org_comm, prc_root(parent_col(i)), &
421  itag, inter_parent, ierr )
422  endif
423  call mpi_barrier(org_comm, ierr)
424  enddo
425  endif
426 
427  deallocate( color_list, key_list )
428 
429  elseif ( num_domain == 1 ) then ! single domain run
430  if ( prc_universal_ismaster ) write (*,*) "*** a single comunicator"
431  else
432  if ( prc_universal_ismaster ) write (*,*) "ERROR: REQUESTED DOMAIN NUMBER IS NOT ACCEPTABLE"
433  call prc_mpistop
434  endif
435 
436  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 448 of file scale_process.F90.

References prc_universal_ismaster.

448  implicit none
449 
450  integer, intent(in) :: org_comm
451  integer, intent(in) :: mem_np
452  integer, intent(in) :: nitmax
453  integer, intent(in) :: nprocs
454  integer, intent(in) :: proc2mem(2,nitmax,nprocs)
455  integer, intent(out) :: intra_comm
456 
457  integer :: org_myrank ! my rank number in the original communicator
458  integer :: color, key
459  integer :: ierr
460  !---------------------------------------------------------------------------
461 
462  call mpi_comm_rank( org_comm, org_myrank, ierr )
463 
464  if ( proc2mem(1,1,org_myrank+1) >= 1 ) then
465  color = proc2mem(1,1,org_myrank+1) - 1
466  key = proc2mem(2,1,org_myrank+1)
467  else
468  color = mpi_undefined
469  key = mpi_undefined
470  endif
471 
472  call mpi_comm_split( org_comm, &
473  color, &
474  key, &
475  intra_comm, &
476  ierr )
477 
478  return

◆ prc_mpibarrier()

subroutine, public scale_process::prc_mpibarrier ( )

Barrier MPI.

Definition at line 700 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().

700  implicit none
701 
702  integer :: ierr
703  !---------------------------------------------------------------------------
704 
705  if ( prc_mpi_alive ) then
706  call mpi_barrier(prc_local_comm_world,ierr)
707  endif
708 
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 715 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().

715  implicit none
716 
717  real(DP) :: time
718  !---------------------------------------------------------------------------
719 
720  if ( prc_mpi_alive ) then
721  time = real(MPI_WTIME(), kind=dp)
722  else
723  call cpu_time(time)
724  endif
725 
integer, parameter, public dp
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 737 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().

737  implicit none
738 
739  real(DP), intent(out) :: avgvar(:)
740  real(DP), intent(out) :: maxvar(:)
741  real(DP), intent(out) :: minvar(:)
742  integer, intent(out) :: maxidx(:)
743  integer, intent(out) :: minidx(:)
744  real(DP), intent(in) :: var(:)
745 
746  real(DP), allocatable :: statval(:,:)
747  integer :: vsize
748 
749  real(DP) :: totalvar
750  integer :: ierr
751  integer :: v, p
752  !---------------------------------------------------------------------------
753 
754  vsize = size(var(:))
755 
756  allocate( statval(vsize,0:prc_nprocs-1) )
757  statval(:,:) = 0.0_dp
758 
759  do v = 1, vsize
760  statval(v,prc_myrank) = var(v)
761  enddo
762 
763  ! MPI broadcast
764  do p = 0, prc_nprocs-1
765  call mpi_bcast( statval(1,p), &
766  vsize, &
767  mpi_double_precision, &
768  p, &
769  prc_local_comm_world, &
770  ierr )
771  enddo
772 
773  do v = 1, vsize
774  totalvar = 0.0_dp
775  do p = 0, prc_nprocs-1
776  totalvar = totalvar + statval(v,p)
777  enddo
778  avgvar(v) = totalvar / prc_nprocs
779 
780  maxvar(v) = maxval(statval(v,:))
781  minvar(v) = minval(statval(v,:))
782  maxidx(v:v) = maxloc(statval(v,:))
783  minidx(v:v) = minloc(statval(v,:))
784  enddo
785 
786  deallocate( statval )
787 
788  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 57 of file scale_process.F90.

Referenced by scalerm_launcher().

57  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 60 of file scale_process.F90.

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

60  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 61 of file scale_process.F90.

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

61  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 62 of file scale_process.F90.

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

62  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 63 of file scale_process.F90.

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

63  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 65 of file scale_process.F90.

Referenced by prc_mpisplit(), and prc_mpitimestat().

65  integer, public :: prc_universal_jobid = 0

◆ prc_global_comm_world

integer, public scale_process::prc_global_comm_world = -1

global communicator

Definition at line 68 of file scale_process.F90.

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

68  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 69 of file scale_process.F90.

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

69  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 70 of file scale_process.F90.

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

70  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 71 of file scale_process.F90.

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

71  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 73 of file scale_process.F90.

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

73  integer, public :: prc_global_domainid = 0

◆ prc_local_comm_world

integer, public scale_process::prc_local_comm_world = -1

local communicator

Definition at line 76 of file scale_process.F90.

Referenced by scale_comm::comm_setup(), prc_local_setup(), prc_mpibarrier(), prc_mpifinish(), prc_mpitimestat(), and scale_rm_process::prc_setup().

76  integer, public :: 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 78 of file scale_process.F90.

Referenced by mod_admin_time::admin_time_setup(), scale_atmos_boundary::atmos_boundary_resume(), scale_atmos_boundary::atmos_boundary_update(), 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_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_read_1d(), scale_fileio::fileio_read_2d(), scale_fileio::fileio_read_3d(), scale_fileio::fileio_read_4d(), 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_grid::grid_allocate(), scale_grid::grid_generate(), scale_grid_index::grid_index_setup(), scale_history::hist_setup(), scale_land_grid::land_grid_setup(), scale_land_sfc_slab::land_sfc_slab(), scale_monitor::monit_finalize(), scale_monitor::monit_write(), scale_grid_nest::nest_comm_intercomm_nestdown_3d(), scale_grid_nest::nest_comm_issuer_of_receive_3d(), scale_grid_nest::nest_comm_nestdown(), scale_grid_nest::nest_comm_recv_cancel(), 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_topography::topo_fillhalo(), 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().

78  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 82 of file scale_process.F90.

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

82  logical, public :: prc_mpi_alive = .false.

◆ prc_universal_handler

integer, public scale_process::prc_universal_handler

error handler in universal communicator

Definition at line 83 of file scale_process.F90.

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

83  integer, public :: prc_universal_handler

◆ prc_abort_comm_world

integer, public scale_process::prc_abort_comm_world

communicator for aborting

Definition at line 84 of file scale_process.F90.

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

84  integer, public :: prc_abort_comm_world

◆ prc_abort_handler

integer, public scale_process::prc_abort_handler

error handler communicator for aborting

Definition at line 85 of file scale_process.F90.

Referenced by prc_mpifinish(), and prc_universal_setup().

85  integer, public :: prc_abort_handler