diff --git a/CMakeLists.txt b/CMakeLists.txt index 8647d52405..1fb0b78fd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -505,7 +505,7 @@ if(REALM_ENABLE_OPENMP) if(REALM_OPENMP_SYSTEM_RUNTIME) find_package(OpenMP REQUIRED COMPONENTS C CXX) list(APPEND REALM_STATIC_DEPENDS OpenMP) - list(APPEND REALM_LIBRARIES OpenMP::OpenMP_CXX) + list(APPEND REALM_PUBLIC_LIBRARIES OpenMP::OpenMP_CXX) endif() endif() diff --git a/src/realm/inst_layout.h b/src/realm/inst_layout.h index a67b535790..b7582b95b9 100644 --- a/src/realm/inst_layout.h +++ b/src/realm/inst_layout.h @@ -24,6 +24,7 @@ #include "realm/serialize.h" #if defined(REALM_USE_KOKKOS) +#include // we don't want to include Kokkos_View.hpp because it brings in too much // other stuff, so forward declare the pieces we need to define a templated // conversion from Realm accessor to Kokkos::View (anything that actually @@ -35,8 +36,6 @@ namespace Kokkos { template struct MemoryTraits; struct LayoutStride; - template - struct Array; namespace Experimental { template class OffsetView; diff --git a/src/realm/inst_layout.inl b/src/realm/inst_layout.inl index 0ee4db6960..661a54b0eb 100644 --- a/src/realm/inst_layout.inl +++ b/src/realm/inst_layout.inl @@ -1428,8 +1428,8 @@ namespace Realm { Kokkos::MemoryTraits> unmanaged_view; // verify our Kokkos_Unmanaged enum was right - static_assert(unmanaged_view::traits::is_managed == 0, - "incorrect value for Kokkos_Unmanaged!"); + static_assert(unmanaged_view::memory_traits::is_unmanaged, + "incorrect value for Kokkos_Unmanaged!"); // verify the type and rank of the view match us - technically the type // part would be caught by Kokkos if we passed an FT *, but the error @@ -1438,7 +1438,7 @@ namespace Realm { std::is_same::value || std::is_same::value, "base type mismatch between Kokkos view and accessor!"); - static_assert(unmanaged_view::Rank == N, + static_assert(unmanaged_view::rank == N, "rank mismatch between Kokkos view and accessor!"); // we're relying on the check above for type safety, so hand the @@ -1458,7 +1458,7 @@ namespace Realm { const { typename DeferType::type kls; - Kokkos::Array begins; + Kokkos::Array begins; uintptr_t base_shifted = base; for(int i = 0; i < N; i++) { // a Kokkos::Experimental::OffsetView uses absolute indexing, but it's @@ -1483,8 +1483,8 @@ namespace Realm { Kokkos::MemoryTraits> unmanaged_view; // verify our Kokkos_Unmanaged enum was right - static_assert(unmanaged_view::traits::is_managed == 0, - "incorrect value for Kokkos_Unmanaged!"); + static_assert(unmanaged_view::memory_traits::is_unmanaged, + "incorrect value for Kokkos_Unmanaged!"); // verify the type and rank of the view match us - technically the type // part would be caught by Kokkos if we passed an FT *, but the error @@ -1493,7 +1493,7 @@ namespace Realm { std::is_same::value || std::is_same::value, "base type mismatch between Kokkos view and accessor!"); - static_assert(unmanaged_view::Rank == N, + static_assert(unmanaged_view::rank == N, "rank mismatch between Kokkos view and accessor!"); // we're relying on the check above for type safety, so hand the diff --git a/src/realm/kokkos/kokkos_interop.cc b/src/realm/kokkos/kokkos_interop.cc index 02373b59dd..5f550f6938 100644 --- a/src/realm/kokkos/kokkos_interop.cc +++ b/src/realm/kokkos/kokkos_interop.cc @@ -52,13 +52,6 @@ namespace Kokkos { #include -// during the development of Kokkos 3.7.00, initialization data structures -// were changed - detect the presence of a new header (included indirectly -// via Kokkos_Core.hpp) -#ifdef KOKKOS_INITIALIZATION_SETTINGS_HPP -#define REALM_USE_KOKKOS_INITIALIZATION_SETTINGS -#endif - #include namespace Realm { @@ -128,14 +121,9 @@ namespace Realm { virtual void execute_on_processor(Processor p) { log_kokkos.info() << "doing openmp init on proc " << p; -#ifdef REALM_USE_KOKKOS_INITIALIZATION_SETTINGS - Kokkos::InitializationSettings init_settings; - init_settings.set_num_threads(-1); // todo - get from proc - Kokkos::OpenMP::impl_initialize(init_settings); -#else - int thread_count = -1; // todo - get from proc - Kokkos::OpenMP::impl_initialize(thread_count); -#endif + Kokkos::InitializationSettings init_settings; + init_settings.set_num_threads(1); + Kokkos::OpenMP::impl_initialize(init_settings); mark_done(); } }; @@ -163,28 +151,13 @@ namespace Realm { { log_kokkos.info() << "doing cuda init on proc " << p; - ProcessorImpl *impl = get_runtime()->get_processor_impl(p); - assert(impl != nullptr && "invalid processor handle"); - assert(impl->kind == Processor::TOC_PROC); - Cuda::GPUProcessor *gpu = checked_cast(impl); + ProcessorImpl *impl = get_runtime()->get_processor_impl(p); + assert(impl->kind == Processor::TOC_PROC); + Cuda::GPUProcessor *gpu = checked_cast(impl); -#ifdef REALM_USE_KOKKOS_INITIALIZATION_SETTINGS - Kokkos::InitializationSettings init_settings; - init_settings.set_device_id(gpu->gpu->info->index); - init_settings.set_num_devices(1); - Kokkos::Cuda::impl_initialize(init_settings); -#else - int cuda_device_id = gpu->gpu->info->index; - int num_instances = 1; // unused in kokkos? - - Kokkos::Cuda::impl_initialize(Kokkos::Cuda::SelectDevice(cuda_device_id), - num_instances); -#endif - { - // some init is deferred until an instance is created - Kokkos::Cuda dummy; - } - mark_done(); + Kokkos::InitializationSettings init_settings; + Kokkos::Cuda::impl_initialize(init_settings); + mark_done(); } }; @@ -224,16 +197,10 @@ namespace Realm { assert(impl->kind == Processor::TOC_PROC); Hip::GPUProcessor *gpu = checked_cast(impl); -#ifdef REALM_USE_KOKKOS_INITIALIZATION_SETTINGS Kokkos::InitializationSettings init_settings; init_settings.set_device_id(gpu->gpu->info->index); init_settings.set_num_devices(1); Kokkos::HIP::impl_initialize(init_settings); -#else - int hip_device_id = gpu->gpu->info->index; - - Kokkos::HIP::impl_initialize(Kokkos::HIP::SelectDevice(hip_device_id)); -#endif { // some init is deferred until an instance is created Kokkos::HIP dummy; @@ -266,22 +233,14 @@ namespace Realm { { // use Kokkos::Impl::{pre,post}_initialize to allow us to do our own // execution space initialization -#ifdef REALM_USE_KOKKOS_INITIALIZATION_SETTINGS Kokkos::InitializationSettings kokkos_init_args; -#else - Kokkos::InitArguments kokkos_init_args; -#endif log_kokkos.info() << "doing general pre-initialization"; Kokkos::Impl::pre_initialize(kokkos_init_args); #ifdef KOKKOS_ENABLE_SERIAL // nothing thread-specific for serial execution space, so just call it // here -#ifdef REALM_USE_KOKKOS_INITIALIZATION_SETTINGS Kokkos::Serial::impl_initialize(kokkos_init_args); -#else - Kokkos::Serial::impl_initialize(); -#endif #endif #ifdef KOKKOS_ENABLE_OPENMP @@ -391,9 +350,8 @@ namespace Realm { REALM_PUBLIC_API void kokkos_finalize( const std::vector &local_procs) // needed by librealm.so { -#if KOKKOS_VERSION >= 40000 Kokkos::Impl::pre_finalize(); -#endif + // per processor finalization on the correct threads #ifdef KOKKOS_ENABLE_OPENMP for(std::vector::const_iterator it = kokkos_omp_procs.begin(); @@ -423,11 +381,7 @@ namespace Realm { #endif log_kokkos.info() << "doing general finalization"; -#if KOKKOS_VERSION >= 40000 Kokkos::Impl::post_finalize(); -#else - Kokkos::finalize(); -#endif } }; // namespace KokkosInterop