forked from kokkos/kokkos
-
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.
Rollback changes to view constructors to reduce the number of instant…
…iations (kokkos#6564) * Add test constructing empty runtime unmanaged view with 0 and NULL * Revert "Merge pull request kokkos#6536 from dalg24/view_constructor_from_label" This reverts commit 201d1de, reversing changes made to 13efa71. * Test View constructor from nullptr for const data type * Avoid clang-tidy warnings --------- Co-authored-by: Christian Trott <crtrott@sandia.gov>
- Loading branch information
Showing
3 changed files
with
75 additions
and
17 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,55 @@ | ||
//@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 | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <Kokkos_Core.hpp> | ||
|
||
namespace { | ||
|
||
template <class T> | ||
void test_empty_view_runtime_unmanaged() { | ||
T d{}; | ||
auto* p = reinterpret_cast<T*>(0xABADBABE); | ||
|
||
(void)Kokkos::View<T>(p); | ||
(void)Kokkos::View<T>(&d); | ||
(void)Kokkos::View<T>(nullptr); | ||
(void)Kokkos::View<T>(NULL); // NOLINT(modernize-use-nullptr) | ||
(void)Kokkos::View<T>(0); // NOLINT(modernize-use-nullptr) | ||
|
||
(void)Kokkos::View<T*>(p, 0); | ||
(void)Kokkos::View<T*>(&d, 0); | ||
(void)Kokkos::View<T*>(nullptr, 0); | ||
(void)Kokkos::View<T*>(NULL, 0); // NOLINT(modernize-use-nullptr) | ||
(void)Kokkos::View<T*>(0, 0); // NOLINT(modernize-use-nullptr) | ||
|
||
(void)Kokkos::View<T**>(p, 0, 0); | ||
(void)Kokkos::View<T**>(&d, 0, 0); | ||
(void)Kokkos::View<T**>(nullptr, 0, 0); | ||
(void)Kokkos::View<T**>(NULL, 0, 0); // NOLINT(modernize-use-nullptr) | ||
(void)Kokkos::View<T**>(0, 0, 0); // NOLINT(modernize-use-nullptr) | ||
} | ||
|
||
TEST(TEST_CATEGORY, view_empty_runtime_unmanaged) { | ||
test_empty_view_runtime_unmanaged<float>(); | ||
test_empty_view_runtime_unmanaged<const double>(); | ||
test_empty_view_runtime_unmanaged<int>(); | ||
test_empty_view_runtime_unmanaged<char>(); | ||
test_empty_view_runtime_unmanaged<const char>(); | ||
} | ||
|
||
} // namespace |