Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ cmake_minimum_required( VERSION 3.22.1 )
#-----------------------------------------------------
set(CMAKE_VERBOSE_MAKEFILE OFF)

#--------------------------------------------------------
# Check cmake option conflicts
#--------------------------------------------------------
include(cmake/CheckOptions.cmake)

#--------------------------------------------------------
# Configure compiler/project
#--------------------------------------------------------
Expand All @@ -22,7 +17,6 @@ include(cmake/ProxyConfig.cmake) # This must go *before* other configurations
#--------------------------------------------------------
include(cmake/PywrapConfig.cmake) # This must go *before* kokkos and adios configurations
include(cmake/MPIConfig.cmake) # This must go *before* adios configuration
include(cmake/KokkosConfig.cmake)
include(cmake/ADIOS2Config.cmake)
include(cmake/GoogleTestConfig.cmake)
include(cmake/GoogleBenchConfig.cmake)
Expand Down
16 changes: 0 additions & 16 deletions cmake/CheckOptions.cmake

This file was deleted.

13 changes: 0 additions & 13 deletions cmake/KokkosConfig.cmake

This file was deleted.

8 changes: 4 additions & 4 deletions cmake/KokkosUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Kokkos related functions
#-------------------------------------------------------------------

find_package(Kokkos REQUIRED)

function(target_link_kokkos_if_enabled target_name)
if (USE_KOKKOS)
target_link_libraries(${target_name} PUBLIC Kokkos::kokkos)
target_compile_definitions(${target_name} PUBLIC USE_KOKKOS)
endif()
target_link_libraries(${target_name} PUBLIC Kokkos::kokkos)
target_compile_definitions(${target_name} PUBLIC USE_KOKKOS)
endfunction()
5 changes: 0 additions & 5 deletions cmake/ProxyConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ option(COMPILE_SEM "Compile Spectral Elements Method simulation" ON)
option(COMPILE_FD "Compile finite elements simulation" ON)

# Programming models
option(USE_VECTOR "Use vectors." OFF)
option(USE_KOKKOS "Use KOKKOS to parallelise loops" OFF)
option(USE_KOKKOS_TEAMS "use hierarchical parallelism in Kokkos" OFF)
option(ENABLE_CUDA "Enable cuda compilation" OFF)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove ENABLE_CUDA and ENABLE_HIP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These flags are handled by Kokkos now.

Our code should be independent of the GPU/HOST implementation. This part is handled by kokkos and TPL (or users installation).

option(USE_MPI "Enable MPI compilation" OFF)
option(ENABLE_HIP "Enable hip compilation" OFF)

# Python wrapping
option(ENABLE_PYWRAP "Enable python binding compilation with pybind11" OFF)
Expand Down
7 changes: 0 additions & 7 deletions cmake/ProxyUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ function(print_configuration_summary)
message(STATUS " COMPILE_FD: ${COMPILE_FD}")
message(STATUS "")

message(STATUS "Programming Models:")
message(STATUS " USE_VECTOR: ${USE_VECTOR}")
message(STATUS " USE_KOKKOS: ${USE_KOKKOS}")
message(STATUS " ENABLE_CUDA: ${ENABLE_CUDA}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove ENABLE_CUDA and ENABLE_HIP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These flags are handled by Kokkos now.

Our code should be independent of the GPU/HOST implementation. This part is handled by kokkos and TPL (or users installation).

message(STATUS " USE_KOKKOS_TEAMS: ${USE_KOKKOS_TEAMS}")
message(STATUS "")

message(STATUS "Python Wrapping:")
message(STATUS " ENABLE_PYWRAP: ${ENABLE_PYWRAP}")
message(STATUS "")
Expand Down
21 changes: 0 additions & 21 deletions src/discretization/fd/kernels/include/fd_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,10 @@
#define IDX3_eta1(i, j, k) \
((nz + 2) * (ny + 2) * ((i) + 1) + (nz + 2) * ((j) + 1) + ((k) + 1))

#if defined(USE_KOKKOS)
#define LOOP3DHEAD(x3, y3, z3, x4, y4, z4) Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<3>>({z3,x3,y3},{z4,x4,y4}),KOKKOS_LAMBDA(int k,int i,int j) {
#else
#define LOOP3DHEAD(x3, y3, z3, x4, y4, z4) \
for (int i = x3; i < x4; ++i) \
{ \
for (int j = y3; j < y4; ++j) \
{ \
for (int k = z3; k < z4; ++k) \
{
#endif

#if defined(USE_KOKKOS)
#define LOOP3DEND \
});
#else
#define LOOP3DEND \
} \
} \
}
#endif

#define CREATEVIEWINNER \
vectorReal coefx = myModels.coefx; \
Expand All @@ -47,9 +30,5 @@
#define CREATEVIEWSPONGE vectorReal spongeArray = myModels.spongeArray;
#define PN_Global pnGlobal

#if defined(USE_KOKKOS)
#define FDFENCE Kokkos::fence();
#else
#define FDFENCE
#endif
#endif // FUNTIDES_DISCRETIZATION_FD_KERNELS_INCLUDE_FD_MACROS_H_
8 changes: 0 additions & 8 deletions src/main/fd/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#include <iostream>
#include <memory>

#ifdef USE_KOKKOS
#include <Kokkos_Core.hpp>
#endif

#include "fd_options.h"
#include "fd_proxy.h"
Expand All @@ -37,7 +35,6 @@ using std::chrono::time_point;
// Global start time for total execution timing
time_point<system_clock> g_start_init_time;

#ifdef USE_KOKKOS
/**
* @brief RAII wrapper for Kokkos initialization/finalization.
*/
Expand All @@ -56,7 +53,6 @@ class KokkosScope
KokkosScope(KokkosScope&&) = delete;
KokkosScope& operator=(KokkosScope&&) = delete;
};
#endif

/**
* @brief Converts nanoseconds duration to seconds as a double.
Expand Down Expand Up @@ -120,11 +116,9 @@ void Compute(fdtd::FdtdProxy& fd_sim)
*/
void ConfigureParallelEnvironment()
{
#ifdef USE_KOKKOS
// Configure OpenMP thread binding for optimal performance
setenv("OMP_PROC_BIND", "spread", 0); // Don't override if already set
setenv("OMP_PLACES", "threads", 0);
#endif
}

} // namespace
Expand All @@ -147,11 +141,9 @@ int main(int argc, char* argv[])
// Configure parallel execution environment
ConfigureParallelEnvironment();

#ifdef USE_KOKKOS
// RAII: Kokkos will be automatically finalized when this object goes out of
// scope
KokkosScope kokkos_scope(argc, argv);
#endif

try
{
Expand Down
5 changes: 0 additions & 5 deletions src/main/fe/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,10 @@ int main(int argc, char *argv[])
MPI_Comm_size(MPI_COMM_WORLD, &size);
#endif

#ifdef USE_KOKKOS
setenv("OMP_PROC_BIND", "spread", 1);
setenv("OMP_PLACES", "threads", 1);
Kokkos::initialize(argc, argv);
{
#endif

cxxopts::Options options("SEM Proxy", "Runs the SEM simulation.");
options.allow_unrecognised_options(); // lets Kokkos flags pass

Expand Down Expand Up @@ -114,10 +111,8 @@ int main(int argc, char *argv[])
SEMproxy semsim(opt);

compute_loop(semsim);
#ifdef USE_KOKKOS
}
Kokkos::finalize();
#endif

#ifdef USE_MPI
MPI_Barrier(MPI_COMM_WORLD);
Expand Down
29 changes: 0 additions & 29 deletions src/main/fe/src/sem_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,9 @@ void SEMproxy::run()

for (int i = 0; i < pnAtReceiver.extent(0); i++)
{
#ifdef USE_KOKKOS
auto subview = Kokkos::subview(pnAtReceiver, i, Kokkos::ALL());
vectorReal subset("receiver_save", num_sample_);
Kokkos::deep_copy(subset, subview);
#else
auto& subview = pnAtReceiver;
vectorReal subset(subview.extent(0) * subview.extent(1));
for (size_t k = 0; k < subview.extent(0); ++k)
{
for (size_t j = 0; j < subview.extent(1); ++j)
{
subset[k * subview.extent(1) + j] = subview(k, j);
}
}
#endif
io_ctrl_->saveReceiver(subset, src_coord_);
}

Expand Down Expand Up @@ -461,21 +449,9 @@ void SEMproxy::run()

for (int i = 0; i < uxnAtReceiver.extent(0); i++)
{
#ifdef USE_KOKKOS
auto subview = Kokkos::subview(uxnAtReceiver, i, Kokkos::ALL());
vectorReal subset("receiver_save", num_sample_);
Kokkos::deep_copy(subset, subview);
#else
auto& subview = pnAtReceiver;
vectorReal subset(subview.extent(0) * subview.extent(1));
for (size_t k = 0; k < subview.extent(0); ++k)
{
for (size_t j = 0; j < subview.extent(1); ++j)
{
subset[k * subview.extent(1) + j] = subview(k, j);
}
}
#endif // USE_KOKKOS
io_ctrl_->saveReceiver(subset, src_coord_);
}

Expand Down Expand Up @@ -887,7 +863,6 @@ void SEMproxy::init_source()

void SEMproxy::saveSnapshot(int timestep, VECTOR_REAL_VIEW data) const
{
#ifdef USE_KOKKOS
Kokkos::fence();
auto nb_nodes = data.extent(0);

Expand All @@ -896,10 +871,6 @@ void SEMproxy::saveSnapshot(int timestep, VECTOR_REAL_VIEW data) const
Kokkos::parallel_for(
"copy_column", nb_nodes, KOKKOS_LAMBDA(int i) { subset(i) = data(i); });
Kokkos::fence();
#else
auto& subset = data;
#endif // USE_KOKKOS

io_ctrl_->saveSnapshot(subset, timestep);
}

Expand Down
6 changes: 0 additions & 6 deletions src/utils/include/common_config.h.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef COMMON_CONFIG_HPP
#define COMMON_CONFIG_HPP

// Enable use of Vector (CMake option)
#cmakedefine USE_VECTOR

// Enables use of ENABLE_HIP (CMake option)
#cmakedefine ENABLE_HIP

Expand All @@ -19,9 +16,6 @@
// Enable printout memory allocation info for arrays
#cmakedefine PRINT_ALLOC_INFO

// Enable hierarchical parallelism in Kokkos
#cmakedefine USE_KOKKOS_TEAMS

#cmakedefine USE_DOUBLE

#cmakedefine USE_SIMPLE_MESH
Expand Down
Loading
Loading