|
Kokkos Core Kernels Package
Version of the Day
|
00001 /* 00002 //@HEADER 00003 // ************************************************************************ 00004 // 00005 // Kokkos 00006 // Manycore Performance-Portable Multidimensional Arrays 00007 // 00008 // Copyright (2012) Sandia Corporation 00009 // 00010 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00011 // the U.S. Government retains certain rights in this software. 00012 // 00013 // Redistribution and use in source and binary forms, with or without 00014 // modification, are permitted provided that the following conditions are 00015 // met: 00016 // 00017 // 1. Redistributions of source code must retain the above copyright 00018 // notice, this list of conditions and the following disclaimer. 00019 // 00020 // 2. Redistributions in binary form must reproduce the above copyright 00021 // notice, this list of conditions and the following disclaimer in the 00022 // documentation and/or other materials provided with the distribution. 00023 // 00024 // 3. Neither the name of the Corporation nor the names of the 00025 // contributors may be used to endorse or promote products derived from 00026 // this software without specific prior written permission. 00027 // 00028 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00029 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00030 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00031 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00032 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00033 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00034 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00035 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00036 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00037 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00038 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 // 00040 // Questions? Contact H. Carter Edwards (hcedwar@sandia.gov) 00041 // 00042 // ************************************************************************ 00043 //@HEADER 00044 */ 00045 00046 #ifndef KOKKOS_MEMORYTRAITS_HPP 00047 #define KOKKOS_MEMORYTRAITS_HPP 00048 00049 #include <impl/Kokkos_Traits.hpp> 00050 #include <impl/Kokkos_Tags.hpp> 00051 00052 //---------------------------------------------------------------------------- 00053 00054 namespace Kokkos { 00055 00064 enum MemoryTraitsFlags 00065 { Unmanaged = 0x01 00066 , RandomAccess = 0x02 00067 , Atomic = 0x04 00068 }; 00069 00070 template < unsigned T > 00071 struct MemoryTraits { 00073 typedef Impl::MemoryTraitsTag kokkos_tag ; 00074 00075 enum { Unmanaged = T & unsigned(Kokkos::Unmanaged) }; 00076 enum { RandomAccess = T & unsigned(Kokkos::RandomAccess) }; 00077 enum { Atomic = T & unsigned(Kokkos::Atomic) }; 00078 00079 typedef MemoryTraits memory_traits ; 00080 }; 00081 00082 } // namespace Kokkos 00083 00084 //---------------------------------------------------------------------------- 00085 00086 namespace Kokkos { 00087 00088 typedef Kokkos::MemoryTraits<0> MemoryManaged ; 00089 typedef Kokkos::MemoryTraits< Kokkos::Unmanaged > MemoryUnmanaged ; 00090 typedef Kokkos::MemoryTraits< Kokkos::Unmanaged | Kokkos::RandomAccess > MemoryRandomAccess ; 00091 00092 } // namespace Kokkos 00093 00094 //---------------------------------------------------------------------------- 00095 00096 namespace Kokkos { 00097 namespace Impl { 00098 00105 enum { MEMORY_ALIGNMENT = 00106 #if defined( KOKKOS_MEMORY_ALIGNMENT ) 00107 ( 1 << Kokkos::Impl::power_of_two< KOKKOS_MEMORY_ALIGNMENT >::value ) 00108 #else 00109 ( 1 << Kokkos::Impl::power_of_two< 128 >::value ) 00110 #endif 00111 , MEMORY_ALIGNMENT_THRESHOLD = 4 00112 }; 00113 00114 00115 } //namespace Impl 00116 } // namespace Kokkos 00117 00118 #endif /* #ifndef KOKKOS_MEMORYTRAITS_HPP */ 00119
1.7.6.1