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

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Wed Aug 6 14:54:50 PDT 2008


Author: dkomati1
Date: 2008-08-06 14:54:50 -0700 (Wed, 06 Aug 2008)
New Revision: 12562

Modified:
   seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/recompute_missing_arrays.f90
   seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90
Log:
converted recompute_missing_arrays.f90 from heap to stack


Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/recompute_missing_arrays.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/recompute_missing_arrays.f90	2008-08-06 21:35:34 UTC (rev 12561)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/recompute_missing_arrays.f90	2008-08-06 21:54:50 UTC (rev 12562)
@@ -31,7 +31,8 @@
      etaxstore,etaystore,etazstore, &
      gammaxstore,gammaystore,gammazstore, &
      xstore,ystore,zstore, &
-     xelm_store,yelm_store,zelm_store,ibool,nspec,nglob)
+     xelm_store,yelm_store,zelm_store,ibool,nspec,nglob, &
+     xigll,yigll,zigll)
 
   implicit none
 
@@ -55,37 +56,16 @@
   double precision xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz
   double precision jacobian
 
-! Gauss-Lobatto-Legendre points and weights of integration
-  double precision, dimension(:), allocatable :: xigll,yigll,zigll,wxgll,wygll,wzgll
-
-! 3D shape functions and their derivatives
-  double precision, dimension(:,:,:,:), allocatable :: shape3D
-  double precision, dimension(:,:,:,:,:), allocatable :: dershape3D
-
 ! Gauss-Lobatto-Legendre points of integration
-  allocate(xigll(NGLLX))
-  allocate(yigll(NGLLY))
-  allocate(zigll(NGLLZ))
+  double precision, dimension(NGLLX) :: xigll
+  double precision, dimension(NGLLY) :: yigll
+  double precision, dimension(NGLLZ) :: zigll
 
-! Gauss-Lobatto-Legendre weights of integration
-  allocate(wxgll(NGLLX))
-  allocate(wygll(NGLLY))
-  allocate(wzgll(NGLLZ))
-
+! allocate these automatic arrays in the memory stack to avoid memory fragmentation with "allocate()"
 ! 3D shape functions and their derivatives
-  allocate(shape3D(NGNOD,NGLLX,NGLLY,NGLLZ))
-  allocate(dershape3D(NDIM,NGNOD,NGLLX,NGLLY,NGLLZ))
+  double precision, dimension(NGNOD,NGLLX,NGLLY,NGLLZ) :: shape3D
+  double precision, dimension(NDIM,NGNOD,NGLLX,NGLLY,NGLLZ) :: dershape3D
 
-! set up coordinates of the Gauss-Lobatto-Legendre points
-  call zwgljd(xigll,wxgll,NGLLX,GAUSSALPHA,GAUSSBETA)
-  call zwgljd(yigll,wygll,NGLLY,GAUSSALPHA,GAUSSBETA)
-  call zwgljd(zigll,wzgll,NGLLZ,GAUSSALPHA,GAUSSBETA)
-
-! if number of points is odd, the middle abscissa is exactly zero
-  if(mod(NGLLX,2) /= 0) xigll((NGLLX-1)/2+1) = ZERO
-  if(mod(NGLLY,2) /= 0) yigll((NGLLY-1)/2+1) = ZERO
-  if(mod(NGLLZ,2) /= 0) zigll((NGLLZ-1)/2+1) = ZERO
-
 ! get the 3-D shape functions
   call get_shape3D(myrank,shape3D,dershape3D,xigll,yigll,zigll)
 
@@ -194,9 +174,5 @@
 
   enddo
 
-  deallocate(xigll,yigll,zigll)
-  deallocate(wxgll,wygll,wzgll)
-  deallocate(shape3D,dershape3D)
-
   end subroutine recompute_missing_arrays
 

Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90	2008-08-06 21:35:34 UTC (rev 12561)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/specfem3D.f90	2008-08-06 21:54:50 UTC (rev 12562)
@@ -622,6 +622,16 @@
 
 ! ************** PROGRAM STARTS HERE **************
 
+!! DK DK added this for merged version
+! synchronize all the processes to make sure everybody has finished
+  call MPI_BARRIER(MPI_COMM_WORLD,ier)
+
+! set up GLL points, weights and derivation matrices
+  call define_derivation_matrices(xigll,yigll,zigll,wxgll,wygll,wzgll, &
+         hprime_xx,hprime_yy,hprime_zz, &
+         hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
+         wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube)
+
 !! DK DK recompute arrays here for merged version
   call recompute_missing_arrays(myrank, &
      xix_crust_mantle,xiy_crust_mantle,xiz_crust_mantle, &
@@ -629,7 +639,8 @@
      gammax_crust_mantle,gammay_crust_mantle,gammaz_crust_mantle, &
      xstore_crust_mantle,ystore_crust_mantle,zstore_crust_mantle, &
      xelm_store_crust_mantle,yelm_store_crust_mantle,zelm_store_crust_mantle, &
-     ibool_crust_mantle,NSPEC_CRUST_MANTLE,NGLOB_CRUST_MANTLE)
+     ibool_crust_mantle,NSPEC_CRUST_MANTLE,NGLOB_CRUST_MANTLE, &
+     xigll,yigll,zigll)
 
   call recompute_missing_arrays(myrank, &
      xix_outer_core,xiy_outer_core,xiz_outer_core, &
@@ -637,7 +648,8 @@
      gammax_outer_core,gammay_outer_core,gammaz_outer_core, &
      xstore_outer_core,ystore_outer_core,zstore_outer_core, &
      xelm_store_outer_core,yelm_store_outer_core,zelm_store_outer_core, &
-     ibool_outer_core,NSPEC_OUTER_CORE,NGLOB_OUTER_CORE)
+     ibool_outer_core,NSPEC_OUTER_CORE,NGLOB_OUTER_CORE, &
+     xigll,yigll,zigll)
 
   call recompute_missing_arrays(myrank, &
      xix_inner_core,xiy_inner_core,xiz_inner_core, &
@@ -645,7 +657,8 @@
      gammax_inner_core,gammay_inner_core,gammaz_inner_core, &
      xstore_inner_core,ystore_inner_core,zstore_inner_core, &
      xelm_store_inner_core,yelm_store_inner_core,zelm_store_inner_core, &
-     ibool_inner_core,NSPEC_INNER_CORE,NGLOB_INNER_CORE)
+     ibool_inner_core,NSPEC_INNER_CORE,NGLOB_INNER_CORE, &
+     xigll,yigll,zigll)
 
 !! DK DK for merged version, deallocate arrays that have become useless
 !! DK DK attention je ne peux plus desallouer ici pour l'instant
@@ -671,10 +684,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 for merged version
-! synchronize all the processes to make sure everybody has finished
-  call MPI_BARRIER(MPI_COMM_WORLD,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(:)), &
@@ -1154,12 +1163,6 @@
 
 ! $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 
-! set up GLL points, weights and derivation matrices
-  call define_derivation_matrices(xigll,yigll,zigll,wxgll,wygll,wzgll, &
-         hprime_xx,hprime_yy,hprime_zz, &
-         hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
-         wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube)
-
 ! allocate arrays for source
   allocate(islice_selected_source(NSOURCES),STAT=ier)
   if (ier /= 0 ) then



More information about the cig-commits mailing list