diff --git a/common/src/KokkosKernels_EagerInitialize.cpp b/common/src/KokkosKernels_EagerInitialize.cpp index f1c07e8c22..ec4c6e1225 100644 --- a/common/src/KokkosKernels_EagerInitialize.cpp +++ b/common/src/KokkosKernels_EagerInitialize.cpp @@ -20,14 +20,14 @@ // Include the minimal set of headers that declare all TPL singletons #ifdef KOKKOSKERNELS_ENABLE_COMPONENT_BLAS -#include "KokkosBlas_tpl_spec.hpp" //cuBLAS, rocBLAS +#include "KokkosBlas_tpl_spec.hpp" //cuBLAS, rocBLAS #ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA #include "KokkosBlas_Magma_tpl.hpp" #endif #endif #ifdef KOKKOSKERNELS_ENABLE_COMPONENT_SPARSE -//note: this file declares both cuSPARSE and rocSPARSE singletons +// note: this file declares both cuSPARSE and rocSPARSE singletons #include "KokkosKernels_tpl_handles_decl.hpp" #endif @@ -40,44 +40,40 @@ #endif #endif -namespace KokkosKernels -{ - void eager_initialize() - { - if(!Kokkos::is_initialized()) - { - throw std::runtime_error("Kokkos::intialize must be called before KokkosKernels::eager_initialize"); - } +namespace KokkosKernels { +void eager_initialize() { + if (!Kokkos::is_initialized()) { + throw std::runtime_error("Kokkos::intialize must be called before KokkosKernels::eager_initialize"); + } #ifdef KOKKOSKERNELS_ENABLE_COMPONENT_BLAS #ifdef KOKKOSKERNELS_ENABLE_TPL_CUBLAS - (void) KokkosBlas::Impl::CudaBlasSingleton::singleton(); + (void)KokkosBlas::Impl::CudaBlasSingleton::singleton(); #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_ROCBLAS - (void) KokkosBlas::Impl::RocBlasSingleton::singleton(); + (void)KokkosBlas::Impl::RocBlasSingleton::singleton(); #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA #include "KokkosBlas_Magma_tpl.hpp" - (void) KokkosBlas::Impl::MagmaSingleton::singleton(); + (void)KokkosBlas::Impl::MagmaSingleton::singleton(); #endif #endif #ifdef KOKKOSKERNELS_ENABLE_COMPONENT_SPARSE #ifdef KOKKOSKERNELS_ENABLE_TPL_CUSPARSE - (void) KokkosKernels::Impl::CusparseSingleton::singleton(); + (void)KokkosKernels::Impl::CusparseSingleton::singleton(); #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_ROCSPARSE - (void) KokkosKernels::Impl::RocsparseSingleton::singleton(); + (void)KokkosKernels::Impl::RocsparseSingleton::singleton(); #endif #endif #ifdef KOKKOSKERNELS_ENABLE_COMPONENT_LAPACK #ifdef KOKKOSKERNELS_ENABLE_TPL_CUSOLVER - (void) KokkosLapack::Impl::CudaLapackSingleton::singleton(); + (void)KokkosLapack::Impl::CudaLapackSingleton::singleton(); #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA - (void) KokkosLapack::Impl::MagmaSingleton::singleton(); + (void)KokkosLapack::Impl::MagmaSingleton::singleton(); #endif #endif - } } - +} // namespace KokkosKernels diff --git a/common/src/KokkosKernels_EagerInitialize.hpp b/common/src/KokkosKernels_EagerInitialize.hpp index 1a5627b7db..83ddba74ee 100644 --- a/common/src/KokkosKernels_EagerInitialize.hpp +++ b/common/src/KokkosKernels_EagerInitialize.hpp @@ -17,24 +17,22 @@ #ifndef KOKKOKERNELS_EAGER_INITIALIZE_HPP #define KOKKOKERNELS_EAGER_INITIALIZE_HPP -namespace KokkosKernels -{ - // \brief Eagerly initialize handles for all enabled TPLs, as well - // as any other globally shared resources that would otherwise be lazily initialized. - // - // Eagerly initializing a TPL means that it doesn't have to be - // lazily initialized when first calling a kernel that uses it. - // For example, \c eager_initialize() will call \c cusparseCreate() upfront - // so that the first call to \c KokkosSparse::spmv doesn't have to. - // This can add a significant amount of apparent runtime to that first kernel - // call, even though the added time isn't really spent in the kernel. - // - // Calling this before using any kernels/TPLs is optional. - // This function is idempotent (any calls after the first have no effect). - // - // \pre \c Kokkos::initialize() has been called. - void eager_initialize(); -} +namespace KokkosKernels { +// \brief Eagerly initialize handles for all enabled TPLs, as well +// as any other globally shared resources that would otherwise be lazily initialized. +// +// Eagerly initializing a TPL means that it doesn't have to be +// lazily initialized when first calling a kernel that uses it. +// For example, \c eager_initialize() will call \c cusparseCreate() upfront +// so that the first call to \c KokkosSparse::spmv doesn't have to. +// This can add a significant amount of apparent runtime to that first kernel +// call, even though the added time isn't really spent in the kernel. +// +// Calling this before using any kernels/TPLs is optional. +// This function is idempotent (any calls after the first have no effect). +// +// \pre \c Kokkos::initialize() has been called. +void eager_initialize(); +} // namespace KokkosKernels #endif - diff --git a/common/unit_test/Test_Common_EagerInitialize.hpp b/common/unit_test/Test_Common_EagerInitialize.hpp index cfb6f6a740..a6f55b7022 100644 --- a/common/unit_test/Test_Common_EagerInitialize.hpp +++ b/common/unit_test/Test_Common_EagerInitialize.hpp @@ -19,8 +19,7 @@ #include "KokkosKernels_EagerInitialize.hpp" -TEST_F(TestCategory, common_eager_initialize) -{ +TEST_F(TestCategory, common_eager_initialize) { KokkosKernels::eager_initialize(); KokkosKernels::eager_initialize(); };