Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lapack magma tpl fixes #2044

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lapack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ IF (KOKKOSKERNELS_ENABLE_TPL_LAPACK OR KOKKOSKERNELS_ENABLE_TPL_MKL OR KOKKOSKER
ENDIF()

# Include cuda lapack TPL source file
IF (KOKKOSKERNELS_ENABLE_TPL_CUSOLVER)
IF (KOKKOSKERNELS_ENABLE_TPL_MAGMA)
LIST(APPEND SOURCES
lapack/tpls/KokkosLapack_Cuda_tpl.cpp
)
Expand Down
25 changes: 1 addition & 24 deletions lapack/tpls/KokkosLapack_Cuda_tpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,8 @@
#ifndef KOKKOSLAPACK_CUDA_TPL_HPP_
#define KOKKOSLAPACK_CUDA_TPL_HPP_

#if defined(KOKKOSKERNELS_ENABLE_TPL_CUSOLVER)
#include <KokkosLapack_tpl_spec.hpp>

namespace KokkosLapack {
namespace Impl {

CudaLapackSingleton::CudaLapackSingleton() {
cusolverStatus_t stat = cusolverDnCreate(&handle);
if (stat != CUSOLVER_STATUS_SUCCESS)
Kokkos::abort("CUSOLVER initialization failed\n");

Kokkos::push_finalize_hook([&]() { cusolverDnDestroy(handle); });
}

CudaLapackSingleton& CudaLapackSingleton::singleton() {
static CudaLapackSingleton s;
return s;
}

} // namespace Impl
} // namespace KokkosLapack
#endif // defined (KOKKOSKERNELS_ENABLE_TPL_CUSOLVER)

#if defined(KOKKOSKERNELS_ENABLE_TPL_MAGMA)
#include <KokkosLapack_tpl_spec.hpp>
#include <KokkosLapack_magma.hpp>

namespace KokkosLapack {
namespace Impl {
Expand Down
2 changes: 1 addition & 1 deletion lapack/tpls/KokkosLapack_gesv_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ KOKKOSLAPACK_CGESV_LAPACK(Kokkos::LayoutLeft, Kokkos::HostSpace, false)

// MAGMA
#ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA
#include <KokkosLapack_tpl_spec.hpp>
#include <KokkosLapack_magma.hpp>

namespace KokkosLapack {
namespace Impl {
Expand Down
35 changes: 35 additions & 0 deletions lapack/tpls/KokkosLapack_magma.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//@HEADER
// ************************************************************************
//
// Kokkos v. 4.0
// Copyright (2022) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
// See https://kokkos.org/LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//@HEADER

#ifndef KOKKOSLAPACK_MAGMA_HPP_
#define KOKKOSLAPACK_MAGMA_HPP_
// If LAPACK TPL is enabled, it is preferred over magma's LAPACK
#ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA
#include "magma_v2.h"

namespace KokkosLapack {
namespace Impl {

struct MagmaSingleton {
MagmaSingleton();

static MagmaSingleton& singleton();
};

} // namespace Impl
} // namespace KokkosBlas
#endif // KOKKOSKERNELS_ENABLE_TPL_MAGMA
#endif // KOKKOSLAPACK_MAGMA_HPP_
4 changes: 3 additions & 1 deletion lapack/tpls/KokkosLapack_trtri_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#define KOKKOSLAPACK_TRTRI_TPL_SPEC_DECL_HPP_

#include "KokkosLapack_Host_tpl.hpp" // trtri prototype
//#include "KokkosLapack_tpl_spec.hpp"
#ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA
#include "KokkosLapack_magma.hpp"
#endif

namespace KokkosLapack {
namespace Impl {
Expand Down