Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 398 - Implement dynamic testing #464

Merged
merged 6 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .jenkins/gnu_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline{
}
axis{
name 'HostSpace'
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 10'
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 1 -c 10'
}
}
stages {
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/intel_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pipeline{
}
axis{
name 'HostSpace'
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 10'
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 1 -c 10'
}
axis{
name 'SIMD'
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/nvidia_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pipeline{
}
axis{
name 'HostSpace'
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 10'
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON; -n 1 -c 10'
}
axis{
name 'DeviceSpace'
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,15 @@ add_library(
src/IO/sources.cpp
src/IO/receivers.cpp
src/IO/mesh.cpp
# Fortran 2D part
src/IO/mesh/impl/fortran/dim2/read_boundaries.cpp
src/IO/mesh/impl/fortran/dim2/read_elements.cpp
src/IO/mesh/impl/fortran/dim2/read_material_properties.cpp
src/IO/mesh/impl/fortran/dim2/read_mesh_database.cpp
src/IO/mesh/impl/fortran/dim2/read_interfaces.cpp
src/IO/mesh/impl/fortran/dim2/read_parameters.cpp
# Fortran 3D part
src/IO/mesh/impl/fortran/dim3/read_parameters.cpp
)

if (NOT HDF5_CXX_BUILD)
Expand Down
43 changes: 43 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": 6,
"configurePresets": [
{
"name": "release",
"displayName": "Default Release -- SIMD enabled",
"binaryDir": "build/release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_TESTS": "ON",
"ENABLE_SIMD": "ON",
"Kokkos_ARCH_NATIVE": "ON",
"Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION": "ON",
"Kokkos_ENABLE_ATOMICS_BYPASS": "ON"
}
},
{
"name": "debug",
"displayName": "Default Debug -- SIMD enabled",
"binaryDir": "build/debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BUILD_TESTS": "ON",
"ENABLE_SIMD": "ON",
"Kokkos_ARCH_NATIVE": "ON",
"Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION": "ON",
"Kokkos_ENABLE_ATOMICS_BYPASS": "ON"
}
}
],
"buildPresets": [
{
"name": "release",
"configurePreset": "release",
"targets": ["all"]
},
{
"name": "debug",
"configurePreset": "debug",
"targets": ["all"]
}
]
}
1 change: 1 addition & 0 deletions examples/dim3/homogeneous_halfspace/specfem_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ parameters:
## databases
databases:
mesh-database: "OUTPUT_FILES/DATABASES_MPI/proc000000_external_mesh.bin"
mesh-parameters: "OUTPUT_FILES/DATABASES_MPI/mesh_parameters.bin"

## sources
sources: "/Users/lsawade/SPECFEMPP/examples/homogeneous-medium-flat-topography/source.yaml"
30 changes: 15 additions & 15 deletions fortran/meshfem3d/generate_databases/save_parameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ subroutine save_parameters()
use shared_parameters, only: LOCAL_PATH, MAX_STRING_LEN

use generate_databases_par, only: &
IOUT, myrank, &
IOUT, myrank, sizeprocs, &
NDIM, NSPEC_AB, NGLOB_AB, &
NGLLX, NGLLY, NGLLZ, nfaces_surface, num_neighbors_all, NGLLSQUARE, &
nspec2D_xmin, nspec2D_xmin, nspec2D_ymin, nspec2D_ymin, &
Expand Down Expand Up @@ -58,7 +58,6 @@ subroutine save_parameters()
WRITE(IOUT) APPROXIMATE_OCEAN_LOAD
WRITE(IOUT) USE_MESH_COLORING_GPU


! Write test parameter
itest = 9998
WRITE(IOUT) itest
Expand All @@ -70,34 +69,35 @@ subroutine save_parameters()
WRITE(IOUT) NGLLY
WRITE(IOUT) NGLLZ
WRITE(IOUT) NGLLSQUARE
WRITE(IOUT) sizeprocs

! Write test parameter
WRITE(IOUT) itest
itest = 9997
WRITE(IOUT) itest

WRITE(IOUT) NSPEC_AB ! nspec
WRITE(IOUT) NSPEC_PORO ! nspec_poro == nspec, if POROELASTIC_SIMULATION
WRITE(IOUT) NGLOB_AB ! nglob
WRITE(IOUT) NGLOB_OCEAN
WRITE(IOUT) NSPEC2D_BOTTOM
WRITE(IOUT) NSPEC2D_TOP
WRITE(IOUT) nspec_irregular

! Write test parameter
WRITE(IOUT) itest
itest = 9996
WRITE(IOUT) itest

WRITE(IOUT) num_neighbors_all
WRITE(IOUT) nfaces_surface
WRITE(IOUT) nspec2D_xmin
WRITE(IOUT) NSPEC2D_BOTTOM
WRITE(IOUT) NSPEC2D_TOP
WRITE(IOUT) nspec2D_xmin
WRITE(IOUT) nspec2D_xmax
WRITE(IOUT) nspec2D_ymin
WRITE(IOUT) nspec2D_ymin
WRITE(IOUT) nspec2D_ymax
WRITE(IOUT) nspec_irregular

! Write test parameter
WRITE(IOUT) itest
itest = 9995
WRITE(IOUT) itest

WRITE(IOUT) num_neighbors_all
WRITE(IOUT) nfaces_surface
WRITE(IOUT) num_abs_boundary_faces
WRITE(IOUT) num_free_surface_faces
WRITE(IOUT) num_coupling_ac_el_faces
Expand All @@ -108,8 +108,8 @@ subroutine save_parameters()
WRITE(IOUT) max_nibool_interfaces_ext_mesh

! Write test parameter
WRITE(IOUT) itest
itest = 9994
WRITE(IOUT) itest

WRITE(IOUT) nspec_inner_acoustic
WRITE(IOUT) nspec_outer_acoustic
Expand All @@ -119,8 +119,8 @@ subroutine save_parameters()
WRITE(IOUT) nspec_outer_poroelastic

! Write test parameter
WRITE(IOUT) itest
itest = 9993
WRITE(IOUT) itest

WRITE(IOUT) num_phase_ispec_acoustic
WRITE(IOUT) num_phase_ispec_elastic
Expand All @@ -131,8 +131,8 @@ subroutine save_parameters()
WRITE(IOUT) num_colors_outer_elastic

! Write test parameter
WRITE(IOUT) itest
itest = 9992
WRITE(IOUT) itest
endif

end subroutine save_parameters
4 changes: 3 additions & 1 deletion include/IO/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ specfem::mesh::mesh<specfem::dimension::type::dim2>
read_2d_mesh(const std::string filename, const specfem::MPI::MPI *mpi);

specfem::mesh::mesh<specfem::dimension::type::dim3>
read_3d_mesh(const std::string filename, const specfem::MPI::MPI *mpi);
read_3d_mesh(const std::string mesh_parameters_file,
const std::string mesh_databases_file,
const specfem::MPI::MPI *mpi);
/**
* @brief Read station file
*
Expand Down
30 changes: 30 additions & 0 deletions include/IO/mesh/impl/fortran/dim3/read_parameters.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "IO/fortranio/interface.hpp"
#include "mesh/parameters/parameters.hpp"
#include "specfem_mpi/interface.hpp"

namespace specfem {
namespace IO {
namespace mesh {
namespace impl {
namespace fortran {
namespace dim3 {

/*
* @brief Read paramters from 3D mesh database
*
* @param stream Input stream
* @param mpi MPI object
* @return specfem::mesh::parameters<specfem::dimension::type::dim2> Mesh
* parameters
*/
specfem::mesh::parameters<specfem::dimension::type::dim3>
read_mesh_parameters(std::ifstream &stream, const specfem::MPI::MPI *mpi);

} // namespace dim3
} // namespace fortran
} // namespace impl
} // namespace mesh
} // namespace IO
} // namespace specfem
5 changes: 5 additions & 0 deletions include/mesh/mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "coupled_interfaces/coupled_interfaces.hpp"
#include "elements/axial_elements.hpp"
#include "elements/tangential_elements.hpp"
#include "enumerations/dimension.hpp"
#include "enumerations/interface.hpp"
#include "materials/materials.hpp"
#include "mesh/tags/tags.hpp"
Expand Down Expand Up @@ -104,6 +105,10 @@ template <> struct mesh<specfem::dimension::type::dim3> {
constexpr static auto dimension =
specfem::dimension::type::dim3; ///< Dimension

// Struct to store all the mesh parameter
specfem::mesh::parameters<dimension> parameters;

//
// int npgeo; ///< Total number of spectral element control nodes
// int nspec; ///< Total number of spectral elements
// int nproc; ///< Total number of processors
Expand Down
Loading