Skip to content

Commit

Permalink
Added chunk sizes to impl namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit-Kakodkar committed Feb 18, 2025
1 parent 2939aac commit e344fce
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions include/parallel_configuration/chunk_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
namespace specfem {
namespace parallel_config {

namespace impl {
constexpr int cuda_chunk_size = 32;
constexpr int openmp_chunk_size = 1;
constexpr int serial_chunk_size = 1;
} // namespace impl

#ifdef KOKKOS_ENABLE_CUDA
constexpr int chunk_size = 32;
constexpr int storage_chunk_size = chunk_size;
constexpr int storage_chunk_size = impl::cuda_chunk_size;
#elif KOKKOS_ENABLE_OPENMP
constexpr int chunk_size = 1;
constexpr int simd_size = specfem::datatypes::simd<type_real, true>::size();
constexpr int storage_chunk_size = chunk_size * simd_size;
constexpr int storage_chunk_size = impl::openmp_chunk_size * simd_size;
#else
constexpr int chunk_size = 1;
constexpr int simd_size = specfem::datatypes::simd<type_real, true>::size();
constexpr int storage_chunk_size = chunk_size * simd_size;
constexpr int storage_chunk_size = impl::serial_chunk_size * simd_size;
#endif

/**
Expand Down Expand Up @@ -62,24 +65,24 @@ struct default_chunk_config;
#ifdef KOKKOS_ENABLE_CUDA
template <typename SIMD>
struct default_chunk_config<specfem::dimension::type::dim2, SIMD, Kokkos::Cuda>
: chunk_config<specfem::dimension::type::dim2, chunk_size, chunk_size, 160,
1, SIMD, Kokkos::Cuda> {};
: chunk_config<specfem::dimension::type::dim2, impl::cuda_chunk_size,
impl::cuda_chunk_size, 160, 1, SIMD, Kokkos::Cuda> {};
#endif

#ifdef KOKKOS_ENABLE_OPENMP
template <typename SIMD>
struct default_chunk_config<specfem::dimension::type::dim2, SIMD,
Kokkos::OpenMP>
: chunk_config<specfem::dimension::type::dim2, 1, 1, 1, 1, SIMD,
Kokkos::OpenMP> {};
: chunk_config<specfem::dimension::type::dim2, impl::openmp_chunk_size,
impl::openmp_chunk_size, 1, 1, SIMD, Kokkos::OpenMP> {};
#endif

#ifdef KOKKOS_ENABLE_SERIAL
template <typename SIMD>
struct default_chunk_config<specfem::dimension::type::dim2, SIMD,
Kokkos::Serial>
: chunk_config<specfem::dimension::type::dim2, 1, 1, 1, 1, SIMD,
Kokkos::Serial> {};
: chunk_config<specfem::dimension::type::dim2, impl::serial_chunk_size,
impl::serial_chunk_size, 1, 1, SIMD, Kokkos::Serial> {};
#endif
} // namespace parallel_config
} // namespace specfem

0 comments on commit e344fce

Please sign in to comment.