Skip to content

Commit f957e91

Browse files
authored
remove compilation flag use_kokkos and vector version (#265)
* [remove] vector macro in datatype * [remove] compiler option in cmake * [remove] use_kokkos flag removed from code
1 parent 791b432 commit f957e91

File tree

15 files changed

+5
-389
lines changed

15 files changed

+5
-389
lines changed

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ cmake_minimum_required( VERSION 3.22.1 )
55
#-----------------------------------------------------
66
set(CMAKE_VERBOSE_MAKEFILE OFF)
77

8-
#--------------------------------------------------------
9-
# Check cmake option conflicts
10-
#--------------------------------------------------------
11-
include(cmake/CheckOptions.cmake)
12-
138
#--------------------------------------------------------
149
# Configure compiler/project
1510
#--------------------------------------------------------
@@ -22,7 +17,6 @@ include(cmake/ProxyConfig.cmake) # This must go *before* other configurations
2217
#--------------------------------------------------------
2318
include(cmake/PywrapConfig.cmake) # This must go *before* kokkos and adios configurations
2419
include(cmake/MPIConfig.cmake) # This must go *before* adios configuration
25-
include(cmake/KokkosConfig.cmake)
2620
include(cmake/ADIOS2Config.cmake)
2721
include(cmake/GoogleTestConfig.cmake)
2822
include(cmake/GoogleBenchConfig.cmake)

cmake/CheckOptions.cmake

Lines changed: 0 additions & 16 deletions
This file was deleted.

cmake/KokkosConfig.cmake

Lines changed: 0 additions & 13 deletions
This file was deleted.

cmake/KokkosUtils.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Kokkos related functions
33
#-------------------------------------------------------------------
44

5+
find_package(Kokkos REQUIRED)
6+
57
function(target_link_kokkos_if_enabled target_name)
6-
if (USE_KOKKOS)
7-
target_link_libraries(${target_name} PUBLIC Kokkos::kokkos)
8-
target_compile_definitions(${target_name} PUBLIC USE_KOKKOS)
9-
endif()
8+
target_link_libraries(${target_name} PUBLIC Kokkos::kokkos)
9+
target_compile_definitions(${target_name} PUBLIC USE_KOKKOS)
1010
endfunction()

cmake/ProxyConfig.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ option(COMPILE_SEM "Compile Spectral Elements Method simulation" ON)
77
option(COMPILE_FD "Compile finite elements simulation" ON)
88

99
# Programming models
10-
option(USE_VECTOR "Use vectors." OFF)
11-
option(USE_KOKKOS "Use KOKKOS to parallelise loops" OFF)
12-
option(USE_KOKKOS_TEAMS "use hierarchical parallelism in Kokkos" OFF)
13-
option(ENABLE_CUDA "Enable cuda compilation" OFF)
1410
option(USE_MPI "Enable MPI compilation" OFF)
15-
option(ENABLE_HIP "Enable hip compilation" OFF)
1611

1712
# Python wrapping
1813
option(ENABLE_PYWRAP "Enable python binding compilation with pybind11" OFF)

cmake/ProxyUtils.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ function(print_configuration_summary)
1212
message(STATUS " COMPILE_FD: ${COMPILE_FD}")
1313
message(STATUS "")
1414

15-
message(STATUS "Programming Models:")
16-
message(STATUS " USE_VECTOR: ${USE_VECTOR}")
17-
message(STATUS " USE_KOKKOS: ${USE_KOKKOS}")
18-
message(STATUS " ENABLE_CUDA: ${ENABLE_CUDA}")
19-
message(STATUS " USE_KOKKOS_TEAMS: ${USE_KOKKOS_TEAMS}")
20-
message(STATUS "")
21-
2215
message(STATUS "Python Wrapping:")
2316
message(STATUS " ENABLE_PYWRAP: ${ENABLE_PYWRAP}")
2417
message(STATUS "")

src/discretization/fd/kernels/include/fd_macros.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,10 @@
88
#define IDX3_eta1(i, j, k) \
99
((nz + 2) * (ny + 2) * ((i) + 1) + (nz + 2) * ((j) + 1) + ((k) + 1))
1010

11-
#if defined(USE_KOKKOS)
1211
#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) {
13-
#else
14-
#define LOOP3DHEAD(x3, y3, z3, x4, y4, z4) \
15-
for (int i = x3; i < x4; ++i) \
16-
{ \
17-
for (int j = y3; j < y4; ++j) \
18-
{ \
19-
for (int k = z3; k < z4; ++k) \
20-
{
21-
#endif
2212

23-
#if defined(USE_KOKKOS)
2413
#define LOOP3DEND \
2514
});
26-
#else
27-
#define LOOP3DEND \
28-
} \
29-
} \
30-
}
31-
#endif
3215

3316
#define CREATEVIEWINNER \
3417
vectorReal coefx = myModels.coefx; \
@@ -47,9 +30,5 @@
4730
#define CREATEVIEWSPONGE vectorReal spongeArray = myModels.spongeArray;
4831
#define PN_Global pnGlobal
4932

50-
#if defined(USE_KOKKOS)
5133
#define FDFENCE Kokkos::fence();
52-
#else
53-
#define FDFENCE
54-
#endif
5534
#endif // FUNTIDES_DISCRETIZATION_FD_KERNELS_INCLUDE_FD_MACROS_H_

src/main/fd/src/main.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
#include <iostream>
2020
#include <memory>
2121

22-
#ifdef USE_KOKKOS
2322
#include <Kokkos_Core.hpp>
24-
#endif
2523

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

40-
#ifdef USE_KOKKOS
4138
/**
4239
* @brief RAII wrapper for Kokkos initialization/finalization.
4340
*/
@@ -56,7 +53,6 @@ class KokkosScope
5653
KokkosScope(KokkosScope&&) = delete;
5754
KokkosScope& operator=(KokkosScope&&) = delete;
5855
};
59-
#endif
6056

6157
/**
6258
* @brief Converts nanoseconds duration to seconds as a double.
@@ -120,11 +116,9 @@ void Compute(fdtd::FdtdProxy& fd_sim)
120116
*/
121117
void ConfigureParallelEnvironment()
122118
{
123-
#ifdef USE_KOKKOS
124119
// Configure OpenMP thread binding for optimal performance
125120
setenv("OMP_PROC_BIND", "spread", 0); // Don't override if already set
126121
setenv("OMP_PLACES", "threads", 0);
127-
#endif
128122
}
129123

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

150-
#ifdef USE_KOKKOS
151144
// RAII: Kokkos will be automatically finalized when this object goes out of
152145
// scope
153146
KokkosScope kokkos_scope(argc, argv);
154-
#endif
155147

156148
try
157149
{

src/main/fe/src/main.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,10 @@ int main(int argc, char *argv[])
7373
MPI_Comm_size(MPI_COMM_WORLD, &size);
7474
#endif
7575

76-
#ifdef USE_KOKKOS
7776
setenv("OMP_PROC_BIND", "spread", 1);
7877
setenv("OMP_PLACES", "threads", 1);
7978
Kokkos::initialize(argc, argv);
8079
{
81-
#endif
82-
8380
cxxopts::Options options("SEM Proxy", "Runs the SEM simulation.");
8481
options.allow_unrecognised_options(); // lets Kokkos flags pass
8582

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

116113
compute_loop(semsim);
117-
#ifdef USE_KOKKOS
118114
}
119115
Kokkos::finalize();
120-
#endif
121116

122117
#ifdef USE_MPI
123118
MPI_Barrier(MPI_COMM_WORLD);

src/main/fe/src/sem_proxy.cc

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -328,21 +328,9 @@ void SEMproxy::run()
328328

329329
for (int i = 0; i < pnAtReceiver.extent(0); i++)
330330
{
331-
#ifdef USE_KOKKOS
332331
auto subview = Kokkos::subview(pnAtReceiver, i, Kokkos::ALL());
333332
vectorReal subset("receiver_save", num_sample_);
334333
Kokkos::deep_copy(subset, subview);
335-
#else
336-
auto& subview = pnAtReceiver;
337-
vectorReal subset(subview.extent(0) * subview.extent(1));
338-
for (size_t k = 0; k < subview.extent(0); ++k)
339-
{
340-
for (size_t j = 0; j < subview.extent(1); ++j)
341-
{
342-
subset[k * subview.extent(1) + j] = subview(k, j);
343-
}
344-
}
345-
#endif
346334
io_ctrl_->saveReceiver(subset, src_coord_);
347335
}
348336

@@ -461,21 +449,9 @@ void SEMproxy::run()
461449

462450
for (int i = 0; i < uxnAtReceiver.extent(0); i++)
463451
{
464-
#ifdef USE_KOKKOS
465452
auto subview = Kokkos::subview(uxnAtReceiver, i, Kokkos::ALL());
466453
vectorReal subset("receiver_save", num_sample_);
467454
Kokkos::deep_copy(subset, subview);
468-
#else
469-
auto& subview = pnAtReceiver;
470-
vectorReal subset(subview.extent(0) * subview.extent(1));
471-
for (size_t k = 0; k < subview.extent(0); ++k)
472-
{
473-
for (size_t j = 0; j < subview.extent(1); ++j)
474-
{
475-
subset[k * subview.extent(1) + j] = subview(k, j);
476-
}
477-
}
478-
#endif // USE_KOKKOS
479455
io_ctrl_->saveReceiver(subset, src_coord_);
480456
}
481457

@@ -887,7 +863,6 @@ void SEMproxy::init_source()
887863

888864
void SEMproxy::saveSnapshot(int timestep, VECTOR_REAL_VIEW data) const
889865
{
890-
#ifdef USE_KOKKOS
891866
Kokkos::fence();
892867
auto nb_nodes = data.extent(0);
893868

@@ -896,10 +871,6 @@ void SEMproxy::saveSnapshot(int timestep, VECTOR_REAL_VIEW data) const
896871
Kokkos::parallel_for(
897872
"copy_column", nb_nodes, KOKKOS_LAMBDA(int i) { subset(i) = data(i); });
898873
Kokkos::fence();
899-
#else
900-
auto& subset = data;
901-
#endif // USE_KOKKOS
902-
903874
io_ctrl_->saveSnapshot(subset, timestep);
904875
}
905876

0 commit comments

Comments
 (0)