Skip to content

Commit 3a02a2b

Browse files
authored
Merge pull request #464 from PrincetonUniversity/issue-398
Issue 398 - Implement dynamic testing
2 parents e740972 + 9d632f4 commit 3a02a2b

File tree

64 files changed

+264
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+264
-209
lines changed

.jenkins/gnu_compiler_checks.gvy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pipeline{
2525
}
2626
axis{
2727
name 'HostSpace'
28-
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 10'
28+
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 1 -c 10'
2929
}
3030
}
3131
stages {

.jenkins/intel_compiler_checks.gvy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pipeline{
2121
}
2222
axis{
2323
name 'HostSpace'
24-
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 10'
24+
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_ATOMICS_BYPASS=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 1 -c 10'
2525
}
2626
axis{
2727
name 'SIMD'

.jenkins/nvidia_compiler_checks.gvy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pipeline{
2121
}
2222
axis{
2323
name 'HostSpace'
24-
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON;-n 10'
24+
values 'SERIAL;-DKokkos_ENABLE_SERIAL=ON;-n 1', 'OPENMP;-DKokkos_ENABLE_OPENMP=ON; -n 1 -c 10'
2525
}
2626
axis{
2727
name 'DeviceSpace'

CMakePresets.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
11
{
22
"version": 6,
33
"configurePresets": [
4+
{
5+
"name": "release",
6+
"displayName": "Default Release -- SIMD enabled",
7+
"binaryDir": "build/release",
8+
"cacheVariables": {
9+
"CMAKE_BUILD_TYPE": "Release",
10+
"BUILD_TESTS": "ON",
11+
"ENABLE_SIMD": "ON",
12+
"Kokkos_ARCH_NATIVE": "ON",
13+
"Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION": "ON",
14+
"Kokkos_ENABLE_ATOMICS_BYPASS": "ON"
15+
}
16+
},
417
{
518
"name": "debug",
6-
"displayName": "Debug (Serial)",
19+
"displayName": "Default Debug -- SIMD enabled",
720
"binaryDir": "build/debug",
821
"cacheVariables": {
922
"CMAKE_BUILD_TYPE": "Debug",
1023
"BUILD_TESTS": "ON",
11-
"ENABLE_SIMD": "OFF",
24+
"ENABLE_SIMD": "ON",
1225
"Kokkos_ARCH_NATIVE": "ON",
1326
"Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION": "ON",
1427
"Kokkos_ENABLE_ATOMICS_BYPASS": "ON"
1528
}
1629
}
1730
],
1831
"buildPresets": [
32+
{
33+
"name": "release",
34+
"configurePreset": "release",
35+
"targets": ["all"]
36+
},
1937
{
2038
"name": "debug",
2139
"configurePreset": "debug",
22-
"targets": ["all"],
23-
"jobs": 8
40+
"targets": ["all"]
2441
}
2542
]
2643
}

fortran/meshfem3d/generate_databases/save_parameters.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ subroutine save_parameters()
55
use shared_parameters, only: LOCAL_PATH, MAX_STRING_LEN
66

77
use generate_databases_par, only: &
8-
IOUT, myrank, &
8+
IOUT, myrank, sizeprocs, &
99
NDIM, NSPEC_AB, NGLOB_AB, &
1010
NGLLX, NGLLY, NGLLZ, nfaces_surface, num_neighbors_all, NGLLSQUARE, &
1111
nspec2D_xmin, nspec2D_xmin, nspec2D_ymin, nspec2D_ymin, &
@@ -69,6 +69,7 @@ subroutine save_parameters()
6969
WRITE(IOUT) NGLLY
7070
WRITE(IOUT) NGLLZ
7171
WRITE(IOUT) NGLLSQUARE
72+
WRITE(IOUT) sizeprocs
7273

7374
! Write test parameter
7475
itest = 9997

include/mesh/mesh.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ template <> struct mesh<specfem::dimension::type::dim3> {
108108
// Struct to store all the mesh parameter
109109
specfem::mesh::parameters<dimension> parameters;
110110

111+
//
111112
// int npgeo; ///< Total number of spectral element control nodes
112113
// int nspec; ///< Total number of spectral elements
113114
// int nproc; ///< Total number of processors

include/mesh/parameters/parameters.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ template <> struct parameters<specfem::dimension::type::dim3> {
101101
int nglly; ///< Number of GLL points in y
102102
int ngllz; ///< Number of GLL points in z
103103
int ngllsquare; ///< Number of GLL points in square
104+
int nproc; ///< Number of processors
104105

105106
// Integer Parameters: Elements/Nodes
106107
int nspec; ///< Number of spectral elements (SEs)

src/IO/mesh/impl/fortran/dim3/read_parameters.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ specfem::IO::mesh::impl::fortran::dim3::read_mesh_parameters(
7373
int ngly;
7474
int ngllz;
7575
int ngllsquare;
76+
int nproc;
7677

7778
// Read parameters
7879
specfem::IO::fortran_read_line(stream, &ndim);
7980
specfem::IO::fortran_read_line(stream, &ngllx);
8081
specfem::IO::fortran_read_line(stream, &ngly);
8182
specfem::IO::fortran_read_line(stream, &ngllz);
8283
specfem::IO::fortran_read_line(stream, &ngllsquare);
84+
specfem::IO::fortran_read_line(stream, &nproc);
8385

8486
#ifndef NDEBUG
8587
// Print the read parameters
@@ -88,6 +90,7 @@ specfem::IO::mesh::impl::fortran::dim3::read_mesh_parameters(
8890
std::cout << "ngly:................." << ngly << std::endl;
8991
std::cout << "ngllz:................" << ngllz << std::endl;
9092
std::cout << "ngllsquare:..........." << ngllsquare << std::endl;
93+
std::cout << "nproc:................" << nproc << std::endl;
9194
#endif
9295

9396
// Read test parameter

tests/unit-tests/CMakeLists.txt

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests/unit-tests)
1818

1919
include_directories(.)
2020

21+
set(TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
22+
23+
# Some of the writing test need to write somewhere and we don't want that
24+
# to be in the source directory
25+
set(TEST_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
26+
2127
enable_testing()
2228

2329
add_library(
@@ -58,6 +64,7 @@ add_executable(
5864
gll_tests
5965
gll/gll_tests.cpp
6066
)
67+
6168
target_link_libraries(
6269
gll_tests
6370
gtest_main
@@ -203,6 +210,7 @@ add_executable(
203210
assembly/sources/sources.cpp
204211
)
205212

213+
target_compile_definitions(assembly_tests PRIVATE TEST_OUTPUT_DIR=${TEST_OUTPUT_DIR})
206214

207215
target_link_libraries(
208216
assembly_tests
@@ -423,22 +431,22 @@ target_link_libraries(
423431
# Link to gtest only if MPI is enabled
424432
if (NOT MPI_PARALLEL)
425433
include(GoogleTest)
426-
gtest_discover_tests(gll_tests)
427-
gtest_discover_tests(lagrange_tests)
428-
gtest_discover_tests(fortranio_test)
429-
gtest_discover_tests(IO_tests)
430-
gtest_discover_tests(mesh_tests)
431-
gtest_discover_tests(compute_partial_derivatives_tests)
432-
# gtest_discover_tests(compute_elastic_tests)
433-
# # gtest_discover_tests(compute_acoustic_tests)
434-
# gtest_discover_tests(compute_coupled_interfaces_tests)
435-
gtest_discover_tests(compute_tests)
436-
gtest_discover_tests(assembly_tests)
437-
gtest_discover_tests(policies)
438-
gtest_discover_tests(locate_point)
439-
gtest_discover_tests(interpolate_function)
440-
gtest_discover_tests(rmass_inverse_tests)
441-
gtest_discover_tests(displacement_newmark_tests)
434+
gtest_discover_tests(gll_tests WORKING_DIRECTORY ${TEST_DIR})
435+
gtest_discover_tests(lagrange_tests WORKING_DIRECTORY ${TEST_DIR})
436+
gtest_discover_tests(fortranio_test WORKING_DIRECTORY ${TEST_DIR})
437+
gtest_discover_tests(IO_tests WORKING_DIRECTORY ${TEST_DIR})
438+
gtest_discover_tests(mesh_tests WORKING_DIRECTORY ${TEST_DIR})
439+
gtest_discover_tests(compute_partial_derivatives_tests WORKING_DIRECTORY ${TEST_DIR})
440+
# gtest_discover_tests(compute_elastic_tests WORKING_DIRECTORY ${TEST_DIR})
441+
# # gtest_discover_tests(compute_acoustic_tests WORKING_DIRECTORY ${TEST_DIR})
442+
# gtest_discover_tests(compute_coupled_interfaces_tests WORKING_DIRECTORY ${TEST_DIR})
443+
gtest_discover_tests(compute_tests WORKING_DIRECTORY ${TEST_DIR})
444+
gtest_discover_tests(assembly_tests WORKING_DIRECTORY ${TEST_DIR})
445+
gtest_discover_tests(policies WORKING_DIRECTORY ${TEST_DIR})
446+
gtest_discover_tests(locate_point WORKING_DIRECTORY ${TEST_DIR})
447+
gtest_discover_tests(interpolate_function WORKING_DIRECTORY ${TEST_DIR})
448+
gtest_discover_tests(rmass_inverse_tests WORKING_DIRECTORY ${TEST_DIR})
449+
gtest_discover_tests(displacement_newmark_tests WORKING_DIRECTORY ${TEST_DIR})
442450
# gtest_discover_tests(seismogram_elastic_tests)
443451
# gtest_discover_tests(seismogram_acoustic_tests)
444452
endif(NOT MPI_PARALLEL)

tests/unit-tests/IO/sources/test_read_sources.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ TEST(IO_TESTS, read_sources) {
1212
* This test checks whether a moment tensor source is read correctly
1313
*/
1414

15-
std::string sources_file =
16-
"../../../tests/unit-tests/IO/sources/data/single_moment_tensor.yml";
15+
std::string sources_file = "IO/sources/data/single_moment_tensor.yml";
1716

1817
YAML::Node databases;
1918
databases["sources"] = sources_file;

0 commit comments

Comments
 (0)