Kokkos Core Kernels Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Kokkos_Core_fwd.hpp
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_CORE_FWD_HPP
00047 #define KOKKOS_CORE_FWD_HPP
00048 
00049 //----------------------------------------------------------------------------
00050 // Kokkos_Macros.hpp does introspection on configuration options
00051 // and compiler environment then sets a collection of #define macros.
00052 
00053 #include <Kokkos_Macros.hpp>
00054 
00055 //----------------------------------------------------------------------------
00056 //----------------------------------------------------------------------------
00057 // Forward declarations for class inter-relationships
00058 
00059 namespace Kokkos {
00060 
00061 class HostSpace ; 
00062 class Serial ;    
00063 
00064 #if defined( KOKKOS_HAVE_PTHREAD )
00065 class Threads ;  
00066 #endif
00067 
00068 #if defined( KOKKOS_HAVE_OPENMP )
00069 class OpenMP ; 
00070 #endif
00071 
00072 #if defined( KOKKOS_HAVE_CUDA )
00073 class CudaSpace ;            
00074 class CudaUVMSpace ;         
00075 class CudaHostPinnedSpace ;  
00076 class Cuda ;                 
00077 #endif
00078 
00079 } // namespace Kokkos
00080 
00081 //----------------------------------------------------------------------------
00082 //----------------------------------------------------------------------------
00083 // Set the default execution space.
00084 
00088 
00089 namespace Kokkos {
00090 
00091 #if   defined ( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_CUDA )
00092   typedef Kokkos::Cuda DefaultExecutionSpace ;
00093 #elif defined ( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_OPENMP )
00094   typedef OpenMP DefaultExecutionSpace ;
00095 #elif defined ( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_THREADS )
00096   typedef Threads DefaultExecutionSpace ;
00097 #elif defined ( KOKKOS_HAVE_DEFAULT_DEVICE_TYPE_SERIAL )
00098   typedef Serial DefaultExecutionSpace ;
00099 #endif
00100 
00101 } // namespace Kokkos
00102 
00103 //----------------------------------------------------------------------------
00104 //----------------------------------------------------------------------------
00105 // Detect the active execution space and define its memory space.
00106 // This is used to verify whether a running kernel can access
00107 // a given memory space.
00108 
00109 namespace Kokkos {
00110 namespace Impl {
00111 
00112 #if defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA )
00113 typedef Kokkos::CudaSpace  ActiveExecutionMemorySpace ;
00114 #elif defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST )
00115 typedef Kokkos::HostSpace  ActiveExecutionMemorySpace ;
00116 #else
00117 typedef void ActiveExecutionMemorySpace ;
00118 #endif
00119 
00120 template< class ActiveSpace , class MemorySpace >
00121 struct VerifyExecutionCanAccessMemorySpace {
00122   enum {value = 0};
00123 };
00124 
00125 template< class Space >
00126 struct VerifyExecutionCanAccessMemorySpace< Space , Space >
00127 {
00128   enum {value = 1};
00129   KOKKOS_INLINE_FUNCTION static void verify(void) {}
00130   KOKKOS_INLINE_FUNCTION static void verify(const void *) {}
00131 };
00132 
00133 } // namespace Impl
00134 } // namespace Kokkos
00135 
00136 #define KOKKOS_RESTRICT_EXECUTION_TO_DATA( DATA_SPACE , DATA_PTR ) \
00137   Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
00138     Kokkos::Impl::ActiveExecutionMemorySpace , DATA_SPACE >::verify( DATA_PTR )
00139 
00140 #define KOKKOS_RESTRICT_EXECUTION_TO_( DATA_SPACE ) \
00141   Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
00142     Kokkos::Impl::ActiveExecutionMemorySpace , DATA_SPACE >::verify()
00143 
00144 #endif /* #ifndef KOKKOS_CORE_FWD_HPP */
00145 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends