[cig-commits] r12565 - seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Wed Aug 6 15:47:13 PDT 2008


Author: dkomati1
Date: 2008-08-06 15:47:13 -0700 (Wed, 06 Aug 2008)
New Revision: 12565

Modified:
   seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call1.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call2.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/meshfem3D.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90
Log:
converted buffer_send_faces and buffer_received_faces from heap to stack


Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call1.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call1.f90	2008-08-06 22:38:12 UTC (rev 12564)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call1.f90	2008-08-06 22:47:13 UTC (rev 12565)
@@ -7,7 +7,7 @@
   one_minus_sum_beta_crust_mantle,factor_scale_crust_mantle, one_minus_sum_beta_inner_core,factor_scale_inner_core, &
   factor_common_crust_mantle,factor_common_inner_core,factor_common_crust_mantle_dble, factor_common_inner_core_dble, &
 !! DK DK already computed
-  myrank,sizeprocs,addressing,ichunk_slice,iproc_xi_slice,iproc_eta_slice,ibathy_topo,NSOURCES, &
+  myrank,sizeprocs,addressing,ichunk_slice,iproc_xi_slice,iproc_eta_slice,ibathy_topo,NSOURCES,npoin2D_max_all,NDIM_smaller_buffers, &
   ibool_crust_mantle, ibool_outer_core, ibool_inner_core, idoubling_crust_mantle,idoubling_inner_core, &
 ibelm_bottom_crust_mantle, ibelm_bottom_outer_core, ibelm_top_outer_core, &
 ibelm_xmin_inner_core,ibelm_xmax_inner_core,ibelm_ymin_inner_core,ibelm_ymax_inner_core,ibelm_bottom_inner_core, &

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call2.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call2.f90	2008-08-06 22:38:12 UTC (rev 12564)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/call2.f90	2008-08-06 22:47:13 UTC (rev 12565)
@@ -7,7 +7,7 @@
   one_minus_sum_beta_crust_mantle,factor_scale_crust_mantle, one_minus_sum_beta_inner_core,factor_scale_inner_core, &
   factor_common_crust_mantle,factor_common_inner_core,factor_common_crust_mantle_dble, factor_common_inner_core_dble, &
 !! DK DK already computed
-  myrank,sizeprocs,addressing,ichunk_slice,iproc_xi_slice,iproc_eta_slice,ibathy_topo,NSOURCES, &
+  myrank,sizeprocs,addressing,ichunk_slice,iproc_xi_slice,iproc_eta_slice,ibathy_topo,NSOURCES,npoin2D_max_all,NDIM_smaller_buffers, &
   ibool_crust_mantle, ibool_outer_core, ibool_inner_core, idoubling_crust_mantle,idoubling_inner_core, &
 ibelm_bottom_crust_mantle, ibelm_bottom_outer_core, ibelm_top_outer_core, &
 ibelm_xmin_inner_core,ibelm_xmax_inner_core,ibelm_ymin_inner_core,ibelm_ymax_inner_core,ibelm_bottom_inner_core, &

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/meshfem3D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/meshfem3D.f90	2008-08-06 22:38:12 UTC (rev 12564)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/meshfem3D.f90	2008-08-06 22:47:13 UTC (rev 12565)
@@ -635,6 +635,8 @@
 
   logical :: not_done_yet
 
+  integer :: npoin2D_max_all,NDIM_smaller_buffers
+
 ! ************** PROGRAM STARTS HERE **************
 
 ! initialize the MPI communicator and start the NPROCTOT MPI processes.
@@ -2048,6 +2050,16 @@
   npoin2D_xi_inner_core(2) = npoin2D_xi_inner_core(1)
   npoin2D_eta_inner_core(2) = npoin2D_eta_inner_core(1)
 
+!! DK DK added this to reduce the size of the buffers
+! size of buffers is the sum of two sizes because we handle two regions in the same MPI call
+  npoin2D_max_all = max(maxval(npoin2D_xi_crust_mantle(:) + npoin2D_xi_inner_core(:)), &
+                        maxval(npoin2D_eta_crust_mantle(:) + npoin2D_eta_inner_core(:)))
+  if(FEWER_MESSAGES_LARGER_BUFFERS) then
+    NDIM_smaller_buffers = NDIM
+  else
+    NDIM_smaller_buffers = 1
+  endif
+
 !! DK DK for the merged version
   include 'call1.f90'
 !! DK DK for now use variables just to make sure we don't get warning about unused variables

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90	2008-08-06 22:38:12 UTC (rev 12564)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90	2008-08-06 22:47:13 UTC (rev 12565)
@@ -319,7 +319,8 @@
 ! we use the same buffers to assemble scalars and vectors because vectors are
 ! always three times bigger and therefore scalars can use the first part
 ! of the vector buffer in memory even if it has an additional index here
-  real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: buffer_send_faces,buffer_received_faces
+! allocate these automatic arrays in the memory stack to avoid memory fragmentation with "allocate()"
+  real(kind=CUSTOM_REAL), dimension(NDIM_smaller_buffers,npoin2D_max_all) :: buffer_send_faces,buffer_received_faces
 
 ! -------- arrays specific to each region here -----------
 
@@ -686,27 +687,6 @@
 !! DK DK suppressed for merged version  call MPI_COMM_SIZE(MPI_COMM_WORLD,sizeprocs,ier)
 !! DK DK suppressed for merged version  call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ier)
 
-!! DK DK added this to reduce the size of the buffers
-! size of buffers is the sum of two sizes because we handle two regions in the same MPI call
-  npoin2D_max_all = max(maxval(npoin2D_xi_crust_mantle(:) + npoin2D_xi_inner_core(:)), &
-                        maxval(npoin2D_eta_crust_mantle(:) + npoin2D_eta_inner_core(:)))
-  if(FEWER_MESSAGES_LARGER_BUFFERS) then
-    NDIM_smaller_buffers = NDIM
-  else
-    NDIM_smaller_buffers = 1
-  endif
-  allocate(buffer_send_faces(NDIM_smaller_buffers,npoin2D_max_all),STAT=ier)
-  if (ier /= 0 ) then
-    print *,"ABORTING can not allocate in specfem3D ier=",ier
-    call MPI_Abort(MPI_COMM_WORLD,errorcode,ier)
-  endif
-
-  allocate(buffer_received_faces(NDIM_smaller_buffers,npoin2D_max_all),STAT=ier)
-  if (ier /= 0 ) then
-    print *,"ABORTING can not allocate in specfem3D ier=",ier
-    call MPI_Abort(MPI_COMM_WORLD,errorcode,ier)
-  endif
-
   if (myrank == 0) then
 
 ! read the parameter file and compute additional parameters



More information about the cig-commits mailing list