Skip to content

Commit

Permalink
Merge branch 'devel' into issue-160
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit-Kakodkar committed Nov 27, 2024
2 parents 3054ad8 + 0a7ba9f commit f3bb2d8
Show file tree
Hide file tree
Showing 183 changed files with 5,135 additions and 3,943 deletions.
16 changes: 8 additions & 8 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Description

Please describe the changes/features in this pull request.
Please describe the changes/features in this pull request.

# Issue Number

If there is an issue created for these changes, link it here

# Checklist

Please make sure to check developer documentation on specfem docs.
Please make sure to check developer documentation on specfem docs.

[] I ran the code through pre-commit to check style
[] My code passes all the integration tests
[] I have added sufficient unittests to test my changes
[] I have added/updated documentation for the changes I am proposing
[] I have updated CMakeLists to ensure my code builds
[] My code builds across all platforms
- [ ] I ran the code through pre-commit to check style
- [ ] My code passes all the integration tests
- [ ] I have added sufficient unittests to test my changes
- [ ] I have added/updated documentation for the changes I am proposing
- [ ] I have updated CMakeLists to ensure my code builds
- [ ] My code builds across all platforms
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ firebase*.yml
*.out
debug.sh
output.log
output.txt
results/
timing.sh
examples/*/*_config.yaml
Expand Down
8 changes: 4 additions & 4 deletions .jenkins/gnu_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ pipeline{
sh """
module load boost/1.73.0
module load ${GNU_COMPILER_MODULE}
cmake3 -S . -B build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -DBUILD_TESTS=ON
cmake3 --build build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}
cmake3 -S . -B build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -DBUILD_TESTS=ON
cmake3 --build build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}
"""
echo ' Build completed '
}
Expand All @@ -80,7 +80,7 @@ pipeline{
sh """
module load boost/1.73.0
module load ${GNU_COMPILER_MODULE}
cd build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}/tests/unit-tests
cd build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}/tests/unit-tests
srun -N 1 -t 00:20:00 ${HOST_RUN_FLAGS} --constraint=skylake bash -c 'export OMP_PROC_BIND=spread; export OMP_THREADS=places; ctest --verbose;'
"""
echo ' Testing completed '
Expand All @@ -90,7 +90,7 @@ pipeline{
post {
always {
echo ' Cleaning '
sh "rm -rf build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}"
sh "rm -rf build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions .jenkins/intel_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ pipeline{
module load ${INTEL_MODULE}
export CC=icx
export CXX=icpx
cmake3 -S . -B build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON
cmake3 --build build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}
cmake3 -S . -B build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON
cmake3 --build build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}
"""
echo ' Build completed '
}
Expand All @@ -81,7 +81,7 @@ pipeline{
sh """
module load boost/1.73.0
module load ${INTEL_MODULE}
cd build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}/tests/unit-tests
cd build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}/tests/unit-tests
srun -N 1 -t 00:20:00 ${HOST_RUN_FLAGS} --constraint=skylake bash -c 'export OMP_PROC_BIND=spread; export OMP_THREADS=places; ctest --verbose;'
"""
echo ' Testing completed '
Expand All @@ -91,7 +91,7 @@ pipeline{
post {
always {
echo ' Cleaning '
sh "rm -rf build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}"
sh "rm -rf build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions .jenkins/nvidia_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ pipeline{
sh """
module load boost/1.73.0
module load ${CUDA_MODULE}
cmake3 -S . -B build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${CMAKE_DEVICE_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON
cmake3 --build build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}
cmake3 -S . -B build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${CMAKE_DEVICE_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON
cmake3 --build build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG}
"""
echo ' Build completed '
}
Expand All @@ -95,7 +95,7 @@ pipeline{
sh """
module load boost/1.73.0
module load ${CUDA_MODULE}
cd build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}/tests/unit-tests
cd build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG}/tests/unit-tests
srun -N 1 -t 00:20:00 ${HOST_RUN_FLAGS} ${DEVICE_RUN_FLAGS} bash -c 'export OMP_PROC_BIND=spread; export OMP_THREADS=places; ctest --verbose;'
"""
echo ' Testing completed '
Expand All @@ -105,7 +105,7 @@ pipeline{
post {
always {
echo ' Cleaning '
sh "rm -rf build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}"
sh "rm -rf build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG}"
}
}
}
Expand Down
104 changes: 94 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(specfem2d_kokkos VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 17)
option(HDF5_CXX_BUILD "Build HDF5 C++" ON)
option(VTK_CXX_BUILD "Build VTK C++" ON)
option(MPI_PARALLEL "MPI enabled" OFF)
option(BUILD_TESTS "Tests included" OFF)
option(BUILD_EXAMPLES "Examples included" OFF)
Expand Down Expand Up @@ -48,6 +49,26 @@ FetchContent_MakeAvailable(yaml)

include_directories(BEFORE SYSTEM ${yaml_BINARY_DIR} ${yaml_SOURCE_DIR}/include)

find_package(VTK COMPONENTS
CommonColor
CommonCore
FiltersSources
InteractionStyle
RenderingContextOpenGL2
RenderingCore
RenderingFreeType
RenderingGL2PSOpenGL2
RenderingOpenGL2
)

if (NOT VTK_FOUND)
message("VTK not found: ${VTK_NOT_FOUND_MESSAGE}")
set(VTK_CXX_BUILD OFF)
else ()
message(STATUS " VTK: ${VTK_LIBRARIES}")
endif()


# Try finding boost and if not found install.
find_package(Boost 1.73.0 COMPONENTS program_options filesystem system)

Expand Down Expand Up @@ -107,7 +128,16 @@ add_library(
IO
src/IO/fortranio/fortran_io.cpp
src/IO/HDF5/native_type.cpp
src/IO/ASCII/native_type.cpp
# src/IO/ASCII/native_type.cpp
src/IO/mesh/read_mesh.cpp
src/IO/mesh/impl/fortran/read_boundaries.cpp
src/IO/mesh/impl/fortran/read_elements.cpp
src/IO/mesh/impl/fortran/read_material_properties.cpp
src/IO/mesh/impl/fortran/read_mesh_database.cpp
src/IO/mesh/impl/fortran/read_interfaces.cpp
src/IO/mesh/impl/fortran/read_properties.cpp
src/IO/sources/read_sources.cpp
src/IO/receivers/read_receivers.cpp
)

if (NOT HDF5_CXX_BUILD)
Expand All @@ -130,6 +160,21 @@ else()
)
endif()

target_link_libraries(
IO
mesh
)

target_link_libraries(
IO
source_class
)

target_link_libraries(
IO
receiver_class
)

add_library(
point
src/point/coordinates.cpp
Expand All @@ -141,6 +186,11 @@ target_link_libraries(
Kokkos::kokkos
)

add_library(
enumerations
src/enumerations/medium.cpp
)

add_library(
edge
src/edge/interface.cpp
Expand Down Expand Up @@ -180,14 +230,12 @@ endif(MPI_PARALLEL)

add_library(
mesh
src/mesh/IO/fortran/read_mesh_database.cpp
src/mesh/boundaries/forcing_boundaries.cpp
src/mesh/boundaries/absorbing_boundaries.cpp
src/mesh/boundaries/acoustic_free_surface.cpp
src/mesh/elements/tangential_elements.cpp
src/mesh/elements/axial_elements.cpp
src/mesh/properties/properties.cpp
src/mesh/mpi_interfaces/mpi_interfaces.cpp
# src/mesh/mpi_interfaces/mpi_interfaces.cpp
src/mesh/materials/materials.cpp
src/mesh/coupled_interfaces/interface_container.cpp
src/mesh/coupled_interfaces/coupled_interfaces.cpp
Expand All @@ -200,7 +248,6 @@ target_link_libraries(
Kokkos::kokkos
specfem_mpi
# material_class
IO
yaml-cpp
)

Expand Down Expand Up @@ -228,16 +275,26 @@ target_link_libraries(
# specfem_mpi
# )

add_library(
read_seismogram
src/reader/seismogram.cpp
)

target_link_libraries(
read_seismogram
Kokkos::kokkos
)

add_library(
reader
src/reader/wavefield.cpp
src/reader/seismogram.cpp
)

target_link_libraries(
reader
compute
IO
read_seismogram
)

add_library(
Expand All @@ -261,7 +318,7 @@ add_library(

target_link_libraries(
source_time_function
reader
read_seismogram
Kokkos::kokkos
point
)
Expand All @@ -273,7 +330,6 @@ add_library(
src/source/moment_tensor_source.cpp
src/source/adjoint_source.cpp
src/source/external.cpp
src/source/read_sources.cpp
)

target_link_libraries(
Expand All @@ -292,7 +348,6 @@ target_link_libraries(
add_library(
receiver_class
src/receiver/receiver.cpp
src/receiver/read_receiver.cpp
)

target_link_libraries(
Expand All @@ -319,7 +374,8 @@ add_library(
src/compute/boundaries/boundaries.cpp
src/compute/fields/fields.cpp
src/compute/compute_boundary_values.cpp
src/compute/compute_assembly.cpp
src/compute/assembly/assembly.cpp
src/compute/assembly/compute_wavefield.cpp
)

target_link_libraries(
Expand Down Expand Up @@ -359,6 +415,7 @@ add_library(
target_link_libraries(
domain
Kokkos::kokkos
enumerations
)

add_library(coupled_interface
Expand Down Expand Up @@ -448,6 +505,29 @@ target_link_libraries(
IO
)

add_library(
plotter
src/plotter/plot_wavefield.cpp
)

if (NOT VTK_CXX_BUILD)
target_compile_definitions(
plotter
PUBLIC -DNO_VTK
)

target_link_libraries(
plotter
compute
)
else ()
target_link_libraries(
plotter
compute
${VTK_LIBRARIES}
)
endif()

add_library(
parameter_reader
src/parameter_parser/run_setup.cpp
Expand All @@ -460,6 +540,7 @@ add_library(
src/parameter_parser/writer/seismogram.cpp
src/parameter_parser/setup.cpp
src/parameter_parser/writer/wavefield.cpp
src/parameter_parser/writer/plot_wavefield.cpp
src/parameter_parser/writer/kernel.cpp
)

Expand All @@ -482,6 +563,8 @@ add_executable(
src/specfem2d.cpp
)



target_link_libraries(
specfem2d
specfem_mpi
Expand All @@ -493,6 +576,7 @@ target_link_libraries(
parameter_reader
receiver_class
writer
plotter
reader
domain
coupled_interface
Expand Down
2 changes: 2 additions & 0 deletions docs/api/IO/Libraries/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ The snippet below shows how to use these modules to write and read a Kokkos::Vie
.. toctree::
:maxdepth: 1

sources/index
mesh/index
ASCII/index
HDF5/index
31 changes: 31 additions & 0 deletions docs/api/IO/Libraries/mesh/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. _mesh_reader:

Mesh Reader
===========


The below functions are helper functions for the Fortran binary mesh database
reader. The functions are called in :cpp:func:`specfem::IO::read_mesh`
in sequential order and faciliate the reading of the mesh database.

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_mesh_database_header

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_coorg_elements

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_properties

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_mesh_database_attenuation

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_material_properties

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_boundaries

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_coupled_interfaces

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_tangential_elements

.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_axial_elements

Finally, we add tags to the :cpp:struct:`specfem::mesh::mesh` using the
:cpp:struct:`specfem::mesh::tags` struct. The description of which can be found
here: :ref:`mesh_tags`.
Loading

0 comments on commit f3bb2d8

Please sign in to comment.