Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1be6ac4
Iterators and Access functions for edges
Rohit-Kakodkar Aug 28, 2025
a3317f9
Merge branch 'devel-dg' into issue-1150
Rohit-Kakodkar Aug 29, 2025
d26d724
Fixed boost library linker
Rohit-Kakodkar Aug 29, 2025
04fb6f9
Refactor `FOR_EACH` macro to incorporate interface tags
Rohit-Kakodkar Sep 4, 2025
5e6686f
Updated edge definitions and added constexpr tags
Rohit-Kakodkar Sep 4, 2025
21ed3d1
Added Edges to tag 4 macro
Rohit-Kakodkar Sep 4, 2025
a82d0b0
Merge branch 'issue-1165' into issue-1167
Rohit-Kakodkar Sep 4, 2025
0031ccc
Create edge types to sort all edges with tags
Rohit-Kakodkar Sep 5, 2025
de77bd1
Merge branch 'issue-1150' into issue-1165
Rohit-Kakodkar Sep 5, 2025
01be645
Merge branch 'issue-1165' into issue-1167
Rohit-Kakodkar Sep 5, 2025
4d1138f
Added comments to deprecate adjancency graph
Rohit-Kakodkar Sep 5, 2025
695ad91
Merge pull request #1179 from PrincetonUniversity/issue-1167
Rohit-Kakodkar Sep 9, 2025
c5bf5a4
Merge pull request #1166 from PrincetonUniversity/issue-1165
Rohit-Kakodkar Sep 9, 2025
69e5a23
Reimplement coupled interfaces
Rohit-Kakodkar Sep 9, 2025
2b76692
Minor fixes to mesh interface container
Rohit-Kakodkar Sep 9, 2025
2a72e58
Implements new kokkos kernel to compute coupling
Rohit-Kakodkar Sep 10, 2025
b0dbe69
Merge pull request #1189 from PrincetonUniversity/issue-1167
Rohit-Kakodkar Sep 10, 2025
2be2d92
Added missing headers
Rohit-Kakodkar Sep 10, 2025
62276f8
Updated calls to coupling kernels
Rohit-Kakodkar Sep 10, 2025
c8c438d
Merge pull request #1194 from PrincetonUniversity/issue-1167
Rohit-Kakodkar Sep 12, 2025
af7023d
Fixed bugs in compute coupling
Rohit-Kakodkar Sep 12, 2025
6d9a95e
Deprecated old coupled interfaces implementation
Rohit-Kakodkar Sep 12, 2025
a5ca19f
Renames coupled_interfaces2 -> coupled_interfaces
Rohit-Kakodkar Sep 12, 2025
aee82d9
Added documentation
Rohit-Kakodkar Sep 12, 2025
ec75575
Commented display section
Rohit-Kakodkar Sep 16, 2025
aa0c78b
Merge pull request #1201 from PrincetonUniversity/issue-1172
Rohit-Kakodkar Sep 16, 2025
3402636
Merge branch 'devel' into issue-1150
Rohit-Kakodkar Sep 17, 2025
dd16b42
minor fix
Rohit-Kakodkar Sep 17, 2025
5a9cc82
Fixed some access functions
Rohit-Kakodkar Sep 17, 2025
55d2717
Minor bug fix for NVIDIA
Rohit-Kakodkar Sep 17, 2025
2cf0f67
Update tests/unit-tests/policies/chunked_edge.cpp
Rohit-Kakodkar Sep 18, 2025
d460f4d
Update tests/unit-tests/policies/chunked_edge.cpp
Rohit-Kakodkar Sep 18, 2025
81abea7
Revert "Minor bug fix for NVIDIA"
Rohit-Kakodkar Sep 18, 2025
8dff2b4
Fixed NVIDIA tests
Rohit-Kakodkar Sep 18, 2025
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ add_library(
target_link_libraries(
enumerations
${BOOST_LIBS}
Kokkos::kokkos
)


Expand Down
43 changes: 43 additions & 0 deletions core/specfem/assembly/fields/dim2/impl/load_access_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,47 @@ load_after_simd_dispatch(const std::true_type, const IndexType &index,
return;
}

template <bool on_device, typename IndexType, typename ContainerType,
typename... AccessorTypes,
typename std::enable_if_t<
(specfem::data_access::is_index_type<IndexType>::value &&
specfem::data_access::is_chunk_edge<IndexType>::value &&
(specfem::data_access::is_field<AccessorTypes>::value && ...)),
int> = 0>
KOKKOS_FORCEINLINE_FUNCTION void
load_after_simd_dispatch(const std::false_type, const IndexType &index,
const ContainerType &field,
AccessorTypes &...accessors) {
static_assert(!IndexType::using_simd,
"IndexType must not use SIMD in this overload");
constexpr static auto MediumTag =
std::tuple_element_t<0, std::tuple<AccessorTypes...> >::medium_tag;
// Check that all accessors have the same medium tag
specfem::assembly::fields_impl::check_accessor_compatibility<
AccessorTypes...>();
const auto current_field = field.template get_field<MediumTag>();
constexpr static int ncomponents = specfem::element::attributes<
std::tuple_element_t<0, std::tuple<AccessorTypes...> >::dimension_tag,
std::tuple_element_t<0, std::tuple<AccessorTypes...> >::medium_tag>::
components;

specfem::execution::for_each_level(
index.get_iterator(),
[&](const typename IndexType::iterator_type::index_type &iterator_index) {
const auto point_index = iterator_index.get_index();
const auto iedge = point_index.get_policy_index();
const int iglob = field.template get_iglob<on_device>(
point_index.ispec, point_index.iz, point_index.ix, MediumTag);
for (int icomp = 0; icomp < ncomponents; ++icomp) {
(specfem::assembly::fields_impl::base_load_accessor<
on_device, AccessorTypes::data_class>(
iglob, icomp, current_field,
accessors(iedge, point_index.ipoint, icomp)),
...);
}
});

return;
}

} // namespace specfem::assembly::simulation_field_impl
27 changes: 3 additions & 24 deletions core/specfem/assembly/fields/dim2/load_on_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,9 @@ KOKKOS_FORCEINLINE_FUNCTION void load_on_device(const IndexType &index,
template <typename IndexType, typename ContainerType, typename... AccessorTypes,
typename std::enable_if_t<
((specfem::data_access::is_index_type<IndexType>::value) &&
(specfem::data_access::is_point<IndexType>::value) &&
(specfem::data_access::is_field<AccessorTypes>::value && ...)),
int> = 0>
KOKKOS_FORCEINLINE_FUNCTION void load_on_device(const IndexType &index,
const ContainerType &field,
AccessorTypes &...accessors) {

constexpr static auto MediumTag =
std::tuple_element_t<0, std::tuple<AccessorTypes...> >::medium_tag;

// Check that all accessors have the same medium tag
fields_impl::check_accessor_compatibility<AccessorTypes...>();

using simd_accessor_type =
std::integral_constant<bool, IndexType::using_simd>;
simulation_field_impl::load_after_simd_dispatch<true>(
simd_accessor_type(), index, field, accessors...);
return;
}

template <typename IndexType, typename ContainerType, typename... AccessorTypes,
typename std::enable_if_t<
((specfem::data_access::is_chunk_element<IndexType>::value) &&
(specfem::data_access::is_index_type<IndexType>::value) &&
(specfem::data_access::is_point<IndexType>::value ||
specfem::data_access::is_chunk_element<IndexType>::value ||
specfem::data_access::is_chunk_edge<IndexType>::value) &&
(specfem::data_access::is_field<AccessorTypes>::value && ...)),
int> = 0>
KOKKOS_FORCEINLINE_FUNCTION void load_on_device(const IndexType &index,
Expand Down
52 changes: 52 additions & 0 deletions core/specfem/chunk_edge/index.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#pragma once

#include "enumerations/interface.hpp"
#include "execution/chunked_edge_iterator.hpp"
#include "specfem/data_access.hpp"

namespace specfem::chunk_edge {

template <specfem::dimension::type DimensionTag, typename ViewType,
typename TeamMemberType>
class Index
: public specfem::execution::ChunkEdgeIndex<DimensionTag, TeamMemberType,
ViewType>,
public specfem::data_access::Accessor<
specfem::data_access::AccessorType::chunk_edge,
specfem::data_access::DataClassType::index, DimensionTag, false> {
private:
using base_type =
specfem::execution::ChunkEdgeIndex<DimensionTag, TeamMemberType,
ViewType>;

public:
/// @brief Iterator type for traversing elements in the chunk
using iterator_type = typename base_type::iterator_type;

/**
* @brief Construct index from existing chunk element index base.
*
* Creates a chunk element index by wrapping an existing ChunkElementIndex
* object. This constructor is useful when you already have a base chunk
* element index and want to add the data access layer functionality.
*
* @param base The base chunk element index to wrap
*
* @code{.cpp}
* // Create base chunk element index
* auto base_index = specfem::execution::ChunkElementIndex<...>(...);
*
* // Wrap it with data access layer
* IndexType chunk_index(base_index);
* @endcode
*/
KOKKOS_INLINE_FUNCTION
Index(const base_type &base) : base_type(base) {}

KOKKOS_INLINE_FUNCTION
Index(const ViewType indices, const int &ngllz, const int &ngllx,
const TeamMemberType &kokkos_index)
: base_type(indices, ngllz, ngllx, kokkos_index) {}
};

} // namespace specfem::chunk_edge
1 change: 1 addition & 0 deletions core/specfem/point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "point/displacement.hpp"
#include "point/field_derivatives.hpp"
#include "point/index.hpp"
#include "point/interface_index.hpp"
#include "point/jacobian_matrix.hpp"
#include "point/kernels.hpp"
#include "point/mapped_index.hpp"
Expand Down
15 changes: 15 additions & 0 deletions core/specfem/point/interface_index.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

#pragma once

#include "enumerations/interface.hpp"

namespace specfem::point {

template <specfem::dimension::type DimensionTag> class interface_index {
public:
specfem::point::index<DimensionTag> self_index;
specfem::point::index<DimensionTag> coupled_index;
int ipoint;
};

} // namespace specfem::point
8 changes: 0 additions & 8 deletions core/specfem/point/mapped_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,10 @@ template <specfem::dimension::type DimensionTag, bool UseSIMD>
struct mapped_index : public index<DimensionTag, UseSIMD> {
private:
using base_type = index<DimensionTag, UseSIMD>;
using accessor_type = specfem::data_access::Accessor<
specfem::data_access::AccessorType::point,
specfem::data_access::DataClassType::mapped_index, DimensionTag,
UseSIMD>; ///< Accessor type for
///< mapped index

public:
int imap; ///< Index of the mapped element

constexpr static auto data_class =
accessor_type::data_class; ///< Data class of the mapped index

/**
* @brief Constructor for the mapped index
*
Expand Down
16 changes: 16 additions & 0 deletions include/enumerations/mesh_entities.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <Kokkos_Core.hpp>
#include <algorithm>
#include <list>

Expand Down Expand Up @@ -124,4 +125,19 @@ std::list<type> edges_of_corner(const type &corner);
*/
std::list<type> corners_of_edge(const type &edge);

struct edge {
specfem::mesh_entity::type edge_type;
int ispec;
bool reverse_orientation;

KOKKOS_INLINE_FUNCTION
edge(const int ispec, const specfem::mesh_entity::type edge_type,
const bool reverse_orientation = false)
: edge_type(edge_type), ispec(ispec),
reverse_orientation(reverse_orientation) {}

KOKKOS_INLINE_FUNCTION
edge() = default;
};

} // namespace specfem::mesh_entity
9 changes: 9 additions & 0 deletions include/execution/chunked_domain_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,15 @@ class ChunkedDomainIterator : public TeamPolicy<ParallelConfig> {
///< specfem::execution::for_each_level
using execution_space =
typename base_type::execution_space; ///< Execution space type.
using base_index_type = specfem::point::index<
ParallelConfig::dimension,
ParallelConfig::simd::using_simd>; ///< Index type
///< to be used
///< when calling
///< @ref
///< specfem::execution::for_all
///< with this
///< iterator.

/**
* @brief Construct a new Chunked Domain Iterator object
Expand Down
Loading
Loading