-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves multiple definition of Magma and Cuda singletons (#2178)
Address issue #2175
- Loading branch information
1 parent
cb824ca
commit 47a1849
Showing
9 changed files
with
122 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//@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 KOKKOSBLAS_MAGMA_TPL_HPP_ | ||
#define KOKKOSBLAS_MAGMA_TPL_HPP_ | ||
|
||
#if defined(KOKKOSKERNELS_ENABLE_TPL_MAGMA) | ||
#include <KokkosBlas_magma.hpp> | ||
|
||
namespace KokkosBlas { | ||
namespace Impl { | ||
|
||
MagmaSingleton::MagmaSingleton() { | ||
magma_int_t stat = magma_init(); | ||
if (stat != MAGMA_SUCCESS) Kokkos::abort("MAGMA initialization failed\n"); | ||
|
||
Kokkos::push_finalize_hook([&]() { magma_finalize(); }); | ||
} | ||
|
||
MagmaSingleton& MagmaSingleton::singleton() { | ||
static MagmaSingleton s; | ||
return s; | ||
} | ||
|
||
} // namespace Impl | ||
} // namespace KokkosBlas | ||
#endif // defined(KOKKOSKERNELS_ENABLE_TPL_MAGMA) | ||
|
||
#endif // KOKKOSBLAS_MAGMA_TPL_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//@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 KOKKOSBLAS_MAGMA_HPP_ | ||
#define KOKKOSBLAS_MAGMA_HPP_ | ||
|
||
// If LAPACK TPL is enabled, it is preferred over magma's LAPACK | ||
#ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA | ||
#include "magma_v2.h" | ||
|
||
namespace KokkosBlas { | ||
namespace Impl { | ||
|
||
struct MagmaSingleton { | ||
MagmaSingleton(); | ||
|
||
static MagmaSingleton& singleton(); | ||
}; | ||
|
||
} // namespace Impl | ||
} // namespace KokkosBlas | ||
#endif // KOKKOSKERNELS_ENABLE_TPL_MAGMA | ||
|
||
#endif // KOKKOSBLAS_MAGMA_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//@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_TPL_HPP_ | ||
#define KOKKOSLAPACK_MAGMA_TPL_HPP_ | ||
|
||
#if defined(KOKKOSKERNELS_ENABLE_TPL_MAGMA) | ||
#include <KokkosLapack_magma.hpp> | ||
|
||
namespace KokkosLapack { | ||
namespace Impl { | ||
|
||
MagmaSingleton::MagmaSingleton() { | ||
magma_int_t stat = magma_init(); | ||
if (stat != MAGMA_SUCCESS) Kokkos::abort("MAGMA initialization failed\n"); | ||
|
||
Kokkos::push_finalize_hook([&]() { magma_finalize(); }); | ||
} | ||
|
||
MagmaSingleton& MagmaSingleton::singleton() { | ||
static MagmaSingleton s; | ||
return s; | ||
} | ||
|
||
} // namespace Impl | ||
} // namespace KokkosLapack | ||
#endif // defined(KOKKOSKERNELS_ENABLE_TPL_MAGMA) | ||
|
||
#endif // KOKKOSLAPACK_MAGMA_TPL_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters