Skip to content

Commit

Permalink
Merge pull request #2044 from ndellingwood/magma-fix-4200
Browse files Browse the repository at this point in the history
lapack magma tpl fixes
  • Loading branch information
ndellingwood authored Nov 22, 2023
2 parents 557b4af + a77afc8 commit 940cfbe
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 27 deletions.
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

0 comments on commit 940cfbe

Please sign in to comment.