Skip to content

Commit 397dc2e

Browse files
committed
Initial Commit for WIP Cuda Execution Space
1 parent 4927411 commit 397dc2e

File tree

6 files changed

+29
-3
lines changed

6 files changed

+29
-3
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ kr_option(KR_ENABLE_HDF5_PARALLEL "use parallel version of HDF5" OFF KR_ENABLE_H
8787

8888
#Exec space options
8989
kr_option(KR_ENABLE_EXEC_SPACES "enable resilient execution spaces" OFF)
90-
kr_option(KR_ENABLE_OPENMP_EXEC_SPACE "enable the resilient OpenMP execution space" ON "KR_ENABLE_EXEC_SPACES;KR_OPENMP_DEVICE_ENABLED")
91-
if(KR_ENABLE_OPENMP_EXEC_SPACE)
90+
kr_option(KR_ENABLE_OPENMP_EXEC_SPACE "enable resilient OpenMP execution space" OFF "KR_ENABLE_EXEC_SPACES;KR_OPENMP_DEVICE_ENABLED")
91+
kr_option(KR_ENABLE_CUDA_EXEC_SPACE "enable resilient Cuda execution space" OFF "KR_ENABLE_EXEC_SPACES;KR_CUDA_DEVICE_ENABLED")
92+
if(KR_ENABLE_EXEC_SPACES)
9293
set(KR_MODULAR_REDUNDANCY TRIPLE CACHE STRING "choose level of modular redundancy")
9394
set_property(CACHE KR_MODULAR_REDUNDANCY PROPERTY STRINGS OFF DOUBLE TRIPLE)
9495
if (KR_MODULAR_REDUNDANCY STREQUAL TRIPLE)
@@ -127,6 +128,9 @@ if (KR_ENABLE_OPENMP_EXEC_SPACE)
127128
message(STATUS "OpenMP resilient execution spaces are enabled")
128129
endif()
129130

131+
if (KR_ENABLE_CUDA_EXEC_SPACE)
132+
message(STATUS "Cuda resilient execution spaces are enabled")
133+
endif()
130134

131135
add_subdirectory(src)
132136

src/resilience/ErrorHandler.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define INC_RESILIENCE_ERRORHANDLER_HPP
4343

4444
#include <functional>
45+
#include <Kokkos_Core.hpp>
4546

4647
namespace KokkosResilience {
4748
/**
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
if (KR_ENABLE_OPENMP_EXEC_SPACE)
22
add_subdirectory(openMP)
33
endif()
4+
5+
if (KR_ENABLE_CUDA_EXEC_SPACE)
6+
add_subdirectory(cuda)
7+
endif()

src/resilience/exec_space/ExecSpace.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@
4646
#include "openMP/Resilient_OpenMP_Subscriber.hpp"
4747
#include "openMP/Resilient_HostSpace.hpp"
4848
#endif
49+
50+
#ifdef KR_ENABLE_CUDA_EXEC_SPACE
51+
#include "cuda/Resilient_Cuda.hpp"
52+
#include "cuda/Resilient_Cuda_Parallel_For.hpp"
53+
#include "cuda/Resilient_Cuda_Subscriber.hpp"
54+
#include "cuda/Resilient_CudaSpace.hpp"
55+
#endif

src/resilience/exec_space/openMP/Resilient_OpenMP_Subscriber.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,16 @@ struct ResilientDuplicatesSubscriber {
350350

351351
// The first copy constructor in a parallel_for for the given view
352352
if (res.second) {
353+
std::cout << "Do we ever enter the first copy constructor? How many times?" << std::endl;
353354
c.duplicate_count = 0;
354355
}
355-
356+
std::cout << "*****In copy constructor, self has now been set to copy c.duplicate_count=" << c.duplicate_count << "****" << std::endl;
356357
self = c.copy[c.duplicate_count++];
357358
// Copy all data, every time
358359
Kokkos::deep_copy(self, other);
360+
std::cout << std::endl << "This is the end of the constructor after Kokkos::deep_copy" <<std::endl;
361+
std::cout << "c_duplicate_count = "<<c.duplicate_count<< std::endl;
362+
359363
}
360364
}
361365
}

tests/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ if (KR_ENABLE_OPENMP_EXEC_SPACE)
4444
)
4545
endif()
4646

47+
if (KR_ENABLE_CUDA_EXEC_SPACE)
48+
target_sources(resilience_tests PRIVATE
49+
TestCudaResilientExecution.cpp
50+
)
51+
endif()
52+
4753
if (KR_WARNINGS_AS_ERRORS)
4854
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
4955
target_compile_options(resilience_tests PRIVATE "-Wall")

0 commit comments

Comments
 (0)