diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b8aa1b..371e241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## Unreleased ### Added - Ability to build Kokkos and RAJA versions against existing packages. +- Thrust managed memory. ### Changed - RAJA CUDA CMake build issues resolved. diff --git a/src/thrust/ThrustStream.h b/src/thrust/ThrustStream.h index f87ace7..a2a4b72 100644 --- a/src/thrust/ThrustStream.h +++ b/src/thrust/ThrustStream.h @@ -8,7 +8,11 @@ #include #include +#if defined(MANAGED) +#include +#else #include +#endif #include "Stream.h" @@ -21,9 +25,15 @@ class ThrustStream : public Stream // Size of arrays int array_size; + #if defined(MANAGED) + thrust::universtal_vector a; + thrust::universtal_vector b; + thrust::universtal_vector c; + #else thrust::device_vector a; thrust::device_vector b; thrust::device_vector c; + #endif public: ThrustStream(const int, int); diff --git a/src/thrust/model.cmake b/src/thrust/model.cmake index 2d687c7..91821ef 100644 --- a/src/thrust/model.cmake +++ b/src/thrust/model.cmake @@ -18,6 +18,9 @@ register_flag_optional(BACKEND " "CUDA") + register_flag_optional(MANAGED "Enabled managed memory mode." + "OFF") + register_flag_optional(CMAKE_CUDA_COMPILER "[THRUST_IMPL==CUDA] Path to the CUDA nvcc compiler" "") @@ -34,6 +37,9 @@ register_flag_optional(CUDA_EXTRA_FLAGS macro(setup) set(CMAKE_CXX_STANDARD 14) + if (MANAGED) + register_definitions(MANAGED) + endif () if (${THRUST_IMPL} STREQUAL "CUDA") @@ -91,4 +97,4 @@ macro(setup) endmacro() - \ No newline at end of file +