Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) {
25 }
26 void* operator new[](std::size_t count) throw (std::bad_alloc) {
28 }
29 void operator delete(void *ptr) throw() {
31 }
32 void operator delete[](void *ptr) throw() {
34 }
35 #endif
static KOKKOS_INLINE_FUNCTION void * alloc(const size_t size)
Allocate aligned memory of given size.
static KOKKOS_INLINE_FUNCTION void free(void *ptr)
Free memory allocated by alloc()