Run distributed GMBE calculation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(gmbe_context_t), | intent(inout) | :: | this | |||
| type(json_output_data_t), | intent(out), | optional | :: | json_data |
subroutine gmbe_run_distributed(this, json_data) !! Run distributed GMBE calculation use mqc_gmbe_fragment_distribution_scheme, only: gmbe_pie_coordinator use mqc_mbe_fragment_distribution_scheme, only: node_coordinator, node_worker use pic_logger, only: logger => global_logger use pic_io, only: to_char use omp_lib, only: omp_set_num_threads, omp_get_max_threads class(gmbe_context_t), intent(inout) :: this type(json_output_data_t), intent(out), optional :: json_data if (.not. this%has_mpi()) then call logger%error("gmbe_run_distributed: resources not set in context") return end if ! Determine role based on MPI rank if (this%resources%mpi_comms%world_comm%leader() .and. & this%resources%mpi_comms%node_comm%leader()) then ! Global coordinator (rank 0, node leader on node 0) call omp_set_num_threads(omp_get_max_threads()) call logger%verbose("Rank 0: Acting as GMBE PIE coordinator") call gmbe_pie_coordinator(this%resources, this%pie_atom_sets, this%pie_coefficients, & this%n_pie_terms, this%node_leader_ranks, this%num_nodes, & this%sys_geom, this%method_config, this%calc_type, json_data) else if (this%resources%mpi_comms%node_comm%leader()) then ! Node coordinator (node leader on other nodes) call logger%verbose("Rank "//to_char(this%resources%mpi_comms%world_comm%rank())// & ": Acting as node coordinator") ! Note: node_coordinator works for both MBE and GMBE call node_coordinator(this%resources, this%method_config, this%calc_type) else ! Worker call omp_set_num_threads(1) call logger%verbose("Rank "//to_char(this%resources%mpi_comms%world_comm%rank())// & ": Acting as worker") ! Note: node_worker works for both MBE and GMBE (fragment_type distinguishes) if (this%has_geometry()) then call node_worker(this%resources, this%sys_geom, this%method_config, this%calc_type) else call node_worker(this%resources, method_config=this%method_config, & calc_type=this%calc_type) end if end if end subroutine gmbe_run_distributed