forked from trilinos/Trilinos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kokkos-kernels: fix singleton multiple definitions
Resolve issues with Magma and Cuda singleton multiple definitions Reported in kokkos/kokkos-kernels#2175 Patch generated from kokkos/kokkos-kernels#2176
- Loading branch information
1 parent
475a319
commit 6ddcfbc
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
41 changes: 41 additions & 0 deletions
41
packages/kokkos-kernels/blas/tpls/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,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
41 changes: 41 additions & 0 deletions
41
packages/kokkos-kernels/lapack/tpls/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
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