Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
sacado
kokkos
Stokhos_MemoryTraits.cpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Stokhos Package
4
//
5
// Copyright 2009 NTESS and the Stokhos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#include <new>
11
12
#include "
Stokhos_MemoryTraits.hpp
"
13
14
// When aligning memory fo the MIC architecture, we need to globally replace
15
// new/delete with aligned versions because of seg faults in the MueLu setup.
16
// This is true even though MP::Vector provides its own aligned new/delete
17
// overloads, as well as aligned STL allocators. Somewhere in the MueLu setup
18
// code, a raw new/delete must be called.
19
//
20
// Note, this still doesn't resolve seg faults for MIC when using (Intel) MPI.
21
22
#if STOKHOS_ALIGN_MEMORY && defined(__MIC__)
23
void
*
operator
new
(std::size_t count)
throw
(std::bad_alloc) {
24
return
Stokhos::MemoryTraits< Kokkos::HostSpace >::alloc
(count);
25
}
26
void
*
operator
new
[](std::size_t count)
throw
(std::bad_alloc) {
27
return
Stokhos::MemoryTraits< Kokkos::HostSpace >::alloc
(count);
28
}
29
void
operator
delete
(
void
*ptr)
throw
() {
30
Stokhos::MemoryTraits< Kokkos::HostSpace >::free
(ptr);
31
}
32
void
operator
delete
[](
void
*ptr)
throw
() {
33
Stokhos::MemoryTraits< Kokkos::HostSpace >::free
(ptr);
34
}
35
#endif
Stokhos_MemoryTraits.hpp
Stokhos::MemoryTraits::alloc
static KOKKOS_INLINE_FUNCTION void * alloc(const size_t size)
Allocate aligned memory of given size.
Definition:
Stokhos_MemoryTraits.hpp:54
Stokhos::MemoryTraits::free
static KOKKOS_INLINE_FUNCTION void free(void *ptr)
Free memory allocated by alloc()
Definition:
Stokhos_MemoryTraits.hpp:58
Generated on Fri Nov 22 2024 09:18:13 for Stokhos Package Browser (Single Doxygen Collection) by
1.8.5