Kokkos_CUDANodeMemoryModel.hpp

00001 #ifndef KOKKOS_CUDA_NODE_MEMORY_MODEL_HPP_
00002 #define KOKKOS_CUDA_NODE_MEMORY_MODEL_HPP_
00003 
00004 #include "Kokkos_NodeAPIConfigDefs.hpp"
00005 #include <Teuchos_RCP.hpp>
00006 
00007 // forward declarations of Teuchos classes
00008 namespace std {
00009   template <typename CharT> class char_traits;
00010 }
00011 namespace Teuchos {
00012   class ParameterList;
00013   template <typename T> class ArrayRCP;
00014   template <typename T> class ArrayView;
00015   template <typename CharT, typename Traits> class basic_FancyOStream;
00016   typedef basic_FancyOStream<char, std::char_traits<char> > FancyOStream;
00017 }
00018 
00019 namespace Kokkos {
00020 
00022   class CUDANodeMemoryModel {
00023     public:
00024       typedef unsigned long int size_t;
00025 
00027 
00028       CUDANodeMemoryModel();
00029 
00031 
00033 
00047       template <class T> inline
00048       Teuchos::ArrayRCP<T> allocBuffer(size_t size);
00049 
00061       template <class T> inline
00062       void copyFromBuffer(size_t size, const Teuchos::ArrayRCP<const T> &buffSrc, const Teuchos::ArrayView<T> &hostDest);
00063 
00075       template <class T> inline
00076       void copyToBuffer(size_t size, const Teuchos::ArrayView<const T> &hostSrc, const Teuchos::ArrayRCP<T> &buffDest);
00077 
00086       template <class T> inline
00087       void copyBuffers(size_t size, const Teuchos::ArrayRCP<const T> &buffSrc, const Teuchos::ArrayRCP<T> &buffDest);
00088 
00089       template <class T> inline
00090       Teuchos::ArrayRCP<const T> viewBuffer(size_t size, Teuchos::ArrayRCP<const T> buff);
00091 
00092       template <class T> inline
00093       Teuchos::ArrayRCP<T> viewBufferNonConst(ReadWriteOption rw, size_t size, const Teuchos::ArrayRCP<T> &buff);
00094 
00095       inline void readyBuffers(Teuchos::ArrayView<Teuchos::ArrayRCP<const char> > buffers, Teuchos::ArrayView<Teuchos::ArrayRCP<char> > ncBuffers);
00096 
00098 
00100 
00101       void printStatistics(const Teuchos::RCP< Teuchos::FancyOStream > &os) const;
00102 
00104 
00105     public:
00106       size_t allocSize_;
00107       size_t numCopiesD2H_, numCopiesH2D_, numCopiesD2D_;
00108       size_t bytesCopiedD2H_, bytesCopiedH2D_, bytesCopiedD2D_;
00109   };
00110 
00111 } // end of namespace Kokkos
00112 
00113 #ifndef KOKKOS_NO_INCLUDE_INSTANTIATIONS
00114 #include "Kokkos_CUDANodeMemoryModelImpl.hpp"
00115 #endif
00116 
00117 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 09:59:49 2011 for Kokkos Node API and Local Linear Algebra Kernels by  doxygen 1.6.3