Skip to content

Commit

Permalink
Merge pull request #854 from danielpeter/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter authored Nov 6, 2024
2 parents 1a978a5 + 96ab351 commit bbd54b7
Show file tree
Hide file tree
Showing 19 changed files with 751 additions and 268 deletions.
11 changes: 11 additions & 0 deletions .github/scripts/run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ else
petsc=()
fi

## HDF5
if [ "${HDF5}" == "true" ]; then
echo
echo "enabling HDF5"
echo
hdf=(--with-hdf5 HDF5_INC="/usr/include/hdf5/openmpi/" HDF5_LIBS="-L/usr/lib/x86_64-linux-gnu/hdf5/openmpi" )
else
hdf=()
fi

# configuration
echo
echo "configuration:"
Expand All @@ -68,6 +78,7 @@ echo
./configure \
${adios[@]} \
${netcdf[@]} \
${hdf[@]} \
${petsc[@]} \
FC=gfortran MPIFC=mpif90 CC=gcc "${TESTFLAGS}"

Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ sudo apt-get install -yq --no-install-recommends gfortran g++ openmpi-bin libope
if [[ $? -ne 0 ]]; then exit 1; fi
echo

# parallel hdf5
if [ "${HDF5}" == "true" ]; then
echo
echo "HDF5 installation:"
echo
sudo apt-get install -yq --no-install-recommends libhdf5-mpi-dev
## checks installation paths
#echo
#dpkg -L libhdf5-mpi-dev
#echo
#dpkg -L libhdf5-openmpi-dev
#echo
#echo "hdf5 module paths:"
#find /usr/ -iname 'hdf5.mod'
#echo "hdf5 library paths:"
#find /usr/ -iname 'libhdf5hl_fortran*'
#echo
fi

## NetCDF
if [ "${NETCDF}" == "true" ]; then
echo
Expand Down
14 changes: 13 additions & 1 deletion .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo
# bash function for checking seismogram output with reference solutions
my_test(){
echo "testing seismograms:"
ln -s $WORKDIR/utils/compare_seismogram_correlations.py
ln -s $WORKDIR/utils/scripts/compare_seismogram_correlations.py
./compare_seismogram_correlations.py REF_SEIS/ OUTPUT_FILES/
if [[ $? -ne 0 ]]; then exit 1; fi
./compare_seismogram_correlations.py REF_SEIS/ OUTPUT_FILES/ | grep min/max | cut -d \| -f 3 | awk '{print "correlation:",$1; if ($1 < 0.999 ){print $1,"failed"; exit 1;}else{ print $1,"good"; exit 0;}}'
Expand Down Expand Up @@ -65,6 +65,18 @@ if [ "${FULL_GRAVITY}" == "true" ]; then
echo "NSTEP = 2" >> DATA/Par_file
fi

# hdf5 i/o example
if [ "${HDF5}" == "true" ]; then
echo
echo "HDF5 enabled test run"
echo
sed -i "s:^HDF5_ENABLED .*:HDF5_ENABLED = .true.:" DATA/Par_file
#sed -i "s:^HDF5_FOR_MOVIES .*:HDF5_FOR_MOVIES = .true.:" DATA/Par_file
#sed -i "s:^HDF5_IO_NODES .*:HDF5_IO_NODES = 1:" DATA/Par_file
# replaces run script
#cp -v run_this_example_HDF5_IO_server.sh run_this_example.sh
fi

# adios
if [ "${ADIOS2}" == "true" ]; then
# turns on ADIOS
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,31 @@ jobs:
RUN_KERNEL: true
run: ./.github/scripts/run_tests.sh
shell: bash

linuxTest_11:
name: Test run example 11 - regional_Greece_small hdf5 i/o
runs-on: ubuntu-latest
needs: [linuxCheck]

steps:
- uses: actions/checkout@v4

- name: Install packages
env:
HDF5: true
run: ./.github/scripts/run_install.sh
shell: bash

- name: Run build
env:
TESTFLAGS: # no extra flags
HDF5: true
run: ./.github/scripts/run_build.sh
shell: bash

- name: Run test
env:
TESTDIR: EXAMPLES/regional_Greece_small
HDF5: true
run: ./.github/scripts/run_tests.sh
shell: bash
2 changes: 1 addition & 1 deletion EXAMPLES/regional_s40rts/DATA/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -433,5 +433,5 @@ ADIOS_FOR_UNDO_ATTENUATION = .true.

# HDF5 Database I/O
# (note the flags for HDF5 and ADIOS are mutually exclusive, only one can be used)
HDF5_ENABLED = .true.
HDF5_ENABLED = .false.

2 changes: 1 addition & 1 deletion EXAMPLES/regional_small_adjoint/DATA/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -433,5 +433,5 @@ ADIOS_FOR_UNDO_ATTENUATION = .true.

# HDF5 Database I/O
# (note the flags for HDF5 and ADIOS are mutually exclusive, only one can be used)
HDF5_ENABLED = .true.
HDF5_ENABLED = .false.

93 changes: 73 additions & 20 deletions src/meshfem3D/save_arrays_solver_hdf5.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
!=====================================================================
!
! S p e c f e m 3 D G l o b e
! ----------------------------
!
! Main historical authors: Dimitri Komatitsch and Jeroen Tromp
! Princeton University, USA
! and CNRS / University of Marseille, France
! (there are currently many more authors!)
! (c) Princeton University and CNRS / University of Marseille, April 2014
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 3 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License along
! with this program; if not, write to the Free Software Foundation, Inc.,
! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
!
!=====================================================================


subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
NSPEC2D_TOP,NSPEC2D_BOTTOM)

Expand Down Expand Up @@ -37,8 +65,6 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
tau_s_store,tau_e_store,Qmu_store, &
nglob_oceans, nglob_xy



use manager_hdf5
#endif

Expand Down Expand Up @@ -125,7 +151,7 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
!
if (myrank == 0) then
! create and open solver_data.h5
name_database_hdf5 = LOCAL_PATH(1:len_trim(LOCAL_PATH))//'/'//'solver_data.h5'
name_database_hdf5 = LOCAL_PATH(1:len_trim(LOCAL_PATH)) // '/' // 'solver_data.h5'
if (iregion_code == 1) then
call h5_create_file(name_database_hdf5)
else
Expand Down Expand Up @@ -608,6 +634,16 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &
#else
! no HDF5 compilation

! to avoid compiler warnings
integer :: idummy

idummy = size(idoubling,kind=4)
idummy = size(ibool,kind=4)
idummy = size(xstore,kind=4)
idummy = size(ystore,kind=4)
idummy = size(zstore,kind=4)
idummy = max(NSPEC2D_TOP,NSPEC2D_BOTTOM)

! user output
print *
print *, "Error: HDF5 routine save_databases_hdf5() called without HDF5 Support."
Expand All @@ -617,7 +653,7 @@ subroutine save_arrays_solver_hdf5(idoubling,ibool,xstore,ystore,zstore, &

#endif

end subroutine save_arrays_solver_hdf5
end subroutine save_arrays_solver_hdf5

!
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -672,9 +708,6 @@ subroutine save_arrays_boundary_hdf5()
! processor dependent group names
character(len=64) :: gname_region

! process rank
myrank = myrank

! first check the number of surface elements are the same for Moho, 400, 670
if (.not. SUPPRESS_CRUSTAL_MESH .and. HONOR_1D_SPHERICAL_MOHO) then
if (ispec2D_moho_top /= NSPEC2D_MOHO .or. ispec2D_moho_bot /= NSPEC2D_MOHO) &
Expand Down Expand Up @@ -794,7 +827,7 @@ subroutine save_arrays_boundary_hdf5()
stop 'Error HDF5 save_databases_hdf5(): called without compilation support'
#endif

end subroutine save_arrays_boundary_hdf5
end subroutine save_arrays_boundary_hdf5

!
!-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -853,8 +886,6 @@ subroutine save_MPI_arrays_hdf5(iregion_code,LOCAL_PATH, &
integer, dimension(0:NPROCTOT-1) :: offset_num_colors_outer
integer, dimension(0:NPROCTOT-1) :: offset_num_colors_inner

myrank = myrank

! gather the offsets
call gather_all_all_singlei(num_interfaces, offset_num_interfaces, NPROCTOT)
call gather_all_all_singlei(max_nibool_interfaces, offset_max_nibool_interfaces, NPROCTOT)
Expand Down Expand Up @@ -990,13 +1021,29 @@ subroutine save_MPI_arrays_hdf5(iregion_code,LOCAL_PATH, &

#else
! no HDF5 compilation
print* , "Error: HDF5 routine save_MPI_arrays_hdf5() called without HDF5 Support."
print* , "To enable HDF5 support, reconfigure with --with-hdf5 flag."

! to avoid compiler warnings
integer :: idummy

idummy = iregion_code
idummy = len_trim(LOCAL_PATH)
idummy = size(ibool_interfaces,kind=4)
idummy = size(my_neighbors,kind=4)
idummy = size(nibool_interfaces,kind=4)
idummy = max(nspec_inner,nspec_outer)
idummy = size(num_elem_colors)
idummy = size(phase_ispec_inner)

print * , "Error: HDF5 routine save_MPI_arrays_hdf5() called without HDF5 Support."
print * , "To enable HDF5 support, reconfigure with --with-hdf5 flag."
stop 'Error HDF5 save_MPI_arrays_hdf5(): called without compilation support'
#endif

end subroutine save_MPI_arrays_hdf5

!
!-------------------------------------------------------------------------------------------------
!

subroutine get_absorb_stacey_boundary_hdf5(iregion, num_abs_boundary_faces, &
abs_boundary_ispec,abs_boundary_npoin, &
Expand Down Expand Up @@ -1139,15 +1186,21 @@ subroutine get_absorb_stacey_boundary_hdf5(iregion, num_abs_boundary_faces, &
call h5_close_file_p()

#else
! no HDF5 compilation
print* , "Error: HDF5 routine get_absorb_stacey_boundary_hdf5() called without HDF5 Support."
print* , "To enable HDF5 support, reconfigure with --with-hdf5 flag."
stop 'Error HDF5 get_absorb_stacey_boundary_hdf5(): called without compilation support'
#endif


! no HDF5 compilation

! to avoid compiler warnings
integer :: idummy

idummy = iregion
idummy = size(abs_boundary_ispec,kind=4)
idummy = size(abs_boundary_npoin)
idummy = size(abs_boundary_ijk)
idummy = size(abs_boundary_normal,kind=4)
idummy = size(abs_boundary_jacobian2dw,kind=4)

print * , "Error: HDF5 routine get_absorb_stacey_boundary_hdf5() called without HDF5 Support."
print * , "To enable HDF5 support, reconfigure with --with-hdf5 flag."
stop 'Error HDF5 get_absorb_stacey_boundary_hdf5(): called without compilation support'
#endif

end subroutine get_absorb_stacey_boundary_hdf5
end subroutine get_absorb_stacey_boundary_hdf5
11 changes: 5 additions & 6 deletions src/meshfem3D/save_model_meshfiles_hdf5.F90
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ subroutine save_model_meshfiles_hdf5()
do j = 1,NGLLY
do i = 1,NGLLX
temp_store(i,j,k,ispec) = Qmu_store(1,1,1,ispec)
end do
end do
end do
end do
enddo
enddo
enddo
enddo
endif

! Qmu
Expand Down Expand Up @@ -273,5 +273,4 @@ subroutine save_model_meshfiles_hdf5()

#endif


end subroutine save_model_meshfiles_hdf5
end subroutine save_model_meshfiles_hdf5
1 change: 0 additions & 1 deletion src/shared/read_parameter_file.F90
Original file line number Diff line number Diff line change
Expand Up @@ -437,5 +437,4 @@ subroutine read_parameter_file()
endif
#endif


end subroutine read_parameter_file
1 change: 1 addition & 0 deletions src/shared/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ shared_OBJECTS = \
shared_MODULES = \
$(FC_MODDIR)/constants.$(FC_MODEXT) \
$(FC_MODDIR)/manager_adios.$(FC_MODEXT) \
$(FC_MODDIR)/manager_hdf5.$(FC_MODEXT) \
$(FC_MODDIR)/model_prem_par.$(FC_MODEXT) \
$(FC_MODDIR)/model_sohl_par.$(FC_MODEXT) \
$(FC_MODDIR)/model_mars_1d_par.$(FC_MODEXT) \
Expand Down
6 changes: 3 additions & 3 deletions src/specfem3D/locate_point.f90
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,13 @@ subroutine find_local_coordinates(x_target,y_target,z_target,xi,eta,gamma,x,y,z,
! the polynomial solution is defined everywhere
! can be useful for convergence of iterative scheme with distorted elements
!if (xi > 1.10d0) xi = 1.10d0
!if (xi < -1.10d0) xi = -1.10d0
!if (xi <-1.10d0) xi = -1.10d0
if (abs(xi) > 1.10d0) xi = sign(1.10d0,xi)
!if (eta > 1.10d0) eta = 1.10d0
!if (eta < -1.10d0) eta = -1.10d0
!if (eta <-1.10d0) eta = -1.10d0
if (abs(eta) > 1.10d0) eta = sign(1.10d0,eta)
!if (gamma > 1.10d0) gamma = 1.10d0
!if (gamma < -1.10d0) gamma = -1.10d0
!if (gamma <-1.10d0) gamma = -1.10d0
if (abs(gamma) > 1.10d0) gamma = sign(1.10d0,gamma)

! end of non linear iterations
Expand Down
2 changes: 1 addition & 1 deletion src/specfem3D/prepare_movie.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ subroutine prepare_movie_surface()
nmovie_points = NGLLX * NGLLY * NSPEC2D_TOP(IREGION_CRUST_MANTLE)
else ! HDF5
nmovie_points = 4 * (NGLLX-1) * (NGLLY-1) * NSPEC2D_TOP(IREGION_CRUST_MANTLE)
end if
endif
NIT = 1
endif

Expand Down
Loading

0 comments on commit bbd54b7

Please sign in to comment.