Skip to content

Commit

Permalink
Merge branch 'devel' into issue-390
Browse files Browse the repository at this point in the history
  • Loading branch information
lsawade committed Feb 5, 2025
2 parents 344a434 + ac02df2 commit 4de9521
Show file tree
Hide file tree
Showing 79 changed files with 13,139 additions and 875 deletions.
4 changes: 2 additions & 2 deletions .jenkins/gnu_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pipeline{
steps {
echo "Building ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} with ${GNU_COMPILER_NAME}"
sh """
module load boost/1.73.0
module load boost/1.85.0
module load ${GNU_COMPILER_MODULE}
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 -D BUILD_EXAMPLES=OFF
cmake3 --build build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}
Expand All @@ -78,7 +78,7 @@ pipeline{
steps {
echo ' Testing '
sh """
module load boost/1.73.0
module load boost/1.85.0
module load ${GNU_COMPILER_MODULE}
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;'
Expand Down
4 changes: 2 additions & 2 deletions .jenkins/intel_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pipeline{
steps {
echo "Building ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} with ${INTEL_COMPILER_NAME}"
sh """
module load boost/1.73.0
module load boost/1.85.0
module load ${INTEL_MODULE}
export CC=icx
export CXX=icpx
Expand All @@ -79,7 +79,7 @@ pipeline{
steps {
echo ' Testing '
sh """
module load boost/1.73.0
module load boost/1.85.0
module load ${INTEL_MODULE}
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;'
Expand Down
4 changes: 2 additions & 2 deletions .jenkins/nvidia_compiler_checks.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pipeline{
steps {
echo "Building ${CMAKE_HOST_FLAGS} ${CMAKE_DEVICE_FLAGS} ${SIMD_FLAGS} with ${CUDA_COMPILER_NAME}"
sh """
module load boost/1.73.0
module load boost/1.85.0
module load ${CUDA_MODULE}
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 -D BUILD_EXAMPLES=OFF
cmake3 --build build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG}
Expand All @@ -93,7 +93,7 @@ pipeline{
steps {
echo ' Testing '
sh """
module load boost/1.73.0
module load boost/1.85.0
module load ${CUDA_MODULE}
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;'
Expand Down
60 changes: 28 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ endif()
include(FetchContent)
FetchContent_Declare(
kokkos
URL https://github.com/kokkos/kokkos/archive/refs/tags/4.3.01.zip
URL https://github.com/kokkos/kokkos/archive/refs/tags/4.5.01.zip
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
)
FetchContent_MakeAvailable(kokkos)
Expand Down Expand Up @@ -105,7 +105,7 @@ endif()


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


if (NOT ${Boost_FOUND})
Expand Down Expand Up @@ -435,6 +435,7 @@ add_library(

target_link_libraries(
compute
enumerations
quadrature
mesh
# material_class
Expand Down Expand Up @@ -542,30 +543,30 @@ target_link_libraries(
)

add_library(
plotter
src/plotter/plot_wavefield.cpp
periodic_tasks
src/periodic_tasks/plot_wavefield.cpp
)

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

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

# Only define the __APPLE__ compile definition if it is defined
if (__APPLE__)
target_compile_definitions(plotter PRIVATE __APPLE__)
target_compile_definitions(periodic_tasks PRIVATE __APPLE__)
endif(__APPLE__)
endif()

Expand Down Expand Up @@ -600,15 +601,13 @@ target_link_libraries(
${BOOST_LIBS}
)

add_executable(
specfem2d
src/specfem2d.cpp
add_library(
execute
src/execute.cpp
)



target_link_libraries(
specfem2d
execute
specfem_mpi
Kokkos::kokkos
mesh
Expand All @@ -618,7 +617,7 @@ target_link_libraries(
parameter_reader
receiver_class
writer
plotter
periodic_tasks
reader
medium
coupled_interface
Expand All @@ -627,6 +626,18 @@ target_link_libraries(
${BOOST_LIBS}
)

add_executable(
specfem2d
src/specfem2d.cpp
)



target_link_libraries(
specfem2d
execute
)

# Include tests
if (BUILD_TESTS)
message("-- Including tests.")
Expand Down Expand Up @@ -670,28 +681,13 @@ endif ()
if (SPECFEMPP_BINDING_PYTHON)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)
python_add_library(_core MODULE src/specfem2d.cpp WITH_SOABI)
python_add_library(_core MODULE src/python/core.cpp WITH_SOABI)
target_link_libraries(
_core PRIVATE
specfem_mpi
Kokkos::kokkos
mesh
quadrature
compute
source_class
parameter_reader
receiver_class
writer
plotter
reader
medium
coupled_interface
kokkos_kernels
solver
execute
${BOOST_LIBS}
pybind11::headers
)
target_compile_definitions(_core PRIVATE SPECFEMPP_BINDING_PYTHON)
target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION})
install(TARGETS _core DESTINATION specfempp_core)
endif (SPECFEMPP_BINDING_PYTHON)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ SPECFEM++ is a complete re-write of SPECFEM suite of packages (SPECFEM2D, SPECFE
3. portability that allows the code to run on a variety of architectures (CPU, NVIDIA GPUs, Intel GPUs, AMD GPUs etc.), and
4. a user-friendly build infrastructure that allows the code to be easily compiled and run on a variety of platforms.

[specfempp-py](https://github.com/PrincetonUniversity/SPECFEMPP-py) is the official Python package for configuring and running SPECFEM++ with Python.

## Documentation


Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions docs/api/mesh/boundaries/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ Boundaries

.. doxygenstruct:: specfem::mesh::boundaries
:members:

.. toctree::
:maxdepth: 1

absorbing_boundaries
acoustic_free_surface
10 changes: 10 additions & 0 deletions docs/api/mesh/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ SPECFEM++ Mesh

.. doxygenstruct:: specfem::mesh::mesh
:members:


.. toctree::
:maxdepth: 1

boundaries/index
control_nodes/index
coupled_interfaces/index
materials/index
tags/index
2 changes: 1 addition & 1 deletion docs/cookbooks/dim2/anisotropic-crystal/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Wave propagration through anistoropic zinc crystal
Wave propagration through anisotropic zinc crystal
==================================================

In this `example
Expand Down
20 changes: 7 additions & 13 deletions docs/cookbooks/dim2/anisotropic-crystal/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import os
import numpy as np
import obspy
import matplotlib

matplotlib.use("agg")


def get_traces(directory):
Expand All @@ -16,19 +13,15 @@ def get_traces(directory):
"S0040",
"S0050",
]
files = [
glob.glob(directory + f"/{stationname}*.sem*")[0]
for stationname in station_name
]
files = []
for station in station_name:
files += glob.glob(directory + f"/??.{station}.S2.BX?.semd")

## iterate over all seismograms
for filename in files:
station_id = os.path.splitext(filename)[0]
station_id = station_id.split("/")[-1]
network = station_id[5:7]
station = station_id[0:5]
location = "00"
component = station_id[7:10]
network, station, location, channel = station_id.split(".")[:4]
trace = np.loadtxt(filename, delimiter=" ")
starttime = trace[0, 0]
dt = trace[1, 0] - trace[0, 0]
Expand All @@ -39,7 +32,7 @@ def get_traces(directory):
"network": network,
"station": station,
"location": location,
"channel": component,
"channel": channel,
"starttime": starttime,
"delta": dt,
},
Expand All @@ -52,4 +45,5 @@ def get_traces(directory):


stream = get_traces("OUTPUT_FILES/results")
stream.plot(size=(800, 1000))
stream.select(component="X").plot(size=(1000, 750))
stream.select(component="Z").plot(size=(1000, 750))
28 changes: 28 additions & 0 deletions docs/cookbooks/dim2/fluid-solid-interface/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,31 @@ With the configuration file in place, we can run the solver using the following
.. code:: bash
specfem2d -p specfem_config.yaml
Visualizing the results
-----------------------

The simulation generates seismograms at the stations defined in the
``specfem_config.yaml`` file. You can visualize the seismograms using the
following python script.

.. literalinclude:: plot.py
:language: python
:caption: plot.py


.. figure:: seismograms_X.svg
:alt: X-component seismograms
:width: 800
:align: center

X-component seismograms


.. figure:: seismograms_Z.svg
:alt: Z-component seismograms
:width: 800
:align: center

Z-component seismograms
42 changes: 42 additions & 0 deletions docs/cookbooks/dim2/fluid-solid-interface/plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import glob
import os
import numpy as np
import obspy


def get_traces(directory):
traces = []

files = glob.glob(directory + "/AA.S00??.S2.BX?.semd")
files.sort()

## iterate over all seismograms
for filename in files:
station_id = os.path.splitext(filename)[0]
station_id = station_id.split("/")[-1]
network, station, location, channel = station_id.split(".")[:4]
trace = np.loadtxt(filename, delimiter=" ")
starttime = trace[0, 0]
dt = trace[1, 0] - trace[0, 0]
traces.append(
obspy.Trace(
trace[:, 1],
{
"network": network,
"station": station,
"location": location,
"channel": channel,
"starttime": starttime,
"delta": dt,
},
)
)

stream = obspy.Stream(traces)

return stream


stream = get_traces("OUTPUT_FILES/seismograms")
stream.select(component="X").plot(size=(1000, 750))
stream.select(component="Z").plot(size=(1000, 750))
Loading

0 comments on commit 4de9521

Please sign in to comment.