[cig-commits] [commit] devel: Reads locally and broadcasts database MPI OC (3b86bd7)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri Dec 5 07:22:55 PST 2014
Repository : https://github.com/geodynamics/specfem3d_globe
On branch : devel
Link : https://github.com/geodynamics/specfem3d_globe/compare/b9fb1aa33196d161098710455fadbb4ed91c5e47...897de40783bd1a4630c2aacd3fa5f8b016d4c189
>---------------------------------------------------------------
commit 3b86bd76688f88f09ba156c467aee6c0ea3d9986
Author: Matthieu Lefebvre <ml15 at princeton.edu>
Date: Tue Dec 2 10:17:45 2014 -0500
Reads locally and broadcasts database MPI OC
>---------------------------------------------------------------
3b86bd76688f88f09ba156c467aee6c0ea3d9986
src/specfem3D/read_mesh_databases.F90 | 95 +++++++++++++++++++++++++++++++++--
1 file changed, 91 insertions(+), 4 deletions(-)
diff --git a/src/specfem3D/read_mesh_databases.F90 b/src/specfem3D/read_mesh_databases.F90
index 45e7aba..2645df5 100644
--- a/src/specfem3D/read_mesh_databases.F90
+++ b/src/specfem3D/read_mesh_databases.F90
@@ -936,11 +936,14 @@
endif
! outer core
- if (ADIOS_FOR_MPI_ARRAYS) then
- call read_mesh_databases_MPI_OC_adios()
- else
- call read_mesh_databases_MPI_OC()
+ if (I_should_read_the_database) then
+ if (ADIOS_FOR_MPI_ARRAYS) then
+ call read_mesh_databases_MPI_OC_adios()
+ else
+ call read_mesh_databases_MPI_OC()
+ endif
endif
+ call bcast_mesh_databases_MPI_OC()
allocate(buffer_send_scalar_outer_core(max_nibool_interfaces_oc,num_interfaces_outer_core), &
buffer_recv_scalar_outer_core(max_nibool_interfaces_oc,num_interfaces_outer_core), &
@@ -1747,3 +1750,87 @@
!-------------------------------------------------------------------------------------------------
!
+ subroutine bcast_mesh_databases_MPI_OC()
+
+ use specfem_par
+ use specfem_par_outercore
+ implicit none
+
+ ! local parameters
+ integer :: ier
+
+ ! MPI interfaces
+ call bcast_all_i_for_database(num_interfaces_outer_core, 1)
+ if (.not. I_should_read_the_database) then
+ allocate(my_neighbours_outer_core(num_interfaces_outer_core), &
+ nibool_interfaces_outer_core(num_interfaces_outer_core), &
+ stat=ier)
+ if (ier /= 0 ) &
+ call exit_mpi(myrank,'Error allocating array my_neighbours_outer_core etc.')
+ endif
+
+ if (num_interfaces_outer_core > 0) then
+ call bcast_all_i_for_database(max_nibool_interfaces_oc, 1)
+ if (.not. I_should_read_the_database) then
+ allocate(ibool_interfaces_outer_core(max_nibool_interfaces_oc,num_interfaces_outer_core), &
+ stat=ier)
+ if (ier /= 0 ) call exit_mpi(myrank,'Error allocating array ibool_interfaces_outer_core')
+ endif
+
+ call bcast_all_i_for_database(my_neighbours_outer_core(1), 1)
+ call bcast_all_i_for_database(nibool_interfaces_outer_core(1), 1)
+ call bcast_all_i_for_database(ibool_interfaces_outer_core(1,1), 1)
+ else
+ ! dummy array
+ max_nibool_interfaces_oc = 0
+ if (.not. I_should_read_the_database) then
+ allocate(ibool_interfaces_outer_core(0,0),stat=ier)
+ if (ier /= 0 ) call exit_mpi(myrank,'Error allocating array dummy ibool_interfaces_outer_core')
+ endif
+ endif
+
+ ! inner / outer elements
+ call bcast_all_i_for_database(nspec_inner_outer_core, 1)
+ call bcast_all_i_for_database(nspec_outer_outer_core, 1)
+ call bcast_all_i_for_database(num_phase_ispec_outer_core, 1)
+ if (num_phase_ispec_outer_core < 0 ) &
+ call exit_mpi(myrank,'Error num_phase_ispec_outer_core is < zero')
+
+ if (.not. I_should_read_the_database) then
+ allocate(phase_ispec_inner_outer_core(num_phase_ispec_outer_core,2),&
+ stat=ier)
+ if (ier /= 0 ) &
+ call exit_mpi(myrank,'Error allocating array phase_ispec_inner_outer_core')
+ endif
+
+ if (num_phase_ispec_outer_core > 0 ) then
+ call bcast_all_i_for_database(phase_ispec_inner_outer_core(1,1), 1)
+ endif
+
+ ! mesh coloring for GPUs
+ if (USE_MESH_COLORING_GPU) then
+ ! colors
+ call bcast_all_i_for_database(num_colors_outer_outer_core, 1)
+ call bcast_all_i_for_database(num_colors_inner_outer_core, 1)
+
+ if (.not. I_should_read_the_database) then
+ allocate(num_elem_colors_outer_core(num_colors_outer_outer_core + num_colors_inner_outer_core), &
+ stat=ier)
+ if (ier /= 0 ) &
+ call exit_mpi(myrank,'Error allocating num_elem_colors_outer_core array')
+ endif
+
+ call bcast_all_i_for_database(num_elem_colors_outer_core(1), 1)
+ else
+ ! allocates dummy arrays
+ num_colors_outer_outer_core = 0
+ num_colors_inner_outer_core = 0
+ if (.not. I_should_read_the_database) then
+ allocate(num_elem_colors_outer_core(num_colors_outer_outer_core + num_colors_inner_outer_core), &
+ stat=ier)
+ if (ier /= 0 ) &
+ call exit_mpi(myrank,'Error allocating num_elem_colors_outer_core array')
+ endif
+ endif
+
+ end subroutine bcast_mesh_databases_MPI_OC
More information about the CIG-COMMITS
mailing list