Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-kelley committed Aug 27, 2024
1 parent 0ec7cfc commit b13b5a8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 40 deletions.
34 changes: 15 additions & 19 deletions common/src/KokkosKernels_EagerInitialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
36 changes: 17 additions & 19 deletions common/src/KokkosKernels_EagerInitialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

3 changes: 1 addition & 2 deletions common/unit_test/Test_Common_EagerInitialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down

0 comments on commit b13b5a8

Please sign in to comment.