alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
ConstBufCpu.hpp
Go to the documentation of this file.
1/* Copyright 2022 Alexander Matthes, Axel Huebl, Benjamin Worpitz, Andrea Bocci, Jan Stephan, Bernhard Manfred Gruber
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
10#include "alpaka/core/Hip.hpp"
12#include "alpaka/dev/DevCpu.hpp"
13#include "alpaka/dev/Traits.hpp"
20#include "alpaka/vec/Vec.hpp"
21
22#include <functional>
23#include <memory>
24#include <type_traits>
25#include <utility>
26
27namespace alpaka
28{
29 // Predeclaration of BufCpu
30 template<typename TElem, typename TDim, typename TIdx>
31 class BufCpu;
32
33 //! The CPU memory buffer.
34 template<typename TElem, typename TDim, typename TIdx>
35 class ConstBufCpu : public internal::ViewAccessOps<ConstBufCpu<TElem, TDim, TIdx>>
36 {
37 public:
38 template<typename TExtent, typename Deleter>
39 ALPAKA_FN_HOST ConstBufCpu(DevCpu const& dev, TElem* pMem, Deleter deleter, TExtent const& extent)
40 : m_spBufImpl{
41 std::make_shared<detail::BufCpuImpl<TElem, TDim, TIdx>>(dev, pMem, std::move(deleter), extent)}
42 {
43 }
44
45 ALPAKA_FN_HOST ConstBufCpu(BufCpu<TElem, TDim, TIdx> const& buf) : m_spBufImpl{buf.m_spBufImpl}
46 {
47 }
48
49 ALPAKA_FN_HOST ConstBufCpu(BufCpu<TElem, TDim, TIdx>&& buf) : m_spBufImpl{std::move(buf.m_spBufImpl)}
50 {
51 }
52
53 private:
54 std::shared_ptr<detail::BufCpuImpl<TElem, TDim, TIdx>> m_spBufImpl;
55
60 };
61
62} // namespace alpaka
The CPU memory buffer template implementing muting accessors.
Definition BufCpu.hpp:24
The CPU memory buffer.
ALPAKA_FN_HOST ConstBufCpu(BufCpu< TElem, TDim, TIdx > &&buf)
ALPAKA_FN_HOST ConstBufCpu(BufCpu< TElem, TDim, TIdx > const &buf)
ALPAKA_FN_HOST ConstBufCpu(DevCpu const &dev, TElem *pMem, Deleter deleter, TExtent const &extent)
The CPU device handle.
Definition DevCpu.hpp:56
#define ALPAKA_FN_HOST
Definition Common.hpp:40
The alpaka accelerator library.
STL namespace.
The device get trait.
Definition Traits.hpp:27
The GetExtents trait for getting the extents of an object as an alpaka::Vec.
Definition Traits.hpp:37
The pointer on device get trait.
Definition Traits.hpp:58
The native pointer get trait.
Definition Traits.hpp:54